优化商品库存查询的接口,解决0库存的商品不展示的问题

This commit is contained in:
jishenghua 2024-03-28 22:44:44 +08:00
parent af673380df
commit 6aa51ffdc4

View File

@ -610,16 +610,16 @@
FROM jsh_material m
left JOIN jsh_material_extend me on m.id = me.material_id and ifnull(me.delete_Flag,'0') !='1'
left join jsh_material_current_stock mcs on m.id = mcs.material_id and ifnull(mcs.delete_flag,'0') !='1'
left JOIN jsh_unit u on m.unit_id = u.id and ifnull(u.delete_Flag,'0') !='1'
left JOIN jsh_material_category mc on m.category_id = mc.id and ifnull(mc.delete_Flag,'0') !='1'
where 1=1
and me.default_flag=1
<if test="depotList.size()>0">
and mcs.depot_id in
<foreach collection="depotList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
left JOIN jsh_unit u on m.unit_id = u.id and ifnull(u.delete_Flag,'0') !='1'
left JOIN jsh_material_category mc on m.category_id = mc.id and ifnull(mc.delete_Flag,'0') !='1'
where 1=1
and me.default_flag=1
<if test="idList.size()>0">
and m.category_id in
<foreach collection="idList" item="item" index="index" separator="," open="(" close=")">
@ -655,16 +655,16 @@
(select m.id, ifnull(sum(mcs.current_number),0) currentStock from jsh_material m
left JOIN jsh_material_extend me on m.id = me.material_id and ifnull(me.delete_Flag,'0') !='1'
left join jsh_material_current_stock mcs on m.id = mcs.material_id and ifnull(mcs.delete_flag,'0') !='1'
left JOIN jsh_unit u on m.unit_id = u.id and ifnull(u.delete_Flag,'0') !='1'
left JOIN jsh_material_category mc on m.category_id = mc.id and ifnull(mc.delete_Flag,'0') !='1'
where 1=1
and me.default_flag=1
<if test="depotList.size()>0">
and mcs.depot_id in
<foreach collection="depotList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
left JOIN jsh_unit u on m.unit_id = u.id and ifnull(u.delete_Flag,'0') !='1'
left JOIN jsh_material_category mc on m.category_id = mc.id and ifnull(mc.delete_Flag,'0') !='1'
where 1=1
and me.default_flag=1
<if test="idList.size()>0">
and m.category_id in
<foreach collection="idList" item="item" index="index" separator="," open="(" close=")">