<?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.PlatBuildParamsMapper">
    
    <resultMap type="PlatBuildParams" id="PlatBuildParamsResult">
        <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="type"    column="type"    />
        <result property="paramName"    column="param_name"    />
        <result property="paramKey"    column="param_key"    />
        <result property="paramsValue"    column="params_value"    />
        <result property="paramsValue2"    column="params_value2"    />
        <result property="paramsValue3"    column="params_value3"    />
        <result property="paramsValue4"    column="params_value4"    />
    </resultMap>

    <sql id="selectPlatBuildParamsVo">
        select id, del_flag, create_by, create_time, update_by, update_time, app_org, type, param_name, param_key, params_value, params_value2, params_value3, params_value4 from large_plat_build_params
    </sql>

    <select id="selectPlatBuildParamsList" parameterType="PlatBuildParams" resultMap="PlatBuildParamsResult">
        <include refid="selectPlatBuildParamsVo"/>
        <where>  
            <if test="appOrg != null  and appOrg != ''"> and app_org = #{appOrg}</if>
            <if test="type != null "> and type = #{type}</if>
            <if test="paramName != null  and paramName != ''"> and param_name like concat('%', #{paramName}, '%')</if>
            <if test="paramKey != null  and paramKey != ''"> and param_key = #{paramKey}</if>
            <if test="paramsValue != null "> and params_value = #{paramsValue}</if>
            <if test="paramsValue2 != null "> and params_value2 = #{paramsValue2}</if>
            <if test="paramsValue3 != null "> and params_value3 = #{paramsValue3}</if>
            <if test="paramsValue4 != null "> and params_value4 = #{paramsValue4}</if>
        </where>
    </select>
    
    <select id="selectPlatBuildParamsById" parameterType="Long" resultMap="PlatBuildParamsResult">
        <include refid="selectPlatBuildParamsVo"/>
        where id = #{id}
    </select>

    <insert id="insertPlatBuildParams" parameterType="PlatBuildParams" useGeneratedKeys="true" keyProperty="id">
        insert into large_plat_build_params
        <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="type != null">type,</if>
            <if test="paramName != null">param_name,</if>
            <if test="paramKey != null">param_key,</if>
            <if test="paramsValue != null">params_value,</if>
            <if test="paramsValue2 != null">params_value2,</if>
            <if test="paramsValue3 != null">params_value3,</if>
            <if test="paramsValue4 != null">params_value4,</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="type != null">#{type},</if>
            <if test="paramName != null">#{paramName},</if>
            <if test="paramKey != null">#{paramKey},</if>
            <if test="paramsValue != null">#{paramsValue},</if>
            <if test="paramsValue2 != null">#{paramsValue2},</if>
            <if test="paramsValue3 != null">#{paramsValue3},</if>
            <if test="paramsValue4 != null">#{paramsValue4},</if>
         </trim>
    </insert>

    <update id="updatePlatBuildParams" parameterType="PlatBuildParams">
        update large_plat_build_params
        <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="type != null">type = #{type},</if>
            <if test="paramName != null">param_name = #{paramName},</if>
            <if test="paramKey != null">param_key = #{paramKey},</if>
            <if test="paramsValue != null">params_value = #{paramsValue},</if>
            <if test="paramsValue2 != null">params_value2 = #{paramsValue2},</if>
            <if test="paramsValue3 != null">params_value3 = #{paramsValue3},</if>
            <if test="paramsValue4 != null">params_value4 = #{paramsValue4},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deletePlatBuildParamsById" parameterType="Long">
        delete from large_plat_build_params where id = #{id}
    </delete>

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