Commit 00a1a559036cc7af4db9f78cf63128fdee41ee53

Authored by wangqian
1 parent 59523d5f

根据id获取子部门列表

urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/controller/admin/dept/DeptController.java
... ... @@ -4,6 +4,7 @@ package com.zteits.urbanops.module.system.controller.admin.dept;
4 4 import com.zteits.urbanops.framework.common.enums.CommonStatusEnum;
5 5 import com.zteits.urbanops.framework.common.pojo.CommonResult;
6 6 import com.zteits.urbanops.framework.common.util.object.BeanUtils;
  7 +import com.zteits.urbanops.module.system.api.dept.dto.DeptRespDTO;
7 8 import com.zteits.urbanops.module.system.controller.admin.dept.vo.dept.DeptListReqVO;
8 9 import com.zteits.urbanops.module.system.controller.admin.dept.vo.dept.DeptRespVO;
9 10 import com.zteits.urbanops.module.system.controller.admin.dept.vo.dept.DeptSaveReqVO;
... ... @@ -99,4 +100,11 @@ public class DeptController {
99 100 return success(BeanUtils.toBean(list, DeptRespVO.class));
100 101 }
101 102  
  103 + @GetMapping("/sub-list-id")
  104 + @Operation(summary = "根据id获取子部门列表")
  105 + @PreAuthorize("@ss.hasPermission('system:dept:query')")
  106 + public CommonResult<List<DeptRespVO>> getTeamsList(@RequestParam("id") Long id) {
  107 + List<DeptDO> list = deptService.getSubDeptList(id);
  108 + return success(BeanUtils.toBean(list, DeptRespVO.class));
  109 + }
102 110 }
... ...
urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/service/dept/DeptService.java
... ... @@ -127,4 +127,10 @@ public interface DeptService {
127 127 */
128 128 void validateDeptList(Collection<Long> ids);
129 129  
  130 + /**
  131 + * 根据id获取子集
  132 + * @return 部门信息数组
  133 + */
  134 + List<DeptDO> getSubDeptList(Long id);
  135 +
130 136 }
... ...
urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/service/dept/DeptServiceImpl.java
... ... @@ -240,4 +240,8 @@ public class DeptServiceImpl implements DeptService {
240 240 });
241 241 }
242 242  
  243 + @Override
  244 + public List<DeptDO> getSubDeptList(Long id) {
  245 + return deptMapper.selectList(DeptDO::getParentId,id);
  246 + }
243 247 }
... ...