<?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.PlatEmployeeTypeMapper">
    
    <resultMap type="PlatEmployeeType" id="PlatEmployeeTypeResult">
        <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="entryInternalNum"    column="entry_internal_num"    />
        <result property="entryToLoanNum"    column="entry_to_loan_num"    />
        <result property="entryAssistNum"    column="entry_assist_num"    />
        <result property="entryPropertyNum"    column="entry_property_num"    />
        <result property="visitorNum"    column="visitor_num"    />
        <result property="grossNum"    column="gross_num"    />
        <result property="between2030Num"    column="between2030_num"    />
        <result property="between3040Num"    column="between3040_num"    />
        <result property="between4050Num"    column="between4050_num"    />
        <result property="exceed50Num"    column="exceed50_num"    />
        <result property="manNum"    column="man_num"    />
        <result property="womenNum"    column="women_num"    />
    </resultMap>

    <sql id="selectPlatEmployeeTypeVo">
        select id, del_flag, create_by, create_time, update_by, update_time, app_org, inside_num, loan_num, association_num, property_num, entry_internal_num, entry_to_loan_num, entry_assist_num, entry_property_num, visitor_num, gross_num, between2030_num, between3040_num, between4050_num, exceed50_num, man_num, women_num from large_plat_employee_type
    </sql>

    <select id="selectPlatEmployeeTypeList" parameterType="PlatEmployeeType" resultMap="PlatEmployeeTypeResult">
        <include refid="selectPlatEmployeeTypeVo"/>
        <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="entryInternalNum != null "> and entry_internal_num = #{entryInternalNum}</if>
            <if test="entryToLoanNum != null "> and entry_to_loan_num = #{entryToLoanNum}</if>
            <if test="entryAssistNum != null "> and entry_assist_num = #{entryAssistNum}</if>
            <if test="entryPropertyNum != null "> and entry_property_num = #{entryPropertyNum}</if>
            <if test="visitorNum != null "> and visitor_num = #{visitorNum}</if>
            <if test="grossNum != null "> and gross_num = #{grossNum}</if>
            <if test="between2030Num != null "> and between2030_num = #{between2030Num}</if>
            <if test="between3040Num != null "> and between3040_num = #{between3040Num}</if>
            <if test="between4050Num != null "> and between4050_num = #{between4050Num}</if>
            <if test="exceed50Num != null "> and exceed50_num = #{exceed50Num}</if>
            <if test="manNum != null "> and man_num = #{manNum}</if>
            <if test="womenNum != null "> and women_num = #{womenNum}</if>
        </where>
    </select>
    
    <select id="selectPlatEmployeeTypeById" parameterType="Long" resultMap="PlatEmployeeTypeResult">
        <include refid="selectPlatEmployeeTypeVo"/>
        where id = #{id}
    </select>

    <insert id="insertPlatEmployeeType" parameterType="PlatEmployeeType" useGeneratedKeys="true" keyProperty="id">
        insert into large_plat_employee_type
        <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="entryInternalNum != null">entry_internal_num,</if>
            <if test="entryToLoanNum != null">entry_to_loan_num,</if>
            <if test="entryAssistNum != null">entry_assist_num,</if>
            <if test="entryPropertyNum != null">entry_property_num,</if>
            <if test="visitorNum != null">visitor_num,</if>
            <if test="grossNum != null">gross_num,</if>
            <if test="between2030Num != null">between2030_num,</if>
            <if test="between3040Num != null">between3040_num,</if>
            <if test="between4050Num != null">between4050_num,</if>
            <if test="exceed50Num != null">exceed50_num,</if>
            <if test="manNum != null">man_num,</if>
            <if test="womenNum != null">women_num,</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="entryInternalNum != null">#{entryInternalNum},</if>
            <if test="entryToLoanNum != null">#{entryToLoanNum},</if>
            <if test="entryAssistNum != null">#{entryAssistNum},</if>
            <if test="entryPropertyNum != null">#{entryPropertyNum},</if>
            <if test="visitorNum != null">#{visitorNum},</if>
            <if test="grossNum != null">#{grossNum},</if>
            <if test="between2030Num != null">#{between2030Num},</if>
            <if test="between3040Num != null">#{between3040Num},</if>
            <if test="between4050Num != null">#{between4050Num},</if>
            <if test="exceed50Num != null">#{exceed50Num},</if>
            <if test="manNum != null">#{manNum},</if>
            <if test="womenNum != null">#{womenNum},</if>
         </trim>
    </insert>

    <update id="updatePlatEmployeeType" parameterType="PlatEmployeeType">
        update large_plat_employee_type
        <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="entryInternalNum != null">entry_internal_num = #{entryInternalNum},</if>
            <if test="entryToLoanNum != null">entry_to_loan_num = #{entryToLoanNum},</if>
            <if test="entryAssistNum != null">entry_assist_num = #{entryAssistNum},</if>
            <if test="entryPropertyNum != null">entry_property_num = #{entryPropertyNum},</if>
            <if test="visitorNum != null">visitor_num = #{visitorNum},</if>
            <if test="grossNum != null">gross_num = #{grossNum},</if>
            <if test="between2030Num != null">between2030_num = #{between2030Num},</if>
            <if test="between3040Num != null">between3040_num = #{between3040Num},</if>
            <if test="between4050Num != null">between4050_num = #{between4050Num},</if>
            <if test="exceed50Num != null">exceed50_num = #{exceed50Num},</if>
            <if test="manNum != null">man_num = #{manNum},</if>
            <if test="womenNum != null">women_num = #{womenNum},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deletePlatEmployeeTypeById" parameterType="Long">
        delete from large_plat_employee_type where id = #{id}
    </delete>

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