guoyuji
2024-05-09 f93960436b42dff6bc965cd8a24d247cda17d79e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.example.erp.controller.userInfo;
 
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.example.erp.common.Result;
import com.example.erp.entity.userInfo.Role;
import com.example.erp.service.userInfo.RoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
@RestController
@Api(value="角色controller",tags={"角色操作接口"})
@RequestMapping("/role")
public class RoleController {
    private final RoleService roleService;
 
    public RoleController(RoleService roleService) {
        this.roleService = roleService;
    }
 
 
    @ApiOperation("查询所有角色")
    @SaCheckPermission("roleList.search")
    @GetMapping("/findAll")
    public Result findAll(){
        return Result.seccess(roleService.findAll());
    }
 
 
    @ApiOperation("新增角色")
    @SaCheckPermission("roleList.add")
    @PostMapping("/add")
    public Result add(@RequestBody Role role){
        return Result.seccess(roleService.add(role));
 
    }
}