From 9343e802bd45a58de02343db3832b4c7dd16e49e Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期一, 14 七月 2025 11:06:22 +0800 Subject: [PATCH] 修改用水户年用水量统计查询中的bug --- pipIrr-platform/pipIrr-global/src/main/resources/mapper/StClientAmountYearMapper.xml | 70 ++++++++++++++++++++++++++++++++++- 1 files changed, 68 insertions(+), 2 deletions(-) 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 3a2f404..3003517 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/StClientAmountYearMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/StClientAmountYearMapper.xml @@ -125,6 +125,63 @@ </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 + 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 ASC + </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> + <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 @@ -136,14 +193,23 @@ cayTb.money as money, cayTb.times as times from se_client ctb - LEFT JOIN st_client_amount_year cayTb on cayTb.client_id = ctb.id + <if test="clientIdsJson != null and clientIdsJson !=''"> + INNER JOIN JSON_TABLE( + <!--'[{"clientId":"37142501020100215"},{"clientId":"37142501020100215"}]'--> + #{clientIdsJson}, + '$[*]' COLUMNS ( + clientId BIGINT PATH '$.clientId' + ) + ) clientIdTb ON clientIdTb.clientId = ctb.id + </if> + LEFT JOIN st_client_amount_year 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} </if> <if test="name != null and name != ''"> - and ctb.name like concat('%', #{name}, '%') + and ctb.name like concat('%', #{clientName}, '%') </if> </trim> order by ctb.id DESC -- Gitblit v1.8.0