| | |
| | | select * from lf.sys_meta where 1=1 and type in ('mpt', '3dml') |
| | | select * from bs.u_sectionline; |
| | | |
| | | select * from lf.sys_meta_pub; |
| | | select * from lf.sys_publish; |
| | | |
| | | delete from lf.sys_meta_pub; |
| | | insert into lf.sys_meta_pub (metaid, pubid) values (1, 1); |
| | | select * from lf.sys_meta_pub; -- delete from lf.sys_meta_pub where id = 3; |
| | | select ST_AsText(geom),a.* from lf.sys_publish a; -- delete from lf.sys_publish where id = 1; |
| | | insert into lf.sys_meta_pub (metaid, pubid) select 1, 1 from (select 1) temp where not exists (select 1 from lf.sys_meta_pub where metaid = 1 and pubid = 1); |
| | | select count(gid) from bd.b_rg20w_anna where 1=1; |
| | | |
| | | insert into lf.sys_publish(name, url, path, type, status, dirid, depid, min, max, json, create_user, geom, bak) values (@name, @url, @path, @type, @status, @dirid, @depid, @min, @max, @json, @create_user, @geom, @bak); |
| | | select * from lf.sys_dict where field='gid' --482 |
| | | |
| | | select ns, tab, tab_desc, fn_get_entity(tab) entity, tableType, bak |
| | | from lf.sys_dict a WHERE field = 'gid' and status = 0 order by id limit 500 offset 1 |
| | | |
| | | select count(gid) from bd.b_rg20w_anna where 1=1 |
| | | select count(1) from bd.b_rg20w_anna where 1=1 |
| | | select * from bd.b_rg20w_anna where 1=1 limit 10; |
| | | |
| | | select fn_tab_count('bd', 'b_rg20w_anna', '1=1') "rows" |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | declare |
| | | cc integer; |
| | | begin |
| | | raise notice 'select count(*) from %s.%s where %s', ns, tab, filters; |
| | | --raise notice 'select count(*) from %s.%s where %', ns, tab, filters; |
| | | execute format('select count(*) from %s.%s where %s', ns, tab, filters) into cc; |
| | | |
| | | return cc; |
| | | end; |
| | | $$ language plpgsql; |
| | | |
| | | select fn_tab_count('bd', 'dlg_agnp', '1 = 1'); |
| | | select fn_tab_count('bd', 'dlg_agnp', '1=1'); |
| | | select fn_tab_count('bd', 'b_rg20w_anna', '1=1'); |
| | | ----------------------------------------------------------------------------------------------------- 09.10进制转62进制 |
| | | -- drop function fn_10_to_62(numeric); |
| | | create or replace function fn_10_to_62(num numeric(30, 0)) |
| | |
| | | import com.lf.server.annotation.SysLog; |
| | | import com.lf.server.controller.all.BaseController; |
| | | import com.lf.server.entity.all.ResponseMsg; |
| | | import com.lf.server.entity.data.MetaEntity; |
| | | import com.lf.server.entity.data.PublishEntity; |
| | | import com.lf.server.entity.sys.UserEntity; |
| | | import com.lf.server.helper.StringHelper; |
| | | import com.lf.server.service.data.PublishService; |
| | | import com.lf.server.service.sys.TokenService; |
| | | import io.swagger.annotations.Api; |
| | |
| | | * 数据发布 |
| | | * @author WWW |
| | | */ |
| | | @Api(tags = "运维管理\\数据发布") |
| | | @Api(tags = "数据管理\\发布管理") |
| | | @RestController |
| | | @RequestMapping("/publish") |
| | | public class PublishController extends BaseController { |
| | |
| | | TokenService tokenService; |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询记录数") |
| | | @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 = publishService.selectCount(name); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "分页查询") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "depcode", value = "单位编码", dataType = "String", paramType = "query", example = "00"), |
| | | @ApiImplicitParam(name = "dircode", value = "目录编码", dataType = "String", paramType = "query", example = "00"), |
| | | @ApiImplicitParam(name = "verid", value = "版本ID", dataType = "Integer", paramType = "query", example = "0"), |
| | | @ApiImplicitParam(name = "type", value = "类别", dataType = "String", paramType = "query", example = "DOM"), |
| | | @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<PublishEntity>> selectByPage(String name, Integer pageSize, Integer pageIndex) { |
| | | @GetMapping(value = "/selectMetasByPage") |
| | | public ResponseMsg<Object> selectMetasByPage(String depcode, String dircode, Integer verid, String type, String name, Integer pageSize, Integer pageIndex) { |
| | | try { |
| | | if (pageSize < 1 || pageIndex < 1) { |
| | | return fail("每页页数或分页数小于1", null); |
| | | } |
| | | if (StringHelper.isEmpty(type)) { |
| | | return fail("请输入数据类别"); |
| | | } |
| | | |
| | | List<PublishEntity> rs = publishService.selectByPage(name, pageSize, pageSize * (pageIndex - 1)); |
| | | String types = getType(type); |
| | | int count = publishService.selectMetasByCount(depcode, dircode, verid, types, name); |
| | | if (count == 0) { |
| | | return success(0, null); |
| | | } |
| | | |
| | | return success(rs); |
| | | List<MetaEntity> rs = publishService.selectMetasByPage(depcode, dircode, verid, types, name, pageSize, pageSize * (pageIndex - 1)); |
| | | |
| | | return success(count, rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取类型 |
| | | */ |
| | | private String getType(String type) throws Exception { |
| | | switch (type) { |
| | | case "DOM": |
| | | return "and type in ('tif', 'tiff', 'img')"; |
| | | case "MPT": |
| | | return "and type = 'mpt'"; |
| | | case "3DML": |
| | | return "and type = '3dml'"; |
| | | case "BIM": |
| | | return "and type in ('ifc', 'fbx', 'rvt')"; |
| | | default: |
| | | throw new Exception("数据类型不匹配"); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "分页查询并返回记录数") |
| | | @ApiImplicitParams({ |
| | |
| | | package com.lf.server.mapper.data; |
| | | |
| | | import com.lf.server.entity.data.MetaEntity; |
| | | import com.lf.server.entity.data.PublishEntity; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | |
| | | * @return |
| | | */ |
| | | public Integer updates(List<PublishEntity> list); |
| | | |
| | | /** |
| | | * 查询元数据记录数 |
| | | * |
| | | * @param depcode 单位编码 |
| | | * @param dircode 目录编码 |
| | | * @param verid 版本ID |
| | | * @param type 类别 |
| | | * @param name 名称 |
| | | * @return 记录数 |
| | | */ |
| | | public Integer selectMetasByCount(String depcode, String dircode, Integer verid, String type, String name); |
| | | |
| | | /** |
| | | * 分页查询 |
| | | * |
| | | * @param depcode 单位编码 |
| | | * @param dircode 目录编码 |
| | | * @param verid 版本ID |
| | | * @param type 类别 |
| | | * @param name 名称 |
| | | * @param limit 记录数 |
| | | * @param offset 偏移量 |
| | | * @return 列表 |
| | | */ |
| | | public List<MetaEntity> selectMetasByPage(String depcode, String dircode, Integer verid, String type, String name, Integer limit, Integer offset); |
| | | } |
| | |
| | | package com.lf.server.service.data; |
| | | |
| | | import com.lf.server.entity.data.MetaEntity; |
| | | import com.lf.server.entity.data.PublishEntity; |
| | | import com.lf.server.helper.StringHelper; |
| | | import com.lf.server.mapper.data.PublishMapper; |
| | |
| | | public Integer updates(List<PublishEntity> list) { |
| | | return publishMapper.updates(list); |
| | | } |
| | | |
| | | @Override |
| | | public Integer selectMetasByCount(String depcode, String dircode, Integer verid, String type, String name) { |
| | | depcode = StringHelper.getRightLike(depcode); |
| | | dircode = StringHelper.getRightLike(dircode); |
| | | name = StringHelper.getLikeStr(name); |
| | | |
| | | return publishMapper.selectMetasByCount(depcode, dircode, verid, type, name); |
| | | } |
| | | |
| | | @Override |
| | | public List<MetaEntity> selectMetasByPage(String depcode, String dircode, Integer verid, String type, String name, Integer limit, Integer offset) { |
| | | depcode = StringHelper.getRightLike(depcode); |
| | | dircode = StringHelper.getRightLike(dircode); |
| | | name = StringHelper.getLikeStr(name); |
| | | |
| | | return publishMapper.selectMetasByPage(depcode, dircode, verid, type, name, limit, offset); |
| | | } |
| | | } |