Commit 3b3403ffce821686df5bc58f5a927418d17aacce
1 parent
6c7282ff
✨ feat(system): 为前端 UserSelect 提供多选支持
Showing
1 changed file
with
16 additions
and
0 deletions
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java
| ... | ... | @@ -21,6 +21,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; |
| 21 | 21 | import jakarta.annotation.Resource; |
| 22 | 22 | import jakarta.servlet.http.HttpServletResponse; |
| 23 | 23 | import jakarta.validation.Valid; |
| 24 | +import java.util.Collections; | |
| 24 | 25 | import org.springframework.security.access.prepost.PreAuthorize; |
| 25 | 26 | import org.springframework.validation.annotation.Validated; |
| 26 | 27 | import org.springframework.web.bind.annotation.*; |
| ... | ... | @@ -34,6 +35,7 @@ import java.util.Map; |
| 34 | 35 | import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; |
| 35 | 36 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 36 | 37 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; |
| 38 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | |
| 37 | 39 | |
| 38 | 40 | @Tag(name = "管理后台 - 用户") |
| 39 | 41 | @RestController |
| ... | ... | @@ -112,6 +114,20 @@ public class UserController { |
| 112 | 114 | pageResult.getTotal())); |
| 113 | 115 | } |
| 114 | 116 | |
| 117 | + @GetMapping("/list") | |
| 118 | + @Operation(summary = "获得用户详情列表") | |
| 119 | + @Parameter(name = "ids", description = "编号列表", required = true, example = "[1024]") | |
| 120 | + @PreAuthorize("@ss.hasPermission('system:user:query')") | |
| 121 | + public CommonResult<List<UserRespVO>> getUserList(@RequestParam("ids") List<Long> ids) { | |
| 122 | + List<AdminUserDO> list = userService.getUserList(ids); | |
| 123 | + if (CollUtil.isEmpty(list)) { | |
| 124 | + return success(Collections.emptyList()); | |
| 125 | + } | |
| 126 | + // 拼接数据 | |
| 127 | + Map<Long, DeptDO> deptMap = deptService.getDeptMap(convertSet(list, AdminUserDO::getDeptId)); | |
| 128 | + return success(UserConvert.INSTANCE.convertList(list, deptMap)); | |
| 129 | + } | |
| 130 | + | |
| 115 | 131 | @GetMapping({"/list-all-simple", "/simple-list"}) |
| 116 | 132 | @Operation(summary = "获取用户精简信息列表", description = "只包含被开启的用户,主要用于前端的下拉选项") |
| 117 | 133 | public CommonResult<List<UserSimpleRespVO>> getSimpleUserList() { | ... | ... |