管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2023-02-27 9513fe9cc622eca5659cf055da1a1f315f80b555
src/main/java/com/lf/server/controller/data/upload/QueryController.java
@@ -54,6 +54,37 @@
    protected BaseQueryService baseQueryService;
    @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.getMessage(), null);
        }
    }
    @SysLog()
    @ApiOperation(value = "查询所有单位")
    @GetMapping(value = "/selectDepAll")
    public ResponseMsg<List<DepEntity>> selectDepAll() {
@@ -119,6 +150,19 @@
    }
    @SysLog()
    @ApiOperation(value = "查询项目名称")
    @GetMapping(value = "/selectProject")
    public ResponseMsg<Object> selectProject() {
        try {
            List<DirEntity> list = uploadService.selectProject();
            return success(list);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
        }
    }
    @SysLog()
    @ApiOperation(value = "查询所有表")
    @GetMapping(value = "/selectTabs")
    public ResponseMsg<List<TabEntity>> selectTabs() {
@@ -155,7 +199,7 @@
    @SysLog()
    @ApiOperation(value = "查询表中数据")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "元数据ID", dataType = "Integer", paramType = "query", example = "115"),
            @ApiImplicitParam(name = "id", value = "源数据ID", dataType = "Integer", paramType = "query", example = "115"),
            @ApiImplicitParam(name = "pageIndex", value = "分页数(从1开始)", dataType = "Integer", paramType = "query", example = "1"),
            @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "Integer", paramType = "query", example = "10")
    })
@@ -164,15 +208,15 @@
        // noinspection AlibabaRemoveCommentedCode
        try {
            if (null == id || id < 0) {
                return fail("元数据ID不能为空或小于0", null);
                return fail("源数据ID不能为空或小于0", null);
            }
            MetaEntity meta = metaService.selectById(id);
            if (null == meta || null == meta.getBstab() || !meta.getBstab().contains(StaticData.POINT)) {
                return fail("找不到元数据信息", null);
            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;
@@ -207,16 +251,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);
        }
    }
    @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.getMessage(), null);
        }
    }
}