新增部门子级查询功能,更新相关API接口和前端组件,优化部门树形结构展示,支持父子部门关系的处理

This commit is contained in:
Chuck1sn
2025-06-19 15:29:22 +08:00
parent fa580a5dd4
commit ea86342a0f
12 changed files with 749 additions and 162 deletions

View File

@@ -4,6 +4,7 @@ import com.zl.mjga.dto.PageRequestDto;
import com.zl.mjga.dto.PageResponseDto;
import com.zl.mjga.dto.department.DepartmentQueryDto;
import com.zl.mjga.dto.department.DepartmentRespDto;
import com.zl.mjga.dto.department.DepartmentWithParentDto;
import com.zl.mjga.repository.DepartmentRepository;
import com.zl.mjga.service.DepartmentService;
import java.util.List;
@@ -37,6 +38,12 @@ public class DepartmentController {
return departmentService.queryAvailableParentDepartmentsBy(id);
}
@PreAuthorize("hasAuthority(T(com.zl.mjga.model.urp.EPermission).READ_DEPARTMENT_PERMISSION)")
@GetMapping("/query-sub")
List<DepartmentWithParentDto> querySubDepartment(@RequestParam(required = false) Long id) {
return departmentService.queryDepartmentAndSubsBy(id);
}
@PreAuthorize("hasAuthority(T(com.zl.mjga.model.urp.EPermission).WRITE_DEPARTMENT_PERMISSION)")
@DeleteMapping()
void deleteDepartment(@RequestParam Long id) {

View File

@@ -37,7 +37,8 @@ public class DepartmentRepository extends DepartmentDao {
DEPARTMENT.PARENT_ID,
DEPARTMENT.NAME.cast(VARCHAR))
.from(DEPARTMENT)
.where(DEPARTMENT.ID.eq(id))
.where(id == null ? noCondition() : DEPARTMENT.ID.eq(id))
.and(DEPARTMENT.PARENT_ID.isNull())
.unionAll(
select(
DEPARTMENT.ID,