zjh
2024-12-25 79f9fbd9f999e26af3f0bca534d825eb687e092c
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
<?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.ltkj.hosp.mapper.TjCustomerMapper">
 
    <resultMap type="TjCustomer" id="TjCustomerResult">
        <result property="cusId" column="cus_id"/>
        <result property="cusName" column="cus_name"/>
        <result property="cusSex" column="cus_sex"/>
        <result property="cusBrithday" column="cus_brithday"/>
        <result property="cusAddr" column="cus_addr"/>
        <result property="addr" column="addr"/>
        <result property="cusPhone" column="cus_phone"/>
        <result property="cusPassword" column="cus_password"/>
        <result property="cusPostcode" column="cus_postCode"/>
        <result property="cusEmail" column="cus_email"/>
        <result property="indexCard" column="index_card"/>
        <result property="cusNational" column="cus_national"/>
        <result property="cusMarryStatus" column="cus_marry_status"/>
        <result property="cusIdcard" column="cus_idcard"/>
        <result property="cusIntroduce" column="cus_introduce"/>
        <result property="cusNumber" column="cus_number"/>
        <result property="cusIsvip" column="cus_isvip"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="deleted" column="deleted"/>
        <result property="age" column="age"/>
        <result property="idType" column="id_type"/>
        <result property="ageUnit" column="age_unit"/>
        <result property="career" column="career"/>
        <result property="dwPhone" column="dw_phone"/>
        <result property="pym" column="pym"/>
        <result property="dictCompId" column="dict_comp_id"/>
        <result property="compName" column="comp_name"/>
        <result property="hisJzkh" column="his_jzkh"/>
    </resultMap>
 
    <sql id="selectTjCustomerVo">
        select cus_id,
               cus_name,
               cus_sex,
               cus_brithday,
               cus_addr,
               addr,
               cus_phone,
               cus_password,
               cus_postCode,
               cus_email,
               index_card,
               cus_national,
               cus_marry_status,
               cus_idcard,
               cus_introduce,
               cus_number,
               cus_isvip,
               create_by,
               create_time,
               update_by,
               update_time,
               deleted,
               age,
               id_type,
               age_unit,
               career,
               dw_phone,
               pym,dict_comp_id,comp_name,his_jzkh
        from tj_customer
    </sql>
 
    <select id="selectTjCustomerList" parameterType="TjCustomer" resultMap="TjCustomerResult">
        <include refid="selectTjCustomerVo"/>
        <where>
            <if test="cusName != null  and cusName != ''">and cus_name like concat('%', #{cusName}, '%')</if>
            <if test="cusSex != null ">and cus_sex = #{cusSex}</if>
            <if test="cusBrithday != null ">and cus_brithday = #{cusBrithday}</if>
            <if test="cusAddr != null  and cusAddr != ''">and cus_addr = #{cusAddr}</if>
            <if test="addr != null  and addr != ''">and addr = #{addr}</if>
            <if test="cusPhone != null  and cusPhone != ''">and cus_phone = #{cusPhone}</if>
            <if test="cusPostcode != null  and cusPostcode != ''">and cus_postCode = #{cusPostcode}</if>
            <if test="cusEmail != null  and cusEmail != ''">and cus_email = #{cusEmail}</if>
            <if test="indexCard != null  and indexCard != ''">and index_card = #{indexCard}</if>
            <if test="cusNational != null  and cusNational != ''">and cus_national = #{cusNational}</if>
            <if test="cusMarryStatus != null  and cusMarryStatus != ''">and cus_marry_status = #{cusMarryStatus}</if>
            <if test="cusIdcard != null  and cusIdcard != ''">and cus_idcard = #{cusIdcard}</if>
            <if test="cusIntroduce != null  and cusIntroduce != ''">and cus_introduce = #{cusIntroduce}</if>
            <if test="cusNumber != null ">and cus_number = #{cusNumber}</if>
            <if test="cusIsvip != null  and cusIsvip != ''">and cus_isvip = #{cusIsvip}</if>
            <if test="pym != null  and pym != ''">and pym = #{pym}</if>
            <if test="dictCompId != null  and dictCompId != ''">and dict_comp_id = #{dictCompId}</if>
            <if test="compName != null  and compName != ''">and comp_name = #{compName}</if>
        </where>
    </select>
 
    <select id="selectTjCustomerByCusId" parameterType="Long" resultMap="TjCustomerResult">
        <include refid="selectTjCustomerVo"/>
        where cus_id = #{cusId} and deleted = '0'
    </select>
 
    <insert id="insertTjCustomer" parameterType="TjCustomer" useGeneratedKeys="true" keyProperty="cusId">
        insert into tj_customer
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="cusName != null and cusName != ''">cus_name,</if>
            <if test="cusSex != null">cus_sex,</if>
            <if test="cusBrithday != null">cus_brithday,</if>
            <if test="cusAddr != null and cusAddr != ''">cus_addr,</if>
            <if test="addr != null and addr != ''">addr,</if>
            <if test="cusPhone != null and cusPhone != ''">cus_phone,</if>
            <if test="cusPassword != null and cusPassword != ''">cus_password,</if>
            <if test="cusPostcode != null">cus_postCode,</if>
            <if test="cusEmail != null">cus_email,</if>
            <if test="indexCard != null">index_card,</if>
            <if test="cusNational != null and cusNational != ''">cus_national,</if>
            <if test="cusMarryStatus != null">cus_marry_status,</if>
            <if test="cusIdcard != null and cusIdcard != ''">cus_idcard,</if>
            <if test="cusIntroduce != null">cus_introduce,</if>
            <if test="cusNumber != null">cus_number,</if>
            <if test="cusIsvip != null">cus_isvip,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="deleted != null">deleted,</if>
            <if test="age != null">age,</if>
            <if test="idType != null">id_type,</if>
            <if test="ageUnit != null">age_unit,</if>
            <if test="career != null">career,</if>
            <if test="dwPhone != null">dw_phone,</if>
            <if test="pym != null">pym,</if>
            <if test="dictCompId != null">dict_comp_id,</if>
            <if test="compName != null">comp_name,</if>
            <if test="hisJzkh != null">his_jzkh,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="cusName != null and cusName != ''">#{cusName},</if>
            <if test="cusSex != null">#{cusSex},</if>
            <if test="cusBrithday != null">#{cusBrithday},</if>
            <if test="cusAddr != null and cusAddr != ''">#{cusAddr},</if>
            <if test="addr != null and addr != ''">#{addr},</if>
            <if test="cusPhone != null and cusPhone != ''">#{cusPhone},</if>
            <if test="cusPassword != null and cusPassword != ''">#{cusPassword},</if>
            <if test="cusPostcode != null">#{cusPostcode},</if>
            <if test="cusEmail != null">#{cusEmail},</if>
            <if test="indexCard != null">#{indexCard},</if>
            <if test="cusNational != null and cusNational != ''">#{cusNational},</if>
            <if test="cusMarryStatus != null">#{cusMarryStatus},</if>
            <if test="cusIdcard != null and cusIdcard != ''">#{cusIdcard},</if>
            <if test="cusIntroduce != null">#{cusIntroduce},</if>
            <if test="cusNumber != null">#{cusNumber},</if>
            <if test="cusIsvip != null">#{cusIsvip},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="deleted != null">#{deleted},</if>
            <if test="age != null">#{age},</if>
            <if test="idType != null">#{idType},</if>
            <if test="ageUnit != null">#{ageUnit},</if>
            <if test="career != null">#{career},</if>
            <if test="dw_phone != null">#{dwPhone},</if>
            <if test="pym != null">#{pym},</if>
            <if test="dictCompId != null">#{dictCompId},</if>
            <if test="compName != null">#{compName},</if>
            <if test="hisJzkh != null">#{hisJzkh},</if>
        </trim>
    </insert>
 
    <update id="updateTjCustomer" parameterType="TjCustomer">
        update tj_customer
        <trim prefix="SET" suffixOverrides=",">
            <if test="cusName != null and cusName != ''">cus_name = #{cusName},</if>
            <if test="cusSex != null">cus_sex = #{cusSex},</if>
            <if test="cusBrithday != null">cus_brithday = #{cusBrithday},</if>
            <if test="cusAddr != null and cusAddr != ''">cus_addr = #{cusAddr},</if>
            <if test="addr != null and addr != ''">addr = #{addr},</if>
            <if test="cusPhone != null and cusPhone != ''">cus_phone = #{cusPhone},</if>
            <if test="cusPassword != null and cusPassword != ''">cus_password = #{cusPassword},</if>
            <if test="cusPostcode != null">cus_postCode = #{cusPostcode},</if>
            <if test="cusEmail != null">cus_email = #{cusEmail},</if>
            <if test="indexCard != null">index_card = #{indexCard},</if>
            <if test="cusNational != null and cusNational != ''">cus_national = #{cusNational},</if>
            <if test="cusMarryStatus != null">cus_marry_status = #{cusMarryStatus},</if>
            <if test="cusIdcard != null and cusIdcard != ''">cus_idcard = #{cusIdcard},</if>
            <if test="cusIntroduce != null">cus_introduce = #{cusIntroduce},</if>
            <if test="cusNumber != null">cus_number = #{cusNumber},</if>
            <if test="cusIsvip != null">cus_isvip = #{cusIsvip},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="deleted != null">deleted = #{deleted},</if>
            <if test="age != null">age = #{age},</if>
            <if test="idType != null">id_type = #{idType},</if>
            <if test="ageUnit != null">age_unit = #{ageUnit},</if>
            <if test="career != null">career = #{career},</if>
            <if test="dwPhone != null">dw_phone = #{dwPhone},</if>
            <if test="pym != null">pym = #{pym},</if>
            <if test="dictCompId != null">dict_comp_id = #{dictCompId},</if>
            <if test="compName != null">comp_name = #{compName},</if>
            <if test="hisJzkh != null">his_jzkh = #{hisJzkh},</if>
        </trim>
        where cus_id = #{cusId}
    </update>
 
    <delete id="deleteTjCustomerByCusId" parameterType="Long">
        delete
        from tj_customer
        where cus_id = #{cusId}
    </delete>
 
    <delete id="deleteTjCustomerByCusIds" parameterType="String">
        delete from tj_customer where cus_id in
        <foreach item="cusId" collection="array" open="(" separator="," close=")">
            #{cusId}
        </foreach>
    </delete>
</mapper>