<?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.project.zcustom.mapper.employee.PlatEmployeeTypeFlowMapper">
    
    <resultMap type="PlatEmployeeTypeFlow" id="PlatEmployeeTypeFlowResult">
        <result property="id"    column="id"    />
        <result property="delFlag"    column="del_flag"    />
        <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="appOrg"    column="app_org"    />
        <result property="insideNum"    column="inside_num"    />
        <result property="loanNum"    column="loan_num"    />
        <result property="associationNum"    column="association_num"    />
        <result property="propertyNum"    column="property_num"    />
        <result property="visitNum"    column="visit_num"    />
        <result property="timeSign"    column="time_sign"    />
    </resultMap>

    <sql id="selectPlatEmployeeTypeFlowVo">
        select id, del_flag, create_by, create_time, update_by, update_time, app_org, inside_num, loan_num, association_num, property_num, visit_num, time_sign from large_plat_employee_type_flow
    </sql>

    <select id="selectPlatEmployeeTypeFlowList" parameterType="PlatEmployeeTypeFlow" resultMap="PlatEmployeeTypeFlowResult">
        <include refid="selectPlatEmployeeTypeFlowVo"/>
        <where>  
            <if test="appOrg != null  and appOrg != ''"> and app_org = #{appOrg}</if>
            <if test="insideNum != null "> and inside_num = #{insideNum}</if>
            <if test="loanNum != null "> and loan_num = #{loanNum}</if>
            <if test="associationNum != null "> and association_num = #{associationNum}</if>
            <if test="propertyNum != null "> and property_num = #{propertyNum}</if>
            <if test="visitNum != null "> and visit_num = #{visitNum}</if>
            <if test="timeSign != null "> and time_sign = #{timeSign}</if>
        </where>
    </select>
    
    <select id="selectPlatEmployeeTypeFlowById" parameterType="Long" resultMap="PlatEmployeeTypeFlowResult">
        <include refid="selectPlatEmployeeTypeFlowVo"/>
        where id = #{id}
    </select>

    <insert id="insertPlatEmployeeTypeFlow" parameterType="PlatEmployeeTypeFlow" useGeneratedKeys="true" keyProperty="id">
        insert into large_plat_employee_type_flow
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="delFlag != null">del_flag,</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="appOrg != null">app_org,</if>
            <if test="insideNum != null">inside_num,</if>
            <if test="loanNum != null">loan_num,</if>
            <if test="associationNum != null">association_num,</if>
            <if test="propertyNum != null">property_num,</if>
            <if test="visitNum != null">visit_num,</if>
            <if test="timeSign != null">time_sign,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="delFlag != null">#{delFlag},</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="appOrg != null">#{appOrg},</if>
            <if test="insideNum != null">#{insideNum},</if>
            <if test="loanNum != null">#{loanNum},</if>
            <if test="associationNum != null">#{associationNum},</if>
            <if test="propertyNum != null">#{propertyNum},</if>
            <if test="visitNum != null">#{visitNum},</if>
            <if test="timeSign != null">#{timeSign},</if>
         </trim>
    </insert>

    <update id="updatePlatEmployeeTypeFlow" parameterType="PlatEmployeeTypeFlow">
        update large_plat_employee_type_flow
        <trim prefix="SET" suffixOverrides=",">
            <if test="delFlag != null">del_flag = #{delFlag},</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="appOrg != null">app_org = #{appOrg},</if>
            <if test="insideNum != null">inside_num = #{insideNum},</if>
            <if test="loanNum != null">loan_num = #{loanNum},</if>
            <if test="associationNum != null">association_num = #{associationNum},</if>
            <if test="propertyNum != null">property_num = #{propertyNum},</if>
            <if test="visitNum != null">visit_num = #{visitNum},</if>
            <if test="timeSign != null">time_sign = #{timeSign},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deletePlatEmployeeTypeFlowById" parameterType="Long">
        delete from large_plat_employee_type_flow where id = #{id}
    </delete>

    <delete id="deletePlatEmployeeTypeFlowByIds" parameterType="String">
        delete from large_plat_employee_type_flow where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    <delete id="reallyDeleteByWrapper">
        DELETE FROM large_plat_employee_type_flow ${ew.customSqlSegment}
    </delete>
</mapper>