管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2022-10-08 e7b3a5e891287b1291d2ac38f7c83d5d73bc7906
src/main/java/com/lf/server/controller/sys/RoleController.java
ÎļþÃû´Ó src/main/java/com/lf/server/controller/data/RoleController.java ÐÞ¸Ä
@@ -1,9 +1,10 @@
package com.lf.server.controller.data;
package com.lf.server.controller.sys;
import com.lf.server.controller.BaseController;
import com.lf.server.aspect.SysLog;
import com.lf.server.controller.all.BaseController;
import com.lf.server.entity.all.ResponseMsg;
import com.lf.server.entity.data.RoleEntity;
import com.lf.server.service.data.RoleService;
import com.lf.server.entity.sys.RoleEntity;
import com.lf.server.service.sys.RoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
@@ -18,13 +19,14 @@
 * @author SWS
 * @date 2022-09.28
 */
@Api(tags = "角色表")
@Api(tags = "运维管理\\角色管理")
@RestController
@RequestMapping("/role")
public class RoleController extends BaseController {
    @Autowired
    RoleService roleService;
    @SysLog()
    @ApiOperation(value = "查询记录数")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "name", value = "名称", dataType = "String", paramType = "query", required = false, example = "sys_role")
@@ -40,6 +42,7 @@
        }
    }
    @SysLog()
    @ApiOperation(value = "分页查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "name", value = "名称", dataType = "String", paramType = "query", example = "sys_role"),
@@ -48,18 +51,19 @@
            @ApiImplicitParam(name = "pageIndex", value = "分页数(从1开始)", dataType = "Integer", paramType = "query", example = "1")
    })
    @GetMapping(value = "/selectByPage")
    public ResponseMsg<List<RoleEntity>> selectByPage(String name,String depName, Integer pageSize, Integer pageIndex) {
    public ResponseMsg<List<RoleEntity>> selectByPage(String name, String depName, Integer pageSize, Integer pageIndex) {
        try {
            if (pageSize < 1 || pageIndex < 1) {
                return fail("每页页数或分页数小于1", null);
            }
            List<RoleEntity> rs = roleService.selectByPage(name,depName, pageSize, pageSize * (pageIndex - 1));
            List<RoleEntity> rs = roleService.selectByPage(name, depName, pageSize, pageSize * (pageIndex - 1));
            return success(rs);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
        }
    }
    @SysLog()
    @ApiOperation(value = "分页查询并返回记录数")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "name", value = "名称", dataType = "String", paramType = "query", example = "1"),
@@ -68,7 +72,7 @@
            @ApiImplicitParam(name = "pageIndex", value = "分页数(从1开始)", dataType = "Integer", paramType = "query", example = "1")
    })
    @GetMapping(value = "/selectByPageAndCount")
    public ResponseMsg<List<RoleEntity>> selectByPageAndCount(String name,String depName, Integer pageSize, Integer pageIndex) {
    public ResponseMsg<List<RoleEntity>> selectByPageAndCount(String name, String depName, Integer pageSize, Integer pageIndex) {
        try {
            if (pageSize < 1 || pageIndex < 1) {
                return fail("每页页数或分页数小于1", null);
@@ -79,7 +83,7 @@
                return success(0, null);
            }
            List<RoleEntity> rs = roleService.selectByPage(name,depName, pageSize, pageSize * (pageIndex - 1));
            List<RoleEntity> rs = roleService.selectByPage(name, depName, pageSize, pageSize * (pageIndex - 1));
            return success(count, rs);
        } catch (Exception ex) {
@@ -87,9 +91,10 @@
        }
    }
    @SysLog()
    @ApiOperation(value = "插入字典")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "roleEntity", value = "字典实体类", dataType = "com.lf.server.entity.data.RoleEntity", paramType = "body", example = "")
            @ApiImplicitParam(name = "roleEntity", value = "字典实体类", dataType = "com.lf.server.entity.sys.RoleEntity", paramType = "body", example = "")
    })
    @PostMapping(value = "/insertRole", produces = "application/json; charset=UTF-8")
    public ResponseMsg<Integer> insertRole(@RequestBody RoleEntity roleEntity) {
@@ -102,6 +107,7 @@
        }
    }
    @SysLog()
    @ApiOperation(value = "插入多条字典")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "roleEntity", value = "字典实体类集合", dataType = "List<RoleEntity>", paramType = "body", example = "")
@@ -117,6 +123,7 @@
        }
    }
    @SysLog()
    @ApiOperation(value = "删除一条字典")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "字典ID", dataType = "Integer", paramType = "query", example = "1")
@@ -132,6 +139,7 @@
        }
    }
    @SysLog()
    @ApiOperation(value = "删除多条字典")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "ids", value = "字典ID集合", dataType = "List<Integer>", paramType = "query", example = "1,2")
@@ -149,6 +157,7 @@
        }
    }
    @SysLog()
    @ApiOperation(value = "更新一条字典")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "roleEntity", value = "字典ID集合", dataType = "RoleEntity", paramType = "body", example = "")
@@ -165,6 +174,7 @@
        }
    }
    @SysLog()
    @ApiOperation(value = "根据ID查询字典")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "字典ID", dataType = "Integer", paramType = "query", example = "1")
@@ -180,6 +190,7 @@
        }
    }
    @SysLog()
    @ApiOperation(value = "查询所有字典")
    @GetMapping(value = "/selectRoleAll")
    public ResponseMsg<List<RoleEntity>> selectRoleAll() {
@@ -191,5 +202,4 @@
            return fail(ex.getMessage(), null);
        }
    }
}