package com.yuanchu.limslaboratory.controller;
|
|
import com.yuanchu.limslaboratory.annotation.AuthHandler;
|
import com.yuanchu.limslaboratory.pojo.dto.GetAllRoleAndMenuByConditionPageDto;
|
import com.yuanchu.limslaboratory.pojo.dto.RoleInfoDto;
|
import com.yuanchu.limslaboratory.pojo.dto.UpdateRoleMenuDto;
|
import com.yuanchu.limslaboratory.service.RoleManagerService;
|
import com.yuanchu.limslaboratory.vo.Result;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.annotation.Resource;
|
|
/**
|
* @Author 张宾
|
* @Date 2023/8/23
|
*/
|
@Api(tags = "实验室-->3、角色管理")
|
@RestController
|
@RequestMapping("/role-manager")
|
public class RoleMangerController {
|
|
@Resource
|
private RoleManagerService roleManagerService;
|
|
@ApiOperation("获取菜单功能树")
|
@GetMapping("/getMenusTree")
|
@AuthHandler
|
public Result<?>getMenusTree() {
|
return Result.success(roleManagerService.getMenusTree());
|
};
|
|
@ApiOperation("新增角色")
|
@PostMapping("/addRoleInfo")
|
@AuthHandler
|
public Result<?>addRoleInfo(@RequestBody RoleInfoDto dto){
|
return Result.success(roleManagerService.addRoleInfo(dto));
|
}
|
|
@ApiOperation("查询角色名重复")
|
@GetMapping("/assertRepeat")
|
@AuthHandler
|
public Result<?> assertRepeat(String roleName){
|
return Result.success(roleManagerService.assertRepeat(roleName));
|
}
|
|
@ApiOperation("获取角色信息")
|
@GetMapping("/getAllRoleAndMenuInfo")
|
@AuthHandler
|
public Result<?> getAllRoleAndMenuInfo(GetAllRoleAndMenuByConditionPageDto dto){
|
return Result.success(roleManagerService.getAllRoleAndMenuInfo(dto));
|
}
|
|
@ApiOperation("逻辑删除角色")
|
@GetMapping("/deleteRole")
|
@AuthHandler
|
public Result<?> deleteRole(Long id){
|
return Result.success(roleManagerService.deleteRole(id));
|
}
|
|
@ApiOperation("修改权限")
|
@PostMapping("/updateRoleMenu")
|
@AuthHandler
|
public Result<?> updateRoleMenu(@RequestBody UpdateRoleMenuDto dto){
|
return Result.success(roleManagerService.updateRoleMenu(dto));
|
}
|
|
@ApiOperation("根据角色Id获取Role")
|
@GetMapping("/getRoleAndMenuByRole")
|
@AuthHandler
|
public Result<?> getRoleAndMenuByRole(Long roleId){
|
return Result.success(roleManagerService.getRoleAndMenuByRole(roleId));
|
}
|
|
@AuthHandler(type = 1)
|
@ApiOperation("测试生成")
|
@GetMapping("/test")
|
public Result<?> test(Long roleId){
|
return Result.success(null);
|
}
|
}
|