diff --git a/src/main/java/com/cm/serviceusercenter/controller/resources/system/user/UserResourceController.java b/src/main/java/com/cm/serviceusercenter/controller/resources/system/user/UserResourceController.java index b633dc6..adca1b5 100644 --- a/src/main/java/com/cm/serviceusercenter/controller/resources/system/user/UserResourceController.java +++ b/src/main/java/com/cm/serviceusercenter/controller/resources/system/user/UserResourceController.java @@ -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 listUserByUsernames(@RequestParam("usernames") String usernames) throws ParamsException, SearchException { + if (StringUtils.isBlank(usernames)) { + throw new ParamsException("参数usernames不能为空"); + } + Map 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"), diff --git a/src/main/resources/mybatis/mapper/system/user/user-mapper.xml b/src/main/resources/mybatis/mapper/system/user/user-mapper.xml index 511ff71..417f22a 100644 --- a/src/main/resources/mybatis/mapper/system/user/user-mapper.xml +++ b/src/main/resources/mybatis/mapper/system/user/user-mapper.xml @@ -858,6 +858,13 @@ #{userIds[${index}]} + + AND + t1.user_username IN + + #{userUsernames[${index}]} + + ORDER BY