liurunyu
2025-07-29 bf8fa97694336defc961cd0124e58067438c6f0d
pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml
@@ -887,6 +887,24 @@
    <!--获取指定时间段内用水量超过指定值的农户数量-->
    <select id="getLargeWaterConsumptionClientsCount" resultType="java.lang.Long">
        SELECT COUNT(*)
        FROM se_client cli
        inner join (
            SELECT client_id, SUM(cl_this_amount) AS waterConsumption
            FROM rm_open_close_valve_history
            <where>
                <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != ''">
                    op_dt BETWEEN #{timeStart} AND #{timeStop}
                </if>
            </where>
            group by client_id
            <if test="waterConsumption != null and waterConsumption > 0">
                having waterConsumption &gt; #{waterConsumption}
            </if>
        ) as his on his.client_id = cli.id
    </select>
    <!-- 2025-07-29 下面SQL查询太慢,废弃  -->
    <select id="_getLargeWaterConsumptionClientsCount" resultType="java.lang.Long">
        SELECT COUNT(*) AS recordCount
        FROM se_client cli
        <where>
@@ -901,6 +919,36 @@
    <!--获取指定时间段内用水量超过指定值的农户-->
    <select id="getLargeWaterConsumptionClients" resultType="com.dy.pipIrrGlobal.voSt.VoClient">
        SELECT cli.id  AS clientId,
        cli.name       AS clientName,
        cli.clientNum,
        cli.address,
        cli.phone,
        cli.idCard,
        his.waterConsumption
        FROM se_client cli
        inner join (
            SELECT client_id, SUM(cl_this_amount) AS waterConsumption
            FROM rm_open_close_valve_history
            <where>
                <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != ''">
                    op_dt BETWEEN #{timeStart} AND #{timeStop}
                </if>
            </where>
            group by client_id
            <if test="waterConsumption != null and waterConsumption > 0">
                having waterConsumption &gt; #{waterConsumption}
            </if>
        ) as his on his.client_id = cli.id
        ORDER BY cli.id
        <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-29 下面SQL查询太慢,废弃  -->
    <select id="_getLargeWaterConsumptionClients" resultType="com.dy.pipIrrGlobal.voSt.VoClient">
        SELECT cli.id                                 AS clientId,
               cli.name                               AS clientName,
               cli.clientNum,