添加通过部门编号查询部门接口
This commit is contained in:
@@ -60,6 +60,11 @@ public interface DeptFeignClient {
|
|||||||
@GetMapping("/getDeptById")
|
@GetMapping("/getDeptById")
|
||||||
HttpResult<Dept> getDeptById(@RequestParam("deptId") String deptId);
|
HttpResult<Dept> getDeptById(@RequestParam("deptId") String deptId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据部门code获取部门信息
|
||||||
|
*/
|
||||||
|
@GetMapping("/getDeptByCode")
|
||||||
|
HttpResult<Dept> getDeptByCode(@RequestParam("deptCode") String deptCode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据部门id获取所有子部门ids
|
* 根据部门id获取所有子部门ids
|
||||||
|
|||||||
@@ -70,6 +70,12 @@ public class DeptFeignClientFallbackFactory implements FallbackFactory<DeptFeign
|
|||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<Dept> getDeptByCode(String deptCode) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","查询部门信息异常",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpResult<List<String>> getDepSonIdtByDeptId(String deptId) {
|
public HttpResult<List<String>> getDepSonIdtByDeptId(String deptId) {
|
||||||
log.error("{}异常,降级处理,异常为:{}","查询所有子孙部门异常",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","查询所有子孙部门异常",cause.toString());
|
||||||
|
|||||||
@@ -271,7 +271,7 @@ public class DeptController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据部门获取部门信息
|
* 根据部门Id获取部门信息
|
||||||
* @author cdf
|
* @author cdf
|
||||||
* @date 2022/7/12
|
* @date 2022/7/12
|
||||||
*/
|
*/
|
||||||
@@ -284,6 +284,20 @@ public class DeptController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据部门code获取部门信息
|
||||||
|
* @author cdf
|
||||||
|
* @date 2022/7/12
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||||
|
@GetMapping("/getDeptByCode")
|
||||||
|
@ApiOperation("根据部门Id获取部门信息")
|
||||||
|
public HttpResult<Dept> getDeptByCode(@RequestParam("deptCode")String deptCode) {
|
||||||
|
String methodDescribe = getMethodDescribe("getDeptByCode");
|
||||||
|
Dept result = deptService.getDeptByCode(deptCode);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据部门id获取所有子部门ids
|
* 根据部门id获取所有子部门ids
|
||||||
|
|||||||
@@ -148,6 +148,13 @@ public interface IDeptService extends IService<Dept> {
|
|||||||
*/
|
*/
|
||||||
Dept getDeptById(String id);
|
Dept getDeptById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据部门code获取部门详情
|
||||||
|
* @author cdf
|
||||||
|
* @date 2022/7/13
|
||||||
|
*/
|
||||||
|
Dept getDeptByCode(String deptCode);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据部门id获取部门详情
|
* 根据部门id获取部门详情
|
||||||
|
|||||||
@@ -266,6 +266,13 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
|||||||
return this.baseMapper.selectById(id);
|
return this.baseMapper.selectById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dept getDeptByCode(String deptCode) {
|
||||||
|
LambdaQueryWrapper<Dept> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.eq(Dept::getCode,deptCode).eq(Dept::getState,DataStateEnum.ENABLE.getCode());
|
||||||
|
return this.baseMapper.selectOne(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验参数,检查是否存在相同编码的部门
|
* 校验参数,检查是否存在相同编码的部门
|
||||||
|
|||||||
Reference in New Issue
Block a user