ShipmentsPlanDetailMapper.xml 4.13 KB
<?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.lframework.xingyun.sc.mappers.ShipmentsPlanDetailMapper">

    <resultMap id="ShipmentsPlanDetail" type="com.lframework.xingyun.sc.entity.ShipmentsPlanDetail">
        <id column="id" property="id"/>
        <result column="plan_id" property="planId"/>
        <result column="order_id" property="orderId"/>
        <result column="order_no" property="orderNo"/>
        <result column="customer_name" property="customerName"/>
        <result column="thickness" property="thickness"/>
        <result column="thickness_tol_pos" property="thicknessTolPos"/>
        <result column="thickness_tol_neg" property="thicknessTolNeg"/>
        <result column="width" property="width"/>
        <result column="width_tol_pos" property="widthTolPos"/>
        <result column="width_tol_neg" property="widthTolNeg"/>
        <result column="length" property="length"/>
        <result column="length_tol_pos" property="lengthTolPos"/>
        <result column="length_tol_neg" property="lengthTolNeg"/>
        <result column="parent_id" property="parentId"/>
        <result column="status" property="status"/>
        <result column="shipments_date" property="shipmentsDate"/>
        <result column="shipments_time" property="shipmentsTime"/>
        <result column="can_shipments" property="canShipments"/>
        <result column="del_flag" property="delFlag"/>
        <result column="create_by_id" property="createById"/>
        <result column="update_by_id" property="updateById"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
    </resultMap>

    <sql id="ShipmentsPlanDetail_sql">
        SELECT
            tb.id,
            tb.plan_id,
            tb.order_id,
            o.order_no,
            c.name AS customer_name,
            tb.order_spec_id,
            ol.thickness,
            ol.thickness_tol_pos,
            ol.thickness_tol_neg,
            ol.width,
            ol.width_tol_pos,
            ol.width_tol_neg,
            ol.length,
            ol.length_tol_pos,
            ol.length_tol_neg,
            ol.quantity,
            tb.parent_id,
            tb.status,
            tb.shipments_date,
            tb.shipments_time,
            tb.can_shipments,
            tb.del_flag,
            tb.create_by_id,
            tb.update_by_id,
            tb.create_time,
            tb.update_time
        FROM shipments_plan_detail AS tb
        INNER JOIN shipments_plan p ON tb.plan_id = p.id
        LEFT JOIN purchase_order_info o ON tb.order_id = o.id
        LEFT JOIN base_data_customer c ON o.ordering_unit = c.id
        LEFT JOIN tbl_purchase_order_line ol ON tb.order_id = ol.purchase_order_id
    </sql>

    <select id="query" resultMap="ShipmentsPlanDetail">
        <include refid="ShipmentsPlanDetail_sql"/>
        <where>
            <if test="vo.planId != null and vo.planId != ''">
                AND tb.plan_id = #{vo.planId}
            </if>
            <if test="vo.shipmentsDate != null">
                AND tb.shipments_date = #{vo.shipmentsDate}
            </if>
        </where>
    </select>

    <insert id="batchAdd">
        INSERT INTO shipments_plan_detail (
        id,
        plan_id,
        order_id,
        order_spec_id,
        parent_id,
        status,
        shipments_date,
        shipments_time,
        can_shipments,
        del_flag,
        create_by_id,
        update_by_id,
        create_time,
        update_time
        ) VALUES
        <foreach collection="list" item="item" separator=",">
            (
            #{item.id},
            #{item.planId},
            #{item.orderId},
            #{item.orderSpecId},
            #{item.parentId},
            #{item.status},
            #{item.shipmentsDate},
            #{item.shipmentsTime},
            #{item.canShipments},
            #{item.delFlag},
            #{item.createById},
            #{item.updateById},
            #{item.createTime},
            #{item.updateTime}
            )
        </foreach>
    </insert>
</mapper>