From bdb2f52b04d53f4e0faaa384238244f253b5334f Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期一, 14 七月 2025 15:14:59 +0800 Subject: [PATCH] 修改用水户日、月、年用水量统计查询中的bug --- pipIrr-platform/pipIrr-global/src/main/resources/mapper/StClientAmountDayMapper.xml | 73 ++++++++++++++++++++++++++---------- 1 files changed, 52 insertions(+), 21 deletions(-) diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/StClientAmountDayMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/StClientAmountDayMapper.xml index a6fa3e8..3f0d939 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/StClientAmountDayMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/StClientAmountDayMapper.xml @@ -1206,13 +1206,32 @@ select count(*) from se_client mtb - where mtb.deleted != 0 + where mtb.deleted != 1 <trim prefix="and" suffixOverrides="and"> <if test="name != null and name != ''"> mtb.name like concat('%', #{name}, '%') </if> </trim> </select> + + <select id="selectClientIds4DayStatistics" resultType="com.dy.pipIrrGlobal.voSt.VoStClientIdAmountYearRecord"> + select + mtb.id as clientId + from se_client mtb + where mtb.deleted != 1 + <trim prefix="and" suffixOverrides="and"> + <if test="name != null and name != ''"> + mtb.name like concat('%', #{name}, '%') + </if> + </trim> + order by mtb.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="selectDayStatistics" resultType="com.dy.pipIrrGlobal.voSt.VoStClientAmountDay"> select @@ -1224,28 +1243,40 @@ <property name="alias" value="stTb"/> </include> from se_client mtb - LEFT JOIN st_client_amount_day stTb on stTb.client_id = mtb.id - where mtb.deleted != 0 - <trim prefix="and" suffixOverrides="and"> - <if test = "year != null"> - stTb.year = #{year, jdbcType=INTEGER} - </if> - <if test = "month != null"> - AND stTb.month = #{month, jdbcType=INTEGER} - </if> - <if test="name != null and name != ''"> - AND mtb.name like concat('%', #{name}, '%') - </if> - </trim> + <if test="clientIdsJson != null and clientIdsJson !=''"> + INNER JOIN JSON_TABLE( + <!--'[{"clientId":"37142501020100215"},{"clientId":"37142501020100215"}]'--> + #{clientIdsJson}, + '$[*]' COLUMNS ( + clientId BIGINT PATH '$.clientId' + ) + ) clientIdTb ON clientIdTb.clientId = mtb.id + </if> + LEFT JOIN + ( + select * + from st_client_amount_day + <where> + <if test="year != null"> + `year` = #{year,jdbcType=INTEGER} + </if> + <if test = "month != null"> + AND month = #{month, jdbcType=INTEGER} + </if> + </where> + ) as stTb on stTb.client_id = mtb.id + where mtb.deleted != 1 order by mtb.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> + <!-- 2025-07-14 鍥犱负鏈塩lientIdsJson闄愬埗浜嗘暟閲忥紝鎵�浠ヤ笉鍐嶇敤limit浜� + <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="statisticsByClient" resultType="com.dy.pipIrrGlobal.voSt.VoClientAmountStatistics"> -- Gitblit v1.8.0