管道基础大数据平台系统开发-【后端】-Server
13693261870
2024-03-12 7bfbdcdab10c58ecf96b45543c0d0df948af4ba5
src/main/resources/mapper/show/OneMapMapper.xml
@@ -1,20 +1,15 @@
<?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">
@@ -67,23 +62,22 @@
        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 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,
@@ -139,7 +133,6 @@
        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;-->
@@ -165,7 +158,6 @@
        select modular1,count(*) from lf.sys_operate group by modular1 order by modular1;
    </select>
    <!--  查询表信息  -->
    <select id="queryTableInfo" resultType="java.util.Map">
        SELECT a.attnum,
@@ -180,7 +172,6 @@
          AND d.objoid=a.attrelid
          AND d.objsubid=a.attnum;
    </select>
    <!--  统计计算全球管道图  -->
    <select id="countGlobalPipeMap" resultType="java.util.Map">
@@ -266,7 +257,7 @@
    <select id="countProjectType" resultType="java.util.Map">
        SELECT a.type,
               count(a.type) AS number,
               sum(a.sizes) AS capacity
               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}%'
@@ -274,7 +265,7 @@
    </select>
    <!--  单个项目的下载个数、下载次数和数据量-->
    <!--    select count(*) "number", sum(c.dcount) "count", sum(c.sizes) "size"
    <!--  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}%';  -->
@@ -297,7 +288,49 @@
        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="java.util.Map">
        (select a.id, a.path, '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, a.path, '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, path, 'OSGB' name from lf.sys_meta where area is null and type = 'osgb')
        union all
        (select id, path, 'LAS' name from lf.sys_meta where area is null and type = 'las' or type = 'laz')
        union all
        (select id, path, 'IFC' name from lf.sys_meta where area is null and type = 'ifc')
        union all
        (select id, path, 'FBX' name from lf.sys_meta where area is null and type = 'fbx')
    </select>
</mapper>