管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2022-10-25 25ee639e42cdaf5c1874fc40d8309dc898989d2b
1
已修改1个文件
64 ■■■■■ 文件已修改
src/main/java/com/lf/server/controller/all/PermsController.java 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/controller/all/PermsController.java
@@ -5,14 +5,15 @@
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.entity.sys.UserEntity;
import com.lf.server.service.all.PermsService;
import com.lf.server.service.sys.TokenService;
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 javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
@@ -26,15 +27,20 @@
    @Autowired
    PermsService permsService;
    @Autowired
    TokenService tokenService;
    @SysLog()
    @ApiOperation(value = "根据用户Uid查询资源授权")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "uid", value = "用户Uid", dataType = "String", paramType = "query", example = "admin")
    })
    @ApiOperation(value = "查询当前用户的资源授权")
    @GetMapping(value = "/selectRes")
    public ResponseMsg<List<ResAuthEntity>> selectRes(String uid) {
    public ResponseMsg<List<ResAuthEntity>> selectRes(HttpServletRequest req) {
        try {
            List<ResAuthEntity> rs = permsService.selectRes(uid);
            UserEntity ue = tokenService.getCurrentUser(req);
            if (ue == null) {
                return null;
            }
            List<ResAuthEntity> rs = permsService.selectRes(ue.getUid());
            return success(rs);
        } catch (Exception ex) {
@@ -43,14 +49,16 @@
    }
    @SysLog()
    @ApiOperation(value = "根据用户Uid查询菜单授权")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "uid", value = "用户Uid", dataType = "String", paramType = "query", example = "admin")
    })
    @ApiOperation(value = "查询当前用户的菜单授权")
    @GetMapping(value = "/selectMenus")
    public ResponseMsg<List<MenusAuthEntity>> selectMenus(String uid) {
    public ResponseMsg<List<MenusAuthEntity>> selectMenus(HttpServletRequest req) {
        try {
            List<MenusAuthEntity> rs = permsService.selectMenus(uid);
            UserEntity ue = tokenService.getCurrentUser(req);
            if (ue == null) {
                return null;
            }
            List<MenusAuthEntity> rs = permsService.selectMenus(ue.getUid());
            return success(rs);
        } catch (Exception ex) {
@@ -59,14 +67,16 @@
    }
    @SysLog()
    @ApiOperation(value = "根据用户Uid查询权限授权")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "uid", value = "用户Uid", dataType = "String", paramType = "query", example = "admin")
    })
    @ApiOperation(value = "查询当前用户的权限授权")
    @GetMapping(value = "/selectPerms")
    public ResponseMsg<List<String>> selectPerms(String uid) {
    public ResponseMsg<List<String>> selectPerms(HttpServletRequest req) {
        try {
            List<String> rs = permsService.selectPerms(uid);
            UserEntity ue = tokenService.getCurrentUser(req);
            if (ue == null) {
                return null;
            }
            List<String> rs = permsService.selectPerms(ue.getUid());
            return success(rs);
        } catch (Exception ex) {
@@ -75,14 +85,16 @@
    }
    @SysLog()
    @ApiOperation(value = "根据用户Uid查询权限授权实体集合")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "uid", value = "用户Uid", dataType = "String", paramType = "query", example = "admin")
    })
    @ApiOperation(value = "查询当前用户的权限授权实体集合")
    @GetMapping(value = "/selectPermsEntity")
    public ResponseMsg<List<PermsAuthEntity>> selectPermsEntity(String uid) {
    public ResponseMsg<List<PermsAuthEntity>> selectPermsEntity(HttpServletRequest req) {
        try {
            List<PermsAuthEntity> rs = permsService.selectPermsEntity(uid);
            UserEntity ue = tokenService.getCurrentUser(req);
            if (ue == null) {
                return null;
            }
            List<PermsAuthEntity> rs = permsService.selectPermsEntity(ue.getUid());
            return success(rs);
        } catch (Exception ex) {