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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?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.SparePartPurchaseStorageDetailMapper">
 
    <select id="getSparePartPurchaseStorageDeatilList"  parameterType="Map" resultType="Map">
        SELECT
            t1.id,
            t1.spare_part_id AS sparePartId,
            t2.num,
            t2.name,
            t2.model,
            t2.specification,
            t1.main_unit_id as mainUnitId,
            t3.name as mainUnitName,
            t1.auxiliary_unit_id as auxiliaryUnitId,
            t4.name as auxiliaryUnitName,
            t5.name as constructorName,
            t1.constructor_id as constructorId,
            t1.main_quantity as mainQuantity,
            t1.auxiliary_quantity AS auxiliaryQuantity,
            t1.batch_num as batchNum,
            t1.manufacture_date as manufactureDate,
            t2.conversion_ratio as conversionRatio,
            t1.supplier_id as supplierId,
            t1.warehouse_id as warehouseId,
            t1.warehouse_area_id AS warehouseAreaId,
            t9.name as warehouseAreaName,
            t1.warehouse_location_id AS warehouseLocationId,
            t10.num as warehouseLocationNum
        FROM
            mom_eam_spare_part_purchase_storage_detail t1
        LEFT JOIN mom_eam_spare_part t2 on t1.spare_part_id = t2.id
        LEFT JOIN mom_base_unit t3 ON t1.main_unit_id = t3.id
        left join mom_base_unit t4 on t1.auxiliary_unit_id = t4.id
        left join mom_base_constructor t5 on t1.constructor_id = t5.id
        left join mom_base_warehouse t8 on t1.warehouse_id = t8.id
        left join mom_base_warehouse_area t9 on t1.warehouse_area_id  = t9.id
        left join mom_base_warehouse_location t10 on t1.warehouse_location_id = t10.id
        WHERE t1.del_flag = '0'
        <if test="sparePartPurchaseStorageId != null and sparePartPurchaseStorageId != ''">
            and t1.spare_part_purchase_storage_id = #{sparePartPurchaseStorageId}
        </if>
        ORDER BY t1.create_time desc
    </select>
 
    <select id="getSparePartPurchaseStorageDeatilsById"  parameterType="Map" resultType="Map">
        SELECT
            t1.id,
            t1.spare_part_id AS sparePartId,
            t2.num,
            t2.name,
            t2.model,
            t2.specification,
            t1.main_unit_id as mainUnitId,
            t3.name as mainUnitName,
            t1.auxiliary_unit_id as auxiliaryUnitId,
            t4.name as auxiliaryUnitName,
            t5.name as constructorName,
            t1.constructor_id as constructorId,
            t1.main_quantity as mainQuantity,
            t1.auxiliary_quantity AS auxiliaryQuantity,
            t1.batch_num as batchNum,
            t1.manufacture_date as manufactureDate,
            t2.conversion_ratio as conversionRatio,
            t6.status as purchaseStorageStatus,
            t1.status,
            t1.spare_part_purchase_storage_id as sparePartPurchaseStorageId,
            t1.supplier_id as supplierId,
            t7.name as supplierName,
            t1.warehouse_id as warehouseId,
            t8.name as warehouseName,
            t1.warehouse_area_id AS warehouseAreaId,
            t9.name as warehouseAreaName,
            t1.warehouse_location_id AS warehouseLocationId,
            t10.num as warehouseLocationNum
        FROM
            mom_eam_spare_part_purchase_storage_detail t1
        LEFT JOIN mom_eam_spare_part t2 on t1.spare_part_id = t2.id
        LEFT JOIN mom_base_unit t3 ON t1.main_unit_id = t3.id
        left join mom_base_unit t4 on t1.auxiliary_unit_id = t4.id
        left join mom_base_constructor t5 on t1.constructor_id = t5.id
        left join mom_eam_spare_part_purchase_storage t6 on t1.spare_part_purchase_storage_id = t6.id
        left join mom_base_supplier t7 on t1.supplier_id = t7.id
        left join mom_base_warehouse t8 on t1.warehouse_id = t8.id
        left join mom_base_warehouse_area t9 on t1.warehouse_area_id  = t9.id
        left join mom_base_warehouse_location t10 on t1.warehouse_location_id = t10.id
        WHERE t1.del_flag = '0'
        <if test="params.sparePartPurchaseStorageId != null and params.sparePartPurchaseStorageId != ''">
            and t1.spare_part_purchase_storage_id = #{params.sparePartPurchaseStorageId}
        </if>
        ORDER BY t1.create_time desc
    </select>
 
    <select id="getWarehouseAreas"  parameterType="Map" resultType="org.jeecg.modules.spare.vo.WarehouseAreaVo">
        SELECT
            id AS value,
            NAME AS title,
            NAME AS text
        FROM
            mom_base_warehouse_area
        WHERE del_flag = '0'
        <if test="warehouseId != null and warehouseId != ''">
            and warehouse_id = #{warehouseId}
        </if>
    </select>
 
    <select id="getWarehouseLocations"  parameterType="Map" resultType="org.jeecg.modules.spare.vo.WarehouseLocationVo">
        SELECT
            id AS value,
            num AS title,
            num AS text
        FROM
            mom_base_warehouse_location
        WHERE del_flag = '0'
        <if test="warehouseId != null and warehouseId != ''">
            and warehouse_id = #{warehouseId}
        </if>
        <if test="warehouseAreaId != null and warehouseAreaId != ''">
            and warehouse_area_id = #{warehouseAreaId}
        </if>
    </select>
 
</mapper>