部门代码调整 新增部门查询子部门接口
This commit is contained in:
@@ -86,4 +86,10 @@ public interface DeptFeignClient {
|
||||
@GetMapping("/getDepSonIdByDeptId")
|
||||
HttpResult<List<String>> getDepSonIdByDeptId(@RequestParam("deptId") String deptId);
|
||||
|
||||
/**
|
||||
* 根据部门id获取直接子部门及自身
|
||||
*/
|
||||
@GetMapping("/getDirectSonSelf")
|
||||
HttpResult<List<Dept>> getDirectSonSelf(@RequestParam("deptId") String deptId);
|
||||
|
||||
}
|
||||
|
||||
@@ -93,6 +93,12 @@ public class DeptFeignClientFallbackFactory implements FallbackFactory<DeptFeign
|
||||
log.error("{}异常,降级处理,异常为:{}","查询所有子孙部门异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<Dept>> getDirectSonSelf(String deptId) {
|
||||
log.error("{}异常,降级处理,异常为:{}","查询所有子部门以及自身异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,7 +291,7 @@ public class DeptController extends BaseController {
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@GetMapping("/getDeptByCode")
|
||||
@ApiOperation("根据部门Id获取部门信息")
|
||||
@ApiOperation("根据部门code获取部门信息")
|
||||
public HttpResult<Dept> getDeptByCode(@RequestParam("deptCode")String deptCode) {
|
||||
String methodDescribe = getMethodDescribe("getDeptByCode");
|
||||
Dept result = deptService.getDeptByCode(deptCode);
|
||||
@@ -342,5 +342,24 @@ public class DeptController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据部门id获取直接子部门及自身
|
||||
* @param deptId 部门编号
|
||||
* @author cdf
|
||||
* @date 2022/12/1
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@GetMapping("/getDirectSonSelf")
|
||||
@ApiOperation("根据部门id获取直接子部门及自身")
|
||||
public HttpResult<List<Dept>> getDirectSonSelf(@RequestParam("deptId")String deptId){
|
||||
String methodDescribe = getMethodDescribe("getDirectSonSelf");
|
||||
List<Dept> deptList = deptService.getDirectSonSelf(deptId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, deptList, methodDescribe);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.njcn.user.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.system.pojo.dto.AreaTreeDTO;
|
||||
import com.njcn.user.pojo.dto.DeptDTO;
|
||||
import com.njcn.user.pojo.param.DeptParam;
|
||||
@@ -10,6 +11,7 @@ import com.njcn.user.pojo.vo.DeptAllTreeVO;
|
||||
import com.njcn.user.pojo.vo.DeptTreeVO;
|
||||
import com.njcn.user.pojo.vo.DeptVO;
|
||||
import com.njcn.user.pojo.vo.PvTerminalTreeVO;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -176,4 +178,12 @@ public interface IDeptService extends IService<Dept> {
|
||||
* @date 2022/7/13
|
||||
*/
|
||||
List<String> getDepSonIdByDeptId(String id);
|
||||
|
||||
/**
|
||||
* 根据部门deptId获取直接子部门及自身
|
||||
* @param deptId 部门编号
|
||||
* @author cdf
|
||||
* @date 2022/12/1
|
||||
*/
|
||||
List<Dept> getDirectSonSelf(String deptId);
|
||||
}
|
||||
|
||||
@@ -349,4 +349,12 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
}
|
||||
return sonId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Dept> getDirectSonSelf(String deptId) {
|
||||
LambdaQueryWrapper<Dept> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(Dept::getPid,deptId).eq(Dept::getState, DataStateEnum.ENABLE.getCode()).
|
||||
or().eq(Dept::getId,deptId);
|
||||
return this.list(lambdaQueryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user