CustomerDetailMapper.xml
8.16 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
<?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="cn.com.glsx.entmicro.mapper.CustomerDetailMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.entmicro.entity.CustomerDetail">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="customer_id" jdbcType="INTEGER" property="customerId"/>
<result column="id_card" jdbcType="INTEGER" property="idCard"/>
<result column="audi" jdbcType="VARCHAR" property="audi"/>
<result column="car_type" jdbcType="VARCHAR" property="carType"/>
<result column="buy_date" jdbcType="TIMESTAMP" property="buyDate"/>
<result column="work_uid" jdbcType="CHAR" property="workUid"/>
<result column="del_flag" jdbcType="INTEGER" property="delFlag"/>
<result column="created_by" jdbcType="INTEGER" property="createdBy"/>
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime"/>
<result column="updated_by" jdbcType="INTEGER" property="updatedBy"/>
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime"/>
<result column="maintenance_date" jdbcType="TIMESTAMP" property="maintenanceDate"/>
<result column="arrival_date" jdbcType="TIMESTAMP" property="arrivalDate"/>
<result column="com_insurance_endtime" jdbcType="TIMESTAMP" property="comInsuranceEndtime"/>
<result column="car_Brand" jdbcType="TIMESTAMP" property="carBrand"/>
<result column="car_Vin" jdbcType="TIMESTAMP" property="carVin"/>
<result column="car_number" jdbcType="TIMESTAMP" property="carNumber"/>
<result column="oneId" jdbcType="TIMESTAMP" property="oneId"/>
<result column="car_Brand" jdbcType="TIMESTAMP" property="carBrand"/>
<result column="car_Vin" jdbcType="TIMESTAMP" property="carVin"/>
<result column="car_number" jdbcType="TIMESTAMP" property="carNumber"/>
</resultMap>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
-->
id, customer_id, id_card, audi, car_type, buy_date, work_uid, del_flag, created_by,
created_time, updated_by, updated_time, maintenance_date, arrival_date, com_insurance_endtime,
com_insurance_starttime
</sql>
<update id="batchUpdate">
<foreach collection="datalist" item="item" index="index" open="" close="" separator=";">
update scrm_customer_detail
<trim prefix="set" suffixOverrides=",">
<!--身份证-->
<if test="item.idCard != null and item.idCard !=''">
id_card = #{item.idCard},
</if>
<!--车系-->
<if test="item.audi != null and item.audi !=''">
audi = #{item.audi},
</if>
<!--车型-->
<if test="item.carType != null and item.carType !=''">
car_type = #{item.carType},
</if>
<!--购买时间-->
<if test="item.buyDate != null">
buy_date = #{item.buyDate},
</if>
<!--是否删除-->
<if test="item.delFlag != null">
del_flag = #{item.delFlag},
</if>
<!--更新人-->
<if test="item.updatedBy != null">
updated_by = #{item.updatedBy},
</if>
<!--更新时间-->
<if test="item.updatedTime != null">
updated_time = #{item.updatedTime},
</if>
<!--近期保养日期-->
<if test="item.maintenanceDate != null">
maintenance_date = #{item.maintenanceDate},
</if>
<!--到店日期-->
<if test="item.arrivalDate != null">
arrival_date = #{item.arrivalDate},
</if>
<!--商业险结束日期-->
<if test="item.comInsuranceEndtime != null">
com_insurance_endtime = #{item.comInsuranceEndtime},
</if>
<!--商业险生效日期-->
<if test="item.comInsuranceStarttime != null">
com_insurance_starttime = #{item.comInsuranceStarttime},
</if>
<if test="item.carBrand != null">
car_brand = #{item.carBrand},
</if>
<if test="item.carBrandIds != null">
car_brand_ids = #{item.carBrandIds},
</if>
<if test="item.carVin != null">
car_vin = #{item.carVin},
</if>
<if test="item.carNumber != null">
car_number = #{item.carNumber},
</if>
</trim>
where customer_id = #{item.customerId}
</foreach>
</update>
<update id="updateByCustId" parameterType="cn.com.glsx.entmicro.entity.CustomerDetail">
update scrm_customer_detail
<trim prefix="set" suffixOverrides=",">
<!--身份证-->
<if test="idCard != null and idCard !=''">
`id_card` = #{idCard},
</if>
<!--车系-->
<if test="audi != null and audi !=''">
`audi` = #{audi},
</if>
<!--车型-->
<if test="carType != null and carType !=''">
`car_type` = #{carType},
</if>
<!--购买时间-->
<if test="buyDate != null">
`buy_date` = #{buyDate},
</if>
<!--是否删除-->
<if test="delFlag != null">
`del_flag` = #{delFlag},
</if>
<!--更新人-->
<if test="updatedBy != null">
`updated_by` = #{updatedBy},
</if>
<!--更新时间-->
<if test="updatedTime != null">
`updated_time` = #{updatedTime},
</if>
<!--近期保养日期-->
<if test="maintenanceDate != null">
`maintenance_date` = #{maintenanceDate},
</if>
<!--到店日期-->
<if test="arrivalDate != null">
`arrival_date` = #{arrivalDate},
</if>
<!--商业险结束日期-->
<if test="comInsuranceEndtime != null">
`com_insurance_endtime` = #{comInsuranceEndtime},
</if>
<!--商业险生效日期-->
<if test="comInsuranceStarttime != null">
`com_insurance_starttime` = #{comInsuranceStarttime},
</if>
</trim>
where `customer_id` = #{customerId}
</update>
<select id="selectByCustomerId" resultMap="BaseResultMap">
select * from scrm_customer_detail where `customer_id` = #{customerId}
</select>
<select id="selectByCustomerIds" resultMap="BaseResultMap">
select * from scrm_customer_detail where `customer_id` in
<foreach collection="customerIds" index="index" open="(" close=")" separator="," item="id">
#{id}
</foreach>
</select>
<select id="selectByOneIds" resultMap="BaseResultMap">
select t1.*,t2.one_Id as oneId from scrm_customer_detail t1
left join scrm_customer t2 on t1.customer_id=t2.id
where t2.one_Id in
<foreach collection="oneIds" index="index" open="(" close=")" separator="," item="id">
#{id}
</foreach>
</select>
<!-- <insert id="batchInsert" useGeneratedKeys="true" keyProperty="id">
insert into scrm_customer_detail (`customer_name`,`customer_phone`,`customer_sex`,`created_by`,`created_time`,`del_flag`,`merchantId`,`add_way`)
values
<foreach collection="customers" item="item" index="index" open="" close="" separator=",">
(#{item.customerName}, #{item.customerPhone}, #{item.customerSex}, #{item.createdBy}, #{item.createdTime}, #{item.delFlag}, #{item.merchantid}, #{item.addWay})
</foreach>
</insert>-->
</mapper>