65 lines
2.7 KiB
XML
65 lines
2.7 KiB
XML
<?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="jnpf.mapper.OrderDetailMapper">
|
|
|
|
<select id="getOrderItemWithOrder" resultType="jnpf.model.order.OrderItemWithOrderVO">
|
|
SELECT
|
|
od.id AS itemId,
|
|
od.sale_ord_id AS saleOrdId,
|
|
od.ord_item_status AS ordItemStatus,
|
|
od.ord_qty AS ordQty,
|
|
od.produce_qty AS produceQty,
|
|
(od.ord_qty - IFNULL(od.produce_qty, 0)) AS remainingQty,
|
|
od.material_name AS materialName,
|
|
od.unit AS unit,
|
|
od.spec AS spec,
|
|
od.deliveried_qty AS deliveriedQty,
|
|
od.material_code AS materialCode,
|
|
od.price_tax AS priceTax,
|
|
od.material_use AS materialUse,
|
|
od.remark AS remark,
|
|
od.f_creator_user_id AS creatorUserId,
|
|
eo.is_urgent AS isUrgent,
|
|
eo.contract_no AS contractNo,
|
|
eo.sale_ord_no AS saleOrdNo,
|
|
eo.cust_name AS custName,
|
|
eo.ord_type AS ordType,
|
|
eo.ord_status AS ordStatus,
|
|
eo.pro_status AS proStatus,
|
|
eo.ord_date AS ordDate,
|
|
eo.req_delivery_date AS reqDeliveryDate,
|
|
eo.payment_terms AS paymentTerms,
|
|
eo.tax_rate AS taxRate,
|
|
eo.ord_status AS ordStatus
|
|
FROM tso_order_item od
|
|
LEFT JOIN tso_order eo ON od.sale_ord_id = eo.id
|
|
<where>
|
|
AND (od.f_delete_mark IS NULL OR od.f_delete_mark = 0)
|
|
AND (eo.f_delete_mark IS NULL OR eo.f_delete_mark = 0)
|
|
AND eo.pro_status <> '2'
|
|
AND od.ord_item_status NOT IN ('2','9')
|
|
AND eo.ord_status = '3'
|
|
<if test="pagination.ordDateStart != null">
|
|
AND eo.ord_date >= #{pagination.ordDateStart}
|
|
</if>
|
|
<if test="pagination.ordDateEnd != null">
|
|
AND eo.ord_date <= #{pagination.ordDateEnd}
|
|
</if>
|
|
<if test="pagination.saleOrdNo != null and pagination.saleOrdNo != ''">
|
|
AND eo.sale_ord_no LIKE CONCAT('%', #{pagination.saleOrdNo}, '%')
|
|
</if>
|
|
<if test="pagination.custName != null and pagination.custName != ''">
|
|
AND eo.cust_name LIKE CONCAT('%', #{pagination.custName}, '%')
|
|
</if>
|
|
<if test="pagination.ordItemStatus == null or pagination.ordItemStatus == ''">
|
|
AND od.ord_item_status IN ('1', '0')
|
|
</if>
|
|
<if test="pagination.ordItemStatus != null and pagination.ordItemStatus != ''">
|
|
AND od.ord_item_status = #{pagination.ordItemStatus}
|
|
</if>
|
|
</where>
|
|
ORDER BY eo.ord_date DESC, od.id DESC
|
|
</select>
|
|
|
|
</mapper>
|