mirror of https://gitee.com/stylefeng/roses
【8.3.3】【role】初始化新的角色绑定的业务,增加获取用户机构列表的接口
parent
ec22f6306d
commit
7007cf31c7
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue