<?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.property.PlatPropertyToolsMapper">
    
    <resultMap type="PlatPropertyTools" id="PlatPropertyToolsResult">
        <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="toolsNameFirst"    column="tools_name_first"    />
        <result property="toolsNumFirst"    column="tools_num_first"    />
        <result property="toolsNameTwo"    column="tools_name_two"    />
        <result property="toolsNumTwo"    column="tools_num_two"    />
        <result property="toolsNameThird"    column="tools_name_third"    />
        <result property="toolsNumThird"    column="tools_num_third"    />
        <result property="toolsNameFour"    column="tools_name_four"    />
        <result property="toolsNumFour"    column="tools_num_four"    />
    </resultMap>

    <sql id="selectPlatPropertyToolsVo">
        select id, del_flag, create_by, create_time, update_by, update_time, app_org, tools_name_first, tools_num_first, tools_name_two, tools_num_two, tools_name_third, tools_num_third, tools_name_four, tools_num_four from large_plat_property_tools
    </sql>

    <select id="selectPlatPropertyToolsList" parameterType="PlatPropertyTools" resultMap="PlatPropertyToolsResult">
        <include refid="selectPlatPropertyToolsVo"/>
        <where>  
            <if test="appOrg != null  and appOrg != ''"> and app_org = #{appOrg}</if>
            <if test="toolsNameFirst != null  and toolsNameFirst != ''"> and tools_name_first = #{toolsNameFirst}</if>
            <if test="toolsNumFirst != null "> and tools_num_first = #{toolsNumFirst}</if>
            <if test="toolsNameTwo != null  and toolsNameTwo != ''"> and tools_name_two = #{toolsNameTwo}</if>
            <if test="toolsNumTwo != null "> and tools_num_two = #{toolsNumTwo}</if>
            <if test="toolsNameThird != null  and toolsNameThird != ''"> and tools_name_third = #{toolsNameThird}</if>
            <if test="toolsNumThird != null "> and tools_num_third = #{toolsNumThird}</if>
            <if test="toolsNameFour != null  and toolsNameFour != ''"> and tools_name_four = #{toolsNameFour}</if>
            <if test="toolsNumFour != null "> and tools_num_four = #{toolsNumFour}</if>
        </where>
    </select>
    
    <select id="selectPlatPropertyToolsById" parameterType="Long" resultMap="PlatPropertyToolsResult">
        <include refid="selectPlatPropertyToolsVo"/>
        where id = #{id}
    </select>

    <insert id="insertPlatPropertyTools" parameterType="PlatPropertyTools" useGeneratedKeys="true" keyProperty="id">
        insert into large_plat_property_tools
        <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="toolsNameFirst != null">tools_name_first,</if>
            <if test="toolsNumFirst != null">tools_num_first,</if>
            <if test="toolsNameTwo != null">tools_name_two,</if>
            <if test="toolsNumTwo != null">tools_num_two,</if>
            <if test="toolsNameThird != null">tools_name_third,</if>
            <if test="toolsNumThird != null">tools_num_third,</if>
            <if test="toolsNameFour != null">tools_name_four,</if>
            <if test="toolsNumFour != null">tools_num_four,</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="toolsNameFirst != null">#{toolsNameFirst},</if>
            <if test="toolsNumFirst != null">#{toolsNumFirst},</if>
            <if test="toolsNameTwo != null">#{toolsNameTwo},</if>
            <if test="toolsNumTwo != null">#{toolsNumTwo},</if>
            <if test="toolsNameThird != null">#{toolsNameThird},</if>
            <if test="toolsNumThird != null">#{toolsNumThird},</if>
            <if test="toolsNameFour != null">#{toolsNameFour},</if>
            <if test="toolsNumFour != null">#{toolsNumFour},</if>
         </trim>
    </insert>

    <update id="updatePlatPropertyTools" parameterType="PlatPropertyTools">
        update large_plat_property_tools
        <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="toolsNameFirst != null">tools_name_first = #{toolsNameFirst},</if>
            <if test="toolsNumFirst != null">tools_num_first = #{toolsNumFirst},</if>
            <if test="toolsNameTwo != null">tools_name_two = #{toolsNameTwo},</if>
            <if test="toolsNumTwo != null">tools_num_two = #{toolsNumTwo},</if>
            <if test="toolsNameThird != null">tools_name_third = #{toolsNameThird},</if>
            <if test="toolsNumThird != null">tools_num_third = #{toolsNumThird},</if>
            <if test="toolsNameFour != null">tools_name_four = #{toolsNameFour},</if>
            <if test="toolsNumFour != null">tools_num_four = #{toolsNumFour},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deletePlatPropertyToolsById" parameterType="Long">
        delete from large_plat_property_tools where id = #{id}
    </delete>

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