Commit 60bbe201 authored by zhengyi's avatar zhengyi

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

parent 68248677
...@@ -545,35 +545,69 @@ ...@@ -545,35 +545,69 @@
and (o.line_id in( and (o.line_id in(
select whl.id select whl.id
from ecw_warehouse_line whl from ecw_warehouse_line whl
where whl.start_warehouse_id in where
<foreach item='warehouseId' collection='query.startWarehouseIds' open='(' separator=',' close=')'> <if test="query.startWarehouseIds.size() == 1">
#{warehouseId} whl.start_warehouse_id =
</foreach> <foreach item='warehouseId' collection='query.startWarehouseIds'>
#{warehouseId}
and whl.dest_warehouse_id in </foreach>
<foreach item='destWarehouseId' collection='query.destWarehouseIds' open='(' separator=',' close=')'> </if>
#{destWarehouseId} <if test="query.startWarehouseIds.size() > 1">
</foreach> 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>
<if test="query.startWarehouseIds !=null and query.startWarehouseIds.size() > 0 and (query.destWarehouseIds==null or query.destWarehouseIds.size() == 0) "> <if test="query.startWarehouseIds !=null and query.startWarehouseIds.size() > 0 and (query.destWarehouseIds==null or query.destWarehouseIds.size() == 0) ">
and (o.line_id in( and (o.line_id in(
select whl.id select whl.id
from ecw_warehouse_line whl from ecw_warehouse_line whl
where whl.start_warehouse_id in where
<foreach item='warehouseId' collection='query.startWarehouseIds' open='(' separator=',' close=')'> <if test="query.startWarehouseIds.size() == 1">
#{warehouseId} whl.start_warehouse_id =
</foreach> <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>
<if test="(query.startWarehouseIds ==null or query.startWarehouseIds.size() == 0) and query.destWarehouseIds !=null and query.destWarehouseIds.size() > 0 "> <if test="(query.startWarehouseIds ==null or query.startWarehouseIds.size() == 0) and query.destWarehouseIds !=null and query.destWarehouseIds.size() > 0 ">
and (o.line_id in( and (o.line_id in(
select whl.id select whl.id
from ecw_warehouse_line whl from ecw_warehouse_line whl
where whl.dest_warehouse_id in where
<foreach item='destWarehouseId' collection='query.destWarehouseIds' open='(' separator=',' close=')'> <if test="query.destWarehouseIds.size() == 1">
#{destWarehouseId} and whl.dest_warehouse_id =
</foreach> <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>
<if test="query.customsTypes != null and query.customsTypes.size()>0"> <if test="query.customsTypes != null and query.customsTypes.size()>0">
...@@ -1225,9 +1259,9 @@ ...@@ -1225,9 +1259,9 @@
</foreach> </foreach>
</if> </if>
<if test="query.destCountryId != null "> <if test="query.destCountryIds != null and query.destCountryIds.size() > 0">
AND ob.`objective_country_id` in 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} #{destCountryId}
</foreach> </foreach>
</if> </if>
...@@ -1235,35 +1269,69 @@ ...@@ -1235,35 +1269,69 @@
and (o.line_id in( and (o.line_id in(
select whl.id select whl.id
from ecw_warehouse_line whl from ecw_warehouse_line whl
where whl.start_warehouse_id in where
<foreach item='warehouseId' collection='query.startWarehouseIds' open='(' separator=',' close=')'> <if test="query.startWarehouseIds.size() == 1">
#{warehouseId} whl.start_warehouse_id =
</foreach> <foreach item='warehouseId' collection='query.startWarehouseIds'>
#{warehouseId}
and whl.dest_warehouse_id in </foreach>
<foreach item='destWarehouseId' collection='query.destWarehouseIds' open='(' separator=',' close=')'> </if>
#{destWarehouseId} <if test="query.startWarehouseIds.size() > 1">
</foreach> 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>
<if test="query.startWarehouseIds !=null and query.startWarehouseIds.size() > 0 and (query.destWarehouseIds==null or query.destWarehouseIds.size() == 0) "> <if test="query.startWarehouseIds !=null and query.startWarehouseIds.size() > 0 and (query.destWarehouseIds==null or query.destWarehouseIds.size() == 0) ">
and (o.line_id in( and (o.line_id in(
select whl.id select whl.id
from ecw_warehouse_line whl from ecw_warehouse_line whl
where whl.start_warehouse_id in where
<foreach item='warehouseId' collection='query.startWarehouseIds' open='(' separator=',' close=')'> <if test="query.startWarehouseIds.size() == 1">
#{warehouseId} whl.start_warehouse_id =
</foreach> <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>
<if test="(query.startWarehouseIds ==null or query.startWarehouseIds.size() == 0) and query.destWarehouseIds !=null and query.destWarehouseIds.size() > 0 "> <if test="(query.startWarehouseIds ==null or query.startWarehouseIds.size() == 0) and query.destWarehouseIds !=null and query.destWarehouseIds.size() > 0 ">
and (o.line_id in( and (o.line_id in(
select whl.id select whl.id
from ecw_warehouse_line whl from ecw_warehouse_line whl
where whl.dest_warehouse_id in where
<foreach item='destWarehouseId' collection='query.destWarehouseIds' open='(' separator=',' close=')'> <if test="query.destWarehouseIds.size() == 1">
#{destWarehouseId} and whl.dest_warehouse_id =
</foreach> <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>
......
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