|
@@ -105,6 +105,12 @@
|
|
|
left join t_spare_part_info info on outstoreform.spare_id = info.id
|
|
|
left join t_spare_store spareStore on
|
|
|
spareStore.spare_id = outstoreform.spare_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>
|
|
|
<include refid="List_Condition"/>
|
|
|
<if test="useCompany != null and useCompany != ''">
|
|
@@ -122,6 +128,97 @@
|
|
|
<if test="searchTimeEnd!=null ">
|
|
|
and outstoreform.created_time <![CDATA[<=]]> #{searchTimeEnd}
|
|
|
</if>
|
|
|
+ <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="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 outstoreform.spare_id
|
|
|
</select>
|
|
@@ -142,10 +239,20 @@
|
|
|
|
|
|
<select id="getOutStoreForm" parameterType="com.platform.dao.dto.store.OutStoreFormDTO"
|
|
|
resultType="com.platform.dao.vo.query.store.OutStoreFormVO">
|
|
|
- select outstore.*,info.brand ,info.name,info.initial_value as price,info.ggxh from
|
|
|
+ select outstore.*,info.brand ,info.name,info.initial_value as price,info.ggxh,
|
|
|
+ type.name as typeName,info.no,
|
|
|
+ info.unit,sum(spareStore.num) as currentStock,
|
|
|
+ info.max_stock,info.min_stock,
|
|
|
+ info.level,
|
|
|
+ producer.name as producerName,
|
|
|
+ info.yt
|
|
|
+ from
|
|
|
t_out_store_form outstore
|
|
|
left join t_spare_part_info info
|
|
|
on outstore.spare_id = info.id
|
|
|
+ left join t_spare_type type on type.id=info.type_id
|
|
|
+ left join t_spare_store spareStore on spareStore.spare_id = info.id
|
|
|
+ left join t_firm_producer producer on producer.id = info.producer_id
|
|
|
<where>
|
|
|
<if test="keyword!=null and keyword!=''">
|
|
|
and (info.name like concat('%',#{keyword},'%')
|
|
@@ -153,6 +260,7 @@
|
|
|
)
|
|
|
</if>
|
|
|
</where>
|
|
|
+ group by info.id
|
|
|
</select>
|
|
|
|
|
|
<select id="getOutStoreSpareNum" parameterType="com.platform.dao.dto.store.OutStoreFormDTO"
|
|
@@ -171,10 +279,16 @@
|
|
|
|
|
|
<select id="getOutStoreFormCollect" resultType="com.platform.dao.vo.query.store.OutStoreFormVO"
|
|
|
parameterType="com.platform.dao.dto.store.OutStoreFormDTO">
|
|
|
- select info.*,if(sum(form.in_num is null),0,form.in_num) totalNum,if(sum(form.in_num is null),0,form.in_num)*info.initial_value as totalPrice from t_spare_part_info info
|
|
|
- left join t_out_store_form form on info.id = form.spare_id
|
|
|
+ select info.*,sum(form.out_num ) totalNum,sum(form.out_num )*info.initial_value as totalPrice,form.id outId,form.out_no outNo,store.id storeId,spareStore.spare_id spareId from t_spare_part_info info
|
|
|
+ right join t_out_store_form form on info.id = form.spare_id
|
|
|
left join t_spare_store spareStore on spareStore.spare_id = info.id
|
|
|
left join t_store store on store.id = spareStore.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="storeId!=null and storeId!=''">
|
|
|
store.id = #{storeId}
|
|
@@ -185,7 +299,99 @@
|
|
|
<if test="searchTimeEnd!=null and searchTimeEnd!=''">
|
|
|
form.created_time <![CDATA[<=]]> #{searchTimeEnd}
|
|
|
</if>
|
|
|
+ <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="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
|
|
|
|
|
|
</select>
|