月球大数据地理空间分析展示平台-【后端】-月球后台服务
13693261870
2023-08-08 7bde03cf77380ba505fb8d6d15d68db4a978b3f7
角色资源接口删除3个无用的接口,解决根据角色查询报错
已修改2个文件
53 ■■■■■ 文件已修改
src/main/java/com/moon/server/controller/sys/RoleResController.java 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/sys/RoleResMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/controller/sys/RoleResController.java
@@ -52,44 +52,6 @@
    }
    @SysLog()
    @ApiOperation(value = "查询记录数")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "roleid", value = "角色ID", dataType = "Integer", paramType = "query", required = false, example = "")
    })
    @GetMapping({"/selectCount"})
    public ResponseMsg<Integer> selectCount(Integer roleid) {
        try {
            int count = roleResService.selectCount(roleid);
            return success(count);
        } catch (Exception ex) {
            return fail(ex, -1);
        }
    }
    @SysLog()
    @ApiOperation(value = "分页查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "roleid", value = "角色ID", dataType = "Integer", paramType = "query", example = ""),
            @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "Integer", paramType = "query", example = "10"),
            @ApiImplicitParam(name = "pageIndex", value = "分页数(从1开始)", dataType = "Integer", paramType = "query", example = "1")
    })
    @GetMapping(value = "/selectByPage")
    public ResponseMsg<List<RoleResEntity>> selectByPage(Integer roleid, Integer pageSize, Integer pageIndex) {
        try {
            if (pageSize < 1 || pageIndex < 1) {
                return fail("每页页数或分页数小于1", null);
            }
            List<RoleResEntity> rs = roleResService.selectByPage(roleid, pageSize, pageSize * (pageIndex - 1));
            return success(rs);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
    @SysLog()
    @ApiOperation(value = "分页查询并返回记录数")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "roleid", value = "角色ID", dataType = "Integer", paramType = "query", example = ""),
@@ -109,19 +71,6 @@
            List<RoleResEntity> rs = roleResService.selectByPage(roleid, pageSize, pageSize * (pageIndex - 1));
            return success(count, rs);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
    @SysLog()
    @ApiOperation(value = "查询所有")
    @GetMapping(value = "/selectAll")
    public ResponseMsg<List<RoleResEntity>> selectAll() {
        try {
            List<RoleResEntity> list = roleResService.selectAll();
            return success(list);
        } catch (Exception ex) {
            return fail(ex, null);
        }
src/main/resources/mapper/sys/RoleResMapper.xml
@@ -3,7 +3,7 @@
<mapper namespace="com.moon.server.mapper.sys.RoleResMapper">
    <select id="selectResByRole" resultType="com.moon.server.entity.sys.RoleResEntity">
        with rs as (select id, resid from lf.sys_role_res where roleid = #{roleid})
        select (select id from rs b where b.resid = a.id) "id", a.id "resid", a.cn_name, a.en_name, a.type, a.pid, a.level, a.sort, a.tab
        select (select id from rs b where b.resid = a.id) "id", a.id "resid", a.cn_name, a.en_name, a.type, a.tab
        from lf.sys_res a;
    </select>