ShipmentHeaderMapper.xml
8.63 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<?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.huaheng.pc.shipment.shipmentHeader.mapper.ShipmentHeaderMapper">
<resultMap id="BaseResultMap" type="com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader">
<!--@mbg.generated-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="warehouseCode" jdbcType="VARCHAR" property="warehouseCode" />
<result column="companyCode" jdbcType="VARCHAR" property="companyCode" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="referCode" jdbcType="VARCHAR" property="referCode" />
<result column="referCodeType" jdbcType="VARCHAR" property="referCodeType" />
<result column="referId" jdbcType="INTEGER" property="referId" />
<result column="referPlatform" jdbcType="INTEGER" property="referPlatform" />
<result column="firstStatus" jdbcType="INTEGER" property="firstStatus" />
<result column="lastStatus" jdbcType="INTEGER" property="lastStatus" />
<result column="shipmentType" jdbcType="VARCHAR" property="shipmentType" />
<result column="route" jdbcType="VARCHAR" property="route" />
<result column="customerCode" jdbcType="VARCHAR" property="customerCode" />
<result column="customerName" jdbcType="VARCHAR" property="customerName" />
<result column="priority" jdbcType="INTEGER" property="priority" />
<result column="requestedDeliveryDate" jdbcType="DATE" property="requestedDeliveryDate" />
<result column="scheduledShipDate" jdbcType="DATE" property="scheduledShipDate" />
<result column="actualShipDateTime" jdbcType="TIMESTAMP" property="actualShipDateTime" />
<result column="actualDeliveryDate" jdbcType="DATE" property="actualDeliveryDate" />
<result column="deliveryNote" jdbcType="VARCHAR" property="deliveryNote" />
<result column="rejectionNote" jdbcType="VARCHAR" property="rejectionNote" />
<result column="waveId" jdbcType="INTEGER" property="waveId" />
<result column="shipDock" jdbcType="VARCHAR" property="shipDock" />
<result column="allocateComplete" jdbcType="INTEGER" property="allocateComplete" />
<result column="totalWeight" jdbcType="DECIMAL" property="totalWeight" />
<result column="totalQty" jdbcType="INTEGER" property="totalQty" />
<result column="totalVolume" jdbcType="DECIMAL" property="totalVolume" />
<result column="totalLines" jdbcType="INTEGER" property="totalLines" />
<result column="processType" jdbcType="VARCHAR" property="processType" />
<result column="lastWaveId" jdbcType="INTEGER" property="lastWaveId" />
<result column="signValue" jdbcType="VARCHAR" property="signValue" />
<result column="carrierCode" jdbcType="VARCHAR" property="carrierCode" />
<result column="carrierService" jdbcType="VARCHAR" property="carrierService" />
<result column="shipmentNote" jdbcType="VARCHAR" property="shipmentNote" />
<result column="carrierServer" jdbcType="VARCHAR" property="carrierServer" />
<result column="carrierServerName" jdbcType="VARCHAR" property="carrierServerName" />
<result column="plateNumber" jdbcType="VARCHAR" property="plateNumber" />
<result column="carModel" jdbcType="VARCHAR" property="carModel" />
<result column="driverName" jdbcType="VARCHAR" property="driverName" />
<result column="driverTel" jdbcType="VARCHAR" property="driverTel" />
<result column="created" jdbcType="TIMESTAMP" property="created" />
<result column="createdBy" jdbcType="VARCHAR" property="createdBy" />
<result column="lastUpdated" jdbcType="TIMESTAMP" property="lastUpdated" />
<result column="lastUpdatedBy" jdbcType="VARCHAR" property="lastUpdatedBy" />
<result column="version" jdbcType="INTEGER" property="version" />
<result column="userDef1" jdbcType="VARCHAR" property="userDef1" />
<result column="userDef2" jdbcType="VARCHAR" property="userDef2" />
<result column="userDef3" jdbcType="VARCHAR" property="userDef3" />
<result column="processStamp" jdbcType="VARCHAR" property="processStamp" />
<result column="deleted" jdbcType="BIT" property="deleted" />
<result column="qtcklx" jdbcType="VARCHAR" property="qtcklx" />
<result column="stockId" jdbcType="VARCHAR" property="stockId" />
<result column="saleOrder" jdbcType="INTEGER" property="saleOrder" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, warehouseCode, companyCode, code, referCode, referCodeType, referId,
referPlatform, firstStatus, lastStatus, shipmentType, route, customerCode, customerName,
priority, requestedDeliveryDate, scheduledShipDate, actualShipDateTime,
actualDeliveryDate, deliveryNote, rejectionNote, waveId, shipDock, allocateComplete,
totalWeight, totalQty, totalVolume, totalLines,
processType, lastWaveId, signValue, carrierCode, carrierService, shipmentNote, carrierServer,
carrierServerName, plateNumber, carModel, driverName, driverTel, created, createdBy,
lastUpdated, lastUpdatedBy, version, userDef1, userDef2, userDef3,processStamp, deleted,qtcklx,stockId,saleOrder
</sql>
<select id="createCode" resultType="java.lang.String">
SELECT code FROM shipment_header WHERE shipmentType = #{shipmentType,jdbcType=VARCHAR} AND `code` like concat('%', #{shipmentType,jdbcType=VARCHAR}, '%') ORDER BY code DESC LIMIT 1
</select>
<select id="selectListByCreated" resultType="com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader">
SELECT s.* from shipment_header s
inner join task_detail t on t.billCode=s.code and
t.status>700 and DATEDIFF(NOW(), t.lastUpdated)=0 GROUP BY s.code
</select>
<select id="getLatestShipment" resultType="com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader">
select * from shipment_header order by id desc limit 10
</select>
<select id="selectShipmentStatistics" resultType="com.huaheng.api.tv.domain.ProjectBean">
select "当天出库量" as name,if(sum(totalQty)is null,0,sum(totalQty)) as nums FROM shipment_header
<![CDATA[ WHERE created > CURDATE() and firstStatus>=300 and lastStatus>=300
union
select "当天未出量" as name,if(sum(totalQty)is null,0,sum(totalQty)) as nums FROM shipment_header
WHERE created > CURDATE() and firstStatus<300 and lastStatus<300
union
select "当月出库量" as name,if(sum(totalQty)is null,0,sum(totalQty)) as nums FROM shipment_header
WHERE date_format(created,'%Y-%m-%d') > DATE_FORMAT(now(), '%Y-%m-01') and firstStatus>=300 and lastStatus>=300
union
select "未完成单据" as name,count(1) as nums FROM shipment_header
WHERE firstStatus <300 and lastStatus<300
]]>
</select>
<select id="selectShipmentTrend" resultType="com.huaheng.api.tv.domain.ProjectBean">
<![CDATA[ select curdate() as name,if(sum(totalQty)is null,0,sum(totalQty)) as nums
FROM shipment_header
where created>=curdate() and firstStatus>=300 and lastStatus>=300
union
select DATE_SUB(curdate(),interval 1 day) as name,if(sum(totalQty)is null,0,sum(totalQty)) as nums
FROM shipment_header
where created>=DATE_SUB(curdate(),interval 1 day) and created<=curdate()
and firstStatus>=300 and lastStatus>=300
union
select DATE_SUB(curdate(),interval 2 day) as name,if(sum(totalQty)is null,0,sum(totalQty)) as nums
FROM shipment_header
where created>=DATE_SUB(curdate(),interval 2 day) and created<=DATE_SUB(curdate(),interval 1 day)
and firstStatus>=300 and lastStatus>=300
union
select DATE_SUB(curdate(),interval 3 day) as name,if(sum(totalQty)is null,0,sum(totalQty)) as nums
FROM shipment_header
where created>=DATE_SUB(curdate(),interval 3 day) and created<=DATE_SUB(curdate(),interval 2 day)
and firstStatus>=300 and lastStatus>=300
union
select DATE_SUB(curdate(),interval 4 day) as name,if(sum(totalQty)is null,0,sum(totalQty)) as nums
FROM shipment_header
where created>=DATE_SUB(curdate(),interval 4 day) and created<=DATE_SUB(curdate(),interval 3 day)
and firstStatus>=300 and lastStatus>=300
]]>
</select>
<select id="selectShipmentSituation" resultType="com.huaheng.api.tv.domain.ShipmentSituation">
SELECT sh.referCode,sh.shipmentType,pd.name,sh.created as time
FROM shipment_header sh
left join reservation_submission rs
on sh.referCode=rs.order_number
left join platform_details pd
on pd.id=rs.platform_detail_id
WHERE
sh.referCode!='' and sh.referCode is not null
</select>
<select id="createNewCode" resultType="java.lang.String">
SELECT code FROM shipment_header WHERE code like concat('%', #{shipmentType,jdbcType=VARCHAR}, '%') ORDER BY id DESC LIMIT 1
</select>
</mapper>