cuijian
2023-08-19 bdd0875d4b13a3f1ef472f64d4b6a95e0ef64b22
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
<?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="org.jeecg.modules.spare.mapper.SparePartOutboundDetailMapper">
 
    <select id="getSparePartOutboundDeatilList"  parameterType="Map" resultType="Map">
        SELECT
            t10.id,
            t1.id AS sparesPartInventoryId,
            t6.id as sparePartId,
            t6.num,
            t6.name,
            t6.model,
            t6.specification,
            t6.conversion_ratio as conversionRatio,
            t1.batch_num AS batchNum,
            t1.main_quantity AS mainQuantity,
            t1.auxiliary_quantity AS auxiliaryQuantity,
            t1.main_unit_id AS mainUnitId,
            t1.auxiliary_unit_id AS auxiliaryUnitId,
            t1.supplier_id as supplierId,
            t2.NAME AS mainUnitName,
            t3.NAME AS auxiliaryUnitName,
            t1.manufacture_date AS manufactureDate,
            t4.NAME AS supplierName,
            t1.validity_period AS validityPeriod,
            t1.validity_forecast AS validityForecast,
            t5.NAME AS warehouseName,
            t1.constructor_id AS constructorId,
            t7.name as constructorName,
            t10.outbound_main_quantity as outboundMainQuantity
        FROM
            mom_eam_spare_part_outbound_detail t10
        left join mom_eam_spares_part_inventory t1 on t10.spares_part_inventory_id = t1.id
        LEFT JOIN mom_base_unit t2 ON t1.main_unit_id = t2.id
        LEFT JOIN mom_base_unit t3 ON t1.auxiliary_unit_id = t3.id
        LEFT JOIN mom_base_supplier t4 ON t1.supplier_id = t4.id
        LEFT JOIN mom_base_warehouse t5 ON t1.warehouse_id = t5.id
        LEFT JOIN mom_eam_spare_part t6 ON t1.spare_part_id = t6.id
        left join mom_base_constructor t7 on t1.constructor_id = t7.id
        WHERE t10.del_flag = '0'
        <if test="sparePartOutboundId != null and sparePartOutboundId != ''">
            and t10.spare_part_outbound_id = #{sparePartOutboundId}
        </if>
        ORDER BY t10.create_time desc
    </select>
 
    <select id="getSparePartOutboundDetailsById"  parameterType="Map" resultType="Map">
        SELECT
            t10.id,
            t1.id AS sparesPartInventoryId,
            t10.status,
            t10.spare_part_outbound_id as sparePartOutboundId,
            t6.id as sparePartId,
            t6.num,
            t6.name,
            t6.model,
            t6.specification,
            t6.conversion_ratio as conversionRatio,
            t1.batch_num AS batchNum,
            t1.main_quantity AS mainQuantity,
            t1.auxiliary_quantity AS auxiliaryQuantity,
            t1.main_unit_id AS mainUnitId,
            t1.auxiliary_unit_id AS auxiliaryUnitId,
            t1.supplier_id as supplierId,
            t2.NAME AS mainUnitName,
            t3.NAME AS auxiliaryUnitName,
            t1.manufacture_date AS manufactureDate,
            t4.NAME AS supplierName,
            t1.validity_period AS validityPeriod,
            t1.validity_forecast AS validityForecast,
            t5.NAME AS warehouseName,
            t1.constructor_id AS constructorId,
            t7.name as constructorName,
            t10.outbound_main_quantity as outboundMainQuantity,
            t10.outbound_auxiliary_quantity as outboundAuxiliaryQuantity,
            t8.status as outboundStatus,
            t1.warehouse_area_id AS warehouseAreaId,
            t11.name as warehouseAreaName,
            t1.warehouse_location_id AS warehouseLocationId,
            t12.num as warehouseLocationNum
        FROM
            mom_eam_spare_part_outbound_detail t10
        left join mom_eam_spares_part_inventory t1 on t10.spares_part_inventory_id = t1.id
        LEFT JOIN mom_base_unit t2 ON t1.main_unit_id = t2.id
        LEFT JOIN mom_base_unit t3 ON t1.auxiliary_unit_id = t3.id
        LEFT JOIN mom_base_supplier t4 ON t1.supplier_id = t4.id
        LEFT JOIN mom_base_warehouse t5 ON t1.warehouse_id = t5.id
        LEFT JOIN mom_eam_spare_part t6 ON t1.spare_part_id = t6.id
        left join mom_base_constructor t7 on t1.constructor_id = t7.id
        left join mom_eam_spare_part_outbound t8 on t8.id = t10.spare_part_outbound_id
 
        left join mom_base_warehouse_area t11 on t1.warehouse_area_id  = t11.id
        left join mom_base_warehouse_location t12 on t1.warehouse_location_id = t12.id
        WHERE t10.del_flag = '0'
        <if test="params.sparePartOutboundId != null and params.sparePartOutboundId != ''">
            and t10.spare_part_outbound_id = #{params.sparePartOutboundId}
        </if>
        <if test="params.status != null and params.status != ''">
            and t10.status = #{params.status}
        </if>
        <if test="params.warehouseId != null and params.warehouseId != ''">
            and t1.warehouse_id = #{params.warehouseId}
        </if>
        ORDER BY t10.create_time desc
    </select>
 
 
</mapper>