DomesticPlanSummaryDetailMapper.xml
4.73 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?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.procurement.mappers.summary.DomesticPlanSummaryDetailMapper">
<resultMap id="DomesticPlanSummaryDetail" type="com.lframework.xingyun.sc.procurement.entity.summary.DomesticPlanSummaryDetail">
<id column="id" property="id"/>
<result column="summary_id" property="summaryId"/>
<result column="order_no" property="orderNo"/>
<result column="plan_create_date" property="planCreateDate"/>
<result column="purchase_dept_id" property="purchaseDeptId"/>
<result column="purchase_dept_name" property="purchaseDeptName"/>
<result column="supplier_name" property="supplierName"/>
<result column="plan_id" property="planId"/>
<result column="plan_code" property="planCode"/>
<result column="product_id" property="productId"/>
<result column="product_name" property="productName"/>
<result column="quantity" property="quantity"/>
<result column="actual_purchase_price" property="actualPurchasePrice"/>
<result column="shipping_cost" property="shippingCost"/>
<result column="price_with_shipping" property="priceWithShipping"/>
<result column="workshop_id" property="workshopId"/>
<result column="workshop_name" property="workshopName"/>
<result column="coordination_range" property="coordinationRange"/>
<result column="remark_flag" property="remarkFlag"/>
<result column="plan_line_id" property="planLineId"/>
<result column="approval_pass_time" property="approvalPassTime"/>
<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="DomesticPlanSummaryDetail_sql">
SELECT
dpsd.id,
dpsd.summary_id,
dpsd.order_no,
dpsd.plan_create_date,
dpsd.purchase_dept_id,
sd.name AS purchase_dept_name,
dpsd.supplier_name,
dpsd.plan_id,
dpsd.plan_code,
dpsd.product_id,
br.product_name,
dpsd.quantity,
dpsd.actual_purchase_price,
dpsd.shipping_cost,
dpsd.price_with_shipping,
dpsd.workshop_id,
ws.name AS workshop_name,
dpsd.coordination_range,
dpsd.remark_flag,
dpsd.plan_line_id,
dpsd.approval_pass_time,
dpsd.create_by_id,
dpsd.create_by,
dpsd.update_by_id,
dpsd.update_by,
dpsd.create_time,
dpsd.update_time
FROM domestic_plan_summary_detail AS dpsd
LEFT JOIN base_data_breed_relationship br ON br.id = dpsd.product_id
LEFT JOIN base_data_workshop as ws on ws.id = dpsd.workshop_id
LEFT JOIN sys_dept sd ON sd.id = dpsd.purchase_dept_id
</sql>
<select id="getBySummaryId" resultMap="DomesticPlanSummaryDetail">
<include refid="DomesticPlanSummaryDetail_sql"/>
WHERE dpsd.summary_id = #{summaryId}
ORDER BY dpsd.order_no ASC
</select>
<delete id="deleteBySummaryId">
DELETE FROM domestic_plan_summary_detail WHERE summary_id = #{summaryId}
</delete>
<select id="selectPlanLinesForYesterdaySummary" resultType="java.util.HashMap">
SELECT
pp.id AS plan_id,
pp.code AS plan_code,
pp.create_time AS plan_create_time,
pp.purchase_department AS purchase_dept_id,
pdc.customer_short_name AS supplier_name,
pp.shipping_cost AS shipping_cost,
pp.approval_pass_time AS approval_pass_time,
ppl.id AS plan_line_id,
ppl.product_id AS product_id,
ppl.quantity AS quantity,
ppl.actual_purchase_price AS actual_purchase_price,
ppl.coordination_range AS coordination_range,
ppl.workshop_id AS workshop_id
FROM procurement_plan_line ppl
INNER JOIN procurement_plan pp ON ppl.procurement_plan_id = pp.id
AND pp.process_status = 'COMPLETED'
AND (pp.frozen = 0 OR pp.frozen IS NULL)
AND pp.deleted = 0
AND pp.approval_pass_time BETWEEN #{yesterdayStart} AND #{yesterdayEnd}
LEFT JOIN procurement_domestic_customer_credit pdc ON pdc.id = pp.supplier_id
ORDER BY pp.approval_pass_time ASC, ppl.id ASC
</select>
</mapper>