部门代码调整 新增部门查询子部门接口

This commit is contained in:
2022-12-01 09:43:47 +08:00
parent af68a790d8
commit 7e3f51a44f
9 changed files with 63 additions and 2 deletions

View File

@@ -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);
}
}

View File

@@ -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);
}

View File

@@ -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);
}
}