ReceiptHeaderMapper.xml
2.36 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
<?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.receipt.receiptHeader.mapper.ReceiptHeaderMapper">
<select id="createCode" resultType="java.lang.String">
SELECT code FROM receipt_header WHERE type = #{receiptType,jdbcType=VARCHAR} ORDER BY id DESC LIMIT 1
</select>
<insert id="headerToHistory">
INSERT INTO receipt_header_history (
code, warehouseCode, companyId, type, sourceCode, sourcePlatform, companyCode, totalQty,
totalLines, remark, uploadStatus, uploadremark, uploadTime, appointmentTime, firstStatus, lastStatus,
created, createdBy, lastUpdated, lastUpdatedBy, ENABLE, userDef1, userDef2, userDef3, deleted)
SELECT
code, warehouseCode, companyId, type, sourceCode, sourcePlatform, companyCode, totalQty,
totalLines, remark, uploadStatus, uploadremark, uploadTime, appointmentTime, firstStatus,
lastStatus, created, createdBy, lastUpdated, lastUpdatedBy, ENABLE, userDef1, userDef2, userDef3, 1
FROM receipt_header WHERE code = #{code,jdbcType=VARCHAR}
</insert>
<insert id="detailToHistory">
INSERT INTO receipt_detail_history (
id,sourceLine,receiptCode,materialCode,batch,lot,project,manufactureDate,expirationDate,inventoryStatus,qty,
price,uploadTime,created,createdBy,lastUpdated,lastUpdatedBy,enable,deleted,userDef1,userDef2,userDef3)
SELECT
id,sourceLine,receiptCode,materialCode,batch,lot,project,manufactureDate,expirationDate,inventoryStatus,qty,
price,uploadTime,created,createdBy,lastUpdated,lastUpdatedBy,enable,1,userDef1,userDef2,userDef3
FROM receipt_detail WHERE receiptCode = #{code,jdbcType=VARCHAR}
</insert>
<select id="getDetail" resultType="java.util.Map">
SELECT d.id, d.receiptId, d.receiptCode, d.materialCode, d.sysQty, d.qty, m.name, s.dictLabel inventoryStatus, '个' unit
FROM receipt_detail d
INNER JOIN material m ON d.materialId = m.id and m.deleted = FALSE AND d.receiptCode = #{code}
INNER JOIN sys_dict_data s ON s.dictType = 'inventoryStatus' AND d.inventoryStatus = s.dictValue AND s.enable = TRUE AND s.deleted = FALSE
</select>
</mapper>