<?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.xunmei.system.mapper.SysUserInformationMapper">

    <resultMap type="com.xunmei.system.api.domain.SysUserInformation" id="SysUserInformationResult">
                <result property="id" column="id"/>
                <result property="userId" column="user_id"/>
                <result property="deptId" column="dept_id"/>
                <result property="duties" column="duties"/>
                <result property="workType" column="work_type"/>
                <result property="isFullTime" column="is_full_time"/>
                <result property="highestEducation" column="highest_education"/>
                <result property="educationType" column="education_type"/>
                <result property="certificateWork" column="certificate_work"/>
                <result property="professionalQualifications" column="professional_qualifications"/>
                <result property="certificateFailReason" column="certificate_fail_reason"/>
                <result property="workTime" column="work_time"/>
                <result property="entryTime" column="entry_time"/>
                <result property="bornTime" column="born_time"/>
                <result property="responsibilitiesLeaderName" column="responsibilities_leader_name"/>
                <result property="responsibilitiesLeaderDuties" column="responsibilities_leader_duties"/>
                <result property="qualificationCertificateUrl" column="qualification_certificate_url"/>
                <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="delFlag" column="del_flag"/>
    </resultMap>

    <sql id="selectSysUserInformationVo">
        select id, user_id, dept_id, duties, work_type, is_full_time, highest_education, education_type, certificate_work, professional_qualifications, certificate_fail_reason, work_time, entry_time, born_time, responsibilities_leader_name, responsibilities_leader_duties, qualification_certificate_url, create_by, create_time, update_by, update_time, del_flag
        from sys_user_information
    </sql>

    <select id="selectSysUserInformationList" parameterType="com.xunmei.system.api.domain.SysUserInformation"
            resultMap="SysUserInformationResult">
        <include refid="selectSysUserInformationVo"/>
        <where>
                        <if test="userId != null ">
                            and user_id = #{userId}
                        </if>
                        <if test="deptId != null ">
                            and dept_id = #{deptId}
                        </if>
                        <if test="duties != null ">
                            and duties = #{duties}
                        </if>
                        <if test="workType != null  and workType != ''">
                            and work_type = #{workType}
                        </if>
                        <if test="isFullTime != null  and isFullTime != ''">
                            and is_full_time = #{isFullTime}
                        </if>
                        <if test="highestEducation != null  and highestEducation != ''">
                            and highest_education = #{highestEducation}
                        </if>
                        <if test="educationType != null  and educationType != ''">
                            and education_type = #{educationType}
                        </if>
                        <if test="certificateWork != null  and certificateWork != ''">
                            and certificate_work = #{certificateWork}
                        </if>
                        <if test="professionalQualifications != null  and professionalQualifications != ''">
                            and professional_qualifications = #{professionalQualifications}
                        </if>
                        <if test="certificateFailReason != null  and certificateFailReason != ''">
                            and certificate_fail_reason = #{certificateFailReason}
                        </if>
                        <if test="workTime != null ">
                            and work_time = #{workTime}
                        </if>
                        <if test="entryTime != null ">
                            and entry_time = #{entryTime}
                        </if>
                        <if test="bornTime != null ">
                            and born_time = #{bornTime}
                        </if>
                        <if test="responsibilitiesLeaderName != null  and responsibilitiesLeaderName != ''">
                            and responsibilities_leader_name like concat('%', #{responsibilitiesLeaderName}, '%')
                        </if>
                        <if test="responsibilitiesLeaderDuties != null  and responsibilitiesLeaderDuties != ''">
                            and responsibilities_leader_duties = #{responsibilitiesLeaderDuties}
                        </if>
                        <if test="qualificationCertificateUrl != null  and qualificationCertificateUrl != ''">
                            and qualification_certificate_url = #{qualificationCertificateUrl}
                        </if>
        </where>
    </select>

    <select id="selectSysUserInformationById" parameterType="Long"
            resultMap="SysUserInformationResult">
            <include refid="selectSysUserInformationVo"/>
            where id = #{id}
    </select>
    <select id="getInformationByUserId" resultType="com.xunmei.system.api.domain.SysUserInformation">
        <include refid="selectSysUserInformationVo"/>
        WHERE
            user_id=#{userId}
    </select>

    <insert id="insertSysUserInformation" parameterType="com.xunmei.system.api.domain.SysUserInformation">
        insert into sys_user_information
        <trim prefix="(" suffix=")" suffixOverrides=",">
                    <if test="id != null">id,
                    </if>
                    <if test="userId != null">user_id,
                    </if>
                    <if test="deptId != null">dept_id,
                    </if>
                    <if test="duties != null">duties,
                    </if>
                    <if test="workType != null">work_type,
                    </if>
                    <if test="isFullTime != null">is_full_time,
                    </if>
                    <if test="highestEducation != null">highest_education,
                    </if>
                    <if test="educationType != null">education_type,
                    </if>
                    <if test="certificateWork != null">certificate_work,
                    </if>
                    <if test="professionalQualifications != null">professional_qualifications,
                    </if>
                    <if test="certificateFailReason != null">certificate_fail_reason,
                    </if>
                    <if test="workTime != null">work_time,
                    </if>
                    <if test="entryTime != null">entry_time,
                    </if>
                    <if test="bornTime != null">born_time,
                    </if>
                    <if test="responsibilitiesLeaderName != null">responsibilities_leader_name,
                    </if>
                    <if test="responsibilitiesLeaderDuties != null">responsibilities_leader_duties,
                    </if>
                    <if test="qualificationCertificateUrl != null">qualification_certificate_url,
                    </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="delFlag != null">del_flag,
                    </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
                    <if test="id != null">#{id},
                    </if>
                    <if test="userId != null">#{userId},
                    </if>
                    <if test="deptId != null">#{deptId},
                    </if>
                    <if test="duties != null">#{duties},
                    </if>
                    <if test="workType != null">#{workType},
                    </if>
                    <if test="isFullTime != null">#{isFullTime},
                    </if>
                    <if test="highestEducation != null">#{highestEducation},
                    </if>
                    <if test="educationType != null">#{educationType},
                    </if>
                    <if test="certificateWork != null">#{certificateWork},
                    </if>
                    <if test="professionalQualifications != null">#{professionalQualifications},
                    </if>
                    <if test="certificateFailReason != null">#{certificateFailReason},
                    </if>
                    <if test="workTime != null">#{workTime},
                    </if>
                    <if test="entryTime != null">#{entryTime},
                    </if>
                    <if test="bornTime != null">#{bornTime},
                    </if>
                    <if test="responsibilitiesLeaderName != null">#{responsibilitiesLeaderName},
                    </if>
                    <if test="responsibilitiesLeaderDuties != null">#{responsibilitiesLeaderDuties},
                    </if>
                    <if test="qualificationCertificateUrl != null">#{qualificationCertificateUrl},
                    </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="delFlag != null">#{delFlag},
                    </if>
        </trim>
    </insert>

    <update id="updateSysUserInformation" parameterType="com.xunmei.system.api.domain.SysUserInformation">
        update sys_user_information
        <trim prefix="SET" suffixOverrides=",">
                    <if test="userId != null">user_id =
                        #{userId},
                    </if>
                    <if test="deptId != null">dept_id =
                        #{deptId},
                    </if>
                    <if test="duties != null">duties =
                        #{duties},
                    </if>
                    <if test="workType != null">work_type =
                        #{workType},
                    </if>
                    <if test="isFullTime != null">is_full_time =
                        #{isFullTime},
                    </if>
                    <if test="highestEducation != null">highest_education =
                        #{highestEducation},
                    </if>
                    <if test="educationType != null">education_type =
                        #{educationType},
                    </if>
                    <if test="certificateWork != null">certificate_work =
                        #{certificateWork},
                    </if>
                    <if test="professionalQualifications != null">professional_qualifications =
                        #{professionalQualifications},
                    </if>
                    <if test="certificateFailReason != null">certificate_fail_reason =
                        #{certificateFailReason},
                    </if>
                    <if test="workTime != null">work_time =
                        #{workTime},
                    </if>
                    <if test="entryTime != null">entry_time =
                        #{entryTime},
                    </if>
                    <if test="bornTime != null">born_time =
                        #{bornTime},
                    </if>
                    <if test="responsibilitiesLeaderName != null">responsibilities_leader_name =
                        #{responsibilitiesLeaderName},
                    </if>
                    <if test="responsibilitiesLeaderDuties != null">responsibilities_leader_duties =
                        #{responsibilitiesLeaderDuties},
                    </if>
                    <if test="qualificationCertificateUrl != null">qualification_certificate_url =
                        #{qualificationCertificateUrl},
                    </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="delFlag != null">del_flag =
                        #{delFlag},
                    </if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteSysUserInformationById" parameterType="Long">
        delete
        from sys_user_information where id = #{id}
    </delete>

    <delete id="deleteSysUserInformationByIds" parameterType="String">
        delete from sys_user_information where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>