新增获取部门子集接口
This commit is contained in:
@@ -67,4 +67,10 @@ public interface DeptFeignClient {
|
||||
@GetMapping("/getDepSonIdtByDeptId")
|
||||
HttpResult<List<String>> getDepSonIdtByDeptId(@RequestParam("deptId") String deptId);
|
||||
|
||||
/**
|
||||
* 根据部门id获取子部门ids
|
||||
*/
|
||||
@GetMapping("/getDepSonIdByDeptId")
|
||||
HttpResult<List<String>> getDepSonIdByDeptId(@RequestParam("deptId") String deptId);
|
||||
|
||||
}
|
||||
|
||||
@@ -76,6 +76,11 @@ public class DeptFeignClientFallbackFactory implements FallbackFactory<DeptFeign
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<String>> getDepSonIdByDeptId(String deptId) {
|
||||
log.error("{}异常,降级处理,异常为:{}","查询所有子孙部门异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,7 +299,19 @@ public class DeptController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, deptList, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据部门id获取子部门ids
|
||||
* @author dhj
|
||||
* @date 2022/10/09
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@GetMapping("/getDepSonIdByDeptId")
|
||||
@ApiOperation("根据部门id获取子部门ids")
|
||||
public HttpResult<List<String>> getDepSonIdByDeptId(@RequestParam("deptId")String deptId) {
|
||||
String methodDescribe = getMethodDescribe("getDepSonIdByDeptId");
|
||||
List<String> deptList = deptService.getDepSonIdByDeptId(deptId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, deptList, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -102,4 +102,11 @@ public interface DeptMapper extends BaseMapper<Dept> {
|
||||
* @date 2022/7/26
|
||||
*/
|
||||
List<String> getDeptSonIds(@Param("deptId") String deptId);
|
||||
|
||||
/**
|
||||
* 根据部门id获取子部门id集合
|
||||
* @author dhj
|
||||
* @date 2022/10/09
|
||||
*/
|
||||
List<String> getDeptSonId(@Param("deptId") String deptId);
|
||||
}
|
||||
|
||||
@@ -164,5 +164,8 @@
|
||||
select id from sys_dept where find_in_set(#{deptId},pids) and state = 1
|
||||
</select>
|
||||
|
||||
<select id="getDeptSonId" resultType="String">
|
||||
select id from sys_dept where sys_dept.Pid=#{deptId} and state = 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -155,4 +155,11 @@ public interface IDeptService extends IService<Dept> {
|
||||
* @date 2022/7/13
|
||||
*/
|
||||
List<String> getDepSonIdtByDeptId(String id);
|
||||
|
||||
/**
|
||||
* 根据部门id获取子部门ids
|
||||
* @author dhj
|
||||
* @date 2022/7/13
|
||||
*/
|
||||
List<String> getDepSonIdByDeptId(String id);
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
Dept dept = new Dept();
|
||||
BeanUtil.copyProperties(deptParam, dept);
|
||||
//进行先解绑,再新增
|
||||
Integer httpResult=deptLineFeignClient.removeBind(deptParam.getPid()).getData();
|
||||
Integer httpResult = deptLineFeignClient.removeBind(deptParam.getPid()).getData();
|
||||
System.out.println(httpResult);
|
||||
if (deptParam.getPid().equals("-1")) {
|
||||
//上层节点
|
||||
@@ -318,4 +318,13 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
public List<String> getDepSonIdtByDeptId(String id) {
|
||||
return this.baseMapper.getDeptSonIds(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getDepSonIdByDeptId(String id) {
|
||||
List<String> sonId = this.baseMapper.getDeptSonId(id);
|
||||
if (sonId.isEmpty()) {
|
||||
sonId.add(id);
|
||||
}
|
||||
return sonId;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user