|
@@ -343,4 +343,119 @@ warn_status,forecast_status,
|
|
|
</if>
|
|
|
</where>
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="getInOrOut" parameterType="com.platform.dao.dto.sqarepartmanage.SparePartInfoDTO"
|
|
|
+ resultType="com.platform.dao.vo.query.sparepartmanage.SparePartInfoVO">
|
|
|
+ select info.*, SUM(spareStore.num) currentStock,store.name as storeName,spareStore.id as spareStoreId
|
|
|
+ from t_spare_part_info info
|
|
|
+ LEFT JOIN t_spare_store spareStore on spareStore.spare_id = info.id
|
|
|
+ left join t_store store on spareStore.store_id = store.id
|
|
|
+ <if test="producerName != null and producerName != ''">
|
|
|
+ LEFT JOIN t_firm_producer producer on producer.id = info.producer_id
|
|
|
+ </if>
|
|
|
+ <if test="supplierName != null and supplierName != ''">
|
|
|
+ LEFT JOIN t_supplier supplier on supplier.id = info.supplier_id
|
|
|
+ </if>
|
|
|
+ <where>
|
|
|
+ <if test="spareIdList != null and spareIdList.size > 0">
|
|
|
+ and sparestore.spare_id in
|
|
|
+ <foreach item="item" index="index" collection="spareIdList" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="warnStatusList != null and warnStatusList.size > 0">
|
|
|
+ AND info.warn_status in
|
|
|
+ <foreach item="item" index="index" collection="warnStatusList" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="forecastStatusList != null and forecastStatusList.size > 0">
|
|
|
+ AND info.forecast_status in
|
|
|
+ <foreach item="item" index="index" collection="forecastStatusList" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="typeId != null and typeId != ''">
|
|
|
+ and info.type_id = #{typeId}
|
|
|
+ </if>
|
|
|
+ <if test="isSpecial != null and isSpecial != ''">
|
|
|
+ and info.is_special = #{isSpecial}
|
|
|
+ </if>
|
|
|
+ <if test="producerName != null and producerName != ''">
|
|
|
+ AND producer.name like concat('%',#{producerName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="supplierName != null and supplierName != ''">
|
|
|
+ AND supplier.name like concat('%',#{supplierName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="keyword != null and keyword != ''">
|
|
|
+ AND ( info.name like concat('%',#{keyword},'%') or
|
|
|
+ info.no like concat('%',#{keyword},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="name != null and name != ''">
|
|
|
+ AND info.name = #{name}
|
|
|
+ </if>
|
|
|
+ <if test="warnStatus != null and warnStatus != ''">
|
|
|
+ AND info.warn_status = #{warnStatus}
|
|
|
+ </if>
|
|
|
+ <if test="forecastStatus != null and forecastStatus != ''">
|
|
|
+ AND info.forecast_status = #{forecastStatus}
|
|
|
+ </if>
|
|
|
+ <if test="ggxh != null and ggxh != ''">
|
|
|
+ AND info.ggxh like concat('%',#{ggxh},'%')
|
|
|
+ </if>
|
|
|
+ <if test="initNo != null and initNo != ''">
|
|
|
+ AND info.init_no like concat('%',#{initNo},'%')
|
|
|
+ </if>
|
|
|
+ <if test="yt != null">
|
|
|
+ AND info.yt=#{yt}
|
|
|
+ </if>
|
|
|
+ <if test="storeId != null and storeId != ''">
|
|
|
+ AND spare.store_id=#{storeId}
|
|
|
+ </if>
|
|
|
+ <if test="level != null and level != ''">
|
|
|
+ AND info.level=#{level}
|
|
|
+ </if>
|
|
|
+ <if test="typeIds != null and typeIds.size > 0">
|
|
|
+ AND info.type_id in
|
|
|
+ <foreach item="item" index="index" collection="typeIds" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="producerId != null and producerId != ''">
|
|
|
+ AND info.producer_id=#{producerId}
|
|
|
+ </if>
|
|
|
+ <if test="supplierId != null and producerId != ''">
|
|
|
+ AND info.supplier_id=#{supplierId}
|
|
|
+ </if>
|
|
|
+ <if test="parentTypeId != null and parentTypeId != ''">
|
|
|
+ AND info.parent_type_id=#{parentTypeId}
|
|
|
+ </if>
|
|
|
+ <!-- <if test="typeId != null and typeId != ''">
|
|
|
+ AND info.type_id=#{typeId}
|
|
|
+ </if>-->
|
|
|
+ <if test="parentNo != null and parentNo != ''">
|
|
|
+ AND info.parent_no=#{parentNo}
|
|
|
+ </if>
|
|
|
+ <if test="childNo != null and childNo != ''">
|
|
|
+ AND info.child_no=#{childNo}
|
|
|
+ </if>
|
|
|
+ <if test="searchMinStockWarn">
|
|
|
+ AND info.min_stock is not null
|
|
|
+ </if>
|
|
|
+ <if test="searchMinStockWarn">
|
|
|
+ AND info.warn_status = 0
|
|
|
+ </if>
|
|
|
+ <if test="searchType">
|
|
|
+ AND info.type_id not in (select id from t_spare_type)
|
|
|
+ </if>
|
|
|
+ <if test="brand!=null">
|
|
|
+ and info.brand like concat('%',#{brand},'%')
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ group by info.id
|
|
|
+ <if test="searchMinStockWarn">
|
|
|
+ HAVING info.min_stock > SUM( spareStore.num )
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
</mapper>
|