ShipmentDetailStatisticsMapper.xml 5.72 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.ShipmentDetailStatisticsMapper">

    <resultMap id="ShipmentDetailStatistics" type="com.lframework.xingyun.sc.entity.ShipmentDetailStatistics">
        <id column="id" property="id"/>
        <result column="shipment_order_no" property="shipmentOrderNo"/>
        <result column="workshop_name" property="workshopName"/>
        <result column="dept_name" property="deptName"/>
        <result column="region_name" property="regionName"/>
        <result column="ordering_unit_name" property="orderingUnitName"/>
        <result column="brand" property="brand"/>
        <result column="thickness" property="thickness"/>
        <result column="width" property="width"/>
        <result column="length" property="length"/>
        <result column="status" property="status"/>
        <result column="quantity" property="quantity"/>
        <result column="actual_shipment_quantity" property="actualShipmentQuantity"/>
        <result column="sales_price" property="salesPrice"/>
        <result column="thickness_tol_pos" property="thicknessTolPos"/>
        <result column="thickness_tol_neg" property="thicknessTolNeg"/>
        <result column="width_tol_pos" property="widthTolPos"/>
        <result column="width_tol_neg" property="widthTolNeg"/>
        <result column="length_tol_pos" property="lengthTolPos"/>
        <result column="length_tol_neg" property="lengthTolNeg"/>
        <result column="assessment_exceeds_agreement" property="assessmentExceedsAgreement"/>
        <result column="shipping_cost" property="shippingCost"/>
        <result column="return_freight" property="returnFreight"/>
        <result column="industry" property="industry"/>
        <result column="stock_up_company_name" property="stockUpCompanyName"/>
        <result column="order_no" property="orderNo"/>
        <result column="yield_batch_no" property="yieldBatchNo"/>
        <result column="invoicing_status" property="invoicingStatus"/>
        <result column="order_date" property="orderDate"/>
        <result column="packaging_fee" property="packagingFee"/>
        <result column="quality" property="quality"/>
        <result column="num" property="num"/>
        <result column="settlement_terms" property="settlementTerms"/>
        <result column="processing_or_distribution" property="processingOrDistribution"/>
        <result column="packaging_requirements" property="packagingRequirements"/>
        <result column="shipment_date" property="shipmentDate"/>
        <result column="supplier" property="supplier"/>
        <result column="customer_short_name" property="customerShortName"/>
        <result column="customer_type" property="customerType"/>
        <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"/>
        <result column="delivery_method" property="deliveryMethod"/>
    </resultMap>

    <sql id="ShipmentDetailStatistics_sql">
        SELECT
            tb.id,
            tb.shipment_order_no,
            tb.workshop_name,
            tb.dept_name,
            tb.region_name,
            tb.ordering_unit_name,
            tb.brand,
            tb.thickness,
            tb.width,
            tb.length,
            tb.status,
            tb.quantity,
            tb.actual_shipment_quantity,
            tb.sales_price,
            tb.thickness_tol_pos,
            tb.thickness_tol_neg,
            tb.width_tol_pos,
            tb.width_tol_neg,
            tb.length_tol_pos,
            tb.length_tol_neg,
            tb.assessment_exceeds_agreement,
            tb.shipping_cost,
            tb.return_freight,
            tb.industry,
            tb.stock_up_company_name,
            tb.order_no,
            tb.yield_batch_no,
            tb.invoicing_status,
            tb.order_date,
            tb.packaging_fee,
            tb.quality,
            tb.num,
            tb.settlement_terms,
            tb.processing_or_distribution,
            tb.packaging_requirements,
            tb.shipment_date,
            tb.supplier,
            tb.customer_short_name,
            tb.customer_type,
            tb.create_by_id,
            tb.update_by_id,
            tb.create_time,
            tb.update_time,
            tb.delivery_method
        FROM shipments_detail_statistics AS tb
    </sql>

    <select id="query" resultMap="ShipmentDetailStatistics">
        <include refid="ShipmentDetailStatistics_sql"/>
        <where>
            <if test="vo.workshopName != null and vo.workshopName != ''">
             AND tb.workshop_name LIKE CONCAT('%', #{vo.workshopName}, '%')
            </if>
            <if test="vo.deptName != null and vo.deptName != ''">
             AND tb.dept_name LIKE CONCAT('%', #{vo.deptName}, '%')
            </if>
            <if test="vo.orderingUnitName != null and vo.orderingUnitName != ''">
             AND tb.ordering_unit_name LIKE CONCAT('%', #{vo.orderingUnitName}, '%')
            </if>
        </where>
    </select>

    <select id="getShipmentDetailInfo" resultType="com.lframework.xingyun.sc.entity.ShipmentDetailStatistics">
        select ol.*, o.*,w.name as workshop_name,sd.actual_shipment_quantity,sd.yield_batch_no
        from shipments_plan_detail sd
                 left join tbl_purchase_order_line ol on sd.order_spec_id = ol.id
                 left join purchase_order_info o on ol.purchase_order_id = o.id
                 left join base_data_workshop w on o.workshop_id = w.id
        where sd.shipment_order_id = #{shipmentOrderId}
    </select>
</mapper>