添加通过部门编号查询部门接口
This commit is contained in:
@@ -72,6 +72,14 @@ public interface DeptFeignClient {
|
||||
@GetMapping("/getDepSonIdtByDeptId")
|
||||
HttpResult<List<String>> getDepSonIdtByDeptId(@RequestParam("deptId") String deptId);
|
||||
|
||||
/**
|
||||
* 根据部门id获取所有子部门ids
|
||||
*/
|
||||
@GetMapping("/getDepSonSelfCodetByDeptId")
|
||||
HttpResult<List<String>> getDepSonSelfCodetByDeptId(@RequestParam("deptId") String deptId);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据部门id获取子部门ids
|
||||
*/
|
||||
|
||||
@@ -82,6 +82,12 @@ public class DeptFeignClientFallbackFactory implements FallbackFactory<DeptFeign
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<String>> getDepSonSelfCodetByDeptId(String deptId) {
|
||||
log.error("{}异常,降级处理,异常为:{}","查询所有子孙部门异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<String>> getDepSonIdByDeptId(String deptId) {
|
||||
log.error("{}异常,降级处理,异常为:{}","查询所有子孙部门异常",cause.toString());
|
||||
|
||||
@@ -313,6 +313,20 @@ public class DeptController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, deptList, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据部门id获取所有子部门的code
|
||||
* @author cdf
|
||||
* @date 2022/11/25
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@GetMapping("/getDepSonSelfCodetByDeptId")
|
||||
@ApiOperation("根据部门id获取所有子部门以及自身的code")
|
||||
public HttpResult<List<String>> getDepSonSelfCodetByDeptId(@RequestParam("deptId")String deptId) {
|
||||
String methodDescribe = getMethodDescribe("getDepSonSelfIdtByDeptId");
|
||||
List<String> deptList = deptService.getDepSonSelfCodetByDeptId(deptId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, deptList, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据部门id获取子部门ids
|
||||
* @author dhj
|
||||
|
||||
@@ -103,6 +103,13 @@ public interface DeptMapper extends BaseMapper<Dept> {
|
||||
*/
|
||||
List<String> getDeptSonIds(@Param("deptId") String deptId);
|
||||
|
||||
/**
|
||||
* 根据部门id获取所有子部门以及自己code集合
|
||||
* @author cdf
|
||||
* @date 2022/7/26
|
||||
*/
|
||||
List<String> getDeptSonSlfeIds(@Param("deptId") String deptId);
|
||||
|
||||
/**
|
||||
* 根据部门id获取子部门id集合
|
||||
* @author dhj
|
||||
|
||||
@@ -166,6 +166,12 @@
|
||||
select id from sys_dept where find_in_set(#{deptId},pids) and state = 1
|
||||
</select>
|
||||
|
||||
<select id="getDeptSonSlfeIds" resultType="String">
|
||||
select code 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>
|
||||
|
||||
@@ -163,6 +163,13 @@ public interface IDeptService extends IService<Dept> {
|
||||
*/
|
||||
List<String> getDepSonIdtByDeptId(String id);
|
||||
|
||||
/**
|
||||
* 根据部门id获取部门详情
|
||||
* @author cdf
|
||||
* @date 2022/7/13
|
||||
*/
|
||||
List<String> getDepSonSelfCodetByDeptId(String id);
|
||||
|
||||
/**
|
||||
* 根据部门id获取子部门ids
|
||||
* @author dhj
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.user.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -324,7 +325,20 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
*/
|
||||
@Override
|
||||
public List<String> getDepSonIdtByDeptId(String id) {
|
||||
return this.baseMapper.getDeptSonIds(id);
|
||||
List<String> sonIds = this.baseMapper.getDeptSonIds(id);
|
||||
if(CollectionUtil.isNotEmpty(sonIds)){
|
||||
sonIds.add(id);
|
||||
}
|
||||
return sonIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getDepSonSelfCodetByDeptId(String id) {
|
||||
List<String> sonIds = this.baseMapper.getDeptSonSlfeIds(id);
|
||||
if(CollectionUtil.isNotEmpty(sonIds)){
|
||||
sonIds.add(id);
|
||||
}
|
||||
return sonIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user