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); + } + +}