<?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.ruoyi.business.mapper.TCkPicktaskMapper">
    
    <resultMap type="TCkPicktask" id="TCkPicktaskResult">
        <result property="taskid"    column="taskId"    />
        <result property="plcid"    column="plcId"    />
        <result property="taskType"    column="task_type"    />
        <result property="origin"    column="origin"    />
        <result property="vesselNo"    column="vessel_no"    />
        <result property="taskStatus"    column="task_status"    />
        <result property="createTime"    column="create_time"    />
        <result property="wipentity"    column="wipEntity"    />
        <result property="goodsId"    column="goods_id"    />
        <result property="goodsNum"    column="goods_num"    />
        <result property="batchNo"    column="batch_no"    />
    </resultMap>

    <sql id="selectTCkPicktaskVo">
        select taskId, plcId, task_type, origin, vessel_no, task_status, create_time, wipEntity, goods_id, goods_num, batch_no from t_ck_picktask
    </sql>

    <select id="selectTCkPicktaskList" parameterType="TCkPicktask" resultMap="TCkPicktaskResult">
        <include refid="selectTCkPicktaskVo"/>
        <where>  
            <if test="plcid != null "> and plcId = #{plcid}</if>
            <if test="taskType != null "> and task_type = #{taskType}</if>
            <if test="origin != null  and origin != ''"> and origin = #{origin}</if>
            <if test="vesselNo != null  and vesselNo != ''"> and vessel_no = #{vesselNo}</if>
            <if test="taskStatus != null "> and task_status = #{taskStatus}</if>
            <if test="wipentity != null  and wipentity != ''"> and wipEntity = #{wipentity}</if>
            <if test="goodsId != null  and goodsId != ''"> and goods_id = #{goodsId}</if>
            <if test="goodsNum != null  and goodsNum != ''"> and goods_num = #{goodsNum}</if>
            <if test="batchNo != null  and batchNo != ''"> and batch_no = #{batchNo}</if>
        </where>
    </select>
    
    <select id="selectTCkPicktaskByTaskid" parameterType="String" resultMap="TCkPicktaskResult">
        <include refid="selectTCkPicktaskVo"/>
        where taskId = #{taskid}
    </select>
        
    <insert id="insertTCkPicktask" parameterType="TCkPicktask">
        insert into t_ck_picktask
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="taskid != null">taskId,</if>
            <if test="plcid != null">plcId,</if>
            <if test="taskType != null">task_type,</if>
            <if test="origin != null and origin != ''">origin,</if>
            <if test="vesselNo != null and vesselNo != ''">vessel_no,</if>
            <if test="taskStatus != null">task_status,</if>
            <if test="createTime != null">create_time,</if>
            <if test="wipentity != null">wipEntity,</if>
            <if test="goodsId != null">goods_id,</if>
            <if test="goodsNum != null">goods_num,</if>
            <if test="batchNo != null">batch_no,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="taskid != null">#{taskid},</if>
            <if test="plcid != null">#{plcid},</if>
            <if test="taskType != null">#{taskType},</if>
            <if test="origin != null and origin != ''">#{origin},</if>
            <if test="vesselNo != null and vesselNo != ''">#{vesselNo},</if>
            <if test="taskStatus != null">#{taskStatus},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="wipentity != null">#{wipentity},</if>
            <if test="goodsId != null">#{goodsId},</if>
            <if test="goodsNum != null">#{goodsNum},</if>
            <if test="batchNo != null">#{batchNo},</if>
         </trim>
    </insert>

    <update id="updateTCkPicktask" parameterType="TCkPicktask">
        update t_ck_picktask
        <trim prefix="SET" suffixOverrides=",">
            <if test="plcid != null">plcId = #{plcid},</if>
            <if test="taskType != null">task_type = #{taskType},</if>
            <if test="origin != null and origin != ''">origin = #{origin},</if>
            <if test="vesselNo != null and vesselNo != ''">vessel_no = #{vesselNo},</if>
            <if test="taskStatus != null">task_status = #{taskStatus},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="wipentity != null">wipEntity = #{wipentity},</if>
            <if test="goodsId != null">goods_id = #{goodsId},</if>
            <if test="goodsNum != null">goods_num = #{goodsNum},</if>
            <if test="batchNo != null">batch_no = #{batchNo},</if>
        </trim>
        where taskId = #{taskid}
    </update>

    <delete id="deleteTCkPicktaskByTaskid" parameterType="String">
        delete from t_ck_picktask where taskId = #{taskid}
    </delete>

    <delete id="deleteTCkPicktaskByTaskids" parameterType="String">
        delete from t_ck_picktask where taskId in 
        <foreach item="taskid" collection="array" open="(" separator="," close=")">
            #{taskid}
        </foreach>
    </delete>

</mapper>