From d41fe2e95f3f64c6e3a7229acd9e74e673513a0a Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期四, 09 七月 2026 16:13:59 +0800
Subject: [PATCH] 1.人力资源大模块开发 2.仓库大模块开发

---
 yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java |   44 ++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java
index 820c132..7cb7d78 100644
--- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java
+++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java
@@ -1,6 +1,7 @@
 package cn.iocoder.yudao.module.system.controller.admin.user;
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
 import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
 import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
@@ -29,6 +30,7 @@
 
 import java.io.IOException;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 
@@ -130,8 +132,16 @@
 
     @GetMapping({"/list-all-simple", "/simple-list"})
     @Operation(summary = "鑾峰彇鐢ㄦ埛绮剧畝淇℃伅鍒楄〃", description = "鍙寘鍚寮�鍚殑鐢ㄦ埛锛屼富瑕佺敤浜庡墠绔殑涓嬫媺閫夐」")
-    public CommonResult<List<UserSimpleRespVO>> getSimpleUserList() {
-        List<AdminUserDO> list = userService.getUserListByStatus(CommonStatusEnum.ENABLE.getStatus());
+    public CommonResult<List<UserSimpleRespVO>> getSimpleUserList(
+            @RequestParam(value = "deptId", required = false) Long deptId) {
+        List<AdminUserDO> list;
+        if (deptId != null) {
+            List<Long> deptIds = Collections.singletonList(deptId);
+            list = userService.getDeptUsers(deptIds);
+        } else {
+            list = userService.getUserListByStatus(CommonStatusEnum.ENABLE.getStatus());
+        }
+
         // 鎷兼帴鏁版嵁
         Map<Long, DeptDO> deptMap = deptService.getDeptMap(
                 convertList(list, AdminUserDO::getDeptId));
@@ -194,4 +204,34 @@
         return success(userService.importUserList(list, updateSupport));
     }
 
+    // ==================== 鍏嶉壌鏉冩帴鍙o紙鐢ㄤ簬 IM 鐐瑰ご鍍忓脊鍚嶇墖銆佸姞濂藉弸鎼滅储绛夊満鏅級 ====================
+
+    @GetMapping("/get-simple")
+    @Operation(summary = "鑾峰緱鐢ㄦ埛绮剧畝淇℃伅", description = "鐢ㄤ簬鐐瑰ご鍍忓脊鍚嶇墖绛夊満鏅紱鍏嶉壌鏉�")
+    @Parameter(name = "id", description = "鐢ㄦ埛缂栧彿", required = true, example = "1024")
+    public CommonResult<UserSimpleRespVO> getSimpleUser(@RequestParam("id") Long id) {
+        AdminUserDO user = userService.getUser(id);
+        if (user == null) {
+            return success(null);
+        }
+        // 鎷兼帴鏁版嵁
+        DeptDO dept = user.getDeptId() != null ? deptService.getDept(user.getDeptId()) : null;
+        Map<Long, DeptDO> deptMap = dept != null ? Collections.singletonMap(dept.getId(), dept) : Collections.emptyMap();
+        return success(CollUtil.getFirst(UserConvert.INSTANCE.convertSimpleList(
+                Collections.singletonList(user), deptMap)));
+    }
+
+    @GetMapping("/list-by-nickname")
+    @Operation(summary = "鎸夋樀绉版ā绯婃悳绱㈢敤鎴风簿绠�淇℃伅", description = "鐢ㄤ簬鍔犲ソ鍙嬬瓑鍦烘櫙锛涘厤閴存潈锛涘綋鍓嶄粎鎸夋樀绉板尮閰�")
+    @Parameter(name = "nickname", description = "鏄电О鍏抽敭璇�", required = true, example = "鑺嬮亾")
+    public CommonResult<List<UserSimpleRespVO>> getSimpleUserListByNickname(@RequestParam("nickname") String nickname) {
+        if (StrUtil.isBlank(nickname)) {
+            return success(Collections.emptyList());
+        }
+        // 鎷兼帴鏁版嵁
+        List<AdminUserDO> list = userService.getUserListByNickname(nickname.trim());
+        Map<Long, DeptDO> deptMap = deptService.getDeptMap(convertList(list, AdminUserDO::getDeptId));
+        return success(UserConvert.INSTANCE.convertSimpleList(list, deptMap));
+    }
+
 }

--
Gitblit v1.9.3