1.app远程接口代码提交
This commit is contained in:
@@ -447,7 +447,20 @@ public class DeptController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据部门id查询当前部门所有父级部门id
|
||||
* @param deptId
|
||||
* @return
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@GetMapping("/getUpByDeptIds")
|
||||
@ApiOperation("根据部门id查询当前部门所有父级部门id")
|
||||
@ApiImplicitParam(name = "deptId", value = "用户部门id", required = true)
|
||||
public HttpResult<List<String>> getUpByDeptIds(@RequestParam("deptId") String deptId) {
|
||||
String methodDescribe = getMethodDescribe("getUpByDeptIds");
|
||||
List<String> users = deptService.getUpByDeptIds(deptId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, users, methodDescribe);
|
||||
}
|
||||
/*++++++++++++++++++++++++++++++++pms专用+++++++++++++++++++++++++++++++begin*/
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.njcn.user.controller;
|
||||
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.LogInfo;
|
||||
@@ -444,5 +445,25 @@ public class UserController extends BaseController {
|
||||
List<User> users = userService.getUserListByDeptId(deptId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, users, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据部门ids查询用户信息
|
||||
* @param deptId
|
||||
* @return
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@GetMapping("/getUserByDeptIds")
|
||||
@ApiOperation("根据部门ids查询用户信息")
|
||||
@ApiImplicitParam(name = "deptId", value = "用户部门id", required = true)
|
||||
public HttpResult<List<User>> getUserByDeptIds(@RequestBody List<String> deptId) {
|
||||
String methodDescribe = getMethodDescribe("getUpByDeptIds");
|
||||
List<User> users = userService.list(new LambdaQueryWrapper<User>()
|
||||
.in(User::getDeptId,deptId)
|
||||
.eq(User::getSmsNotice,1)
|
||||
.eq(User::getState,1)
|
||||
);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, users, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -116,4 +116,13 @@ public interface DeptMapper extends BaseMapper<Dept> {
|
||||
* @date 2022/10/09
|
||||
*/
|
||||
List<String> getDeptSonId(@Param("deptId") String deptId);
|
||||
|
||||
/**
|
||||
* @Description: 查询所有父级部门
|
||||
* @param deptId
|
||||
* @return: java.util.List<java.lang.String>
|
||||
* @Author: wr
|
||||
* @Date: 2023/11/9 15:59
|
||||
*/
|
||||
List<String> selectUpByDeptIds(@Param("deptId") String deptId);
|
||||
}
|
||||
|
||||
@@ -184,4 +184,23 @@
|
||||
select id from sys_dept where sys_dept.Pid=#{deptId} and state = 1
|
||||
</select>
|
||||
|
||||
<select id="selectUpByDeptIds" resultType="java.lang.String">
|
||||
SELECT
|
||||
T2.id
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
@r AS _id,
|
||||
( SELECT @r := Pid FROM sys_dept WHERE id = _id LIMIT 1 ) AS parent_id,
|
||||
@l := @l + 1 AS lvl
|
||||
FROM
|
||||
( SELECT @r := #{deptId}, @l := 0 ) vars,
|
||||
sys_dept h
|
||||
WHERE
|
||||
Pid >> 0
|
||||
) T1
|
||||
JOIN sys_dept T2 ON T1.parent_id = T2.id
|
||||
ORDER BY
|
||||
T1.lvl DESC;
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -65,4 +65,5 @@
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -218,4 +218,12 @@ public interface IDeptService extends IService<Dept> {
|
||||
* @Date: 2023/1/10
|
||||
*/
|
||||
List<DeptDTO> getDepSonDetailByDeptId(String deptId);
|
||||
|
||||
/**
|
||||
* @Description: 向上查询部门信息
|
||||
* @param deptId 部门id
|
||||
* @Author: wr
|
||||
* @Date: 2023/11/9 15:57
|
||||
*/
|
||||
List<String> getUpByDeptIds(String deptId);
|
||||
}
|
||||
|
||||
@@ -458,4 +458,11 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
}).collect (Collectors.toList ( ));
|
||||
return collect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getUpByDeptIds(String deptId) {
|
||||
List<String> list = this.baseMapper.selectUpByDeptIds(deptId);
|
||||
list.add(deptId);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user