添加通过部门编号查询部门接口

This commit is contained in:
2022-11-28 10:14:37 +08:00
parent ae39bcf84c
commit a9f0b494b0
9 changed files with 80 additions and 2 deletions

View File

@@ -37,7 +37,7 @@ public enum SystemResponseEnum {
MONITOR_TAG_EMPTY("A00365","查询字典监测点标签类型为空"), MONITOR_TAG_EMPTY("A00365","查询字典监测点标签类型为空"),
MONITORY_TYPE_EMPTY("A00366","查询字典监测对象类型为空"), MONITORY_TYPE_EMPTY("A00366","查询字典监测对象类型为空"),
TERMINAL_WIRING_EMPTY("A00367","查询字典监测终端接线方式为空"), TERMINAL_WIRING_EMPTY("A00367","查询字典监测终端接线方式为空"),
MONITOR_TYPE_EMPTY("A00368","查询字典监测点类别为空"),

View File

@@ -0,0 +1,16 @@
package com.njcn.system.pojo.constant;
/**
* pqs
*
* @author cdf
* @date 2022/11/23
*/
public interface DicDataConstant {
/*监测点类别*/
String ONE_LINE = "One_Line";
String TWO_LINE = "Two_Line";
String THREE_LINE ="Three_Line";
}

View File

@@ -72,6 +72,14 @@ public interface DeptFeignClient {
@GetMapping("/getDepSonIdtByDeptId") @GetMapping("/getDepSonIdtByDeptId")
HttpResult<List<String>> getDepSonIdtByDeptId(@RequestParam("deptId") String deptId); HttpResult<List<String>> getDepSonIdtByDeptId(@RequestParam("deptId") String deptId);
/**
* 根据部门id获取所有子部门ids
*/
@GetMapping("/getDepSonSelfCodetByDeptId")
HttpResult<List<String>> getDepSonSelfCodetByDeptId(@RequestParam("deptId") String deptId);
/** /**
* 根据部门id获取子部门ids * 根据部门id获取子部门ids
*/ */

View File

@@ -82,6 +82,12 @@ public class DeptFeignClientFallbackFactory implements FallbackFactory<DeptFeign
throw new BusinessException(finalExceptionEnum); throw new BusinessException(finalExceptionEnum);
} }
@Override
public HttpResult<List<String>> getDepSonSelfCodetByDeptId(String deptId) {
log.error("{}异常,降级处理,异常为:{}","查询所有子孙部门异常",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override @Override
public HttpResult<List<String>> getDepSonIdByDeptId(String deptId) { public HttpResult<List<String>> getDepSonIdByDeptId(String deptId) {
log.error("{}异常,降级处理,异常为:{}","查询所有子孙部门异常",cause.toString()); log.error("{}异常,降级处理,异常为:{}","查询所有子孙部门异常",cause.toString());

View File

@@ -313,6 +313,20 @@ public class DeptController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, deptList, methodDescribe); 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 * 根据部门id获取子部门ids
* @author dhj * @author dhj

View File

@@ -103,6 +103,13 @@ public interface DeptMapper extends BaseMapper<Dept> {
*/ */
List<String> getDeptSonIds(@Param("deptId") String deptId); List<String> getDeptSonIds(@Param("deptId") String deptId);
/**
* 根据部门id获取所有子部门以及自己code集合
* @author cdf
* @date 2022/7/26
*/
List<String> getDeptSonSlfeIds(@Param("deptId") String deptId);
/** /**
* 根据部门id获取子部门id集合 * 根据部门id获取子部门id集合
* @author dhj * @author dhj

View File

@@ -166,6 +166,12 @@
select id from sys_dept where find_in_set(#{deptId},pids) and state = 1 select id from sys_dept where find_in_set(#{deptId},pids) and state = 1
</select> </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="getDeptSonId" resultType="String">
select id from sys_dept where sys_dept.Pid=#{deptId} and state = 1 select id from sys_dept where sys_dept.Pid=#{deptId} and state = 1
</select> </select>

View File

@@ -163,6 +163,13 @@ public interface IDeptService extends IService<Dept> {
*/ */
List<String> getDepSonIdtByDeptId(String id); List<String> getDepSonIdtByDeptId(String id);
/**
* 根据部门id获取部门详情
* @author cdf
* @date 2022/7/13
*/
List<String> getDepSonSelfCodetByDeptId(String id);
/** /**
* 根据部门id获取子部门ids * 根据部门id获取子部门ids
* @author dhj * @author dhj

View File

@@ -1,6 +1,7 @@
package com.njcn.user.service.impl; package com.njcn.user.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -324,7 +325,20 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
*/ */
@Override @Override
public List<String> getDepSonIdtByDeptId(String id) { 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 @Override