ustcyc
2025-01-07 de5d55508afd27fb2b47e6d4d6fd9984525c222c
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
141
142
143
<?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.zhitan.basicdata.mapper.MeterImplementCountMapper">
    
    <resultMap type="MeterImplementCount" id="MeterImplementCountResult">
        <result property="code"    column="code"    />
        <result property="meterName"    column="meter_name"    />
        <result property="meterType"    column="meter_type"    />
        <result property="modelNumber"    column="model_number"    />
        <result property="measureRange"    column="measure_range"    />
        <result property="id"    column="id"    />
        <result property="manufacturer"    column="manufacturer"    />
        <result property="personCharge"    column="person_charge"    />
        <result property="installactionLocation"    column="installaction_location"    />
        <result property="startTime"    column="start_time"    />
        <result property="checkCycle"    column="check_cycle"    />
        <result property="reminderCycle"    column="reminder_cycle"    />
        <result property="meterStatus"    column="meter_status"    />
        <result property="delFlage"    column="del_flage"    />
        <result property="remark"    column="remark"    />
        <result property="createTime"    column="create_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="txflage"    column="txflage"    />
        <result property="putrunTime"    column="putrun_time"    />
    </resultMap>
 
    <sql id="selectMeterImplementCountVo">
         select id, code, meter_name, meter_type, model_number, measure_range, manufacturer, person_charge, installaction_location, start_time, check_cycle, reminder_cycle, meter_status, del_flage, remark, putrun_time, create_time, create_by, update_time, update_by,(start_time+check_cycle-reminder_cycle)&lt;=current_date as txflage from meter_implement
    </sql>
 
    <select id="selectMeterImplementCountList" parameterType="MeterImplementCount" resultMap="MeterImplementCountResult">
        <include refid="selectMeterImplementCountVo"/>
        <where>  
            <if test="code != null  and code != ''"> and code like concat('%', #{code}, '%')</if>
            <if test="meterName != null  and meterName != ''"> and meter_name like concat('%', #{meterName}, '%')</if>
            <if test="meterType != null  and meterType != ''"> and meter_type = #{meterType}</if>
            <if test="measureRange != null  and measureRange != ''"> and measure_range like concat('%', #{measureRange}, '%')</if>
            <if test="manufacturer != null  and manufacturer != ''"> and manufacturer like concat('%', #{manufacturer}, '%')</if>
            <if test="installactionLocation != null  and installactionLocation != ''"> and installaction_location like concat('%', #{installactionLocation}, '%')</if>
        </where>
    </select>
    
    <select id="selectMeterImplementCountById" parameterType="String" resultMap="MeterImplementCountResult">
        <include refid="selectMeterImplementCountVo"/>
        where code = #{code}
    </select>
        
    <insert id="insertMeterImplementCount" parameterType="MeterImplementCount">
        insert into meter_implement
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="code != null  and code != ''">code,</if>
            <if test="meterName != null  and meterName != ''">meter_name,</if>
            <if test="meterType != null  and meterType != ''">meter_type,</if>
            <if test="modelNumber != null  and modelNumber != ''">model_number,</if>
            <if test="measureRange != null  and measureRange != ''">measure_range,</if>
            <if test="id != null  and id != ''">id,</if>
            <if test="manufacturer != null  and manufacturer != ''">manufacturer,</if>
            <if test="personCharge != null  and personCharge != ''">person_charge,</if>
            <if test="installactionLocation != null  and installactionLocation != ''">installaction_location,</if>
            <if test="startTime != null ">start_time,</if>
            <if test="checkCycle != null ">check_cycle,</if>
            <if test="reminderCycle != null ">reminder_cycle,</if>
            <if test="meterStatus != null  and meterStatus != ''">meter_status,</if>
            <if test="delFlage != null  and delFlage != ''">del_flage,</if>
            <if test="remark != null  and remark != ''">remark,</if>
            <if test="createTime != null ">create_time,</if>
            <if test="createBy != null  and createBy != ''">create_by,</if>
            <if test="updateTime != null ">update_time,</if>
            <if test="updateBy != null  and updateBy != ''">update_by,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="code != null  and code != ''">#{code},</if>
            <if test="meterName != null  and meterName != ''">#{meterName},</if>
            <if test="meterType != null  and meterType != ''">#{meterType},</if>
            <if test="modelNumber != null  and modelNumber != ''">#{modelNumber},</if>
            <if test="measureRange != null  and measureRange != ''">#{measureRange},</if>
            <if test="id != null  and id != ''">#{id},</if>
            <if test="manufacturer != null  and manufacturer != ''">#{manufacturer},</if>
            <if test="personCharge != null  and personCharge != ''">#{personCharge},</if>
            <if test="installactionLocation != null  and installactionLocation != ''">#{installactionLocation},</if>
            <if test="startTime != null ">#{startTime},</if>
            <if test="checkCycle != null ">#{checkCycle},</if>
            <if test="reminderCycle != null ">#{reminderCycle},</if>
            <if test="meterStatus != null  and meterStatus != ''">#{meterStatus},</if>
            <if test="delFlage != null  and delFlage != ''">#{delFlage},</if>
            <if test="remark != null  and remark != ''">#{remark},</if>
            <if test="createTime != null ">#{createTime},</if>
            <if test="createBy != null  and createBy != ''">#{createBy},</if>
            <if test="updateTime != null ">#{updateTime},</if>
            <if test="updateBy != null  and updateBy != ''">#{updateBy},</if>
         </trim>
    </insert>
 
    <update id="updateMeterImplementCount" parameterType="MeterImplementCount">
        update meter_implement
        <trim prefix="SET" suffixOverrides=",">
            <if test="meterName != null  and meterName != ''">meter_name = #{meterName},</if>
            <if test="meterType != null  and meterType != ''">meter_type = #{meterType},</if>
            <if test="modelNumber != null  and modelNumber != ''">model_number = #{modelNumber},</if>
            <if test="measureRange != null  and measureRange != ''">measure_range = #{measureRange},</if>
            <if test="id != null  and id != ''">id = #{id},</if>
            <if test="manufacturer != null  and manufacturer != ''">manufacturer = #{manufacturer},</if>
            <if test="personCharge != null  and personCharge != ''">person_charge = #{personCharge},</if>
            <if test="installactionLocation != null  and installactionLocation != ''">installaction_location = #{installactionLocation},</if>
            <if test="startTime != null ">start_time = #{startTime},</if>
            <if test="checkCycle != null ">check_cycle = #{checkCycle},</if>
            <if test="reminderCycle != null ">reminder_cycle = #{reminderCycle},</if>
            <if test="meterStatus != null  and meterStatus != ''">meter_status = #{meterStatus},</if>
            <if test="delFlage != null  and delFlage != ''">del_flage = #{delFlage},</if>
            <if test="remark != null  and remark != ''">remark = #{remark},</if>
            <if test="createTime != null ">create_time = #{createTime},</if>
            <if test="createBy != null  and createBy != ''">create_by = #{createBy},</if>
            <if test="updateTime != null ">update_time = #{updateTime},</if>
            <if test="updateBy != null  and updateBy != ''">update_by = #{updateBy},</if>
        </trim>
        where code = #{code}
    </update>
 
    <delete id="deleteMeterImplementCountById" parameterType="String">
        delete from meter_implement where code = #{code}
    </delete>
 
  <!--  <delete id="deleteMeterImplementCountByIds" parameterType="String">
        delete from meter_implement where code in 
        <foreach item="code" collection="array" open="(" separator="," close=")">
            #{code}
        </foreach>
    </delete>-->
 
    <update id="deleteMeterImplementCountByIds" parameterType="String" >
        update meter_implement
        set start_time = NOW()
        where code in
        <foreach item="code" collection="array" open="(" separator="," close=")">
        #{code}
        </foreach>
    </update>
    
</mapper>