| | |
| | | select * from lf.sys_token where to_char(create_time,'yyyy-MM-dd') = '2022-09-30'; |
| | | select fn_rec_query(depid,'dep') depName,fn_rec_query(dirid,'dir') dirName,fn_ver(verid) verName,fn_uname(createuser) createName,fn_uname(updateuser) updateName from bd.dlg_agnp limit 10; |
| | | |
| | | select ns,tab,tab_desc,field,type from lf.sys_dict; |
| | | select type from lf.sys_dict group by type; |
| | | select * from lf.sys_dict where ns='bd' and tab='dlg_agnp'; |
| | | select count(distinct tab) from lf.sys_dict where tab like '%b_b%'; |
| | | |
| | | select * from bd.b_borehole where endholtime <= '1978-06-29' limit 10; |
| | | |
| | | select c.relname tab, cast(obj_description(c.oid) as varchar) desc, a.attnum num, a.attname col, t.typname type, d.description bak |
| | | from pg_attribute a left join pg_description d on d.objoid = a.attrelid and d.objsubid = a.attnum left join |
| | | pg_class c on a.attrelid = c.oid left join pg_type t on a.atttypid = t.oid where a.attnum >= 0 and reltype>0 and |
| | | relnamespace in (29258) order by c.relname; |
| | | |
| | | select t.typname type |
| | | from pg_attribute a left join pg_description d on d.objoid = a.attrelid and d.objsubid = a.attnum left join |
| | | pg_class c on a.attrelid = c.oid left join pg_type t on a.atttypid = t.oid where a.attnum >= 0 and reltype>0 and |
| | | relnamespace in (29258) group by type; |
| | | |
| | | select count(*) from lf.sys_downlog a inner join lf.sys_user b on a.create_user = b.id inner join lf.sys_download c on a.downid = c.id |
| | | WHERE 1 = 1 and b.uname like '%管çå%' and c.type = 3 and a.create_time >= ? and a.create_time <= ? |
| | | select * from lf.sys_download where id in (80,100); |
| | | select * from lf.sys_downlog; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | comment on column lf.sys_role.depid is 'åä½ID'; |
| | | comment on column lf.sys_role.name is 'åç§°'; |
| | | comment on column lf.sys_role.descr is 'æè¿°'; |
| | | comment on column lf.sys_role.is_admin is 'æ¯å¦ä¸ºç®¡çåï¼0-å¦,1-æ¯'; |
| | | comment on column lf.sys_role.is_admin is 'æ¯/å¦ä¸ºç®¡çåï¼0-æ®éä¼åï¼1-è¶
级管çåï¼2-æ°æ®ç®¡çå'; |
| | | comment on column lf.sys_role.create_user is 'å建人ID'; |
| | | comment on column lf.sys_role.create_time is 'å建æ¶é´'; |
| | | comment on column lf.sys_role.update_user is 'æ´æ°äººID'; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | ----------------------------------------------------------------------- |
| | | select count(*) from bd.dlg_25w_resa; -- 157217 |
| | | select count(*) from bd.dlg_25w_boul; -- 7453 |
| | | select count(*) from bd.dlg_agnp; -- 3248 |
| | | |
| | | select count(*) from bd.dlg_25w_hyda; -- 297884 |
| | | select count(*) from bd.dlg_25w_hydl; -- 2212590 |
| | | select count(*) from bd.dlg_25w_lrdl; -- 4690386 |
| | | select count(*) from bd.dlg_25w_lrrl; -- 51338 |
| | | select count(*) from bs.m_pipeline; -- 26 |
| | | |
| | | select * from bd.dlg_25w_resa order by gid limit 10; |
| | | select * from bd.dlg_25w_boul order by gid limit 10; |
| | | select * from bd.dlg_agnp order by gid limit 10; |
| | | ----------------------------------------------------------------------- è®¾ç½®æ°æ®åä½ |
| | | select * from lf.sys_dep; |
| | | |
| | | -- pid = 15, ç产ä¸å¡é¨é¨ |
| | | update bd.dlg_25w_resa set depid = 20 where gid % 7 = 0; -- 线路室 |
| | | update bd.dlg_25w_resa set depid = 21 where gid % 7 = 1; -- ç©¿è·¨è¶å®¤ |
| | | --update bd.dlg_25w_resa set depid = 22 where gid % 7 = 2; -- å建室 |
| | | |
| | | -- pid = 38, åå¯äºä¸é¨ |
| | | update bd.dlg_25w_resa set depid = 55 where gid % 7 = 3; -- åå¯å®¤ |
| | | --update bd.dlg_25w_resa set depid = 56 where gid % 7 = 4; -- 岩å设计室 |
| | | --update bd.dlg_25w_resa set depid = 54 where gid % 7 = 5; -- æµç»å®¤ |
| | | |
| | | update bd.dlg_25w_boul set depid = 20 where gid % 7 = 0; -- 线路室 |
| | | update bd.dlg_25w_boul set depid = 21 where gid % 7 = 1; -- ç©¿è·¨è¶å®¤ |
| | | update bd.dlg_25w_boul set depid = 55 where gid % 7 = 3; -- åå¯å®¤ |
| | | |
| | | update bd.dlg_agnp set depid = 20 where gid % 7 = 0; -- 线路室 |
| | | update bd.dlg_agnp set depid = 21 where gid % 7 = 1; -- ç©¿è·¨è¶å®¤ |
| | | update bd.dlg_agnp set depid = 55 where gid % 7 = 3; -- åå¯å®¤ |
| | | |
| | | update bd.dlg_25w_resa set depid = 22 where depid is null or depid = 0; -- å建室 |
| | | update bd.dlg_25w_boul set depid = 22 where depid is null or depid = 0; -- å建室 |
| | | update bd.dlg_agnp set depid = 22 where depid is null or depid = 0; -- å建室 |
| | | |
| | | update bd.dlg_agnp set depid = null where gid = 3247; |
| | | update bd.dlg_agnp set depid = 0 where gid = 3246; |
| | | |
| | | select depid from bd.dlg_25w_resa group by depid order by depid; |
| | | select depid from bd.dlg_25w_boul group by depid order by depid; |
| | | select depid from bd.dlg_agnp group by depid order by depid; |
| | | ----------------------------------------------------------------------- è®¾ç½®ç¨æ· |
| | | select * from lf.sys_user order by id; |
| | | update lf.sys_user set depid = 20 where uname = '线路室'; -- id = 2 |
| | | update lf.sys_user set depid = 21 where uname = 'ç©¿è·¨è¶å®¤'; -- id = 3 |
| | | update lf.sys_user set depid = 55 where uname = 'åå¯å®¤'; -- id = 5 |
| | | ----------------------------------------------------------------------- 设置è§è² |
| | | select * from lf.sys_role order by id; |
| | | |
| | | delete from lf.sys_role where id between 2 and 11; |
| | | insert into lf.sys_role (depid,name,descr,is_admin,create_user) values (20,'线路室-æ°æ®ç®¡çå', 'æ°æ®ç®¡çå',2,1); |
| | | insert into lf.sys_role (depid,name,descr,is_admin,create_user) values (21,'ç©¿è·¨è¶å®¤-æ°æ®ç®¡çå','æ°æ®ç®¡çå',2,1); |
| | | insert into lf.sys_role (depid,name,descr,is_admin,create_user) values (55,'åå¯å®¤-æ°æ®ç®¡çå', 'æ°æ®ç®¡çå',2,1); |
| | | ----------------------------------------------------------------------- |
| | | select depid from bd.dlg_25w_boul where depid != ANY(fn_rec_array(15, 'dep')) group by depid order by depid; |
| | | select * from lf.sys_dep; |
| | | select fn_rec_array(38, 'dep'); |
| | | select depid from bd.dlg_25w_boul where depid > 0 and depid != ALL(fn_rec_array(38, 'dep')) |
| | | where ST_Intersects(geom, ST_PolygonFromText('POLYGON ((115.94927385452 32.3754479115071 0,121.989371092554 32.2766788010181 0,121.850621222894 29.6874200067864 0,115.9727267226 29.7835368627922 0,115.94927385452 32.3754479115071 0))', 0)) |
| | | group by depid; |
| | | |
| | | select count(*) from bd.dlg_25w_resa -- 103,6964,180 |
| | | where ST_Intersects(geom, ST_PolygonFromText('POLYGON ((115.94927385452 32.3754479115071 0,121.989371092554 32.2766788010181 0,121.850621222894 29.6874200067864 0,115.9727267226 29.7835368627922 0,115.94927385452 32.3754479115071 0))', 4490)) |
| | | group by depid; |
| | | |
| | | select max(gid) from bd.dlg_agnp --3248 |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ¥è¯¢DB䏿º¢åºçåä½ID") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "reqEntity", value = "请æ±ä¸è½½å®ä½", dataType = "DownloadReqEntity", paramType = "body") |
| | | }) |
| | | @ResponseBody |
| | | @PostMapping(value = "/selectDbOverflowDep") |
| | | public ResponseMsg<Object> selectDbOverflowDep(@RequestBody DownloadReqEntity reqEntity, HttpServletRequest req, HttpServletResponse res) { |
| | | try { |
| | | if (null == reqEntity || null == reqEntity.getEntities() || reqEntity.getEntities().isEmpty()) { |
| | | return fail("è¯·éæ©è¦ä¸è½½çå®ä½å"); |
| | | } |
| | | reqEntity.setWkt(AesHelper.decrypt(reqEntity.getWkt())); |
| | | if (StringHelper.isEmpty(reqEntity.getWkt())) { |
| | | return fail("è¯·éæ©è¦ä¸è½½çWKTèå´"); |
| | | } |
| | | |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | List<Integer> list = dataLibService.selectDbOverflowDep(ue, reqEntity.getEntities(), reqEntity.getWkt()); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "请æ±DBæ°æ®ä¸è½½") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "reqEntity", value = "请æ±ä¸è½½å®ä½", dataType = "DownloadReqEntity", paramType = "body") |
| | |
| | | import org.apache.ibatis.annotations.Select; |
| | | import org.apache.ibatis.annotations.Update; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 空é´åºç¡Mapper |
| | | * @author WWW |
| | |
| | | public String selectGeometryType(@Param("tab") String tab); |
| | | |
| | | /** |
| | | * æ¥è¯¢DB䏿º¢åºçåä½ID |
| | | * |
| | | * @param tab 表å |
| | | * @param depid åä½ID |
| | | * @param geoFilter 空é´è¿æ»¤æ¡ä»¶ |
| | | * @return 溢åºçåä½ID |
| | | */ |
| | | @Select("<script>" + |
| | | " select depid from ${tab} where depid > 0 and depid != ALL(fn_rec_array(#{depid}, 'dep'))" + |
| | | " <if test='geoFilter != null'>" + |
| | | " and ${geoFilter}" + |
| | | " </if>" + |
| | | " group by depid" + |
| | | "</script>") |
| | | public List<Integer> selectDbOverflowDep(@Param("tab") String tab, @Param("depid") Integer depid, @Param("geoFilter") String geoFilter); |
| | | |
| | | /** |
| | | * æ´æ°ç©ºé´ä½ç½® |
| | | * |
| | | * @param tab 表å |
| | |
| | | wkt = AesHelper.decrypt(wkt); |
| | | |
| | | Integer srid = getSrid((GeomBaseMapper) basicMapper); |
| | | wrapper.apply(String.format("ST_Intersects(ST_PolygonFromText('%s', %d), geom)", wkt, srid)); |
| | | if (null != srid) { |
| | | wrapper.apply(String.format("ST_Intersects(ST_PolygonFromText('%s', %d), geom)", wkt, srid)); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.io.File; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * èµæé¦ |
| | |
| | | BaseQueryService baseQueryService; |
| | | |
| | | private final static Log log = LogFactory.getLog(DataLibService.class); |
| | | |
| | | /** |
| | | * æ¥è¯¢DB䏿º¢åºçåä½ID |
| | | */ |
| | | public List<Integer> selectDbOverflowDep(UserEntity ue, List<String> entities, String wkt) { |
| | | List<Integer> rs = new ArrayList<>(); |
| | | for (String enity : entities) { |
| | | try { |
| | | GeomBaseMapper<?> baseMapper = ClassHelper.getGeoBaseMapper(enity); |
| | | if (null == baseMapper) { |
| | | continue; |
| | | } |
| | | |
| | | QueryWrapper wrapper = new QueryWrapper(); |
| | | wrapper.select("depid"); |
| | | wrapper.gt("depid", 0); |
| | | wrapper.apply(String.format("depid != ALL(fn_rec_array(%d, 'dep')", ue.getDepid())); |
| | | |
| | | Integer srid = baseQueryService.getSrid(baseMapper); |
| | | if (null != srid) { |
| | | wrapper.apply(String.format("ST_Intersects(ST_PolygonFromText('%s', %d), geom)", wkt, srid)); |
| | | } |
| | | |
| | | List<Integer> ids = baseMapper.selectList(wrapper); |
| | | |
| | | addDepIds(rs, ids); |
| | | } catch (Exception ex) { |
| | | log.error(ex.getMessage(), ex); |
| | | } |
| | | } |
| | | |
| | | return rs; |
| | | } |
| | | |
| | | /** |
| | | * æ·»å åä½ID |
| | | */ |
| | | private void addDepIds(List<Integer> rs, List<Integer> ids) { |
| | | if (null == ids || ids.isEmpty()) { |
| | | return; |
| | | } |
| | | |
| | | for (Integer id : ids) { |
| | | if (!rs.contains(id)) { |
| | | rs.add(id); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å建Zipå
|
| | |
| | | Map<String, List<?>> map = new HashMap<>(5); |
| | | for (String enity : entities) { |
| | | try { |
| | | GeomBaseMapper baseMapper = ClassHelper.getGeoBaseMapper(enity); |
| | | GeomBaseMapper<?> baseMapper = ClassHelper.getGeoBaseMapper(enity); |
| | | if (null == baseMapper) { |
| | | continue; |
| | | } |
| | |
| | | map.put(enity, list); |
| | | } |
| | | } catch (Exception ex) { |
| | | // |
| | | log.error(ex.getMessage(), ex); |
| | | } |
| | | } |
| | | |
| | |
| | | private QueryWrapper createWrapper(GeomBaseMapper baseMapper, String wkt) { |
| | | QueryWrapper wrapper = new QueryWrapper(); |
| | | wrapper.select("ST_AsText(geom) as geom, *"); |
| | | |
| | | Integer srid = baseQueryService.getSrid(baseMapper); |
| | | wrapper.apply(String.format("ST_Intersects(ST_PolygonFromText('%s', %d), geom)", wkt, srid)); |
| | | if (null != srid) { |
| | | wrapper.apply(String.format("ST_Intersects(ST_PolygonFromText('%s', %d), geom)", wkt, srid)); |
| | | } |
| | | |
| | | return wrapper; |
| | | } |