Commit 99022f79 authored by 332784038@qq.com's avatar 332784038@qq.com

查询sql条件补充完善

parent 16ad5b47
......@@ -807,7 +807,7 @@
</foreach>
))
</if>
<if test="query.startWarehouseId !=null and query.startWarehouseIds.size() > 0 and (query.destWarehouseId==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(
select whl.id
from ecw_warehouse_line whl
......@@ -1376,53 +1376,54 @@
or pb.`title_zh` = #{query.notEqProdKey} or pb.`title_en` = #{query.notEqProdKey})
))
</if>
<!-- <if test="query.objectiveIds != null and query.objectiveIds.size() > 0">-->
<!-- AND ob.`objective_id` in-->
<!-- <foreach item='orderId' index='index' collection='query.objectiveIds' open='(' separator=',' close=')'>-->
<!-- #{orderId}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="query.destCountryId != null ">-->
<!-- AND ob.`objective_country_id` in-->
<!-- <foreach item='destCountryId' index='index' collection='query.destCountryId' open='(' separator=',' close=')'>-->
<!-- #{destCountryId}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test = "query.startWarehouseId != null and query.destWarehouseId != null ">-->
<!-- and (o.line_id in(-->
<!-- select whl.id-->
<!-- from ecw_warehouse_line whl-->
<!-- where whl.start_warehouse_id in-->
<!-- <foreach item='startWarehouseId' index='index' collection='query.startWarehouseId' open='(' separator=',' close=')'>-->
<!-- #{startWarehouseId}-->
<!-- </foreach>-->
<!-- and whl.dest_warehouse_id in-->
<!-- <foreach item='destWarehouseId' index='index' collection='query.destWarehouseId' open='(' separator=',' close=')'>-->
<!-- #{destWarehouseId}-->
<!-- </foreach>-->
<!-- ))-->
<!-- </if>-->
<!-- <if test = "query.startWarehouseId != null and query.destWarehouseId == null ">-->
<!-- and (o.line_id in(-->
<!-- select whl.id-->
<!-- from ecw_warehouse_line whl-->
<!-- where whl.start_warehouse_id in-->
<!-- <foreach item='startWarehouseId' index='index' collection='query.startWarehouseId' open='(' separator=',' close=')'>-->
<!-- #{startWarehouseId}-->
<!-- </foreach>-->
<!-- ))-->
<!-- </if>-->
<!-- <if test = "query.startWarehouseId == null and query.destWarehouseId != null ">-->
<!-- and (o.line_id in(-->
<!-- select whl.id-->
<!-- from ecw_warehouse_line whl-->
<!-- where whl.dest_warehouse_id in-->
<!-- <foreach item='destWarehouseId' index='index' collection='query.destWarehouseId' open='(' separator=',' close=')'>-->
<!-- #{destWarehouseId}-->
<!-- </foreach>-->
<!-- ))-->
<!-- </if>-->
<if test="query.objectiveIds != null and query.objectiveIds.size() > 0">
AND ob.`objective_id` in
<foreach item='objectiveId' index='index' collection='query.objectiveIds' open='(' separator=',' close=')'>
#{objectiveId}
</foreach>
</if>
<if test="query.destCountryId != null ">
AND ob.`objective_country_id` in
<foreach item='destCountryId' index='index' collection='query.destCountryId' open='(' separator=',' close=')'>
#{destCountryId}
</foreach>
</if>
<if test="query.startWarehouseIds !=null and 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.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>
))
</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>
))
</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>
))
</if>
<if test="query.isNeat == false ">
AND o.sum_num <![CDATA[ < ]]> o.cost->>'$.totalNum'
</if>
......@@ -2352,7 +2353,7 @@
))
</if>
<if test="query.startWarehouseId !=null and query.startWarehouseIds.size() > 0 and (query.destWarehouseId==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(
select whl.id
from ecw_warehouse_line whl
......@@ -3083,7 +3084,7 @@
))
</if>
<if test="query.startWarehouseId !=null and query.startWarehouseIds.size() > 0 and (query.destWarehouseId==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(
select whl.id
from ecw_warehouse_line whl
......@@ -3495,6 +3496,61 @@
where whl.dest_warehouse_id = #{query.destWarehouseId}
))
</if>
<if test="query.objectiveIds != null and query.objectiveIds.size() != 0">
<if test="query.objectiveIds != null and query.objectiveIds.size()==1 ">
AND ob.`objective_id` =
<foreach item='objectiveId' index='index' collection='query.objectiveIds'>
#{objectiveId}
</foreach>
</if>
<if test="query.objectiveIds != null and query.objectiveIds.size()>1 ">
AND ob.`objective_id` in
<foreach item='objectiveId' index='index' collection='query.objectiveIds' open='(' separator=',' close=')'>
#{objectiveId}
</foreach>
</if>
</if>
<if test="query.destCountryIds != null and query.destCountryIds.size()>0 ">
AND ob.`objective_country_id` in
<foreach item='destCountryId' index='index' collection='query.destCountryIds' open='(' separator=',' close=')'>
#{destCountryId}
</foreach>
</if>
<if test="query.startWarehouseIds !=null and 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.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>
))
</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>
))
</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>
))
</if>
<if test="query.isNeat == false ">
AND o.sum_num <![CDATA[ < ]]> o.cost->>'$.totalNum'
</if>
......@@ -3915,7 +3971,7 @@
))
</if>
<if test="query.startWarehouseId !=null and query.startWarehouseIds.size() > 0 and (query.destWarehouseId==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(
select whl.id
from ecw_warehouse_line whl
......@@ -4300,6 +4356,61 @@
where whl.dest_warehouse_id = #{query.destWarehouseId}
))
</if>
<if test="query.objectiveIds != null and query.objectiveIds.size() != 0">
<if test="query.objectiveIds != null and query.objectiveIds.size()==1 ">
AND ob.`objective_id` =
<foreach item='objectiveId' index='index' collection='query.objectiveIds'>
#{objectiveId}
</foreach>
</if>
<if test="query.objectiveIds != null and query.objectiveIds.size()>1 ">
AND ob.`objective_id` in
<foreach item='objectiveId' index='index' collection='query.objectiveIds' open='(' separator=',' close=')'>
#{objectiveId}
</foreach>
</if>
</if>
<if test="query.destCountryIds != null and query.destCountryIds.size()>0 ">
AND ob.`objective_country_id` in
<foreach item='destCountryId' index='index' collection='query.destCountryIds' open='(' separator=',' close=')'>
#{destCountryId}
</foreach>
</if>
<if test="query.startWarehouseIds !=null and 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.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>
))
</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>
))
</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>
))
</if>
<if test="query.isNeat == false ">
AND o.sum_num <![CDATA[ < ]]> o.cost->>'$.totalNum'
</if>
......@@ -5754,6 +5865,61 @@
where whl.dest_warehouse_id = #{query.destWarehouseId}
))
</if>
<if test="query.objectiveIds != null and query.objectiveIds.size() != 0">
<if test="query.objectiveIds != null and query.objectiveIds.size()==1 ">
AND ob.`objective_id` =
<foreach item='objectiveId' index='index' collection='query.objectiveIds'>
#{objectiveId}
</foreach>
</if>
<if test="query.objectiveIds != null and query.objectiveIds.size()>1 ">
AND ob.`objective_id` in
<foreach item='objectiveId' index='index' collection='query.objectiveIds' open='(' separator=',' close=')'>
#{objectiveId}
</foreach>
</if>
</if>
<if test="query.destCountryIds != null and query.destCountryIds.size()>0 ">
AND ob.`objective_country_id` in
<foreach item='destCountryId' index='index' collection='query.destCountryIds' open='(' separator=',' close=')'>
#{destCountryId}
</foreach>
</if>
<if test="query.startWarehouseIds !=null and 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.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>
))
</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>
))
</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>
))
</if>
<if test="query.isNeat == false ">
AND o.sum_num <![CDATA[ < ]]> o.cost->>'$.totalNum'
</if>
......@@ -6279,6 +6445,61 @@
where whl.dest_warehouse_id = #{query.destWarehouseId}
))
</if>
<if test="query.objectiveIds != null and query.objectiveIds.size() != 0">
<if test="query.objectiveIds != null and query.objectiveIds.size()==1 ">
AND ob.`objective_id` =
<foreach item='objectiveId' index='index' collection='query.objectiveIds'>
#{objectiveId}
</foreach>
</if>
<if test="query.objectiveIds != null and query.objectiveIds.size()>1 ">
AND ob.`objective_id` in
<foreach item='objectiveId' index='index' collection='query.objectiveIds' open='(' separator=',' close=')'>
#{objectiveId}
</foreach>
</if>
</if>
<if test="query.destCountryIds != null and query.destCountryIds.size()>0 ">
AND ob.`objective_country_id` in
<foreach item='destCountryId' index='index' collection='query.destCountryIds' open='(' separator=',' close=')'>
#{destCountryId}
</foreach>
</if>
<if test="query.startWarehouseIds !=null and 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.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>
))
</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>
))
</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>
))
</if>
order by rs.order_id desc
limit #{start}, #{size}
</select>
......@@ -6706,6 +6927,61 @@
where whl.dest_warehouse_id = #{query.destWarehouseId}
))
</if>
<if test="query.objectiveIds != null and query.objectiveIds.size() != 0">
<if test="query.objectiveIds != null and query.objectiveIds.size()==1 ">
AND ob.`objective_id` =
<foreach item='objectiveId' index='index' collection='query.objectiveIds'>
#{objectiveId}
</foreach>
</if>
<if test="query.objectiveIds != null and query.objectiveIds.size()>1 ">
AND ob.`objective_id` in
<foreach item='objectiveId' index='index' collection='query.objectiveIds' open='(' separator=',' close=')'>
#{objectiveId}
</foreach>
</if>
</if>
<if test="query.destCountryIds != null and query.destCountryIds.size()>0 ">
AND ob.`objective_country_id` in
<foreach item='destCountryId' index='index' collection='query.destCountryIds' open='(' separator=',' close=')'>
#{destCountryId}
</foreach>
</if>
<if test="query.startWarehouseIds !=null and 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.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>
))
</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>
))
</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>
))
</if>
</select>
<select id="exportOrderExcelList" resultType="cn.iocoder.yudao.module.order.vo.order.OrderExcelVO">
......
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