<?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.sf.system.deployment.mapper.DeploymentWhitelistListMapper">
    
    <resultMap type="DeploymentWhitelistList" id="DeploymentWhitelistListResult">
        <result property="id"    column="id"    />
        <result property="whitelistId"    column="whitelist_id"    />
        <result property="appId"    column="app_id"    />
        <result property="appCode"    column="app_code"    />
        <result property="user"    column="user"    />
        <result property="remarks"    column="remarks"    />
        <result property="orderNum"    column="order_num"    />
        <result property="isDelete"    column="is_delete"    />
        <result property="created"    column="created"    />
        <result property="modified"    column="modified"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>

    <sql id="selectDeploymentWhitelistListVo">
        select id, whitelist_id, app_id, app_code, user, remarks, order_num, is_delete, created, modified, create_time, update_time from DEPLOYMENT_WHITELIST_LIST
    </sql>

    <select id="selectDeploymentWhitelistListList" parameterType="DeploymentWhitelistList" resultMap="DeploymentWhitelistListResult">
        <include refid="selectDeploymentWhitelistListVo"/>
        <where>  
            <if test="createTime != null "> and create_time = #{createTime}</if>
            <if test="user != null "> and user = #{user}</if>
            <if test="whitelistId != null "> and whitelist_id = #{whitelistId}</if>
        </where>
    </select>
    
    <select id="selectDeploymentWhitelistListById" parameterType="Long" resultMap="DeploymentWhitelistListResult">
        <include refid="selectDeploymentWhitelistListVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertDeploymentWhitelistList" parameterType="DeploymentWhitelistList" useGeneratedKeys="true" keyProperty="id">
        insert into DEPLOYMENT_WHITELIST_LIST
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="whitelistId != null">whitelist_id,</if>
            <if test="appId != null">app_id,</if>
            <if test="appCode != null">app_code,</if>
            <if test="user != null and user != ''">user,</if>
            <if test="remarks != null">remarks,</if>
            <if test="orderNum != null">order_num,</if>
            <if test="isDelete != null">is_delete,</if>
            <if test="created != null">created,</if>
            <if test="modified != null">modified,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="whitelistId != null">#{whitelistId},</if>
            <if test="appId != null">#{appId},</if>
            <if test="appCode != null">#{appCode},</if>
            <if test="user != null and user != ''">#{user},</if>
            <if test="remarks != null">#{remarks},</if>
            <if test="orderNum != null">#{orderNum},</if>
            <if test="isDelete != null">#{isDelete},</if>
            <if test="created != null">#{created},</if>
            <if test="modified != null">#{modified},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
         </trim>
    </insert>

    <update id="updateDeploymentWhitelistList" parameterType="DeploymentWhitelistList">
        update DEPLOYMENT_WHITELIST_LIST
        <trim prefix="SET" suffixOverrides=",">
            <if test="whitelistId != null">whitelist_id = #{whitelistId},</if>
            <if test="appId != null">app_id = #{appId},</if>
            <if test="appCode != null">app_code = #{appCode},</if>
            <if test="user != null and user != ''">user = #{user},</if>
            <if test="remarks != null">remarks = #{remarks},</if>
            <if test="orderNum != null">order_num = #{orderNum},</if>
            <if test="isDelete != null">is_delete = #{isDelete},</if>
            <if test="created != null">created = #{created},</if>
            <if test="modified != null">modified = #{modified},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteDeploymentWhitelistListById" parameterType="Long">
        delete from DEPLOYMENT_WHITELIST_LIST where id = #{id}
    </delete>

    <delete id="deleteDeploymentWhitelistListByIds" parameterType="String">
        delete from DEPLOYMENT_WHITELIST_LIST where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>