From 93ba9eca861363be9a0ffa73478a3505920d2673 Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期一, 14 七月 2025 14:23:48 +0800 Subject: [PATCH] 修改用水户年用水量统计查询中的bug --- pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/stClient/StClientSv.java | 6 ++- pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSt/StClientAmountYearMapper.java | 2 - pipIrr-platform/pipIrr-global/src/main/resources/mapper/StClientAmountYearMapper.xml | 60 +++++------------------------- 3 files changed, 14 insertions(+), 54 deletions(-) diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSt/StClientAmountYearMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSt/StClientAmountYearMapper.java index 4f30322..7277306 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSt/StClientAmountYearMapper.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSt/StClientAmountYearMapper.java @@ -74,7 +74,6 @@ * @return */ Long selectCountYearStatistics(Map<?, ?> params) ; - Long selectCountYearStatistics4OneYear(Map<?, ?> params) ; List<VoStClientIdAmountYearRecord> selectClientIds4YearStatistics(Map<?, ?> params) ; /** @@ -82,7 +81,6 @@ * @param params * @return */ - List<VoStClientAmountYearRecord> selectYearStatistics4OneYear(Map<?, ?> params) ; List<VoStClientAmountYearRecord> selectYearStatistics(Map<?, ?> params) ; ////////////////////////////////////// diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/StClientAmountYearMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/StClientAmountYearMapper.xml index d27833a..c28a3db 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/StClientAmountYearMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/StClientAmountYearMapper.xml @@ -125,21 +125,6 @@ </if> </trim> </select> - <select id="selectCountYearStatistics4OneYear" resultType="java.lang.Long"> - select - count(*) - from se_client ctb - INNER JOIN st_client_amount_year cayTb on cayTb.client_id = ctb.id - where ctb.deleted != 1 - <trim prefix="and" suffixOverrides="and"> - <if test="year != null"> - cayTb.`year` = #{year,jdbcType=INTEGER} - </if> - <if test="name != null and name != ''"> - and ctb.name like concat('%', #{name}, '%') - </if> - </trim> - </select> <select id="selectClientIds4YearStatistics" resultType="com.dy.pipIrrGlobal.voSt.VoStClientIdAmountYearRecord"> select @@ -158,37 +143,6 @@ </if> </trim> </select> - - <select id="selectYearStatistics4OneYear" resultType="com.dy.pipIrrGlobal.voSt.VoStClientAmountYearRecord"> - select - ctb.id as clientId, - ctb.clientNum as clientNum, - ctb.name as clientName, - ctb.address as clientAddress, - cayTb.amount as amount, - cayTb.money as money, - cayTb.times as times - from se_client ctb - INNER JOIN st_client_amount_year cayTb on cayTb.client_id = ctb.id - where ctb.deleted != 1 - <trim prefix="and" suffixOverrides="and"> - <if test="year != null"> - cayTb.`year` = #{year,jdbcType=INTEGER} - </if> - <!-- 2025-07-14 鐨剆electClientIds4YearStatisticssselectClientIds4YearStatistics鏌ヨ涓凡缁忕敤浜唍ame鏉′欢 - <if test="name != null and name != ''"> - and ctb.name like concat('%', #{clientName}, '%') - </if> - --> - </trim> - order by ctb.id DESC - <trim prefix="limit " > - <if test="start != null and count != null"> - #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} - </if> - </trim> - </select> - <select id="selectYearStatistics" resultType="com.dy.pipIrrGlobal.voSt.VoStClientAmountYearRecord"> select @@ -209,12 +163,18 @@ ) ) clientIdTb ON clientIdTb.clientId = ctb.id </if> - LEFT JOIN st_client_amount_year cayTb on cayTb.client_id = clientIdTb.clientId + LEFT JOIN + ( + select * + from st_client_amount_year cayTb_ + <where> + <if test="year != null">(cayTb_.`year` = #{year,jdbcType=INTEGER}) + </if> + </where> + ) as cayTb + on cayTb.client_id = clientIdTb.clientId where ctb.deleted != 1 <trim prefix="and" suffixOverrides="and"> - <if test="year != null"> - (cayTb.`year` = #{year,jdbcType=INTEGER} or cayTb.`year` is null) - </if> <!-- 2025-07-14 鐨剆electClientIds4YearStatisticssselectClientIds4YearStatistics鏌ヨ涓凡缁忕敤浜唍ame鏉′欢 <if test="name != null and name != ''"> and ctb.name like concat('%', #{clientName}, '%') diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/stClient/StClientSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/stClient/StClientSv.java index 4ca4a60..e255bc4 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/stClient/StClientSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/stClient/StClientSv.java @@ -127,7 +127,9 @@ int count = 1 ; for(int year: yearGrp){ params.put("year", year); - List<VoStClientAmountYearRecord> list ; + params.put("clientIdsJson", clientIdsJson); + List<VoStClientAmountYearRecord> list = stClientAmountYearDao.selectYearStatistics(params); + /* 2025-07-14 if(oneYear){ list = stClientAmountYearDao.selectYearStatistics4OneYear(params); }else{ @@ -135,7 +137,7 @@ params.put("clientIdsJson", clientIdsJson); } list = stClientAmountYearDao.selectYearStatistics(params); - } + }*/ if(group.isEmpty()){ this.completion(group, list); -- Gitblit v1.8.0