DelayedShipmentDetailMapper.xml
3.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?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.DelayedShipmentDetailMapper">
<resultMap id="DelayedShipmentDetail" type="com.lframework.xingyun.sc.entity.DelayedShipmentDetail">
<id column="id" property="id"/>
<result column="delayed_shipment_id" property="delayedShipmentId"/>
<result column="order_id" property="orderId"/>
<result column="order_no" property="orderNo"/>
<result column="order_type" property="orderType"/>
<result column="workshop_id" property="workshopId"/>
<result column="workshop_name" property="workshopName"/>
<result column="workshop_code" property="workshopCode"/>
<result column="customer_id" property="customerId"/>
<result column="customer_name" property="customerName"/>
<result column="shipments_plan_detail_id" property="shipmentsPlanDetailId"/>
<result column="order_spec_id" property="orderSpecId"/>
<result column="delivery_date" property="deliveryDate"/>
<result column="apply_shipment_date" property="applyShipmentDate"/>
<result column="apply_count" property="applyCount"/>
<result column="quantity" property="quantity"/>
<result column="delay_reason" property="delayReason"/>
<result column="contract_create_by_id" property="contractCreateById"/>
<result column="create_by_id" property="createById"/>
<result column="create_by" property="createBy"/>
<result column="update_by_id" property="updateById"/>
<result column="update_by" property="updateBy"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<sql id="DelayedShipmentDetail_sql">
SELECT
tb.id,
tb.delayed_shipment_id,
tb.order_id,
o.order_no,
CASE
WHEN s.type IN ('DISTRIB_STD', 'DIST_STOCK_CONTRACT', 'DRAFT_DIST_AGMT') THEN '经销'
WHEN s.type IN ('INTL_STD_CONTRACT', 'INTL_INVENTORY_AGMT', 'INTL_OPEN_SPEC_AGMT') THEN '外贸'
WHEN s.type = 'PROCESS_STD_AGMT' THEN '加工'
ELSE '其它'
END AS order_type,
o.workshop_id,
ws.name AS workshop_name,
ws.code AS workshop_code,
o.ordering_unit AS customer_id,
c.name AS customer_name,
tb.shipments_plan_detail_id,
tb.order_spec_id,
tb.delivery_date,
tb.apply_shipment_date,
tb.apply_count,
tb.quantity,
tb.delay_reason,
o.contract_create_by_id,
tb.create_by_id,
tb.create_by,
tb.update_by_id,
tb.update_by,
tb.create_time,
tb.update_time
FROM delayed_shipment_detail AS tb
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 base_data_workshop ws on ws.id = o.workshop_id
LEFT JOIN tbl_contract_distributor_standard s on s.id = o.contract_id
</sql>
<select id="query" resultMap="DelayedShipmentDetail">
<include refid="DelayedShipmentDetail_sql"/>
<where>
<if test="vo.delayedShipmentId != null and vo.delayedShipmentId != ''">
AND tb.delayed_shipment_id = #{vo.delayedShipmentId}
</if>
</where>
ORDER BY tb.create_time DESC
</select>
<select id="findById" resultType="com.lframework.xingyun.sc.entity.DelayedShipmentDetail">
<include refid="DelayedShipmentDetail_sql"/>
<where>
<if test="id != null and id != ''">
AND tb.id = #{id}
</if>
</where>
</select>
</mapper>