TdCCarSMapper.xml
8.74 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
<?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.zteits.pay.mapper.smapper.TdCCarSMapper" >
<resultMap id="BaseResultMap" type="com.zteits.pay.domain.TdCCar">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="cust_id" jdbcType="VARCHAR" property="custId" />
<result column="car_number" jdbcType="VARCHAR" property="carNumber" />
<result column="car_model_id" jdbcType="INTEGER" property="carModelId" />
<result column="car_number_color" jdbcType="INTEGER" property="carNumberColor" />
<result column="plate_type_id" jdbcType="INTEGER" property="plateTypeId" />
<result column="car_brand_id" jdbcType="INTEGER" property="carBrandId" />
<result column="car_shelf_num" jdbcType="VARCHAR" property="carShelfNum" />
<result column="car_engine_num" jdbcType="VARCHAR" property="carEngineNum" />
<result column="phone_number" jdbcType="VARCHAR" property="phoneNumber" />
<result column="car_binding_status" jdbcType="INTEGER" property="carBindingStatus" />
<result column="data_state" jdbcType="INTEGER" property="dataState" />
<result column="create_empid" jdbcType="VARCHAR" property="createEmpid" />
<result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
<result column="modfiy_empid" jdbcType="VARCHAR" property="modfiyEmpid" />
<result column="modfiy_date" jdbcType="TIMESTAMP" property="modfiyDate" />
<result column="examine_state" jdbcType="INTEGER" property="examineState" />
<result column="cer_picture_path" jdbcType="VARCHAR" property="cerPicturePath" />
</resultMap>
<sql id="Base_Column_List">
id, cust_id, car_number,car_number_color, car_model_id, plate_type_id, car_brand_id, car_shelf_num,
car_engine_num, phone_number, car_binding_status, data_state, create_empid, create_date,
modfiy_empid, modfiy_date, examine_state, cer_picture_path
</sql>
<select id="selectCustInfoBycustId" resultMap="BaseResultMap" parameterType="com.zteits.clouds.api.dto.pay.param.TdCCarRequest" >
select
<include refid="Base_Column_List" />
from td_c_car
where cust_id = #{custId,jdbcType=VARCHAR}
<if test="examineState != null">
and examine_state = #{examineState,jdbcType=INTEGER}
</if>
<if test="carNumberColor != null">
and car_number_color = #{carNumberColor,jdbcType=INTEGER}
</if>
and data_state = 1
</select>
<select id="selectCustInfoBycustIds" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
from td_c_car
where data_state = 1
<if test="custIds != null and custIds.size > 0">
and cust_id in
<foreach collection="custIds" open="(" close=")" item="custId" separator=",">
#{custId}
</foreach>
</if>
</select>
<select id="selectCustInfo" resultMap="BaseResultMap" parameterType="com.zteits.pay.domain.TdCCar" >
select
<include refid="Base_Column_List" />
from td_c_car
where data_state = 1
<if test="custId != null" >
and cust_id = #{custId,jdbcType=VARCHAR}
</if>
<if test="carNumber != null" >
and car_number = #{carNumber,jdbcType=VARCHAR}
</if>
<if test="carNumberColor != null">
and car_number_color = #{carNumberColor,jdbcType=INTEGER}
</if>
</select>
<update id="updateCars" parameterType="com.zteits.pay.domain.TdCCar" >
update td_c_car
<set >
<if test="record.custId != null">
cust_id = #{record.custId,jdbcType=VARCHAR},
</if>
<if test="record.carNumber != null">
car_number = #{record.carNumber,jdbcType=VARCHAR},
</if>
<if test="record.carModelId != null">
car_model_id = #{record.carModelId,jdbcType=INTEGER},
</if>
<if test="record.plateTypeId != null">
plate_type_id = #{record.plateTypeId,jdbcType=INTEGER},
</if>
<if test="record.carBrandId != null">
car_brand_id = #{record.carBrandId,jdbcType=INTEGER},
</if>
<if test="record.carShelfNum != null">
car_shelf_num = #{record.carShelfNum,jdbcType=VARCHAR},
</if>
<if test="record.carEngineNum != null">
car_engine_num = #{record.carEngineNum,jdbcType=VARCHAR},
</if>
<if test="record.phoneNumber != null">
phone_number = #{record.phoneNumber,jdbcType=VARCHAR},
</if>
<if test="record.carBindingStatus != null">
car_binding_status = #{record.carBindingStatus,jdbcType=INTEGER},
</if>
<if test="record.dataState != null">
data_state = #{record.dataState,jdbcType=INTEGER},
</if>
<if test="record.createEmpid != null">
create_empid = #{record.createEmpid,jdbcType=VARCHAR},
</if>
<if test="record.createDate != null">
create_date = #{record.createDate,jdbcType=TIMESTAMP},
</if>
<if test="record.modfiyEmpid != null">
modfiy_empid = #{record.modfiyEmpid,jdbcType=VARCHAR},
</if>
<if test="record.modfiyDate != null">
modfiy_date = #{record.modfiyDate,jdbcType=TIMESTAMP},
</if>
<if test="record.examineState != null">
examine_state = #{record.examineState,jdbcType=INTEGER},
</if>
<if test="record.cerPicturePath != null">
cer_picture_path = #{record.cerPicturePath,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<delete id="deleteCars" parameterType="java.lang.Long" >
update td_c_car
<set>
data_state = 0,
<if test="createEmpid != null" >
create_empid = #{createEmpid,jdbcType=VARCHAR},
</if>
<if test="createDate != null" >
create_date = #{createDate,jdbcType=TIMESTAMP},
</if>
<if test="modfiyEmpid != null" >
modfiy_empid = #{modfiyEmpid,jdbcType=VARCHAR},
</if>
<if test="modfiyDate != null" >
modfiy_date = #{modfiyDate,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insertCars" parameterType="com.zteits.pay.domain.TdCCar" >
<selectKey resultType="java.lang.Long" keyProperty="id" order="AFTER" >
SELECT LAST_INSERT_ID()
</selectKey>
insert into td_c_car (cust_id, car_number, car_model_id,
plate_type_id, car_brand_id, car_shelf_num,
car_engine_num, phone_number, car_binding_status,
data_state, create_empid, create_date,
modfiy_empid, modfiy_date, examine_state,
cer_picture_path)
values (#{custId,jdbcType=VARCHAR}, #{carNumber,jdbcType=VARCHAR}, #{carModelId,jdbcType=INTEGER},
#{plateTypeId,jdbcType=INTEGER}, #{carBrandId,jdbcType=INTEGER}, #{carShelfNum,jdbcType=VARCHAR},
#{carEngineNum,jdbcType=VARCHAR}, #{phoneNumber,jdbcType=VARCHAR}, #{carBindingStatus,jdbcType=INTEGER},
#{dataState,jdbcType=INTEGER}, #{createEmpid,jdbcType=VARCHAR}, #{createDate,jdbcType=TIMESTAMP},
#{modfiyEmpid,jdbcType=VARCHAR}, #{modfiyDate,jdbcType=TIMESTAMP}, #{examineState,jdbcType=INTEGER},
#{cerPicturePath,jdbcType=VARCHAR})
</insert>
<!-- 分页查询车辆审核信息(添加用户电话) -->
<select id="queryUserCarInfoForPageAndPN" parameterType="com.zteits.clouds.api.dto.pay.car.param.UserCarInfoQueryForPageReq"
resultType="com.zteits.clouds.api.dto.pay.TdCCarDTO">
select
a.id id,
a.cust_id custId,
a.car_number carNumber,
a.car_model_id carModelId,
a.plate_type_id plateTypeId,
a.car_brand_id carBrandId,
a.car_shelf_num carShelfNum,
a.car_engine_num carEngineNum,
a.phone_number phoneNumber,
a.car_binding_status carBindingStatus,
a.data_state dataState,
a.create_empid createEmpid,
a.create_date createDate,
a.modfiy_empid modfiyEmpid,
a.modfiy_date modfiyDate,
a.examine_state examineState,
a.cer_picture_path cerPicturePath,
b.user_phone userPhone
from td_c_car a
left join td_c_cust_person b on a.cust_id=b.cust_id
where a.data_state = 1
<if test="phoneNum != null and phoneNum != ''">
and b.user_phone = #{phoneNum,jdbcType=VARCHAR}
</if>
<if test="carNumber != null and carNumber != ''">
and a.car_number = #{carNumber,jdbcType=VARCHAR}
</if>
<if test="carNumbers != null and carNumbers.size > 0 ">
and a.car_number in
<foreach collection="carNumbers" open="(" close=")" item="carNumber" separator=",">
#{carNumber}
</foreach>
</if>
<if test="carBindingStatus != null ">
and a.car_binding_status = #{carBindingStatus}
</if>
<if test="examineStates != null and examineStates.size > 0">
and a.examine_state in
<foreach collection="examineStates" open="(" close=")" item="examineState" separator=",">
#{examineState}
</foreach>
</if>
order by a.modfiy_date desc,a.create_date desc
</select>
</mapper>