liurunyu
2025-07-31 0e2583bb895c398f96c28a25a7bfbb945bc84722
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dy.pipIrrGlobal.daoSpecial.SpecialMapper">
 
    <select id="selectStealTotal" parameterType="java.util.Map" resultType="java.lang.Long">
        select
        count(*)
        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 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 != '' ">
                piTb.name = #{intakeNum, jdbcType=VARCHAR} and
            </if>
            <if test = "clientNum != null and clientNum != '' ">
                scTb.clientNum = #{clientNum, jdbcType=VARCHAR} and
            </if>
            <if test = "clientName != null and clientName != '' ">
                scTb.name = #{clientName, jdbcType=VARCHAR} and
            </if>
        </trim>
    </select>
 
 
    <select id="selectStealSome" parameterType="java.util.Map" resultType="com.dy.pipIrrGlobal.voSpecial.VoSteal">
        select mTb.id as id, mTb.intake_id as intakeId, mTb.client_id as clientId,
        piTb.name as intakeNum, piTb.lng as intakeLng, piTb.lat as intakeLat,
        scTb.name as clientName, scTb.clientNum as clientNum,
        mTb.op_dt as openDt, mTb.op_type as opType, mTb.op_total_amount as openTotalAmount, mTb.op_remain_money as openRemainMoney,
        mTb.cl_dt as closeDt, mTb.cl_type as clType, mTb.cl_total_amount as closeTotalAmount, mTb.cl_remain_money as closeRemainMoney,
        mTb.cl_this_amount as thisAmount, mTb.cl_this_money as thisMoney, mTb.cl_this_time as thisTime
        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 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 != '' ">
                piTb.name = #{intakeNum, jdbcType=VARCHAR} and
            </if>
            <if test = "clientNum != null and clientNum != '' ">
                scTb.clientNum = #{clientNum, jdbcType=VARCHAR} and
            </if>
            <if test = "clientName != null and clientName != '' ">
                scTb.name = #{clientName, jdbcType=VARCHAR} and
            </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="selectAbnormalCloseValveTotal" parameterType="java.util.Map" resultType="java.lang.Long">
        select
        count(*)
        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
        <!-- 2025-07-31 参考common模块的类CommonV1和CommonV202404
             case 5 -> "余额不足关阀";
            case 6 -> "流量计故障关阀";
            case 7 -> "紧急关阀";
            case 10 -> "巡检卡关阀";
            case 12 -> "黑名单命令关阀";
            case 16 -> "管道无水自动关阀";
         -->
        where (mTb.cl_type = 5 or mTb.cl_type = 6 or mTb.cl_type = 7 or mTb.cl_type = 10 or mTb.cl_type = 12 or mTb.cl_type = 16)
        <trim prefix="and" suffixOverrides="and">
            <if test = "atDateStart != null">
                mTb.cl_dt <![CDATA[>=]]> #{atDateStart, javaType=DATE, jdbcType=TIMESTAMP} and
            </if>
            <if test = "atDateEnd != null">
                mTb.cl_dt <![CDATA[<=]]> #{atDateEnd, javaType=DATE, jdbcType=TIMESTAMP} and
            </if>
            <if test = "intakeNum != null and intakeNum != '' ">
                piTb.name = #{intakeNum, jdbcType=VARCHAR} and
            </if>
            <if test = "clientNum != null and clientNum != '' ">
                scTb.clientNum = #{clientNum, jdbcType=VARCHAR} and
            </if>
            <if test = "clientName != null and clientName != '' ">
                scTb.name = #{clientName, jdbcType=VARCHAR} and
            </if>
        </trim>
    </select>
 
 
    <select id="selectAbnormalCloseValveSome" parameterType="java.util.Map" resultType="com.dy.pipIrrGlobal.voSpecial.VoAbnormalCloseValve">
        select mTb.id as id, mTb.intake_id as intakeId, mTb.client_id as clientId,
        piTb.name as intakeNum, piTb.lng as intakeLng, piTb.lat as intakeLat,
        scTb.name as clientName, scTb.clientNum as clientNum,
        mTb.op_dt as openDt, mTb.op_type as opType, mTb.op_total_amount as openTotalAmount, mTb.op_remain_money as openRemainMoney,
        mTb.cl_dt as closeDt, mTb.cl_type as clType, mTb.cl_total_amount as closeTotalAmount, mTb.cl_remain_money as closeRemainMoney,
        mTb.cl_this_amount as thisAmount, mTb.cl_this_money as thisMoney, mTb.cl_this_time as thisTime
        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 mTb.cl_type != 2
        <trim prefix="and" suffixOverrides="and">
            <if test = "atDateStart != null">
                mTb.cl_dt <![CDATA[>=]]> #{atDateStart, javaType=DATE, jdbcType=TIMESTAMP} and
            </if>
            <if test = "atDateEnd != null">
                mTb.cl_dt <![CDATA[<=]]> #{atDateEnd, javaType=DATE, jdbcType=TIMESTAMP} and
            </if>
            <if test = "intakeNum != null and intakeNum != '' ">
                piTb.name = #{intakeNum, jdbcType=VARCHAR} and
            </if>
            <if test = "clientNum != null and clientNum != '' ">
                scTb.clientNum = #{clientNum, jdbcType=VARCHAR} and
            </if>
            <if test = "clientName != null and clientName != '' ">
                scTb.name = #{clientName, jdbcType=VARCHAR} and
            </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>
 
</mapper>