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

查询sql条件补充完善

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