From 6fa8408c8133e8c9aee2bbcdec37bf95c20951c0 Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期五, 07 二月 2025 15:39:16 +0800 Subject: [PATCH] 涉嫌偷水功能增加查询条件用水时长,修改sql语句 --- pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/special/SpecialSv.java | 4 ++++ pipIrr-platform/pipIrr-global/src/main/resources/mapper/SpecialMapper.xml | 34 +++++++++++++++++++++------------- pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/special/QoSteal.java | 5 +++++ 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SpecialMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SpecialMapper.xml index 7e9c338..9675dc5 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SpecialMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SpecialMapper.xml @@ -8,20 +8,24 @@ from rm_open_close_valve_history mTb left join pr_intake piTb on piTb.id = mTb.intake_id left join se_client scTb on scTb.id = mTb.client_id - <where> - <if test = "fromDate != null"> - mTb.cl_dt <![CDATA[>=]]> #{fromDate, javaType=DATE, jdbcType=TIMESTAMP} + where mTb.cl_this_money = 0.0 + <trim prefix="and" suffixOverrides="and"> + <if test = "duration != null"> + mTb.cl_this_time > #{duration, javaType=INTEGER, jdbcType=INTEGER} and + </if> + <if test = "fromDate != null"> + mTb.cl_dt <![CDATA[>=]]> #{fromDate, javaType=DATE, jdbcType=TIMESTAMP} and </if> <if test = "intakeNum != null and intakeNum != '' "> - and piTb.name = #{intakeNum, jdbcType=VARCHAR} + piTb.name = #{intakeNum, jdbcType=VARCHAR} and </if> <if test = "clientNum != null and clientNum != '' "> - and scTb.clientNum = #{clientNum, jdbcType=VARCHAR} + scTb.clientNum = #{clientNum, jdbcType=VARCHAR} and </if> <if test = "clientName != null and clientName != '' "> - and scTb.name = #{clientName, jdbcType=VARCHAR} + scTb.name = #{clientName, jdbcType=VARCHAR} and </if> - </where> + </trim> </select> <select id="selectStealSome" parameterType="java.util.Map" resultType="com.dy.pipIrrGlobal.voSpecial.VoSteal"> @@ -34,20 +38,24 @@ from rm_open_close_valve_history mTb left join pr_intake piTb on piTb.id = mTb.intake_id left join se_client scTb on scTb.id = mTb.client_id - <where> + where mTb.cl_this_money = 0.0 + <trim prefix="and" suffixOverrides="and"> + <if test = "duration != null"> + mTb.cl_this_time > #{duration, javaType=INTEGER, jdbcType=INTEGER} and + </if> <if test = "fromDate != null"> - mTb.cl_dt <![CDATA[>=]]> #{fromDate, javaType=DATE, jdbcType=TIMESTAMP} + mTb.cl_dt <![CDATA[>=]]> #{fromDate, javaType=DATE, jdbcType=TIMESTAMP} and </if> <if test = "intakeNum != null and intakeNum != '' "> - and piTb.name = #{intakeNum, jdbcType=VARCHAR} + piTb.name = #{intakeNum, jdbcType=VARCHAR} and </if> <if test = "clientNum != null and clientNum != '' "> - and scTb.clientNum = #{clientNum, jdbcType=VARCHAR} + scTb.clientNum = #{clientNum, jdbcType=VARCHAR} and </if> <if test = "clientName != null and clientName != '' "> - and scTb.name = #{clientName, jdbcType=VARCHAR} + scTb.name = #{clientName, jdbcType=VARCHAR} and </if> - </where> + </trim> order by mTb.id DESC <trim prefix="limit " > <if test="start != null and count != null"> diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/special/QoSteal.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/special/QoSteal.java index 86e9661..13d5e71 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/special/QoSteal.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/special/QoSteal.java @@ -47,4 +47,9 @@ */ @Schema(description = "鍐滄埛濮撳悕", requiredMode = Schema.RequiredMode.NOT_REQUIRED) public String clientName ; + /** + * 鐢ㄦ按鏃堕暱 + */ + @Schema(description = "鐢ㄦ按鏃堕暱", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + public Integer duration ; } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/special/SpecialSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/special/SpecialSv.java index 0a4edc5..15ba92c 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/special/SpecialSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/special/SpecialSv.java @@ -38,6 +38,10 @@ if(qo.fromDt != null && qo.fromDt != "") { qo.fromDate = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(qo.fromDt + " 00:00:00") ; } + if(qo.duration == null || qo.duration < 0){ + qo.duration = 0 ; + } + Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ; Long itemTotal = Optional.ofNullable(this.dao.selectStealTotal(params)).orElse(0L); -- Gitblit v1.8.0