根据角色id查询具有超管和管理员角色的账户的人(角色id必须唯一)

master
shijie 4 years ago
parent 4a5b21922d
commit 0def26a6ff
  1. 21
      src/main/java/com/yipin/liuwanr/controller/UserInfoController.java
  2. 3
      src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java
  3. 14
      src/main/java/com/yipin/liuwanr/service/UserInfoService.java

@ -812,4 +812,25 @@ public class UserInfoController {
}
return resp;
}
/**
* 根据角色id查询具有超管和管理员角色的账户的人角色id必须唯一
* @return
*/
@GetMapping("/queryUserIds")
Response queryUserIds() {
Response resp = new Response();
HashMap<String, Object> 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;
}
}

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

@ -813,4 +813,18 @@ public class UserInfoService {
}
return resp;
}
public HashMap<String, Object> queryUserIds(){
HashMap<String, Object> resp = new HashMap<String, Object>();
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;
}
}

Loading…
Cancel
Save