【8.3.3】【role】初始化新的角色绑定的业务,增加获取用户机构列表的接口

pull/62/head
stylefeng 2025-01-24 14:21:46 +08:00
parent ec22f6306d
commit 7007cf31c7
1 changed files with 47 additions and 0 deletions

View File

@ -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<List<UserOrgDTO>> getUserOrgList(@RequestParam("userId") Long userId) {
List<UserOrgDTO> list = sysUserOrgService.getUserOrgList(userId, true);
// 清空一些名称的返回
for (UserOrgDTO userOrgDTO : list) {
userOrgDTO.setDeptId(null);
userOrgDTO.setPositionId(null);
}
return new SuccessResponseData<>(list);
}
}