| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.lf.server.mapper.show.OneMapMapper"> |
| | | |
| | | <resultMap type="com.lf.server.entity.show.OneMapEntity" id="OneMapResult"> |
| | | <result property="value" column="value" /> |
| | | <result property="key" column="key" /> |
| | | <result property="value" column="value" /> |
| | | <result property="key" column="key" /> |
| | | </resultMap> |
| | | |
| | | |
| | | <!-- 项目类别 select * from bs.bs_project; --> |
| | | <select id="projectCategoryCount" resultType="java.util.Map"> |
| | | select projtype,count(*) from bs.bs_project group by projtype; |
| | | </select> |
| | | |
| | | |
| | | <!-- 项目位置分布 select a.*,st_astext(geom) from bs.bs_project a --> |
| | | <select id="projectLocationCount" resultType="java.util.Map"> |
| | | select a.*,st_astext(geom) AS wkt from bs.bs_project a; |
| | | </select> |
| | | |
| | | <!-- 项目类别 国家维度-数量 --> |
| | | <!-- 全球 项目类别 国家维度-数量 --> |
| | | <select id="countryDimensionCount" resultType="java.util.Map"> |
| | | select country,count(*) from bs.bs_project group by country; |
| | | </select> |
| | | |
| | | <!-- 项目类别 省维度-数量 --> |
| | | <!-- 全国 项目类别 省维度-数量 --> |
| | | <select id="provinceDimensionCount" resultType="java.util.Map"> |
| | | select province,count(*) from bs.bs_project where country like '%中国%' group by province ; |
| | | </select> |
| | | |
| | | <!-- 全国 按照项自类型统计不同项目个数 --> |
| | | <select id="countProjectTypeNumber" resultType="java.util.Map"> |
| | | select projtype,count(*) from bs.bs_project where country like '%中国%' group by projtype ; |
| | | </select> |
| | | |
| | | <!-- 数据统计 数据存储 --> |
| | |
| | | from lf.sys_dir a where id > 1 and pid = 0; |
| | | </select> |
| | | |
| | | <!-- 数据统计 文件格式维度-文件个数 select type,count(*),count(sizes) from lf.sys_meta group by type; --> |
| | | <!-- 数据大类统计 --> |
| | | <select id="statisticalDataCategories" resultType="java.util.Map"> |
| | | SELECT name, |
| | | (SELECT count(b.id) |
| | | FROM lf.sys_meta b |
| | | WHERE dircode similar to '(' || |
| | | (SELECT string_agg(code, |
| | | '|') |
| | | FROM lf.sys_dir c |
| | | WHERE c.name = a.name) || ')%') "count", |
| | | (SELECT coalesce(sum(b.sizes), |
| | | 0) |
| | | FROM lf.sys_meta b |
| | | WHERE dircode similar to '(' || |
| | | (SELECT string_agg(code, |
| | | '|') |
| | | FROM lf.sys_dir c |
| | | WHERE c.name = a.name) || ')%') "sizes" |
| | | FROM lf.sys_dir a |
| | | WHERE name IN ('基础测绘', '基础地灾', '基础勘察', '合规数据', '管理数据', '测绘(ESV)', '勘察(EGE)', '地灾(EGD)', '洞库(EGD)') |
| | | GROUP BY name |
| | | ORDER BY name; |
| | | </select> |
| | | |
| | | <!-- 统计数据服务类型 --> |
| | | <select id="statisticalDataServiceType" resultType="java.util.Map"> |
| | | SELECT COUNT(*),TYPE FROM lf.sys_serve_log GROUP BY TYPE; |
| | | </select> |
| | | |
| | | <!-- 登录次数统计 --> |
| | | <select id="loginNumberStatistics" resultType="java.util.Map"> |
| | | select b.uname, count(*) from lf.sys_login a inner join lf.sys_user b on a.userid = b.id group by uname; |
| | | </select> |
| | | |
| | | <!-- 数据统计 文件格式维度-文件个数 select type,count(*),count(sizes) from lf.sys_meta group by type; --> |
| | | <select id="fileFormatCount" resultType="java.util.Map"> |
| | | select type,count(type) AS number,sum(sizes) AS capacity from lf.sys_meta group by type; |
| | | </select> |
| | | |
| | | <!-- 数据统计 数据申请 select * from lf.sys_apply a inner join lf.sys_user b on a.userid = b.id; --> |
| | | <!-- 数据统计 数据申请 select * from lf.sys_apply a inner join lf.sys_user b on a.userid = b.id; --> |
| | | <select id="dataApplyCount" resultType="java.util.Map"> |
| | | SELECT |
| | | count(c.name) AS number, |
| | |
| | | select modular1,count(*) from lf.sys_operate group by modular1 order by modular1; |
| | | </select> |
| | | |
| | | <!-- 数据统计 下载量统计 type类型:1-Shp文件,2-专题图,3-源数据,4-业务数据,5-管道分析,6-统计报告 --> |
| | | <!-- 数据统计 下载量统计 type类型:1-Shp文件,2-专题图,3-元数据,4-业务数据,5-管道分析,6-统计报告 --> |
| | | <!-- 数据统计 select type,count(*) from lf.sys_download group by type; --> |
| | | <select id="countDownloads" resultType="java.util.Map"> |
| | | SELECT type, |
| | |
| | | case type |
| | | WHEN '1' THEN 'Shp文件' |
| | | WHEN '2' THEN '专题图' |
| | | WHEN '3' THEN '源数据' |
| | | WHEN '3' THEN '元数据' |
| | | WHEN '4' THEN '业务数据' |
| | | WHEN '5' THEN '管道分析' |
| | | WHEN '6' THEN '统计报告' |
| | |
| | | <select id="countProjectTour" resultType="java.util.Map"> |
| | | SELECT st_astext(geom) AS wkt,* FROM bs.m_pipeline |
| | | <where> |
| | | <if test="pipename != null and pipename != ''"> and pipename = #{pipename}</if> |
| | | <if test="pipename != null and pipename != ''"> |
| | | pipename = #{pipename} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | |
| | | SELECT DISTINCT pipename FROM bs.m_pipeline; |
| | | </select> |
| | | |
| | | |
| | | <!-- 统计项目类型 1 --> |
| | | <!-- select (select string_agg(code, ',') from lf.sys_dir where name = a.name) "key", name "value" from lf.sys_dir a |
| | | where name in ('测绘(ESV)', '勘察(EGE)', '地灾(EGD)', '洞库(EGD)') group by name order by name;--> |
| | | <select id="selectProjectType1" resultMap="OneMapResult"> |
| | | select (select string_agg(code, ',') from lf.sys_dir where name = a.name) "key", name "value" from lf.sys_dir a |
| | | where name in ('测量(ESV)', '勘察(EGE)', '地灾(EGD)', '洞库(EGD)') group by name order by name; |
| | | SELECT |
| | | (SELECT string_agg(code, |
| | | ',') |
| | | FROM lf.sys_dir |
| | | WHERE name = a.name) "key", name "value" |
| | | FROM lf.sys_dir a |
| | | WHERE name IN ('基础地灾', '基础勘察', '合规数据', '管理数据', '勘察(EGE)', '地灾(EGD)', '洞库(EGD)') |
| | | GROUP BY name |
| | | ORDER BY key; |
| | | </select> |
| | | |
| | | <!-- 统计项目类型 2 --> |
| | |
| | | <select id="selectProjectType2" resultType="com.lf.server.entity.show.OneMapEntity"> |
| | | select modular1,count(*) from lf.sys_operate group by modular1 order by modular1; |
| | | </select> |
| | | |
| | | |
| | | <!-- 查询表信息 --> |
| | | <select id="queryTableInfo" resultType="java.util.Map"> |
| | |
| | | AND d.objsubid=a.attnum; |
| | | </select> |
| | | |
| | | <!-- 统计计算全球管道图 --> |
| | | <select id="countGlobalPipeMap" resultType="java.util.Map"> |
| | | SELECT projname,count(*) AS count FROM bs.m_pipesegment group by projname ; |
| | | </select> |
| | | |
| | | <!-- 统计计算全国管道图 --> |
| | | <select id="countNationalPipeMap" resultType="java.util.Map"> |
| | | SELECT projname,count(*) AS count FROM bs.m_pipesegment group by projname ; |
| | | </select> |
| | | |
| | | <!-- 统计全国管网图输送介质长度 --> |
| | | <!--select id="countZhPipeMapLenByMed" resultType="java.util.Map"> |
| | | SELECT medium AS type,count(*) AS count,sum(length)AS length FROM bs.m_pipesegment GROUP BY medium ; |
| | | </select--> |
| | | <select id="countZhPipeMapLenByMed" resultType="java.util.Map"> |
| | | select case medium when 'CO' then '原油' when 'RP' then '成品油' when 'GS' then '天然气' else '其它' end "type", |
| | | count(*) "count", round(sum(ST_Length(geom)::numeric), 2) "length" |
| | | from bs.m_pipeline |
| | | group by medium; |
| | | </select> |
| | | |
| | | <!-- 统计全国站场座数、阀室、管道数量 --> |
| | | <select id="countZhPipeStations" resultType="java.util.Map"> |
| | | select |
| | | case medium when 'CO' then '原油' when 'RP' then '成品油' when 'GS' then '天然气' else '其它' end "输送介质", |
| | | round(sum(st_length(geom))::numeric, 2) "总里程", |
| | | count(*) "管道数量", |
| | | (select count(*) from bs.m_sitepoint b inner join bs.m_pipeline c on b.pipename = c.pipename where c.medium = a.medium) "站场数量", |
| | | (select count(*) from bs.m_valvehousepoint d inner join bs.m_pipeline e on d.pipename = e.pipename where e.medium = a.medium) "阀室数量" |
| | | from bs.m_pipeline a |
| | | group by medium; |
| | | </select> |
| | | |
| | | <!-- 按项目统计项目存储量 --> |
| | | <select id="countStorageByProject" resultType="java.util.Map"> |
| | | with rs as ( |
| | | select a.dircode, c.dcount, c.sizes |
| | | from lf.sys_meta a |
| | | inner join lf.sys_meta_down b on a.id = b.metaid |
| | | inner join lf.sys_download c on b.downid = c.id |
| | | ) |
| | | select |
| | | d.name "项目名称", |
| | | (select count(*) from rs where rs.dircode like d.code || '%') "下载个数", |
| | | (select coalesce(sum(rs.dcount), 0) from rs where rs.dircode like d.code || '%') "下载数量", |
| | | (select round(coalesce(sum(rs.dcount * rs.sizes), 0)::numeric, 3) from rs where rs.dircode like d.code || '%') "数量总量(MB)" |
| | | from lf.sys_dir d |
| | | where pid = 0 order by d.code; |
| | | </select> |
| | | |
| | | <!-- 查询项目信息 select PROJNAME,* from bs.bs_project WHERE PROJNAME LIKE '${projectName}%' AND PROJNAME IS NOT NULL ; --> |
| | | <select id="selectProjectInfo" resultType="java.util.Map"> |
| | | select PROJNAME,* from bs.bs_project WHERE dirid LIKE '${projectCode}%' AND PROJNAME IS NOT NULL ; |
| | | </select> |
| | | |
| | | <select id="selectProjectInfo1" resultType="java.util.Map"> |
| | | select PROJNAME,* from bs.bs_project |
| | | <where> |
| | | <if test="projname != null and projname != ''"> and projname like concat('%', #{projectName}, '%')</if> |
| | | </where> |
| | | AND PROJNAME IS NOT NULL ; |
| | | </select> |
| | | |
| | | <!-- 查询项目文件列表 --> |
| | | <select id="selectProjectFileList" resultType="java.util.Map"> |
| | | select name, code,st_astext(b.geom) AS wkt |
| | | from lf.sys_dir a inner join bs.bs_project b on a.code = b.dirid |
| | | where pid = 0 and id > 1 order by code; |
| | | </select> |
| | | |
| | | <select id="countProjectStorage" resultType="java.util.Map"> |
| | | select name, |
| | | (select count(b.id) from lf.sys_meta b where dircode similar to '(' || (select string_agg(code, '|') from lf.sys_dir c where c.name = a.name) || ')%') "count", |
| | | (select coalesce(sum(b.sizes), 0) from lf.sys_meta b where dircode similar to '(' || (select string_agg(code, '|') from lf.sys_dir c where c.name = a.name) || ')%') "sizes" |
| | | from lf.sys_dir a |
| | | where code like '${projectCode}%' and name in ('基础测绘', '基础地灾', '基础勘察', '合规数据', '管理数据', '测绘(ESV)', '勘察(EGE)', '地灾(EGD)', '洞库(EGD)') |
| | | group by name |
| | | order by name; |
| | | </select> |
| | | |
| | | <!-- 单个项目文件数量--> |
| | | <select id="countProjectType" resultType="java.util.Map"> |
| | | SELECT a.type, |
| | | count(a.type) AS number, |
| | | coalesce( cast(sum(a.sizes) as decimal(12, 2) ), 0) AS capacity |
| | | FROM lf.sys_meta a |
| | | INNER JOIN lf.sys_dir b ON a.dircode = b.code |
| | | WHERE a.dircode LIKE '${projectCode}%' |
| | | GROUP BY a.type; |
| | | </select> |
| | | |
| | | <!-- 单个项目的下载个数、下载次数和数据量--> |
| | | <!-- select count(*) "number", sum(c.dcount) "count", sum(c.sizes) "size" |
| | | from lf.sys_meta a inner join lf.sys_meta_down b on a.id = b.metaid |
| | | inner join lf.sys_download c on b.downid = c.id |
| | | where dircode like '${projectCode}%'; --> |
| | | <select id="countProjectDown" resultType="java.util.Map"> |
| | | select |
| | | d.name "项目名称", |
| | | (select count(*) "number" |
| | | from lf.sys_meta a inner join lf.sys_meta_down b on a.id = b.metaid |
| | | inner join lf.sys_download c on b.downid = c.id |
| | | where dircode like '${projectCode}%') "下载个数", |
| | | (select sum(c.dcount) "count" |
| | | from lf.sys_meta a inner join lf.sys_meta_down b on a.id = b.metaid |
| | | inner join lf.sys_download c on b.downid = c.id |
| | | where dircode like '${projectCode}%') "下载数量", |
| | | (select sum(c.sizes) "size" |
| | | from lf.sys_meta a inner join lf.sys_meta_down b on a.id = b.metaid |
| | | inner join lf.sys_download c on b.downid = c.id |
| | | where dircode like '${projectCode}%') "数量总量(MB)" |
| | | from lf.sys_dir d |
| | | where pid = 0 AND d.code like '${projectCode}%' |
| | | </select> |
| | | |
| | | <!-- 按大类统计 --> |
| | | <select id="countByMajor" resultType="com.lf.server.entity.ctrl.CountEntity"> |
| | | select '测绘(ESV)' "m1", '数字线划图' "m2", '平方千米' "m3", coalesce(sum(area), 0) "sizes" from lf.sys_line_buffer |
| | | union all |
| | | select '测绘(ESV)' "m1", '数字正射影像图' "m2", '平方千米' "m3", ( |
| | | select coalesce(sum(b.area), 0) from lf.sys_meta b |
| | | inner join lf.sys_dir c on b.dircode = c.code |
| | | where c.name = '数字正射影像图' and b.type in ('img', 'tif', 'tiff') ) "sizes" |
| | | union all |
| | | select '测绘(ESV)' "m1", '管线数据' "m2", '千米' "m3", |
| | | cast( coalesce(sum( ST_Length( ST_GeographyFromText( ST_AsText(geom) ) ) ) / 1000, 0) as decimal(12, 2) ) "sizes" from bs.m_pipeline |
| | | union all |
| | | select '勘察(EGE)' "m1", '勘探点' "m2", '个' "m3", count(*) "sizes" from bs.s_explorationpoint |
| | | union all |
| | | select '勘察(EGE)' "m1", '三维地质模型' "m2", '平方米' "m3", ( |
| | | select coalesce(sum(b.area), 0) from lf.sys_meta b |
| | | inner join lf.sys_dir c on b.dircode = c.code |
| | | where b.type in ('fbx', 'ifc') ) "sizes" |
| | | union all |
| | | select '地灾(EGD)' "m1", '地灾点' "m2", '个' "m3", count(*) "sizes" from bd.b_geologic_hazard; |
| | | </select> |
| | | |
| | | <!-- 查询中线缓冲区 --> |
| | | <select id="selectLineBuffer" resultType="java.lang.Integer"> |
| | | select fn_line_buffer(); |
| | | </select> |
| | | |
| | | <!-- 根据类型查询元数据(用于计算面积) --> |
| | | <select id="selectMetaByType" resultType="com.lf.server.entity.ctrl.IdNameEntity"> |
| | | (select a.id, 'DOM' name from lf.sys_meta a |
| | | inner join lf.sys_dir b on a.dircode = b.code |
| | | where a.area is null and a.type in ('img', 'tif', 'tiff') and b.name = '数字正射影像图') |
| | | union all |
| | | (select a.id, 'DEM' name from lf.sys_meta a |
| | | inner join lf.sys_dir b on a.dircode = b.code |
| | | where a.area is null and a.type in ('dem', 'tif', 'tiff') and b.name = '数字高程模型') |
| | | union all |
| | | (select id, 'OSGB' name from lf.sys_meta where area is null and type = 'osgb') |
| | | union all |
| | | (select id, 'LAS' name from lf.sys_meta where area is null and type = 'las' or type = 'laz') |
| | | union all |
| | | (select id, 'IFC' name from lf.sys_meta where area is null and type = 'ifc') |
| | | union all |
| | | (select id, 'FBX' name from lf.sys_meta where area is null and type = 'fbx') |
| | | </select> |
| | | </mapper> |