<?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.build.PlatBuildYearTrendMapper">
    
    <resultMap type="PlatBuildYearTrend" id="PlatBuildYearTrendResult">
        <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="monthString"    column="month_string"    />
        <result property="currentValue"    column="current_value"    />
        <result property="lastYearValue"    column="last_year_value"    />
        <result property="currentYear"    column="current_year"    />
        <result property="lastYear"    column="last_year"    />
        <result property="type"    column="type"    />
    </resultMap>

    <sql id="selectPlatBuildYearTrendVo">
        select id, del_flag, create_by, create_time, update_by, update_time, app_org, month_string, current_value, last_year_value, current_year, last_year, type from large_plat_build_year_trend
    </sql>

    <select id="selectPlatBuildYearTrendList" parameterType="PlatBuildYearTrend" resultMap="PlatBuildYearTrendResult">
        <include refid="selectPlatBuildYearTrendVo"/>
        <where>  
            <if test="appOrg != null  and appOrg != ''"> and app_org = #{appOrg}</if>
            <if test="monthString != null  and monthString != ''"> and month_string = #{monthString}</if>
            <if test="currentValue != null "> and current_value = #{currentValue}</if>
            <if test="lastYearValue != null "> and last_year_value = #{lastYearValue}</if>
            <if test="currentYear != null  and currentYear != ''"> and current_year = #{currentYear}</if>
            <if test="lastYear != null  and lastYear != ''"> and last_year = #{lastYear}</if>
            <if test="type != null "> and type = #{type}</if>
        </where>
    </select>
    
    <select id="selectPlatBuildYearTrendById" parameterType="Long" resultMap="PlatBuildYearTrendResult">
        <include refid="selectPlatBuildYearTrendVo"/>
        where id = #{id}
    </select>

    <insert id="insertPlatBuildYearTrend" parameterType="PlatBuildYearTrend" useGeneratedKeys="true" keyProperty="id">
        insert into large_plat_build_year_trend
        <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="monthString != null">month_string,</if>
            <if test="currentValue != null">current_value,</if>
            <if test="lastYearValue != null">last_year_value,</if>
            <if test="currentYear != null">current_year,</if>
            <if test="lastYear != null">last_year,</if>
            <if test="type != null">type,</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="monthString != null">#{monthString},</if>
            <if test="currentValue != null">#{currentValue},</if>
            <if test="lastYearValue != null">#{lastYearValue},</if>
            <if test="currentYear != null">#{currentYear},</if>
            <if test="lastYear != null">#{lastYear},</if>
            <if test="type != null">#{type},</if>
         </trim>
    </insert>

    <update id="updatePlatBuildYearTrend" parameterType="PlatBuildYearTrend">
        update large_plat_build_year_trend
        <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="monthString != null">month_string = #{monthString},</if>
            <if test="currentValue != null">current_value = #{currentValue},</if>
            <if test="lastYearValue != null">last_year_value = #{lastYearValue},</if>
            <if test="currentYear != null">current_year = #{currentYear},</if>
            <if test="lastYear != null">last_year = #{lastYear},</if>
            <if test="type != null">type = #{type},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deletePlatBuildYearTrendById" parameterType="Long">
        delete from large_plat_build_year_trend where id = #{id}
    </delete>

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