From 7007cf31c7582b14a0299013f223f8d0dbf49615 Mon Sep 17 00:00:00 2001 From: stylefeng Date: Fri, 24 Jan 2025 14:21:46 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=908.3.3=E3=80=91=E3=80=90role=E3=80=91?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E6=96=B0=E7=9A=84=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E7=BB=91=E5=AE=9A=E7=9A=84=E4=B8=9A=E5=8A=A1=EF=BC=8C=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=8E=B7=E5=8F=96=E7=94=A8=E6=88=B7=E6=9C=BA=E6=9E=84?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/NewRoleAssignController.java | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 kernel-s-system/system-business-hr/src/main/java/cn/stylefeng/roses/kernel/sys/modular/user/controller/NewRoleAssignController.java diff --git a/kernel-s-system/system-business-hr/src/main/java/cn/stylefeng/roses/kernel/sys/modular/user/controller/NewRoleAssignController.java b/kernel-s-system/system-business-hr/src/main/java/cn/stylefeng/roses/kernel/sys/modular/user/controller/NewRoleAssignController.java new file mode 100644 index 000000000..05ce9d5d5 --- /dev/null +++ b/kernel-s-system/system-business-hr/src/main/java/cn/stylefeng/roses/kernel/sys/modular/user/controller/NewRoleAssignController.java @@ -0,0 +1,47 @@ +package cn.stylefeng.roses.kernel.sys.modular.user.controller; + +import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData; +import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData; +import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource; +import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource; +import cn.stylefeng.roses.kernel.sys.api.pojo.user.UserOrgDTO; +import cn.stylefeng.roses.kernel.sys.modular.user.service.SysUserOrgService; +import jakarta.annotation.Resource; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * 一套新的用户绑定角色的接口 + * + * @author fengshuonan + * @since 2025/1/24 13:55 + */ +@RestController +@ApiResource(name = "用户绑定角色v2") +public class NewRoleAssignController { + + @Resource + private SysUserOrgService sysUserOrgService; + + /** + * 获取用户的所有机构列表 + * + * @author fengshuonan + * @since 2025/1/24 14:11 + */ + @GetResource(name = "获取左侧机构列表", path = "/sysRoleAssign/v2/getUserOrgList") + public ResponseData> getUserOrgList(@RequestParam("userId") Long userId) { + List list = sysUserOrgService.getUserOrgList(userId, true); + + // 清空一些名称的返回 + for (UserOrgDTO userOrgDTO : list) { + userOrgDTO.setDeptId(null); + userOrgDTO.setPositionId(null); + } + + return new SuccessResponseData<>(list); + } + +}