<?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.SparesPartInventoryMapper">
|
|
|
<select id="getSpareList" parameterType="String" resultType="org.jeecg.modules.spare.vo.SparePartVo">
|
|
select
|
t1.id as id,
|
t1.warehouse_area_id as warehouseAreaId,
|
t1.warehouse_location_id as warehouseLocationId,
|
t1.spare_part_id as sparePartId,
|
t1.batch_num as batchNum,
|
t1.validity_forecast as validityForecast,
|
t1.inventory_forecast as inventoryForecast,
|
t1.constructor_id as constructorId,
|
t1.main_unit_id as mainUnitId,
|
t1.auxiliary_unit_id as auxiliaryUnitId,
|
t1.main_quantity as mainQuantity,
|
t1.auxiliary_quantity as auxiliaryQuantity,
|
t1.manufacture_date as manufactureDate,
|
t1.validity_period as validityPeriod,
|
t3.name as constructorName,
|
t2.num as spareNum,
|
t2.id as spaceId,
|
t2.name as spareName,
|
t2.model,
|
t2.specification,
|
t2.conversion_ratio as conversionRatio,
|
t6.name as warehouseAreaIdName,
|
t7.num as warehouseLocationIdName
|
|
from mom_eam_spares_part_inventory t1
|
LEFT JOIN mom_eam_spare_part t2 ON t1.spare_part_id = t2.id
|
LEFT JOIN mom_base_constructor t3 ON t3.id = t1.constructor_id
|
LEFT JOIN mom_base_unit t4 ON t4.id = t1.auxiliary_unit_id
|
LEFT JOIN mom_base_unit t5 ON t5.id = t1.main_unit_id
|
|
LEFT JOIN mom_base_warehouse_area t6 ON t6.id = t1.warehouse_area_id
|
LEFT JOIN mom_base_warehouse_location t7 ON t7.id = t1.warehouse_location_id
|
|
|
where 1=1 AND t1.main_quantity>0
|
|
<if test="num != 'null' and num != ''">
|
and t2.num like concat('%',#{num},'%')
|
</if>
|
<if test="name != 'null' and name != ''">
|
and t2.name like concat('%',#{name},'%')
|
</if>
|
ORDER BY t2.create_time desc
|
</select>
|
|
<select id="getSparePartInventoryList" parameterType="Map" resultType="Map">
|
SELECT
|
t1.id,
|
t1.batch_num AS batchNum,
|
t1.main_quantity AS mainQuantity,
|
t1.auxiliary_quantity AS auxiliaryQuantity,
|
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.warehouse_area_id AS warehouseAreaId,
|
t9.name as warehouseAreaName,
|
t1.warehouse_location_id AS warehouseLocationId,
|
t10.num as warehouseLocationNum
|
FROM
|
mom_eam_spares_part_inventory t1
|
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_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.sparePartId != null and params.sparePartId != ''">
|
and t1.spare_part_id = #{params.sparePartId}
|
</if>
|
</select>
|
|
<select id="findSparePartInventoryList" parameterType="Map" resultType="Map">
|
SELECT
|
t1.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_unit_id AS mainUnitId,
|
t1.auxiliary_unit_id AS auxiliaryUnitId,
|
t1.main_quantity AS mainQuantity,
|
t1.auxiliary_quantity AS auxiliaryQuantity,
|
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,
|
t1.warehouse_area_id AS warehouseAreaId,
|
t9.name as warehouseAreaName,
|
t1.warehouse_location_id AS warehouseLocationId,
|
t10.num as warehouseLocationNum
|
FROM
|
mom_eam_spares_part_inventory t1
|
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_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 and t1.main_quantity > 0 and t1.warehouse_id =#{params.warehouseId}
|
<if test="params.num != null and params.num != ''">
|
and t6.num like concat('%',#{params.num},'%')
|
</if>
|
<if test="params.name != null and params.name != ''">
|
and t6.name like concat('%',#{params.name},'%')
|
</if>
|
<!-- <if test="params.sparePartId != null and params.sparePartId != ''">-->
|
<!-- and t1.spare_part_id = #{params.sparePartId}-->
|
<!-- </if>-->
|
</select>
|
</mapper>
|