From 779c235959bd1979381b07ffe561242c9cdd9ce2 Mon Sep 17 00:00:00 2001
From: zhangnaisong <2434969829@qq.com>
Date: 星期一, 19 二月 2024 15:32:35 +0800
Subject: [PATCH] 指挥端查看权限下全部单兵端提交
---
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java | 30 +++++++++++++++++++++++++-----
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml | 13 +++++++++++++
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java | 1 +
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java | 2 ++
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java | 6 ++++++
5 files changed, 47 insertions(+), 5 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
index bb69bbe..f26fc52 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
@@ -265,4 +265,10 @@
return Results.succeed("淇敼瀵嗙爜鎴愬姛锛�");
}
}
+
+ @GetMapping("/getAPPSoilderByCommanderId")
+ public AjaxResult getAPPSoilderByCommanderId() {
+ String userId = SecurityUtils.getUserId();
+ return success(userService.getAPPSoilderByCommanderId(userId));
+ }
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
index c7567df..36aa2e0 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
@@ -144,4 +144,6 @@
List<SysUser> getOnlineCommander(String usersId);
List<SysUser> getOnlinePC(@Param("usersId") String usersId,@Param("onLinePCIdList")List<String> onLinePCIdList);
+
+ List<SysUser> getOwnAndChildrenSoilderList(@Param("deptIdList")List<Long> deptIdList);
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java
index ed79e23..43ff491 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java
@@ -238,4 +238,5 @@
List<SysUser> userByDept(Long deptId);
+ List<SysUser> getAPPSoilderByCommanderId(String userId);
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
index 9e26b0f..2720897 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
@@ -18,6 +18,7 @@
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.DictUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
+import com.ruoyi.system.mapper.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -36,11 +37,6 @@
import com.ruoyi.system.domain.SysPost;
import com.ruoyi.system.domain.SysUserPost;
import com.ruoyi.system.domain.SysUserRole;
-import com.ruoyi.system.mapper.SysPostMapper;
-import com.ruoyi.system.mapper.SysRoleMapper;
-import com.ruoyi.system.mapper.SysUserMapper;
-import com.ruoyi.system.mapper.SysUserPostMapper;
-import com.ruoyi.system.mapper.SysUserRoleMapper;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.ISysUserService;
@@ -77,6 +73,9 @@
private RedisCache redisCache;
@Resource
private ArdAlarmTypeConfigMapper ardAlarmTypeConfigMapper;
+
+ @Resource
+ private SysDeptMapper sysDeptMapper;
/**
* 椤圭洰鍚姩鏃讹紝鍒濆鍖栧弬鏁板埌缂撳瓨
@@ -647,4 +646,25 @@
queryWrapper.eq("dept_id",deptId).eq("del_flag","0").eq("app_user_type","1");
return userMapper.selectList(queryWrapper);
}
+
+ @Override
+ public List<SysUser> getAPPSoilderByCommanderId(String userId) {
+ SysUser sysUser = userMapper.selectUserById(userId);//鑾峰彇绯荤粺鐢ㄦ埛
+ List<Long> deptIdList = new ArrayList();
+ deptIdList.add(sysUser.getDeptId());
+ deptIdList = getOwnAndChildrenDeptIdList(deptIdList,new ArrayList());//閫掑綊鏌ヨ涓嬪睘閮ㄩ棬涓婚敭
+ List<SysUser> result = userMapper.getOwnAndChildrenSoilderList(deptIdList);
+ return result;
+ }
+
+ public List<Long> getOwnAndChildrenDeptIdList(List<Long> deptIdList,List<Long> deptIdListr){
+ deptIdListr.addAll(deptIdList);
+ List<Long> result = sysDeptMapper.getChildrenDeptIdList(deptIdList);
+ if(result.size() != 0){
+ deptIdListr.addAll(result);
+ result = getOwnAndChildrenDeptIdList(result,deptIdListr);
+ }
+ deptIdListr = deptIdListr.stream().distinct().collect(Collectors.toList());
+ return deptIdListr;
+ }
}
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
index 18bfb26..66aa0b8 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
@@ -342,4 +342,17 @@
#{userId}
</foreach>
</select>
+
+ <select id="getOwnAndChildrenSoilderList" resultMap="SysUserOnlyResult">
+ select distinct su.user_id,su.dept_id,su.user_name,
+ concat(su.nick_name,'(',sd.dept_name,')') as nick_name from sys_user su
+ inner join sys_user_role sur on su.user_id = sur.user_id
+ inner join sys_role sr on sur.role_id = sr.role_id
+ inner join sys_dept sd on su.dept_id = sd.dept_id
+ where sr.role_key = 'appUser' and su.dept_id in
+ <foreach collection="deptIdList" item="deptId" open="(" close=")" separator=",">
+ #{deptId}
+ </foreach>
+ order by su.dept_id asc
+ </select>
</mapper>
\ No newline at end of file
--
Gitblit v1.9.3