<?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>
|