IMSupplierMapper.xml
11.1 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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
<?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.sibu.orderHelper.integral.web.dao.IMSupplierDao">
<resultMap id="BaseResultMap" type="com.sibu.orderHelper.integral.model.IMSupplier">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="contact" jdbcType="VARCHAR" property="contact" />
<result column="contact_phone" jdbcType="VARCHAR" property="contactPhone" />
<result column="create_dt" jdbcType="TIMESTAMP" property="createDt"/>
<result column="erp_card_code" jdbcType="VARCHAR" property="erpCardCode" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="freight_remark" jdbcType="VARCHAR" property="freightRemark"/>
<result column="address" jdbcType="VARCHAR" property="address" />
<result column="head_img" jdbcType="VARCHAR" property="headImg" />
<result column="service_charge_rate" property="serviceChargeRate" />
<result column="platform_type" property="platformType" />
</resultMap>
<resultMap id="resultMap" type="com.sibu.orderHelper.integral.reponse.WebSupplierDetail">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="contact" jdbcType="VARCHAR" property="contact" />
<result column="contact_phone" jdbcType="VARCHAR" property="contactPhone" />
<result column="erp_card_code" jdbcType="VARCHAR" property="erpCardCode" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="freight_remark" jdbcType="VARCHAR" property="freightRemark"/>
<result column="address" jdbcType="VARCHAR" property="address" />
<result column="head_img" jdbcType="VARCHAR" property="headImg" />
<result column="service_charge_rate" property="serviceChargeRate" />
<result column="platform_type" property="platformType" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, contact, contact_phone,create_dt,erp_card_code,name,freight_remark,address,head_img,service_charge_rate,platform_type
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="resultMap">
select
id, contact, contact_phone,erp_card_code,name,freight_remark,address,head_img,platform_type,service_charge_rate
from im_supplier
where id = #{id}
</select>
<select id="findById" parameterType="java.lang.String" resultMap="BaseResultMap">
select
*
from im_supplier
where id = #{id}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from im_supplier
where id = #{id}
</delete>
<select id="selectByStoreName" parameterType="java.lang.String" resultMap="BaseResultMap">
select
id, contact, contact_phone,name,freight_remark,address,head_img,platform_type,service_charge_rate
from im_supplier
where name = #{name}
</select>
<insert id="insert" parameterType="com.sibu.orderHelper.integral.model.IMSupplier">
insert into im_supplier (id, contact, contact_phone,create_dt,erp_card_code,name,
freight_remark,address,head_img,platform_type,service_charge_rate)
values (#{id,jdbcType=VARCHAR}, #{contact,jdbcType=VARCHAR},
#{contactPhone,jdbcType=VARCHAR},NOW(), #{erpCardCode,jdbcType=VARCHAR},
#{name,jdbcType=VARCHAR},#{freightRemark,jdbcType=VARCHAR},#{address,jdbcType=VARCHAR}
,#{headImg,jdbcType=VARCHAR},#{platformType},#{serviceChargeRate,jdbcType=DECIMAL})
</insert>
<insert id="insertSelective" parameterType="com.sibu.orderHelper.integral.model.IMSupplier">
insert into im_supplier
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="contact != null">
contact,
</if>
<if test="contactPhone != null">
contact_phone,
</if>
<if test="erpCardCode != null">
erp_card_code,
</if>
<if test="name != null">
name,
</if>
<if test="freightRemark != null">
freight_remark,
</if>
<if test="address != null">
address,
</if>
<if test="headImg != null">
head_img,
</if>
<if test="serviceChargeRate != null">
service_charge_rate,
</if>
create_dt
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="contact != null">
#{contact,jdbcType=VARCHAR},
</if>
<if test="contactPhone != null">
#{contactPhone,jdbcType=VARCHAR},
</if>
<if test="erpCardCode != null">
#{erpCardCode,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="freightRemark != null">
#{freightRemark,jdbcType=VARCHAR},
</if>
<if test="address != null">
#{address,jdbcType=VARCHAR},
</if>
<if test="headImg != null">
#{headImg,jdbcType=VARCHAR},
</if>
<if test="serviceChargeRate != null">
#{serviceChargeRate,jdbcType=DECIMAL},
</if>
NOW()
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.sibu.orderHelper.integral.model.IMSupplier">
update im_supplier
<set>
<if test="contact != null">
contact = #{contact,jdbcType=VARCHAR},
</if>
<if test="contactPhone != null">
contact_phone = #{contactPhone,jdbcType=VARCHAR},
</if>
<if test="erpCardCode != null">
erp_card_code = #{erpCardCode,jdbcType=VARCHAR},
</if>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="freightRemark != null">
freight_remark = #{freightRemark,jdbcType=VARCHAR},
</if>
<if test="address != null">
address = #{address,jdbcType=VARCHAR},
</if>
<if test="headImg != null">
head_img = #{headImg,jdbcType=VARCHAR},
</if>
<if test="serviceChargeRate != null">
service_charge_rate = #{serviceChargeRate,jdbcType=DECIMAL},
</if>
create_dt = NOW()
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.sibu.orderHelper.integral.model.IMSupplier">
update im_supplier
set contact = #{contact,jdbcType=VARCHAR}, contact_phone = #{contactPhone,jdbcType=VARCHAR},
erp_card_code = #{erpCardCode,jdbcType=VARCHAR},name = #{name,jdbcType=VARCHAR},
freight_remark = #{freightRemark,jdbcType=VARCHAR},address = #{address,jdbcType=VARCHAR},
head_img = #{headImg,jdbcType=VARCHAR},platform_type = #{platformType},
service_charge_rate = #{serviceChargeRate,jdbcType=DECIMAL},create_dt = NOW()
where id = #{id,jdbcType=VARCHAR}
</update>
<select id="listSupplier" resultMap="BaseResultMap" parameterType="map">
select <include refid="Base_Column_List" />
from im_supplier
where 1=1
<if test="keyword != null and keyword !=''">
and name like concat('%',#{keyword},'%')
</if>
<if test="contact != null and contact !=''">
and contact like concat('%',#{contact},'%')
</if>
<if test="contactPhone != null and contactPhone !=''">
and contact_phone like concat('%',#{contactPhone},'%')
</if>
order by create_dt desc
LIMIT ${pageNow}, ${pageSize}
</select>
<select id="totalSupplier" resultType="java.lang.Integer" parameterType="map">
select COUNT(*) from im_supplier
where 1=1
<if test="keyword != null and keyword !=''">
and name like concat('%',#{keyword},'%')
</if>
<if test="contact != null and contact !=''">
and contact like concat('%',#{contact},'%')
</if>
<if test="contactPhone != null and contactPhone !=''">
and contact_phone like concat('%',#{contactPhone},'%')
</if>
<if test="supplierId != null and supplierId !=''">
and supplier_id = #{supplierId}
</if>
</select>
<select id="selectSupplier" resultMap="BaseResultMap">
select <include refid="Base_Column_List" /> from im_supplier order by create_dt desc
</select>
<select id="paperSupplier" resultType="com.sibu.orderHelper.integral.model.IMSupplier" parameterType="com.sibu.orderHelper.integral.request.SupplierCouponRequest">
select <include refid="Base_Column_List" /> from im_supplier WHERE 1 = 1
</select>
<select id="totalPaperSupplier" resultType="java.lang.Integer" parameterType="com.sibu.orderHelper.integral.request.SupplierCouponRequest">
select COUNT(*) from im_supplier WHERE 1 = 1
<if test="supplierId != null and supplierId !=''">
and id = #{supplierId}
</if>
</select>
<select id="paperSupplierByOrderCheckingRequest" resultMap="BaseResultMap" parameterType="com.sibu.orderHelper.integral.request.OrderCheckingRequest" >
select <include refid="Base_Column_List" /> from im_supplier WHERE 1 = 1
<if test="supplierId != null and supplierId !=''">
and id = #{supplierId}
</if>
</select>
</mapper>