月球大数据地理空间分析展示平台-【后端】-月球后台服务
13693261870
2023-08-25 1fd236eff8e31047d30ccfbd94bd329d861f8d4d
src/main/java/com/moon/server/controller/sys/ResController.java
@@ -44,44 +44,6 @@
    private final static String TAB_NAME = "lf.sys_res";
    @SysLog()
    @ApiOperation(value = "查询记录数")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "name", value = "名称", dataType = "String", paramType = "query", required = false, example = "")
    })
    @GetMapping({"/selectCount"})
    public ResponseMsg<Integer> selectCount(String name) {
        try {
            int count = resService.selectCount(name);
            return success(count);
        } catch (Exception ex) {
            return fail(ex, -1);
        }
    }
    @SysLog()
    @ApiOperation(value = "分页查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "name", value = "名称", dataType = "String", 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<ResEntity>> selectByPage(String name, Integer pageSize, Integer pageIndex) {
        try {
            if (pageSize < 1 || pageIndex < 1) {
                return fail("每页页数或分页数小于1", null);
            }
            List<ResEntity> rs = resService.selectByPage(name, pageSize, pageSize * (pageIndex - 1));
            return success(rs);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
    @SysLog()
    @ApiOperation(value = "分页查询并返回记录数")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "name", value = "名称", dataType = "String", paramType = "query", example = ""),
@@ -136,6 +98,19 @@
    }
    @SysLog()
    @ApiOperation(value = "查询所有")
    @GetMapping(value = "/selectAll")
    public ResponseMsg<List<ResEntity>> selectAll() {
        try {
            List<ResEntity> list = resService.selectAll();
            return success(list);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
    @SysLog()
    @ApiOperation(value = "根据ID查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1")
@@ -162,11 +137,12 @@
            UserEntity ue = tokenService.getCurrentUser(req);
            if (ue != null) {
                entity.setCreateUser(ue.getId());
                entity.setDepid(ue.getDepcode());
            }
            int count = resService.insert(entity);
            if (count > 0) {
                permsService.clearResCache();
                permsService.clearPermsCache();
            }
            return success(count);
@@ -187,12 +163,13 @@
            if (ue != null) {
                for (ResEntity entity : list) {
                    entity.setCreateUser(ue.getId());
                    entity.setDepid(ue.getDepcode());
                }
            }
            int count = resService.inserts(list);
            if (count > 0) {
                permsService.clearResCache();
                permsService.clearPermsCache();
            }
            return success(count);
@@ -211,7 +188,7 @@
        try {
            int count = resService.delete(id);
            if (count > 0) {
                permsService.clearResCache();
                permsService.clearPermsCache();
            }
            return success(count);
@@ -234,7 +211,7 @@
            int count = resService.deletes(ids);
            if (count > 0) {
                permsService.clearResCache();
                permsService.clearPermsCache();
            }
            return success(count);
@@ -255,11 +232,12 @@
            UserEntity ue = tokenService.getCurrentUser(req);
            if (ue != null) {
                entity.setUpdateUser(ue.getId());
                entity.setDepid(ue.getDepcode());
            }
            int count = resService.update(entity);
            if (count > 0) {
                permsService.clearResCache();
                permsService.clearPermsCache();
            }
            return success(count);
@@ -281,12 +259,13 @@
            if (ue != null) {
                for (ResEntity entity : list) {
                    entity.setUpdateUser(ue.getId());
                    entity.setDepid(ue.getDepcode());
                }
            }
            int count = resService.updates(list);
            if (count > 0) {
                permsService.clearResCache();
                permsService.clearPermsCache();
            }
            return success(count);