liurunyu
2024-10-25 f16c96a3bbd126dca21b254ceb018a0558f5ea1d
pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml
@@ -476,7 +476,7 @@
                   WHEN oh.op_type = 3 THEN '中心站开阀'
                   WHEN oh.op_type = 5 THEN '余额不足关阀'
                   WHEN oh.op_type = 8 THEN '用户远程开阀'
                   WHEN oh.op_type = 11 THEN '开关阀卡开阀'
                   WHEN oh.op_type = 11 THEN '巡检卡开阀'
                   ELSE '未知'
                   END                 AS openType,
               oh.op_order_no          AS openOrderNo,
@@ -494,7 +494,7 @@
                   WHEN oh.cl_type = 6 THEN '流量计故障关阀'
                   WHEN oh.cl_type = 7 THEN '紧急关闭'
                   WHEN oh.cl_type = 9 THEN '用户远程关阀'
                   WHEN oh.cl_type = 10 THEN '开关阀卡关阀'
                   WHEN oh.cl_type = 10 THEN '巡检卡关阀'
                   WHEN oh.cl_type = 12 THEN '黑名单命令关阀'
                   WHEN oh.cl_type = 13 THEN '用户远程定时关阀'
                   WHEN oh.cl_type = 14 THEN '用户远程定量关阀'
@@ -1264,4 +1264,88 @@
            </if>
        </trim>
    </select>
    <!--获取物理卡开关阀记录数量,微信小程序使用-->
    <select id="getCardOpenCloseCount" resultType="java.lang.Long">
        SELECT COUNT(*) AS recordCount
        FROM rm_open_close_valve_history his
                 LEFT JOIN pr_intake inta ON inta.id = his.intake_id
        <where>
            AND op_type  = 1
            <if test = "clientId != null">
                AND his.client_id = #{clientId}
            </if>
        </where>
    </select>
    <!--获取物理卡开关阀记录,微信小程序使用-->
    <select id="getCardOpenClose" resultType="com.dy.pipIrrGlobal.voRm.VoOpenClostWechat">
        SELECT
            cl_this_money AS expense,
            op_ic_card_no AS cardNum,
            inta.name AS intakeNum,
            open_dt AS openTime,
            close_dt AS closeTime,
            cl_this_time AS duration,
            cl_this_amount AS amount,
            '刷卡开阀' AS openType
        FROM rm_open_close_valve_history his
                 LEFT JOIN pr_intake inta ON inta.id = his.intake_id
        <where>
            AND op_type  = 1
            <if test = "clientId != null">
                AND his.client_id = #{clientId}
            </if>
        </where>
        ORDER BY open_dt 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="getVcCardOpenCloseCount" resultType="java.lang.Long">
        SELECT COUNT(*) AS recordCount
        FROM rm_open_close_valve_history his
                 LEFT JOIN pr_intake inta ON inta.id = his.intake_id
        <where>
            AND op_type  = 8
            <if test = "clientId != null">
                AND his.client_id = #{clientId}
            </if>
        </where>
    </select>
    <!--获取虚拟卡开关阀记录,微信小程序使用-->
    <select id="getVcCardOpenClose" resultType="com.dy.pipIrrGlobal.voRm.VoOpenClostWechat">
        SELECT
            cl_this_money AS expense,
            op_ic_card_no AS cardNum,
            inta.name AS intakeNum,
            open_dt AS openTime,
            close_dt AS closeTime,
            cl_this_time AS duration,
            cl_this_amount AS amount,
            CASE
                WHEN cl_type = 13 THEN '定时关阀式开阀'
                WHEN cl_type = 14 THEN '定量关阀式开阀'
                ELSE '远程开阀'
                END AS openType
        FROM rm_open_close_valve_history his
                 LEFT JOIN pr_intake inta ON inta.id = his.intake_id
        <where>
            AND op_type  = 8
            <if test = "clientId != null">
                AND his.client_id = #{clientId}
            </if>
        </where>
        ORDER BY open_dt DESC
        <trim prefix="limit " >
            <if test="start != null and count != null">
                #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
            </if>
        </trim>
    </select>
</mapper>