linzhijie
2021-04-12 c632636e2f5b4188b430f5efc9d9f68c8dbe3d6d
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
<?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.ots.project.exam.mapper.SysUserExtendMapper">
    
    <resultMap type="SysUserExtend" id="SysUserExtendResult">
        <result property="userId"    column="user_id"    />
        <result property="parentUserId"    column="parent_user_id"    />
        <result property="legalPerson"    column="legal_person"    />
        <result property="address"    column="address"    />
        <result property="contractText"    column="contract_text"    />
        <result property="contractScope"    column="contract_scope"    />
        <result property="effectTime"    column="effect_time"    />
        <result property="invalidTime"    column="invalid_time"    />
        <result property="companySize"    column="company_size"    />
        <result property="businessLicense"    column="business_license"    />
        <result property="businessManager"    column="business_manager"    />
        <result property="businessLogo"    column="business_logo"    />
        <result property="testNum"    column="test_num"    />
        <result property="hrEmail"    column="hr_email"    />
        <result property="sendReport"    column="send_report"    />
        <result property="mailContent"    column="mail_content"    />
        <result property="hrReportType"    column="hr_report_type"    />
        <result property="langType"    column="lang_type"    />
        <result property="loginName"    column="login_name"    />
        <result property="userName"    column="user_name"    />
        <result property="password"    column="password"    />
        <result property="userType"    column="user_type"    />
        <result property="firstLevel"    column="firstLevel"    />
        <result property="contactPerson"    column="contactPerson"    />
        <result property="contactEmail"    column="contactEmail"    />
    </resultMap>
 
    <sql id="selectSysUserExtendVo">
        select e.user_id, parent_user_id ,legal_person, address, contract_text, contract_scope, effect_time, invalid_time, company_size, business_license, business_manager, business_logo, test_num, hr_email, send_report, mail_content, hr_report_type, lang_type
        ,login_name,user_name,password,user_type,phonenumber,e.firstLevel,e.contactPerson,e.contactEmail
        from sys_user_extend e
        left join sys_user u on u.user_id = e.user_id
    </sql>
 
    <select id="selectSysUserExtendList" parameterType="SysUserExtend" resultMap="SysUserExtendResult">
        <include refid="selectSysUserExtendVo"/>
        <where>  
            <if test="legalPerson != null  and legalPerson != ''"> and legal_person = #{legalPerson}</if>
            <if test="userName != null  and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
            <if test="loginName != null  and loginName != ''"> and login_name = #{loginName}</if>
            <if test="phonenumber != null  and phonenumber != ''"> and phonenumber = #{phonenumber}</if>
            <if test="parentUserId != null  and parentUserId != ''"> and parent_user_id = #{parentUserId}</if>
            <if test="address != null  and address != ''"> and address = #{address}</if>
            <if test="contractText != null  and contractText != ''"> and contract_text = #{contractText}</if>
            <if test="contractScope != null  and contractScope != ''"> and contract_scope = #{contractScope}</if>
            <if test="effectTime != null "> and effect_time = #{effectTime}</if>
            <if test="invalidTime != null "> and invalid_time = #{invalidTime}</if>
            <if test="companySize != null "> and company_size = #{companySize}</if>
            <if test="businessLicense != null  and businessLicense != ''"> and business_license = #{businessLicense}</if>
            <if test="businessManager != null  and businessManager != ''"> and business_manager = #{businessManager}</if>
            <if test="businessLogo != null  and businessLogo != ''"> and business_logo = #{businessLogo}</if>
            <if test="testNum != null "> and test_num = #{testNum}</if>
            <if test="hrEmail != null  and hrEmail != ''"> and hr_email = #{hrEmail}</if>
            <if test="sendReport != null  and sendReport != ''"> and send_report = #{sendReport}</if>
            <if test="mailContent != null  and mailContent != ''"> and mail_content = #{mailContent}</if>
            <if test="hrReportType != null  and hrReportType != ''"> and hr_report_type = #{hrReportType}</if>
            <if test="langType != null  and langType != ''"> and lang_type = #{langType}</if>
            <if test="userType != null">and user_type = #{userType}</if>
            <if test="userId != null">and u.user_id = #{userId}</if>
            <if test="firstLevel != null">and firstLevel = #{firstLevel}</if>
        </where>
    </select>
    
    <select id="selectSysUserExtendById" parameterType="Long" resultMap="SysUserExtendResult">
        <include refid="selectSysUserExtendVo"/>
        where e.user_id = #{userId}
    </select>
        
    <insert id="insertSysUserExtend" parameterType="SysUserExtend">
        insert into sys_user_extend
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="userId != null ">user_id,</if>
            <if test="parentUserId != null ">parent_user_id,</if>
            <if test="legalPerson != null  and legalPerson != ''">legal_person,</if>
            <if test="address != null  and address != ''">address,</if>
            <if test="contractText != null  and contractText != ''">contract_text,</if>
            <if test="contractScope != null  and contractScope != ''">contract_scope,</if>
            <if test="effectTime != null ">effect_time,</if>
            <if test="invalidTime != null ">invalid_time,</if>
            <if test="companySize != null ">company_size,</if>
            <if test="businessLicense != null  and businessLicense != ''">business_license,</if>
            <if test="businessManager != null  and businessManager != ''">business_manager,</if>
            <if test="businessLogo != null  and businessLogo != ''">business_logo,</if>
            <if test="testNum != null ">test_num,</if>
            <if test="hrEmail != null  and hrEmail != ''">hr_email,</if>
            <if test="sendReport != null  and sendReport != ''">send_report,</if>
            <if test="mailContent != null  and mailContent != ''">mail_content,</if>
            <if test="hrReportType != null  and hrReportType != ''">hr_report_type,</if>
            <if test="langType != null  and langType != ''">lang_type,</if>
            <if test="firstLevel != null  and firstLevel != ''">firstLevel,</if>
            <if test="contactPerson != null  and contactPerson != ''">contactPerson,</if>
            <if test="contactEmail != null  and contactEmail != ''">contactEmail,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="userId != null ">#{userId},</if>
            <if test="parentUserId != null ">#{parentUserId},</if>
            <if test="legalPerson != null  and legalPerson != ''">#{legalPerson},</if>
            <if test="address != null  and address != ''">#{address},</if>
            <if test="contractText != null  and contractText != ''">#{contractText},</if>
            <if test="contractScope != null  and contractScope != ''">#{contractScope},</if>
            <if test="effectTime != null ">#{effectTime},</if>
            <if test="invalidTime != null ">#{invalidTime},</if>
            <if test="companySize != null ">#{companySize},</if>
            <if test="businessLicense != null  and businessLicense != ''">#{businessLicense},</if>
            <if test="businessManager != null  and businessManager != ''">#{businessManager},</if>
            <if test="businessLogo != null  and businessLogo != ''">#{businessLogo},</if>
            <if test="testNum != null ">#{testNum},</if>
            <if test="hrEmail != null  and hrEmail != ''">#{hrEmail},</if>
            <if test="sendReport != null  and sendReport != ''">#{sendReport},</if>
            <if test="mailContent != null  and mailContent != ''">#{mailContent},</if>
            <if test="hrReportType != null  and hrReportType != ''">#{hrReportType},</if>
            <if test="langType != null  and langType != ''">#{langType},</if>
            <if test="firstLevel != null  and firstLevel != ''">#{firstLevel},</if>
            <if test="contactPerson != null  and contactPerson != ''">#{contactPerson},</if>
            <if test="contactEmail != null  and contactEmail != ''">#{contactEmail},</if>
         </trim>
    </insert>
 
    <update id="updateSysUserExtend" parameterType="SysUserExtend">
        update sys_user_extend
        <trim prefix="SET" suffixOverrides=",">
            <if test="legalPerson != null  and legalPerson != ''">legal_person = #{legalPerson},</if>
            <if test="parentUserId != null  and parentUserId != ''">parent_user_id = #{parentUserId},</if>
            <if test="address != null  and address != ''">address = #{address},</if>
            <if test="contractText != null  and contractText != ''">contract_text = #{contractText},</if>
            <if test="contractScope != null  and contractScope != ''">contract_scope = #{contractScope},</if>
            <if test="effectTime != null ">effect_time = #{effectTime},</if>
            <if test="invalidTime != null ">invalid_time = #{invalidTime},</if>
            <if test="companySize != null ">company_size = #{companySize},</if>
            <if test="businessLicense != null  and businessLicense != ''">business_license = #{businessLicense},</if>
            <if test="businessManager != null  and businessManager != ''">business_manager = #{businessManager},</if>
            <if test="businessLogo != null  and businessLogo != ''">business_logo = #{businessLogo},</if>
            <if test="testNum != null ">test_num = #{testNum},</if>
            <if test="hrEmail != null  and hrEmail != ''">hr_email = #{hrEmail},</if>
            <if test="sendReport != null  and sendReport != ''">send_report = #{sendReport},</if>
            <if test="mailContent != null  and mailContent != ''">mail_content = #{mailContent},</if>
            <if test="hrReportType != null  and hrReportType != ''">hr_report_type = #{hrReportType},</if>
            <if test="langType != null  and langType != ''">lang_type = #{langType},</if>
            <if test="firstLevel != null  and firstLevel != ''">firstLevel = #{firstLevel},</if>
            <if test="contactPerson != null  and contactPerson != ''">contactPerson = #{contactPerson},</if>
            <if test="contactEmail != null  and contactEmail != ''">contactEmail = #{contactEmail},</if>
        </trim>
        where user_id = #{userId}
    </update>
 
    <delete id="deleteSysUserExtendById" parameterType="Long">
        delete from sys_user_extend where user_id = #{userId}
    </delete>
 
    <delete id="deleteSysUserExtendByIds" parameterType="String">
        delete from sys_user_extend where user_id in 
        <foreach item="userId" collection="array" open="(" separator="," close=")">
            #{userId}
        </foreach>
    </delete>
    
</mapper>