<?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.zehong.system.mapper.TEmployedPeopleInfoChangelogMapper">

    <resultMap type="com.zehong.system.domain.TEmployedPeopleInfoChangelog" id="TEmployedPeopleInfoChangelogResult">
        <result property="id"    column="id"    />
        <result property="employedPeopleName"    column="employed_people_name"    />
        <result property="idCard"    column="id_card"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
        <result property="beforeChange"    column="before_change"    />
        <result property="afterChange"    column="after_change"    />
        <result property="isDel"    column="is_del"    />
        <result property="remarks"    column="remarks"    />
    </resultMap>

    <sql id="selectTEmployedPeopleInfoChangelogVo">
        select id, employed_people_name, id_card, create_time, update_time, before_change, after_change, is_del, remarks from t_employed_people_info_changelog
    </sql>

    <select id="selectTEmployedPeopleInfoChangelogList" parameterType="com.zehong.system.domain.TEmployedPeopleInfoChangelog" resultMap="TEmployedPeopleInfoChangelogResult">
        <include refid="selectTEmployedPeopleInfoChangelogVo"/>
        <where>
            <if test="employedPeopleName != null  and employedPeopleName != ''"> and employed_people_name like concat('%', #{employedPeopleName}, '%')</if>
            <if test="idCard != null  and idCard != ''"> and id_card = #{idCard}</if>
            <if test="beforeChange != null  and beforeChange != ''"> and before_change = #{beforeChange}</if>
            <if test="afterChange != null  and afterChange != ''"> and after_change = #{afterChange}</if>
            <if test="isDel != null  and isDel != ''"> and is_del = #{isDel}</if>
            <if test="remarks != null  and remarks != ''"> and remarks = #{remarks}</if>
        </where>
    </select>

    <select id="selectTEmployedPeopleInfoChangelogById" parameterType="Long" resultMap="TEmployedPeopleInfoChangelogResult">
        <include refid="selectTEmployedPeopleInfoChangelogVo"/>
        where id = #{id}
    </select>

    <insert id="insertTEmployedPeopleInfoChangelog" parameterType="com.zehong.system.domain.TEmployedPeopleInfoChangelog" useGeneratedKeys="true" keyProperty="id">
        insert into t_employed_people_info_changelog
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="employedPeopleName != null">employed_people_name,</if>
            <if test="idCard != null">id_card,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="beforeChange != null">before_change,</if>
            <if test="afterChange != null">after_change,</if>
            <if test="isDel != null">is_del,</if>
            <if test="remarks != null">remarks,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="employedPeopleName != null">#{employedPeopleName},</if>
            <if test="idCard != null">#{idCard},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="beforeChange != null">#{beforeChange},</if>
            <if test="afterChange != null">#{afterChange},</if>
            <if test="isDel != null">#{isDel},</if>
            <if test="remarks != null">#{remarks},</if>
        </trim>
    </insert>

    <update id="updateTEmployedPeopleInfoChangelog" parameterType="com.zehong.system.domain.TEmployedPeopleInfoChangelog">
        update t_employed_people_info_changelog
        <trim prefix="SET" suffixOverrides=",">
            <if test="employedPeopleName != null">employed_people_name = #{employedPeopleName},</if>
            <if test="idCard != null">id_card = #{idCard},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="beforeChange != null">before_change = #{beforeChange},</if>
            <if test="afterChange != null">after_change = #{afterChange},</if>
            <if test="isDel != null">is_del = #{isDel},</if>
            <if test="remarks != null">remarks = #{remarks},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTEmployedPeopleInfoChangelogById" parameterType="Long">
        delete from t_employed_people_info_changelog where id = #{id}
    </delete>

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