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
<?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.SparePartReceiveDeatilMapper">
 
    <delete id="deleteByMainId" parameterType="java.lang.String">
        DELETE 
        FROM  mom_eam_spare_part_receive_deatil 
        WHERE
             spare_part_receive_id = #{mainId}     </delete>
    
 
    <select id="selectByMainId" parameterType="java.lang.String"
            resultType="org.jeecg.modules.spare.vo.SparePartReceiveVo">
 
        SELECT t1.id                       as id,
               t1.receive_main_quantity      as receiveMainQuantity,
               t1.spare_part_inventory_id as sparePartInventoryId,
               t1.receive_auxiliary_quantity as receiveAuxiliaryQuantity,
               t2.conversion_ratio         as conversionRatio,
               t1.spare_part_receive_id      as sparePartReceiveId,
               t1.spare_part_id            as sparePartId,
               t2.num                      as spareNum,
               t2.model,
               t2.name                     as spareName,
               t2.specification,
               t2.constructor_id           as constructorId,
               t6.name                     as constructorName,
               t3.main_unit_id             as mainUnitId,
               t3.auxiliary_unit_id        as auxiliaryUnitId,
               t3.manufacture_date         as manufactureDate,
               t3.validity_period          as validityPeriod,
               t3.warehouse_area_id        as warehouseAreaId,
               t3.warehouse_location_id    as warehouseLocationId,
 
               t3.auxiliary_quantity       as auxiliaryQuantity,
               t3.main_quantity            as mainQuantity,
               t3.batch_num                as batchNum,
               t4.name                     as mainUnitIdName,
               t5.name                     as auxiliaryUnitIdName,
               t8.name                     as warehouseAreaIdName,
               t7.num                      as warehouseLocationIdName
 
        FROM mom_eam_spare_part_receive_deatil t1
                 LEFT JOIN mom_eam_spare_part t2 ON t1.spare_part_id = t2.id
                 LEFT JOIN mom_base_constructor t6 ON t6.id = t2.constructor_id
                 LEFT JOIN mom_eam_spares_part_inventory t3 ON t1.spare_part_inventory_id = t3.id
                 LEFT JOIN mom_base_unit t4 ON t3.main_unit_id = t4.id
                 LEFT JOIN mom_base_unit t5 ON t3.auxiliary_unit_id = t5.id
                 LEFT JOIN mom_base_warehouse_area t8 ON t8.id = t3.warehouse_area_id
                 LEFT JOIN mom_base_warehouse_location t7 ON t7.id = t3.warehouse_location_id
        WHERE
            spare_part_receive_id = #{mainId}
          and t1.del_flag = 0
    </select>
 
</mapper>