管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2023-03-24 e26af85e049516e6ce2b082bc2bc90bf71643e95
src/main/java/com/lf/server/controller/data/upload/QueryController.java
@@ -53,6 +53,40 @@
    @Autowired
    protected BaseQueryService baseQueryService;
    @Autowired
    DictService dictService;
    @SysLog()
    @ApiOperation(value = "根据父ID分页查询并返回记录数")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "metaid", value = "父ID", dataType = "String", paramType = "query", example = "0"),
            @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 = "/selectPageAndCountByPid")
    public ResponseMsg<List<MetaEntity>> selectPageAndCountByPid(Integer metaid, String name, Integer pageSize, Integer pageIndex) {
        try {
            if (pageSize < 1 || pageIndex < 1) {
                return fail("每页页数或分页数小于1", null);
            }
            if (null == metaid || metaid < 1) {
                return fail("父ID不能为空且大于1", null);
            }
            int count = metaService.selectCountByPid(metaid, name);
            if (count == 0) {
                return success(0, null);
            }
            List<MetaEntity> rs = metaService.selectPageByPid(metaid, name, pageSize, pageSize * (pageIndex - 1));
            return success(count, rs);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
    @SysLog()
    @ApiOperation(value = "查询所有单位")
    @GetMapping(value = "/selectDepAll")
@@ -62,7 +96,7 @@
            return success(list);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
            return fail(ex, null);
        }
    }
@@ -75,7 +109,7 @@
            return success(list);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
            return fail(ex, null);
        }
    }
@@ -98,7 +132,7 @@
            return success(list);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
            return fail(ex, null);
        }
    }
@@ -114,7 +148,7 @@
            return success(list);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
            return fail(ex, null);
        }
    }
@@ -127,20 +161,24 @@
            return success(list);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
            return fail(ex, null);
        }
    }
    @SysLog()
    @ApiOperation(value = "查询所有表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "name", value = "名称", dataType = "String", paramType = "query", example = "点"),
            @ApiImplicitParam(name = "hasGeom", value = "含有Geom字段", dataType = "Boolean", paramType = "query", example = "false")
    })
    @GetMapping(value = "/selectTabs")
    public ResponseMsg<List<TabEntity>> selectTabs() {
    public ResponseMsg<List<TabEntity>> selectTabs(String name, Boolean hasGeom) {
        try {
            List<TabEntity> list = baseQueryService.selectTabs();
            List<TabEntity> list = dictService.selectDictTab(name, null == hasGeom || !hasGeom ? "gid" : "geom");
            return success(list);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
            return fail(ex, null);
        }
    }
@@ -161,7 +199,7 @@
            return success(list);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
            return fail(ex, null);
        }
    }
@@ -181,11 +219,11 @@
            }
            MetaEntity meta = metaService.selectById(id);
            if (null == meta || null == meta.getBstab() || !meta.getBstab().contains(StaticData.POINT)) {
            if (null == meta || null == meta.getTab() || !meta.getTab().contains(StaticData.POINT)) {
                return fail("找不到元数据信息", null);
            }
            String entity = meta.getBstab().substring(meta.getBstab().indexOf(".") + 1).replace("_", "").toLowerCase();
            String entity = meta.getTab().substring(meta.getTab().indexOf(".") + 1).replace("_", "").toLowerCase();
            BasicMapper baseMapper = ClassHelper.getBasicMapper(entity);
            if (null == baseMapper) {
                return null;
@@ -195,12 +233,12 @@
            wrapper.eq("parentid", meta.getEventid());
            Page<Object> page = new Page<>(pageIndex, pageSize);
            page.addOrder(OrderItem.asc("gid"));
            page.addOrder(OrderItem.desc("gid"));
            IPage<Object> paged = baseMapper.selectPage(page, wrapper);
            return success(paged.getTotal(), paged.getRecords());
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
            return fail(ex, null);
        }
    }
@@ -220,16 +258,32 @@
            UserEntity ue = tokenService.getCurrentUser(req);
            int count = metaService.selectCountForUpload(name, ue.getId(), StaticData.FILE_TYPES);
            int count = metaService.selectCountForUpload(name, ue.getId(), null);
            if (count == 0) {
                return success(0, null);
            }
            List<MetaEntity> list = metaService.selectByPageForUpload(name, ue.getId(), StaticData.FILE_TYPES, pageSize, pageSize * (pageIndex - 1));
            List<MetaEntity> list = metaService.selectByPageForUpload(name, ue.getId(), null, pageSize, pageSize * (pageIndex - 1));
            return success(count, list);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
            return fail(ex, null);
        }
    }
    @SysLog()
    @ApiOperation(value = "根据元数据ID查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1")
    })
    @GetMapping(value = "/selectMetaById")
    public ResponseMsg<MetaEntity> selectMetaById(int id) {
        try {
            MetaEntity entity = metaService.selectById(id);
            return success(entity);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
}