管道基础大数据平台系统开发-【后端】-Server
13693261870
2022-10-24 403da64eae0a1357d80b6ce44391af1f11b835a3
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package com.lf.server.controller.all;
 
import com.lf.server.aspect.SysLog;
import com.lf.server.entity.all.MenusAuthEntity;
import com.lf.server.entity.all.PermsAuthEntity;
import com.lf.server.entity.all.ResAuthEntity;
import com.lf.server.entity.all.ResponseMsg;
import com.lf.server.service.all.PermsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
 
/**
 * 授权控制器
 * @author WWW
 */
@Api(tags = "运维管理\\授权管理")
@RestController
@RequestMapping("/file")
public class PermsController extends BaseController {
    @Autowired
    PermsService permsService;
 
    @SysLog()
    @ApiOperation(value = "根据用户Uid查询资源授权")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "uid", value = "用户Uid", dataType = "String", paramType = "query", example = "admin")
    })
    @GetMapping(value = "/selectRes")
    public ResponseMsg<List<ResAuthEntity>> selectRes(String uid) {
        try {
            List<ResAuthEntity> rs = permsService.selectRes(uid);
 
            return success(rs);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
        }
    }
 
    @SysLog()
    @ApiOperation(value = "根据用户Uid查询菜单授权")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "uid", value = "用户Uid", dataType = "String", paramType = "query", example = "admin")
    })
    @GetMapping(value = "/selectMenus")
    public ResponseMsg<List<MenusAuthEntity>> selectMenus(String uid) {
        try {
            List<MenusAuthEntity> rs = permsService.selectMenus(uid);
 
            return success(rs);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
        }
    }
 
    @SysLog()
    @ApiOperation(value = "根据用户Uid查询权限授权")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "uid", value = "用户Uid", dataType = "String", paramType = "query", example = "admin")
    })
    @GetMapping(value = "/selectPerms")
    public ResponseMsg<List<PermsAuthEntity>> selectPerms(String uid) {
        try {
            List<PermsAuthEntity> rs = permsService.selectPerms(uid);
 
            return success(rs);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
        }
    }
 
    @SysLog()
    @ApiOperation(value = "根据用户Uid查询权限授权2")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "uid", value = "用户Uid", dataType = "String", paramType = "query", example = "admin")
    })
    @GetMapping(value = "/selectPerms2")
    public ResponseMsg<List<String>> selectPerms2(String uid) {
        try {
            List<String> rs = permsService.selectPerms2(uid);
 
            return success(rs);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
        }
    }
}