<?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.goldenwater.slaj.sins.mapper.ObjExpertMapper">
    <resultMap type="com.goldenwater.slaj.sins.domain.ObjExpert" id="ObjExpertResult">
        <result property="guid" column="guid"/>
        <result property="persGuid" column="pers_guid"/>
        <result property="citNum" column="cit_num"/>
        <result property="persName" column="pers_name"/>
        <result property="orgGuid" column="org_guid"/>
        <result property="sex" column="sex"/>
        <result property="bornDate" column="born_date"/>
        <result property="major" column="major"/>
        <result property="curMajor" column="cur_major"/>
        <result property="curMajorYear" column="cur_major_year"/>
        <result property="admDuty" column="adm_duty"/>
        <result property="techTit" column="tech_tit"/>
        <result property="poafCode" column="poaf_code"/>
        <result property="addr" column="addr"/>
        <result property="zip" column="zip"/>
        <result property="offiTel" column="offi_tel"/>
        <result property="moph" column="moph"/>
        <result property="homeTel" column="home_tel"/>
        <result property="expertGrad" column="expert_grad"/>
        <result property="expertResid" column="expert_resid"/>
        <result property="workResum" column="work_resum"/>
        <result property="winsJobEava" column="wins_job_eava"/>
        <result property="applInsPost" column="appl_ins_post"/>
        <result property="sinsExpertType" column="sins_expert_type"/>
        <result property="sinsJobEava" column="sins_job_eava"/>
        <result property="bankCode" column="bank_code"/>
        <result property="bankDepo" column="bank_depo"/>
        <result property="bankCardNum" column="bank_card_num"/>
        <result property="note" column="note"/>
        <result property="collTime" column="coll_time"/>
        <result property="updTime" column="upd_time"/>
        <result property="recPers" column="rec_pers"/>
    </resultMap>

    <sql id="selectObjExpertVo">
        select guid, pers_guid, cit_num, pers_name, org_guid, sex, born_date, major, cur_major, cur_major_year, adm_duty, tech_tit, poaf_code, addr, zip, offi_tel, moph, home_tel, expert_grad, expert_resid, work_resum, wins_job_eava, appl_ins_post, sins_expert_type, sins_job_eava, bank_code, bank_depo, bank_card_num, note, coll_time, upd_time, rec_pers from obj_expert
    </sql>

    <select id="selectObjExpertByGuid" parameterType="String" resultMap="ObjExpertResult">
        <include refid="selectObjExpertVo"/> where guid = #{guid}
    </select>

    <select id="selectObjExpertList" parameterType="com.goldenwater.slaj.sins.domain.ObjExpert" resultMap="ObjExpertResult">
        <include refid="selectObjExpertVo"/>
        <where>
            <if test="persName != null and persName != ''">
                and pers_name like '%' || #{persName} || '%'
            </if>
            <if test="major != null and major != ''">
                and major like '%' || #{major} || '%'
            </if>
            <if test="expertGrad != null and expertGrad != ''">
                and expert_grad = #{expertGrad}
            </if>
            <if test="sinsExpertType != null and sinsExpertType != ''">
                and sins_expert_type = #{sinsExpertType}
            </if>
        </where>
    </select>

    <insert id="insertObjExpert" parameterType="com.goldenwater.slaj.sins.domain.ObjExpert">
        insert into obj_expert (guid, pers_guid, cit_num, pers_name, org_guid, sex, born_date, major, cur_major, cur_major_year, adm_duty, tech_tit, poaf_code, addr, zip, offi_tel, moph, home_tel, expert_grad, expert_resid, work_resum, wins_job_eava, appl_ins_post, sins_expert_type, sins_job_eava, bank_code, bank_depo, bank_card_num, note, coll_time, upd_time, rec_pers)
        values (#{guid}, #{persGuid}, #{citNum}, #{persName}, #{orgGuid}, #{sex}, #{bornDate}, #{major}, #{curMajor}, #{curMajorYear}, #{admDuty}, #{techTit}, #{poafCode}, #{addr}, #{zip}, #{offiTel}, #{moph}, #{homeTel}, #{expertGrad}, #{expertResid}, #{workResum}, #{winsJobEava}, #{applInsPost}, #{sinsExpertType}, #{sinsJobEava}, #{bankCode}, #{bankDepo}, #{bankCardNum}, #{note}, #{collTime}, #{updTime}, #{recPers})
    </insert>

    <update id="updateObjExpert" parameterType="com.goldenwater.slaj.sins.domain.ObjExpert">
        update obj_expert
        <set>
            <if test="persGuid != null and persGuid != ''">pers_guid = #{persGuid},</if>
            <if test="citNum != null and citNum != ''">cit_num = #{citNum},</if>
            <if test="persName != null and persName != ''">pers_name = #{persName},</if>
            <if test="orgGuid != null and orgGuid != ''">org_guid = #{orgGuid},</if>
            <if test="sex != null and sex != ''">sex = #{sex},</if>
            <if test="bornDate != null">born_date = #{bornDate},</if>
            <if test="major != null and major != ''">major = #{major},</if>
            <if test="curMajor != null and curMajor != ''">cur_major = #{curMajor},</if>
            <if test="curMajorYear != null and curMajorYear != ''">cur_major_year = #{curMajorYear},</if>
            <if test="admDuty != null and admDuty != ''">adm_duty = #{admDuty},</if>
            <if test="techTit != null and techTit != ''">tech_tit = #{techTit},</if>
            <if test="poafCode != null and poafCode != ''">poaf_code = #{poafCode},</if>
            <if test="addr != null and addr != ''">addr = #{addr},</if>
            <if test="zip != null and zip != ''">zip = #{zip},</if>
            <if test="offiTel != null and offiTel != ''">offi_tel = #{offiTel},</if>
            <if test="moph != null and moph != ''">moph = #{moph},</if>
            <if test="homeTel != null and homeTel != ''">home_tel = #{homeTel},</if>
            <if test="expertGrad != null and expertGrad != ''">expert_grad = #{expertGrad},</if>
            <if test="expertResid != null and expertResid != ''">expert_resid = #{expertResid},</if>
            <if test="workResum != null and workResum != ''">work_resum = #{workResum},</if>
            <if test="winsJobEava != null and winsJobEava != ''">wins_job_eava = #{winsJobEava},</if>
            <if test="applInsPost != null and applInsPost != ''">appl_ins_post = #{applInsPost},</if>
            <if test="sinsExpertType != null and sinsExpertType != ''">sins_expert_type = #{sinsExpertType},</if>
            <if test="sinsJobEava != null and sinsJobEava != ''">sins_job_eava = #{sinsJobEava},</if>
            <if test="bankCode != null and bankCode != ''">bank_code = #{bankCode},</if>
            <if test="bankDepo != null and bankDepo != ''">bank_depo = #{bankDepo},</if>
            <if test="bankCardNum != null and bankCardNum != ''">bank_card_num = #{bankCardNum},</if>
            <if test="note != null and note != ''">note = #{note},</if>
            <if test="collTime != null">coll_time = #{collTime},</if>
            <if test="updTime != null">upd_time = #{updTime},</if>
            <if test="recPers != null and recPers != ''">rec_pers = #{recPers},</if>
        </set>
        where guid = #{guid}
    </update>

    <delete id="deleteObjExpertByGuid" parameterType="String">
        delete from obj_expert where guid = #{guid}
    </delete>

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