From 787fb1bc15a46897f0d16e3b530ead410eef01d8 Mon Sep 17 00:00:00 2001 From: wanggeng888 <450292408@qq.com> Date: Mon, 8 Feb 2021 20:22:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=94=A8=E6=88=B7=E5=90=8D?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/user/UserResourceController.java | 15 +++++++++++++++ .../mybatis/mapper/system/user/user-mapper.xml | 7 +++++++ 2 files changed, 22 insertions(+) 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