管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2022-10-25 4ddfd502023662f6d25c4be416d88751e206d91a
src/main/java/com/lf/server/controller/sys/MenuAuthController.java
@@ -5,6 +5,7 @@
import com.lf.server.entity.all.ResponseMsg;
import com.lf.server.entity.sys.MenuAuthEntity;
import com.lf.server.entity.sys.UserEntity;
import com.lf.server.service.all.PermsService;
import com.lf.server.service.sys.MenuAuthService;
import com.lf.server.service.sys.TokenService;
import io.swagger.annotations.Api;
@@ -30,6 +31,9 @@
    @Autowired
    TokenService tokenService;
    @Autowired
    PermsService permsService;
    @SysLog()
    @ApiOperation(value = "查询记录数")
@@ -95,6 +99,34 @@
    }
    @SysLog()
    @ApiOperation(value = "根据角色ID+菜单ID分页查询并返回记录数")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "roleid", value = "角色ID", dataType = "Integer", paramType = "query", example = "1"),
            @ApiImplicitParam(name = "menuid", value = "菜单ID", dataType = "Integer", paramType = "query", example = "1"),
            @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "Integer", paramType = "query", example = "10"),
            @ApiImplicitParam(name = "pageIndex", value = "分页数(从1开始)", dataType = "Integer", paramType = "query", example = "1")
    })
    @GetMapping(value = "/selectByPageForRole")
    public ResponseMsg<List<MenuAuthEntity>> selectByPageForRole(Integer roleid, Integer menuid, Integer pageSize, Integer pageIndex) {
        try {
            if (pageSize < 1 || pageIndex < 1) {
                return fail("每页页数或分页数小于1", null);
            }
            int count = menuAuthService.selectCountForRole(roleid,  menuid);
            if (count == 0) {
                return success(0, null);
            }
            List<MenuAuthEntity> rs = menuAuthService.selectByPageForRole(roleid,  menuid, pageSize, pageSize * (pageIndex - 1));
            return success(count, rs);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
        }
    }
    @SysLog()
    @ApiOperation(value = "查询所有")
    @GetMapping(value = "/selectAll")
    public ResponseMsg<List<MenuAuthEntity>> selectAll() {
@@ -124,7 +156,7 @@
    }
    @SysLog()
    @ApiOperation(value = "添加数据")
    @ApiOperation(value = "插入一条")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "entity", value = "实体类", dataType = "MenuAuthEntity", paramType = "body")
    })
@@ -137,6 +169,9 @@
            }
            int count = menuAuthService.insert(entity);
            if (count > 0) {
                permsService.clearPermsCache();
            }
            return success(count);
        } catch (Exception ex) {
@@ -145,7 +180,7 @@
    }
    @SysLog()
    @ApiOperation(value = "批量添加")
    @ApiOperation(value = "插入多条")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "list", value = "实体类集合", dataType = "MenuAuthEntity", paramType = "body")
    })
@@ -160,6 +195,9 @@
            }
            int count = menuAuthService.inserts(list);
            if (count > 0) {
                permsService.clearPermsCache();
            }
            return success(count);
        } catch (Exception ex) {
@@ -168,7 +206,7 @@
    }
    @SysLog()
    @ApiOperation(value = "刪除数据")
    @ApiOperation(value = "删除一条")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1")
    })
@@ -176,6 +214,9 @@
    public ResponseMsg<Integer> delete(int id) {
        try {
            int count = menuAuthService.delete(id);
            if (count > 0) {
                permsService.clearPermsCache();
            }
            return success(count);
        } catch (Exception ex) {
@@ -184,7 +225,7 @@
    }
    @SysLog()
    @ApiOperation(value = "批量删除")
    @ApiOperation(value = "删除多条")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "ids", value = "ID数组", dataType = "Integer", paramType = "query", example = "1,2")
    })
@@ -196,6 +237,9 @@
            }
            int count = menuAuthService.deletes(ids);
            if (count > 0) {
                permsService.clearPermsCache();
            }
            return success(count);
        } catch (Exception ex) {
@@ -204,7 +248,7 @@
    }
    @SysLog()
    @ApiOperation(value = "修改数据")
    @ApiOperation(value = "更新一条")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "entity", value = "实体类", dataType = "MenuAuthEntity", paramType = "body")
    })
@@ -218,6 +262,9 @@
            }
            int count = menuAuthService.update(entity);
            if (count > 0) {
                permsService.clearPermsCache();
            }
            return success(count);
        } catch (Exception ex) {
@@ -226,7 +273,7 @@
    }
    @SysLog()
    @ApiOperation(value = "批量修改")
    @ApiOperation(value = "更新多条")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "list", value = "实体类集合", dataType = "MenuAuthEntity", paramType = "body")
    })
@@ -242,6 +289,9 @@
            }
            int count = menuAuthService.updates(list);
            if (count > 0) {
                permsService.clearPermsCache();
            }
            return success(count);
        } catch (Exception ex) {