WaterMeterMapper.xml
6.3 KB
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<?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.sunyo.energy.location.dao.WaterMeterMapper">
<resultMap id="BaseResultMap" type="com.sunyo.energy.location.model.WaterMeter">
<result column="wm_id" property="wmId" jdbcType="VARCHAR"/>
<result column="wm_sacc" property="wmSacc" jdbcType="VARCHAR"/>
<result column="wm_lacc" property="wmLacc" jdbcType="VARCHAR"/>
<result column="wm_rdtime" property="wmRdtime" jdbcType="VARCHAR"/>
<result column="wm_fmstate" property="wmFmstate" jdbcType="VARCHAR"/>
<result column="wm_errmessage" property="wmErrmessage" jdbcType="VARCHAR"/>
<result column="wm_voltage" property="wmVoltage" jdbcType="VARCHAR"/>
<result column="wm_signalpower" property="wmSignalpower" jdbcType="VARCHAR"/>
<result column="creatTime" property="creattime" jdbcType="TIMESTAMP"/>
<result column="updateTime" property="updatetime" jdbcType="TIMESTAMP"/>
<result column="reamke1" property="reamke1" jdbcType="VARCHAR"/>
<result column="reamke2" property="reamke2" jdbcType="VARCHAR"/>
<result column="reamke3" property="reamke3" jdbcType="VARCHAR"/>
<result column="reamke4" property="reamke4" jdbcType="VARCHAR"/>
</resultMap>
<select id="waterMeterAll" parameterType="string" resultMap="BaseResultMap">
select * from water_meter where wm_id like concat('%',#{value},'%')
</select>
<insert id="insert" parameterType="com.sunyo.energy.location.model.WaterMeter">
insert into water_meter (wm_id, wm_sacc, wm_lacc,
wm_rdtime, wm_fmstate, wm_errmessage,
wm_voltage, wm_signalpower, creatTime,
updateTime, reamke1, reamke2,
reamke3, reamke4)
values (#{wmId,jdbcType=VARCHAR}, #{wmSacc,jdbcType=VARCHAR}, #{wmLacc,jdbcType=VARCHAR},
#{wmRdtime,jdbcType=VARCHAR}, #{wmFmstate,jdbcType=VARCHAR}, #{wmErrmessage,jdbcType=VARCHAR},
#{wmVoltage,jdbcType=VARCHAR}, #{wmSignalpower,jdbcType=VARCHAR}, #{creattime,jdbcType=TIMESTAMP},
#{updatetime,jdbcType=TIMESTAMP}, #{reamke1,jdbcType=VARCHAR}, #{reamke2,jdbcType=VARCHAR},
#{reamke3,jdbcType=VARCHAR}, #{reamke4,jdbcType=VARCHAR})
</insert>
<select id="selectAll" resultMap="BaseResultMap">
select
*
from water_meter
order by wm_rdtime desc
</select>
<select id="findOneWmSacc" resultType="java.lang.String">
select reamke1 from water_meter where wm_id = #{value,jdbcType=VARCHAR}
</select>
<insert id="insertSelective" parameterType="com.sunyo.energy.location.model.WaterMeter">
insert into water_meter
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="wmId != null">
wm_id,
</if>
<if test="wmSacc != null">
wm_sacc,
</if>
<if test="wmLacc != null">
wm_lacc,
</if>
<if test="wmRdtime != null">
wm_rdtime,
</if>
<if test="wmFmstate != null">
wm_fmstate,
</if>
<if test="wmErrmessage != null">
wm_errmessage,
</if>
<if test="wmVoltage != null">
wm_voltage,
</if>
<if test="wmSignalpower != null">
wm_signalpower,
</if>
<if test="creattime != null">
creatTime,
</if>
<if test="updatetime != null">
updateTime,
</if>
<if test="reamke1 != null">
reamke1,
</if>
<if test="reamke2 != null">
reamke2,
</if>
<if test="reamke3 != null">
reamke3,
</if>
<if test="reamke4 != null">
reamke4,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="wmId != null">
#{wmId,jdbcType=VARCHAR},
</if>
<if test="wmSacc != null">
#{wmSacc,jdbcType=VARCHAR},
</if>
<if test="wmLacc != null">
#{wmLacc,jdbcType=VARCHAR},
</if>
<if test="wmRdtime != null">
#{wmRdtime,jdbcType=VARCHAR},
</if>
<if test="wmFmstate != null">
#{wmFmstate,jdbcType=VARCHAR},
</if>
<if test="wmErrmessage != null">
#{wmErrmessage,jdbcType=VARCHAR},
</if>
<if test="wmVoltage != null">
#{wmVoltage,jdbcType=VARCHAR},
</if>
<if test="wmSignalpower != null">
#{wmSignalpower,jdbcType=VARCHAR},
</if>
<if test="creattime != null">
#{creattime,jdbcType=TIMESTAMP},
</if>
<if test="updatetime != null">
#{updatetime,jdbcType=TIMESTAMP},
</if>
<if test="reamke1 != null">
#{reamke1,jdbcType=VARCHAR},
</if>
<if test="reamke2 != null">
#{reamke2,jdbcType=VARCHAR},
</if>
<if test="reamke3 != null">
#{reamke3,jdbcType=VARCHAR},
</if>
<if test="reamke4 != null">
#{reamke4,jdbcType=VARCHAR},
</if>
</trim>
ON DUPLICATE KEY
UPDATE
wm_sacc = #{wmSacc,jdbcType=VARCHAR},
wm_lacc = #{wmLacc,jdbcType=VARCHAR},
wm_rdtime = #{wmRdtime,jdbcType=VARCHAR},
wm_fmstate = #{wmFmstate,jdbcType=VARCHAR},
wm_errmessage = #{wmErrmessage,jdbcType=VARCHAR},
wm_voltage = #{wmVoltage,jdbcType=VARCHAR},
wm_signalpower = #{wmSignalpower,jdbcType=VARCHAR},
creatTime = #{creattime,jdbcType=TIMESTAMP},
updateTime = #{updatetime,jdbcType=TIMESTAMP},
reamke1 = #{reamke1,jdbcType=VARCHAR},
reamke2 = #{reamke2,jdbcType=VARCHAR},
reamke3 = #{reamke3,jdbcType=VARCHAR},
reamke4 = #{reamke4,jdbcType=VARCHAR}
</insert>
<update id="update" parameterType="java.lang.String">
update water_meter set reamke1 = #{allSacc,jdbcType=VARCHAR}
where wm_id = #{wmId, jdbcType=VARCHAR}
</update>
</mapper>