添加用户名查询

This commit is contained in:
wanggeng888 2021-02-08 20:22:46 +08:00
parent fc71b74d2c
commit 787fb1bc15
2 changed files with 22 additions and 0 deletions

View File

@ -134,6 +134,21 @@ public class UserResourceController extends BaseController {
return userService.listUsers(params);
}
@ApiOperation(value = "获取用户列表,通过用户名", notes = "获取用户列表,通过用户名接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "usernames", value = "用户名列表,下划线分隔", paramType = "query"),
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("listuserbyusernames")
public List<UserDTO> listUserByUsernames(@RequestParam("usernames") String usernames) throws ParamsException, SearchException {
if (StringUtils.isBlank(usernames)) {
throw new ParamsException("参数usernames不能为空");
}
Map<String, Object> params = requestParams();
params.put("userUsernames", Arrays.asList(usernames.split("_")));
return userService.listUsers(params);
}
@ApiOperation(value = "全部用户列表", notes = "全部用户列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query", dataType = "String"),

View File

@ -858,6 +858,13 @@
#{userIds[${index}]}
</foreach>
</if>
<if test="userUsernames != null and userUsernames.size > 0">
AND
t1.user_username IN
<foreach collection="userUsernames" index="index" open="(" separator="," close=")">
#{userUsernames[${index}]}
</foreach>
</if>
<choose>
<when test="sort != null and (sort == 'userUsername' or sort == 'userName' or sort == 'userPhone' or sort == 'userEmail' or sort == 'userState' or sort == 'lastLoginAddress' or sort == 'lastLoginTime')">
ORDER BY