<?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.zehong.system.mapper.shelf.TPlatformDockingTaskMapper">
    
    <resultMap type="TPlatformDockingTask" id="TPlatformDockingTaskResult">
        <result property="fId"    column="f_id"    />
        <result property="fTaskId"    column="f_task_id"    />
        <result property="fOpType"    column="f_op_type"    />
        <result property="fShelf"    column="f_shelf"    />
        <result property="fColor"    column="f_color"    />
        <result property="fType"    column="f_type"    />
        <result property="fLocation"    column="f_location"    />
        <result property="fRid"    column="f_rid"    />
        <result property="fOperateDate"    column="f_operate_date"    />
        <result property="fUsername"    column="f_username"    />
        <result property="fTotalInfo"    column="f_total_info"    />
        <result property="fRequestTime"    column="f_request_time"    />
        <result property="fResponseInfo"    column="f_response_info"    />
    </resultMap>

    <sql id="selectTPlatformDockingTaskVo">
        select f_id, f_task_id, f_op_type, f_shelf, f_color, f_type, f_location, f_rid, f_operate_date, f_username, f_total_info, f_request_time, f_response_info from t_platform_docking_task
    </sql>

    <select id="selectTPlatformDockingTaskList" parameterType="TPlatformDockingTask" resultMap="TPlatformDockingTaskResult">
        <include refid="selectTPlatformDockingTaskVo"/>
        <where>  
            <if test="fTaskId != null  and fTaskId != ''"> and f_task_id = #{fTaskId}</if>
            <if test="fOpType != null  and fOpType != ''"> and f_op_type = #{fOpType}</if>
            <if test="fShelf != null  and fShelf != ''"> and f_shelf = #{fShelf}</if>
            <if test="fColor != null  and fColor != ''"> and f_color = #{fColor}</if>
            <if test="fType != null "> and f_type = #{fType}</if>
            <if test="fLocation != null  and fLocation != ''"> and f_location = #{fLocation}</if>
            <if test="fRid != null  and fRid != ''"> and f_rid = #{fRid}</if>
            <if test="fOperateDate != null "> and f_operate_date = #{fOperateDate}</if>
            <if test="fUsername != null  and fUsername != ''"> and f_username like concat('%', #{fUsername}, '%')</if>
            <if test="fTotalInfo != null  and fTotalInfo != ''"> and f_total_info = #{fTotalInfo}</if>
            <if test="fRequestTime != null "> and f_request_time = #{fRequestTime}</if>
            <if test="fResponseInfo != null  and fResponseInfo != ''"> and f_response_info = #{fResponseInfo}</if>
        </where>
    </select>
    
    <select id="selectTPlatformDockingTaskById" parameterType="Long" resultMap="TPlatformDockingTaskResult">
        <include refid="selectTPlatformDockingTaskVo"/>
        where f_id = #{fId}
    </select>
        
    <insert id="insertTPlatformDockingTask" parameterType="TPlatformDockingTask" useGeneratedKeys="true" keyProperty="fId">
        insert into t_platform_docking_task
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="fTaskId != null and fTaskId != ''">f_task_id,</if>
            <if test="fOpType != null">f_op_type,</if>
            <if test="fShelf != null">f_shelf,</if>
            <if test="fColor != null">f_color,</if>
            <if test="fType != null">f_type,</if>
            <if test="fLocation != null and fLocation != ''">f_location,</if>
            <if test="fRid != null">f_rid,</if>
            <if test="fOperateDate != null">f_operate_date,</if>
            <if test="fUsername != null">f_username,</if>
            <if test="fTotalInfo != null">f_total_info,</if>
            <if test="fRequestTime != null">f_request_time,</if>
            <if test="fResponseInfo != null">f_response_info,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="fTaskId != null and fTaskId != ''">#{fTaskId},</if>
            <if test="fOpType != null">#{fOpType},</if>
            <if test="fShelf != null">#{fShelf},</if>
            <if test="fColor != null">#{fColor},</if>
            <if test="fType != null">#{fType},</if>
            <if test="fLocation != null and fLocation != ''">#{fLocation},</if>
            <if test="fRid != null">#{fRid},</if>
            <if test="fOperateDate != null">#{fOperateDate},</if>
            <if test="fUsername != null">#{fUsername},</if>
            <if test="fTotalInfo != null">#{fTotalInfo},</if>
            <if test="fRequestTime != null">#{fRequestTime},</if>
            <if test="fResponseInfo != null">#{fResponseInfo},</if>
         </trim>
    </insert>

    <update id="updateTPlatformDockingTask" parameterType="TPlatformDockingTask">
        update t_platform_docking_task
        <trim prefix="SET" suffixOverrides=",">
            <if test="fTaskId != null and fTaskId != ''">f_task_id = #{fTaskId},</if>
            <if test="fOpType != null">f_op_type = #{fOpType},</if>
            <if test="fShelf != null">f_shelf = #{fShelf},</if>
            <if test="fColor != null">f_color = #{fColor},</if>
            <if test="fType != null">f_type = #{fType},</if>
            <if test="fLocation != null and fLocation != ''">f_location = #{fLocation},</if>
            <if test="fRid != null">f_rid = #{fRid},</if>
            <if test="fOperateDate != null">f_operate_date = #{fOperateDate},</if>
            <if test="fUsername != null">f_username = #{fUsername},</if>
            <if test="fTotalInfo != null">f_total_info = #{fTotalInfo},</if>
            <if test="fRequestTime != null">f_request_time = #{fRequestTime},</if>
            <if test="fResponseInfo != null">f_response_info = #{fResponseInfo},</if>
        </trim>
        where f_id = #{fId}
    </update>

    <delete id="deleteTPlatformDockingTaskById" parameterType="Long">
        delete from t_platform_docking_task where f_id = #{fId}
    </delete>

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