diff --git a/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java b/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java index 091485f..660542a 100644 --- a/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java +++ b/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java @@ -812,4 +812,25 @@ public class UserInfoController { } return resp; } + + /** + * 根据角色id查询具有超管和管理员角色的账户的人(角色id必须唯一) + * @return + */ + @GetMapping("/queryUserIds") + Response queryUserIds() { + Response resp = new Response(); + HashMap ret = userInfoService.queryUserIds(); + int status = (int) ret.get("retcode"); + Map map = new HashMap(); + if (200 == status) { + resp.setStatus(status); + map.put("retvalue",ret.get("retvalue")); + resp.setMessage(map); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + return resp; + } } \ No newline at end of file diff --git a/src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java b/src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java index de0e6cd..e2b0e7b 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java @@ -343,4 +343,7 @@ public interface UserInfoMapper { @Select("select roleId from hr_user_info where userId = #{userId}") UserInfo queryUser(UserInfo user); + + @Select("select * from hr_user_info where FIND_IN_SET(1,roleId) OR FIND_IN_SET(13,roleId)") + List queryUserIds(); } \ No newline at end of file diff --git a/src/main/java/com/yipin/liuwanr/service/UserInfoService.java b/src/main/java/com/yipin/liuwanr/service/UserInfoService.java index 5752d54..1d6c499 100644 --- a/src/main/java/com/yipin/liuwanr/service/UserInfoService.java +++ b/src/main/java/com/yipin/liuwanr/service/UserInfoService.java @@ -813,4 +813,18 @@ public class UserInfoService { } return resp; } + + public HashMap queryUserIds(){ + HashMap resp = new HashMap(); + try { + resp.put("retvalue", userInfoMapper.queryUserIds()); + resp.put("retcode", 200); + } catch (RuntimeException e) { + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "Inquiry Failed"); + return resp; + } + return resp; + } }