From 0def26a6fff6db4b8d0b4ee0c1013659af7a8f9e Mon Sep 17 00:00:00 2001 From: shijie <648688341@qq.com> Date: Mon, 19 Apr 2021 10:34:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E8=A7=92=E8=89=B2id=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E5=85=B7=E6=9C=89=E8=B6=85=E7=AE=A1=E5=92=8C=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=91=98=E8=A7=92=E8=89=B2=E7=9A=84=E8=B4=A6=E6=88=B7?= =?UTF-8?q?=E7=9A=84=E4=BA=BA=EF=BC=88=E8=A7=92=E8=89=B2id=E5=BF=85?= =?UTF-8?q?=E9=A1=BB=E5=94=AF=E4=B8=80=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/UserInfoController.java | 21 +++++++++++++++++++ .../yipin/liuwanr/mapper/UserInfoMapper.java | 3 +++ .../liuwanr/service/UserInfoService.java | 14 +++++++++++++ 3 files changed, 38 insertions(+) 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; + } }