mirror of
https://github.com/ccmjga/zhilu-admin
synced 2026-03-14 05:33:42 +08:00
新增部门子级查询功能,更新相关API接口和前端组件,优化部门树形结构展示,支持父子部门关系的处理
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user