<?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.PlatPropertyMapper">
    
    <resultMap type="PlatProperty" id="PlatPropertyResult">
        <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="constructionQuantityNum"    column="construction_quantity_num"    />
        <result property="completedNum"    column="completed_num"    />
        <result property="participateProportionRate"    column="participate_proportion_rate"    />
    </resultMap>

    <sql id="selectPlatPropertyVo">
        select id, del_flag, create_by, create_time, update_by, update_time, app_org, construction_quantity_num, completed_num, participate_proportion_rate from large_plat_property
    </sql>

    <select id="selectPlatPropertyList" parameterType="PlatProperty" resultMap="PlatPropertyResult">
        <include refid="selectPlatPropertyVo"/>
        <where>  
            <if test="appOrg != null  and appOrg != ''"> and app_org = #{appOrg}</if>
            <if test="constructionQuantityNum != null "> and construction_quantity_num = #{constructionQuantityNum}</if>
            <if test="completedNum != null "> and completed_num = #{completedNum}</if>
            <if test="participateProportionRate != null "> and participate_proportion_rate = #{participateProportionRate}</if>
        </where>
    </select>
    
    <select id="selectPlatPropertyById" parameterType="Long" resultMap="PlatPropertyResult">
        <include refid="selectPlatPropertyVo"/>
        where id = #{id}
    </select>

    <insert id="insertPlatProperty" parameterType="PlatProperty" useGeneratedKeys="true" keyProperty="id">
        insert into large_plat_property
        <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="constructionQuantityNum != null">construction_quantity_num,</if>
            <if test="completedNum != null">completed_num,</if>
            <if test="participateProportionRate != null">participate_proportion_rate,</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="constructionQuantityNum != null">#{constructionQuantityNum},</if>
            <if test="completedNum != null">#{completedNum},</if>
            <if test="participateProportionRate != null">#{participateProportionRate},</if>
         </trim>
    </insert>

    <update id="updatePlatProperty" parameterType="PlatProperty">
        update large_plat_property
        <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="constructionQuantityNum != null">construction_quantity_num = #{constructionQuantityNum},</if>
            <if test="completedNum != null">completed_num = #{completedNum},</if>
            <if test="participateProportionRate != null">participate_proportion_rate = #{participateProportionRate},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deletePlatPropertyById" parameterType="Long">
        delete from large_plat_property where id = #{id}
    </delete>

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