<?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.srs.comprehensive.mapper.SrsEducationExperienceMapper">
    
    <resultMap type="SrsEducationExperience" id="SrsEducationExperienceResult">
        <result property="eduId"    column="edu_id"    />
        <result property="startTime"    column="start_time"    />
        <result property="endTime"    column="end_time"    />
        <result property="schoolName"    column="school_name"    />
        <result property="education"    column="education"    />
        <result property="certifier"    column="certifier"    />
        <result property="discription"    column="discription"    />
        <result property="attachment"    column="attachment"    />
        <result property="status"    column="status"    />
        <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"    />
        <result property="stuNo"    column="stu_no"    />
        <result property="post"    column="post"    />
    </resultMap>

    <sql id="selectSrsEducationExperienceVo">
        select edu_id, start_time, end_time, school_name, education, certifier, discription, attachment, status, create_by, create_time, update_by, update_time, del_flag, stu_no, post from srs_education_experience
    </sql>

    <select id="selectSrsEducationExperienceList" parameterType="SrsEducationExperience" resultMap="SrsEducationExperienceResult">
        <include refid="selectSrsEducationExperienceVo"/>
        <where>  
            <if test="startTime != null "> and start_time = #{startTime}</if>
            <if test="endTime != null "> and end_time = #{endTime}</if>
            <if test="schoolName != null  and schoolName != ''"> and school_name like concat('%', #{schoolName}, '%')</if>
            <if test="education != null  and education != ''"> and education = #{education}</if>
            <if test="certifier != null  and certifier != ''"> and certifier = #{certifier}</if>
            <if test="discription != null  and discription != ''"> and discription = #{discription}</if>
            <if test="attachment != null  and attachment != ''"> and attachment = #{attachment}</if>
            <if test="status != null  and status != ''"> and status = #{status}</if>
            <if test="stuNo != null  and stuNo != ''"> and stu_no = #{stuNo}</if>
            <if test="post != null  and post != ''"> and post = #{post}</if>
        </where>
    </select>
    
    <select id="selectSrsEducationExperienceByEduId" parameterType="Long" resultMap="SrsEducationExperienceResult">
        <include refid="selectSrsEducationExperienceVo"/>
        where edu_id = #{eduId}
    </select>
        
    <insert id="insertSrsEducationExperience" parameterType="SrsEducationExperience">
        insert into srs_education_experience
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="eduId != null">edu_id,</if>
            <if test="startTime != null">start_time,</if>
            <if test="endTime != null">end_time,</if>
            <if test="schoolName != null">school_name,</if>
            <if test="education != null">education,</if>
            <if test="certifier != null">certifier,</if>
            <if test="discription != null">discription,</if>
            <if test="attachment != null">attachment,</if>
            <if test="status != null">status,</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 and delFlag != ''">del_flag,</if>
            <if test="stuNo != null">stu_no,</if>
            <if test="post != null">post,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="eduId != null">#{eduId},</if>
            <if test="startTime != null">#{startTime},</if>
            <if test="endTime != null">#{endTime},</if>
            <if test="schoolName != null">#{schoolName},</if>
            <if test="education != null">#{education},</if>
            <if test="certifier != null">#{certifier},</if>
            <if test="discription != null">#{discription},</if>
            <if test="attachment != null">#{attachment},</if>
            <if test="status != null">#{status},</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 and delFlag != ''">#{delFlag},</if>
            <if test="stuNo != null">#{stuNo},</if>
            <if test="post != null">#{post},</if>
         </trim>
    </insert>

    <update id="updateSrsEducationExperience" parameterType="SrsEducationExperience">
        update srs_education_experience
        <trim prefix="SET" suffixOverrides=",">
            <if test="startTime != null">start_time = #{startTime},</if>
            <if test="endTime != null">end_time = #{endTime},</if>
            <if test="schoolName != null">school_name = #{schoolName},</if>
            <if test="education != null">education = #{education},</if>
            <if test="certifier != null">certifier = #{certifier},</if>
            <if test="discription != null">discription = #{discription},</if>
            <if test="attachment != null">attachment = #{attachment},</if>
            <if test="status != null">status = #{status},</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 and delFlag != ''">del_flag = #{delFlag},</if>
            <if test="stuNo != null">stu_no = #{stuNo},</if>
            <if test="post != null">post = #{post},</if>
        </trim>
        where edu_id = #{eduId}
    </update>

    <delete id="deleteSrsEducationExperienceByEduId" parameterType="Long">
        delete from srs_education_experience where edu_id = #{eduId}
    </delete>

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