管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2023-04-19 7d824c1e0b6fdd5ddb5d2cd783839895c416c75a
src/main/java/com/lf/server/controller/all/PermsController.java
@@ -1,15 +1,12 @@
package com.lf.server.controller.all;
import com.lf.server.annotation.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.entity.data.DirEntity;
import com.lf.server.entity.all.*;
import com.lf.server.entity.data.LayerEntity;
import com.lf.server.entity.sys.MenuEntity;
import com.lf.server.entity.sys.UserEntity;
import com.lf.server.helper.StringHelper;
import com.lf.server.service.all.PermsService;
import com.lf.server.service.data.LayerService;
import com.lf.server.service.sys.MenuService;
import com.lf.server.service.sys.TokenService;
import io.swagger.annotations.Api;
@@ -20,7 +17,6 @@
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
@@ -40,6 +36,9 @@
    @Autowired
    MenuService menuService;
    @Autowired
    LayerService layerService;
    @SysLog()
    @ApiOperation(value = "查询当前用户的资源授权")
    @GetMapping(value = "/selectRes")
@@ -50,11 +49,12 @@
                return fail("用户未登录", null);
            }
            List<ResAuthEntity> rs = permsService.selectRes(ue.getUid());
            String uid = StaticData.ADMIN.equals(ue.getUid()) ? null : ue.getUid();
            List<ResAuthEntity> rs = permsService.selectRes(uid);
            return success(rs);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
            return fail(ex, null);
        }
    }
@@ -68,11 +68,12 @@
                return fail("用户未登录", null);
            }
            List<MenusAuthEntity> rs = permsService.selectMenus(ue.getUid());
            String uid = StaticData.ADMIN.equals(ue.getUid()) ? null : ue.getUid();
            List<MenusAuthEntity> rs = permsService.selectMenus(uid);
            return success(rs);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
            return fail(ex, null);
        }
    }
@@ -86,11 +87,12 @@
                return fail("用户未登录", null);
            }
            List<String> rs = permsService.selectPerms(ue.getUid());
            String uid = StaticData.ADMIN.equals(ue.getUid()) ? null : ue.getUid();
            List<String> rs = permsService.selectPerms(uid);
            return success(rs);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
            return fail(ex, null);
        }
    }
@@ -104,11 +106,12 @@
                return fail("用户未登录", null);
            }
            List<PermsAuthEntity> rs = permsService.selectPermsEntity(ue.getUid());
            String uid = StaticData.ADMIN.equals(ue.getUid()) ? null : ue.getUid();
            List<PermsAuthEntity> rs = permsService.selectPermsEntity(uid);
            return success(rs);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
            return fail(ex, null);
        }
    }
@@ -121,7 +124,7 @@
            return success(true);
        } catch (Exception ex) {
            return fail(ex.getMessage(), false);
            return fail(ex, false);
        }
    }
@@ -139,7 +142,7 @@
            return success(list);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
            return fail(ex, null);
        }
    }
@@ -156,11 +159,30 @@
                return fail("用户未登录", null);
            }
            List<MenuEntity> list = permsService.selectMenuRecursive(id, ue.getUid());
            String uid = StaticData.ADMIN.equals(ue.getUid()) ? null : ue.getUid();
            List<MenuEntity> list = permsService.selectMenuRecursive(id, uid);
            return success(list);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
            return fail(ex, null);
        }
    }
    @SysLog()
    @ApiOperation(value = "查询所有图层")
    @GetMapping(value = "/selectLayers")
    public ResponseMsg<Object> selectLayers(HttpServletRequest req) {
        try {
            UserEntity ue = tokenService.getCurrentUser(req);
            if (ue == null) {
                return fail("用户未登录", null);
            }
            List<LayerEntity> list = layerService.selectAll();
            return success(list);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
}