Commit 60bbe201 authored by zhengyi's avatar zhengyi

简单优化始发仓与目的仓的查询条件

parent 68248677
......@@ -545,35 +545,69 @@
and (o.line_id in(
select whl.id
from ecw_warehouse_line whl
where whl.start_warehouse_id in
<foreach item='warehouseId' collection='query.startWarehouseIds' open='(' separator=',' close=')'>
#{warehouseId}
</foreach>
and whl.dest_warehouse_id in
<foreach item='destWarehouseId' collection='query.destWarehouseIds' open='(' separator=',' close=')'>
#{destWarehouseId}
</foreach>
where
<if test="query.startWarehouseIds.size() == 1">
whl.start_warehouse_id =
<foreach item='warehouseId' collection='query.startWarehouseIds'>
#{warehouseId}
</foreach>
</if>
<if test="query.startWarehouseIds.size() > 1">
whl.start_warehouse_id in
<foreach item='warehouseId' collection='query.startWarehouseIds' open='(' separator=',' close=')'>
#{warehouseId}
</foreach>
</if>
<if test="query.destWarehouseIds.size() == 1">
and whl.dest_warehouse_id =
<foreach item='destWarehouseId' collection='query.destWarehouseIds'>
#{destWarehouseId}
</foreach>
</if>
<if test="query.destWarehouseIds.size() > 1">
and whl.dest_warehouse_id in
<foreach item='destWarehouseId' collection='query.destWarehouseIds' open='(' separator=',' close=')'>
#{destWarehouseId}
</foreach>
</if>
))
</if>
<if test="query.startWarehouseIds !=null and query.startWarehouseIds.size() > 0 and (query.destWarehouseIds==null or query.destWarehouseIds.size() == 0) ">
and (o.line_id in(
select whl.id
from ecw_warehouse_line whl
where whl.start_warehouse_id in
<foreach item='warehouseId' collection='query.startWarehouseIds' open='(' separator=',' close=')'>
#{warehouseId}
</foreach>
where
<if test="query.startWarehouseIds.size() == 1">
whl.start_warehouse_id =
<foreach item='warehouseId' collection='query.startWarehouseIds'>
#{warehouseId}
</foreach>
</if>
<if test="query.startWarehouseIds.size() > 1">
whl.start_warehouse_id in
<foreach item='warehouseId' collection='query.startWarehouseIds' open='(' separator=',' close=')'>
#{warehouseId}
</foreach>
</if>
))
</if>
<if test="(query.startWarehouseIds ==null or query.startWarehouseIds.size() == 0) and query.destWarehouseIds !=null and query.destWarehouseIds.size() > 0 ">
and (o.line_id in(
select whl.id
from ecw_warehouse_line whl
where whl.dest_warehouse_id in
<foreach item='destWarehouseId' collection='query.destWarehouseIds' open='(' separator=',' close=')'>
#{destWarehouseId}
</foreach>
where
<if test="query.destWarehouseIds.size() == 1">
and whl.dest_warehouse_id =
<foreach item='destWarehouseId' collection='query.destWarehouseIds'>
#{destWarehouseId}
</foreach>
</if>
<if test="query.destWarehouseIds.size() > 1">
and whl.dest_warehouse_id in
<foreach item='destWarehouseId' collection='query.destWarehouseIds' open='(' separator=',' close=')'>
#{destWarehouseId}
</foreach>
</if>
))
</if>
<if test="query.customsTypes != null and query.customsTypes.size()>0">
......@@ -1225,9 +1259,9 @@
</foreach>
</if>
<if test="query.destCountryId != null ">
<if test="query.destCountryIds != null and query.destCountryIds.size() > 0">
AND ob.`objective_country_id` in
<foreach item='destCountryId' index='index' collection='query.destCountryId' open='(' separator=',' close=')'>
<foreach item='destCountryId' index='index' collection='query.destCountryIds' open='(' separator=',' close=')'>
#{destCountryId}
</foreach>
</if>
......@@ -1235,35 +1269,69 @@
and (o.line_id in(
select whl.id
from ecw_warehouse_line whl
where whl.start_warehouse_id in
<foreach item='warehouseId' collection='query.startWarehouseIds' open='(' separator=',' close=')'>
#{warehouseId}
</foreach>
and whl.dest_warehouse_id in
<foreach item='destWarehouseId' collection='query.destWarehouseIds' open='(' separator=',' close=')'>
#{destWarehouseId}
</foreach>
where
<if test="query.startWarehouseIds.size() == 1">
whl.start_warehouse_id =
<foreach item='warehouseId' collection='query.startWarehouseIds'>
#{warehouseId}
</foreach>
</if>
<if test="query.startWarehouseIds.size() > 1">
whl.start_warehouse_id in
<foreach item='warehouseId' collection='query.startWarehouseIds' open='(' separator=',' close=')'>
#{warehouseId}
</foreach>
</if>
<if test="query.destWarehouseIds.size() == 1">
and whl.dest_warehouse_id =
<foreach item='destWarehouseId' collection='query.destWarehouseIds'>
#{destWarehouseId}
</foreach>
</if>
<if test="query.destWarehouseIds.size() > 1">
and whl.dest_warehouse_id in
<foreach item='destWarehouseId' collection='query.destWarehouseIds' open='(' separator=',' close=')'>
#{destWarehouseId}
</foreach>
</if>
))
</if>
<if test="query.startWarehouseIds !=null and query.startWarehouseIds.size() > 0 and (query.destWarehouseIds==null or query.destWarehouseIds.size() == 0) ">
and (o.line_id in(
select whl.id
from ecw_warehouse_line whl
where whl.start_warehouse_id in
<foreach item='warehouseId' collection='query.startWarehouseIds' open='(' separator=',' close=')'>
#{warehouseId}
</foreach>
where
<if test="query.startWarehouseIds.size() == 1">
whl.start_warehouse_id =
<foreach item='warehouseId' collection='query.startWarehouseIds'>
#{warehouseId}
</foreach>
</if>
<if test="query.startWarehouseIds.size() > 1">
whl.start_warehouse_id in
<foreach item='warehouseId' collection='query.startWarehouseIds' open='(' separator=',' close=')'>
#{warehouseId}
</foreach>
</if>
))
</if>
<if test="(query.startWarehouseIds ==null or query.startWarehouseIds.size() == 0) and query.destWarehouseIds !=null and query.destWarehouseIds.size() > 0 ">
and (o.line_id in(
select whl.id
from ecw_warehouse_line whl
where whl.dest_warehouse_id in
<foreach item='destWarehouseId' collection='query.destWarehouseIds' open='(' separator=',' close=')'>
#{destWarehouseId}
</foreach>
where
<if test="query.destWarehouseIds.size() == 1">
and whl.dest_warehouse_id =
<foreach item='destWarehouseId' collection='query.destWarehouseIds'>
#{destWarehouseId}
</foreach>
</if>
<if test="query.destWarehouseIds.size() > 1">
and whl.dest_warehouse_id in
<foreach item='destWarehouseId' collection='query.destWarehouseIds' open='(' separator=',' close=')'>
#{destWarehouseId}
</foreach>
</if>
))
</if>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment