From b6b0cb226fcf184525ee7b36af3a09471e9c0057 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期一, 25 三月 2024 11:29:33 +0800 Subject: [PATCH] 修改数据统计的查询条件 --- src/main/java/com/lf/server/helper/WordHelper.java | 1 src/main/java/com/lf/server/mapper/sys/ReportMapper.java | 2 src/main/java/com/lf/server/controller/show/OneMapController.java | 3 src/main/java/com/lf/server/service/all/TestService.java | 2 src/main/resources/mapper/sys/ReportMapper.xml | 150 +++++++++++++++++++++++++++++++++++++++++++------ src/main/java/com/lf/server/entity/all/BaseEntity.java | 4 + src/main/java/com/lf/server/service/sys/ReportService.java | 2 7 files changed, 139 insertions(+), 25 deletions(-) diff --git a/src/main/java/com/lf/server/controller/show/OneMapController.java b/src/main/java/com/lf/server/controller/show/OneMapController.java index a7ad681..79718e5 100644 --- a/src/main/java/com/lf/server/controller/show/OneMapController.java +++ b/src/main/java/com/lf/server/controller/show/OneMapController.java @@ -389,7 +389,8 @@ return success(resList); } - // ============[ 鏁版嵁缁熻 - 2024-03-06]============ + //============[鏁版嵁缁熻 - 2024-03-06]================== + @SysLog() @ApiOperation(value = "鏁版嵁缁熻(鎸夊ぇ绫荤粺璁�)") @GetMapping("/countByMajor") diff --git a/src/main/java/com/lf/server/entity/all/BaseEntity.java b/src/main/java/com/lf/server/entity/all/BaseEntity.java index 95a76f2..d125e06 100644 --- a/src/main/java/com/lf/server/entity/all/BaseEntity.java +++ b/src/main/java/com/lf/server/entity/all/BaseEntity.java @@ -46,7 +46,9 @@ @TableField(value = "fn_uname(createuser)", insertStrategy = FieldStrategy.NEVER) private String createName; - // updateStrategy = FieldStrategy.NEVER + /** + * updateStrategy = FieldStrategy.NEVER + */ @TableField(value = "fn_uname(updateuser)", insertStrategy = FieldStrategy.NEVER) private String updateName; diff --git a/src/main/java/com/lf/server/helper/WordHelper.java b/src/main/java/com/lf/server/helper/WordHelper.java index c977318..b7af5ce 100644 --- a/src/main/java/com/lf/server/helper/WordHelper.java +++ b/src/main/java/com/lf/server/helper/WordHelper.java @@ -16,6 +16,7 @@ * @author WWW * @date 2024-03-21 */ +@SuppressWarnings("ALL") public class WordHelper { private final static Log log = LogFactory.getLog(WordHelper.class); diff --git a/src/main/java/com/lf/server/mapper/sys/ReportMapper.java b/src/main/java/com/lf/server/mapper/sys/ReportMapper.java index c234019..73ff766 100644 --- a/src/main/java/com/lf/server/mapper/sys/ReportMapper.java +++ b/src/main/java/com/lf/server/mapper/sys/ReportMapper.java @@ -143,8 +143,8 @@ /** * 鏍规嵁椤圭洰缂栫爜鏌ヨ閽诲瓟鏁版嵁鍧愭爣鐐� * + * @param code * @return - * @date */ public List<CoordinateEntity> selectExplorationPoints(String code); diff --git a/src/main/java/com/lf/server/service/all/TestService.java b/src/main/java/com/lf/server/service/all/TestService.java index ebfce76..ccde796 100644 --- a/src/main/java/com/lf/server/service/all/TestService.java +++ b/src/main/java/com/lf/server/service/all/TestService.java @@ -271,7 +271,7 @@ String inputFile = "C:\\Users\\Administrator\\Desktop\\ts\\椤圭洰鏁版嵁鍒嗙被缁熻.docx"; String outPutFile = "C:\\Users\\Administrator\\Desktop\\ts\\NewWord.docx"; - Map<String, String> textMap = new HashMap<>(); + Map<String, String> textMap = new HashMap<>(1); textMap.put("title", "娣卞湷娑插寲澶╃劧姘斿簲鎬ヨ皟宄扮珯澶栬緭绠¢亾宸ョ▼锛圶Q03T04锛�"); List<String[]> tableList = new ArrayList<>(); diff --git a/src/main/java/com/lf/server/service/sys/ReportService.java b/src/main/java/com/lf/server/service/sys/ReportService.java index 376bd4c..24a32ad 100644 --- a/src/main/java/com/lf/server/service/sys/ReportService.java +++ b/src/main/java/com/lf/server/service/sys/ReportService.java @@ -251,7 +251,7 @@ @Override public List<CountEntity> countVariousDataByPrj(String code) { - code = StringHelper.getRightLike(code); + code = StringUtils.isEmpty(code) || "ALL".equals(code) ? null : StringHelper.getRightLike(code); return reportMapper.countVariousDataByPrj(code); } diff --git a/src/main/resources/mapper/sys/ReportMapper.xml b/src/main/resources/mapper/sys/ReportMapper.xml index ae7e3da..2ea38c6 100644 --- a/src/main/resources/mapper/sys/ReportMapper.xml +++ b/src/main/resources/mapper/sys/ReportMapper.xml @@ -326,49 +326,159 @@ <!-- 椤圭洰鏁版嵁鍒嗙被缁熻 --> <select id="countVariousDataByPrj" resultType="com.lf.server.entity.ctrl.CountEntity"> (select '鏁板瓧绾垮垝鍥�' "m1", 'area' "m2", 0 "count", cast( coalesce(sum(area), 0) as decimal(20, 2) ) "area", 0 "len" - from lf.sys_line_buffer where code like #{code}) + from lf.sys_line_buffer + <where> + <if test="null != code"> + code like #{code}) + </if> + </where> union all (select '鏁板瓧楂樼▼妯″瀷' "m1", 'area' "m2", 0 "count", cast( coalesce(sum(b.area), 0) as decimal(20, 2) ) "area", 0 "len" from lf.sys_meta b inner join lf.sys_dir c on b.dircode = c.code - where c.name = '鏁板瓧楂樼▼妯″瀷' and b.type in ('dem', 'tif', 'tiff') and b.dircode like #{code}) + <where> + c.name = '鏁板瓧楂樼▼妯″瀷' and b.type in ('dem', 'tif', 'tiff') + <if test="null != code"> + and b.dircode like #{code} + </if> + </where> + ) union all (select '鏁板瓧姝e皠褰卞儚鍥�' "m1", 'area' "m2", 0 "count", cast( coalesce(sum(b.area), 0) as decimal(20, 2) ) "area", 0 "len" from lf.sys_meta b inner join lf.sys_dir c on b.dircode = c.code - where c.name = '鏁板瓧姝e皠褰卞儚鍥�' and b.type in ('img', 'tif', 'tiff') and b.dircode like #{code}) + <where> + c.name = '鏁板瓧姝e皠褰卞儚鍥�' and b.type in ('img', 'tif', 'tiff') + <if test="null != code"> + and b.dircode like #{code} + </if> + </where> + ) union all (select '鍊炬枩鎽勫奖妯″瀷' "m1", 'area' "m2", 0 "count", cast( coalesce(sum(b.area), 0) as decimal(20, 2) ) "area", 0 "len" - from lf.sys_meta b where b.type = 'osgb' and b.dircode like #{code}) + from lf.sys_meta b + <where> + b.type = 'osgb' + <if test="null != code"> + and b.dircode like #{code} + </if> + </where> + ) union all (select '婵�鍏夌偣浜戞ā鍨�' "m1", 'area' "m2", 0 "count", cast( coalesce(sum(b.area), 0) as decimal(20, 2) ) "area", 0 "len" - from lf.sys_meta b where b.type in ('las', 'laz') and b.dircode like #{code}) + from lf.sys_meta b + <where> + b.type in ('las', 'laz') + <if test="null != code"> + and b.dircode like #{code} + </if> + </where> + ) union all - (select '绠$嚎闀垮害' "m1", 'len' "m2", 0 "count", 0 "area", cast( coalesce(sum( ST_Length( ST_GeographyFromText( ST_AsText(geom) ) ) ) / 1000, 0) as decimal(20, 2) ) "len" - from bs.m_pipeline b where b.dirid like #{code}) + (select '绠$嚎闀垮害' "m1", 'len' "m2", 0 "count", 0 "area", + cast( coalesce(sum( ST_Length( ST_GeographyFromText( ST_AsText(geom) ) ) ) / 1000, 0) as decimal(20, 2) ) "len" + from bs.m_pipeline b + <where> + <if test="null != code"> + b.dirid like #{code} + </if> + </where> + ) union all - (select '鍕樻帰鐐�' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.s_explorationpoint b where b.dirid like #{code}) + (select '鍕樻帰鐐�' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.s_explorationpoint b + <where> + <if test="null != code"> + b.dirid like #{code} + </if> + </where> + ) union all - (select '鍕樺療宸ョ偣' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.s_surveyworksite b where b.dirid like #{code}) + (select '鍕樺療宸ョ偣' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.s_surveyworksite b + <where> + <if test="null != code"> + b.dirid like #{code} + </if> + </where> + ) union all (select '鍕樺療鎶ュ憡' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.s_explorationpoint b - inner join lf.sys_attach c on b.eventid = c.tab_guid where b.dirid like #{code}) + inner join lf.sys_attach c on b.eventid = c.tab_guid + <where> + <if test="null != code"> + b.dirid like #{code} + </if> + </where> + ) union all - (select '涓夌淮鍦拌川妯″瀷' "m1", 'area' "m2", 0 "count", cast( coalesce(sum(b.area), 0) as decimal(20, 2) ) "area", 0 "len" - from lf.sys_meta b where b.type in ('fbx', 'ifc') and b.dircode like #{code}) + (select '涓夌淮鍦拌川妯″瀷' "m1", 'area' "m2", 0 "count", cast( coalesce(sum(b.area), 0) as decimal(20, 2) ) "area", 0 "len" from lf.sys_meta b + <where> + b.type in ('fbx', 'ifc') + <if test="null != code"> + and b.dircode like #{code} + </if> + </where> + ) union all - (select '鍦扮伨鐐�' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bd.b_geologic_hazard b where b.dirid like #{code}) + (select '鍦扮伨鐐�' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bd.b_geologic_hazard b + <where> + <if test="null != code"> + b.dirid like #{code} + </if> + </where> + ) union all - (select '宕╁' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.g_collapse b where b.dirid like #{code}) + (select '宕╁' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.g_collapse b + <where> + <if test="null != code"> + b.dirid like #{code} + </if> + </where> + ) union all - (select '娉ョ煶娴�' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.g_debrisflow b where b.dirid like #{code}) + (select '娉ョ煶娴�' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.g_debrisflow b + <where> + <if test="null != code"> + b.dirid like #{code} + </if> + </where> + ) union all - (select '鍦伴潰濉岄櫡' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.g_ground_collapse b where b.dirid like #{code}) + (select '鍦伴潰濉岄櫡' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.g_ground_collapse b + <where> + <if test="null != code"> + b.dirid like #{code} + </if> + </where> + ) union all - (select '楂橀櫋杈瑰潯' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.g_highandsteep_slope b where b.dirid like #{code}) + (select '楂橀櫋杈瑰潯' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.g_highandsteep_slope b + <where> + <if test="null != code"> + b.dirid like #{code} + </if> + </where> + ) union all - (select '婊戝潯' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.g_landslide b where b.dirid like #{code}) + (select '婊戝潯' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.g_landslide b + <where> + <if test="null != code"> + b.dirid like #{code} + </if> + </where> + ) union all - (select '涓嶇ǔ瀹氭枩鍧�' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.g_unstable_slope b where b.dirid like #{code}) + (select '涓嶇ǔ瀹氭枩鍧�' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.g_unstable_slope b + <where> + <if test="null != code"> + b.dirid like #{code} + </if> + </where> + ) union all - (select '姘存瘉' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.g_water_damage b where b.dirid like #{code}); + (select '姘存瘉' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.g_water_damage b + <where> + <if test="null != code"> + b.dirid like #{code} + </if> + </where> + ); </select> </mapper> \ No newline at end of file -- Gitblit v1.9.3