<?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.shkj.wms.mapper.BusinPickupMapper">

       <select id="getBusinPickupList" resultType="com.shkj.wms.vo.BusinPickupVo" parameterType="com.shkj.wms.bo.BusinPickupQueryBo">

           select taskgoods.qr_code,
           barin.color,
           barin.vehiche_model,
           barin.location,
           barin.location_code,
           barin.is_split,
           barin.is_punching,
           barin.is_repair,
           task.task_type,
           task.task_path AS end_location,
           task.id as taskId,
           task.task_code,
           task.container_id,
           task.task_type
           from busin_data_task task
           left join busin_data_task_goods taskgoods on task.id=taskgoods.task_code
           left join base_container container on container.id=task.container_id
           left join base_barcodes_in barin on barin.qr_code=taskgoods.qr_code
           where task.task_status ='1'

        <if test="keywords !=null and keywords !='' ">
               and (taskgoods.qr_code =#{keywords} or container.container_code =#{keywords})
        </if>

    </select>



    <insert id="insertPuckup" parameterType="BusinPickup">
        <selectKey keyProperty="id" resultType="long" order="AFTER">
            select LAST_INSERT_ID()
        </selectKey>
        insert into busin_pickup(
        <if test="containerId != null ">container_id,</if>
        <if test="pointNo != null">point_no,</if>
        <if test="taskCode != null and taskCode != ''">task_code,</if>
        <if test="createTime != null ">create_time,</if>
        <if test="createBy != null and createBy != ''">create_by</if>
        )values(
        <if test="containerId != null ">#{containerId},</if>
        <if test="pointNo != null">#{pointNo},</if>
        <if test="taskCode != null and taskCode != ''">#{taskCode},</if>
        <if test="createTime != null ">#{createTime},</if>
        <if test="createBy != null and createBy != ''">#{createBy}</if>
        )
    </insert>

</mapper>
