AfmsBasicCustomerMapper.xml
7.4 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
<?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.zhonglai.luhui.afms.mapper.AfmsBasicCustomerMapper">
<resultMap type="AfmsBasicCustomer" id="AfmsBasicCustomerResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="customer_type_id" column="customer_type_id" />
<result property="contact_person" column="contact_person" />
<result property="contact_phone" column="contact_phone" />
<result property="contact_address" column="contact_address" />
<result property="taxpayer_identification_number" column="taxpayer_identification_number" />
<result property="bank" column="bank" />
<result property="account_name" column="account_name" />
<result property="account_number" column="account_number" />
<result property="business_license" column="business_license" />
<result property="create_time" column="create_time" />
</resultMap>
<sql id="selectAfmsBasicCustomerVo">
select `id`, `name`, `customer_type_id`, `contact_person`, `contact_phone`, `contact_address`, `taxpayer_identification_number`, `bank`, `account_name`, `account_number`, `business_license`, `create_time` from afms_basic_customer
</sql>
<select id="selectAfmsBasicCustomerList" parameterType="AfmsBasicCustomer" resultMap="AfmsBasicCustomerResult">
<include refid="selectAfmsBasicCustomerVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="customer_type_id != null "> and customer_type_id = #{customer_type_id}</if>
<if test="contact_person != null and contact_person != ''"> and contact_person like concat('%', #{contact_person}, '%')</if>
<if test="contact_phone != null and contact_phone != ''"> and contact_phone like concat('%', #{contact_phone}, '%')</if>
<if test="contact_address != null and contact_address != ''"> and contact_address like concat('%', #{contact_address}, '%')</if>
<if test="taxpayer_identification_number != null and taxpayer_identification_number != ''"> and taxpayer_identification_number like concat('%', #{taxpayer_identification_number}, '%')</if>
<if test="bank != null and bank != ''"> and bank like concat('%', #{bank}, '%')</if>
<if test="account_name != null and account_name != ''"> and account_name like concat('%', #{account_name}, '%')</if>
<if test="account_number != null and account_number != ''"> and account_number like concat('%', #{account_number}, '%')</if>
<if test="business_license != null and business_license != ''"> and business_license like concat('%', #{business_license}, '%')</if>
<if test="params.beginCreate_time != null and params.beginCreate_time != '' and params.endCreate_time != null and params.endCreate_time != ''"> and create_time between #{params.beginCreate_time} and #{params.endCreate_time}</if>
</where>
</select>
<select id="selectAfmsBasicCustomerById" parameterType="Integer" resultMap="AfmsBasicCustomerResult">
<include refid="selectAfmsBasicCustomerVo"/>
where id = #{id}
</select>
<insert id="insertAfmsBasicCustomer" parameterType="AfmsBasicCustomer" useGeneratedKeys="true" keyProperty="id">
insert into afms_basic_customer
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">name,</if>
<if test="customer_type_id != null">customer_type_id,</if>
<if test="contact_person != null and contact_person != ''">contact_person,</if>
<if test="contact_phone != null and contact_phone != ''">contact_phone,</if>
<if test="contact_address != null and contact_address != ''">contact_address,</if>
<if test="taxpayer_identification_number != null and taxpayer_identification_number != ''">taxpayer_identification_number,</if>
<if test="bank != null and bank != ''">bank,</if>
<if test="account_name != null and account_name != ''">account_name,</if>
<if test="account_number != null and account_number != ''">account_number,</if>
<if test="business_license != null and business_license != ''">business_license,</if>
<if test="create_time != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">#{name},</if>
<if test="customer_type_id != null">#{customer_type_id},</if>
<if test="contact_person != null and contact_person != ''">#{contact_person},</if>
<if test="contact_phone != null and contact_phone != ''">#{contact_phone},</if>
<if test="contact_address != null and contact_address != ''">#{contact_address},</if>
<if test="taxpayer_identification_number != null and taxpayer_identification_number != ''">#{taxpayer_identification_number},</if>
<if test="bank != null and bank != ''">#{bank},</if>
<if test="account_name != null and account_name != ''">#{account_name},</if>
<if test="account_number != null and account_number != ''">#{account_number},</if>
<if test="business_license != null and business_license != ''">#{business_license},</if>
<if test="create_time != null">#{create_time},</if>
</trim>
</insert>
<update id="updateAfmsBasicCustomer" parameterType="AfmsBasicCustomer">
update afms_basic_customer
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if>
<if test="customer_type_id != null">customer_type_id = #{customer_type_id},</if>
<if test="contact_person != null and contact_person != ''">contact_person = #{contact_person},</if>
<if test="contact_phone != null and contact_phone != ''">contact_phone = #{contact_phone},</if>
<if test="contact_address != null and contact_address != ''">contact_address = #{contact_address},</if>
<if test="taxpayer_identification_number != null and taxpayer_identification_number != ''">taxpayer_identification_number = #{taxpayer_identification_number},</if>
<if test="bank != null and bank != ''">bank = #{bank},</if>
<if test="account_name != null and account_name != ''">account_name = #{account_name},</if>
<if test="account_number != null and account_number != ''">account_number = #{account_number},</if>
<if test="business_license != null and business_license != ''">business_license = #{business_license},</if>
<if test="create_time != null">create_time = #{create_time},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteAfmsBasicCustomerById" parameterType="Integer">
delete from afms_basic_customer where id = #{id}
</delete>
<delete id="deleteAfmsBasicCustomerByIds" parameterType="String">
delete from afms_basic_customer where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>