Commit f0fe3503 authored by 332784038@qq.com's avatar 332784038@qq.com

sql优化

parent 2691febe
...@@ -775,8 +775,12 @@ public class OrderQueryVO { ...@@ -775,8 +775,12 @@ public class OrderQueryVO {
if (Objects.isNull(this.shipmentStateList)){ if (Objects.isNull(this.shipmentStateList)){
this.shipmentStateList = new ArrayList<>(); this.shipmentStateList = new ArrayList<>();
} }
if (!this.statusList.contains(12)) {
this.statusList.add(12); this.statusList.add(12);
}
if (!this.shipmentStateList.contains(325)) {
this.shipmentStateList.add(325); this.shipmentStateList.add(325);
}
break; break;
case 10501: case 10501:
// 空运待出 // 空运待出
...@@ -789,10 +793,18 @@ public class OrderQueryVO { ...@@ -789,10 +793,18 @@ public class OrderQueryVO {
if (Objects.isNull(this.abnormalStateList)){ if (Objects.isNull(this.abnormalStateList)){
this.abnormalStateList = new ArrayList<>(); this.abnormalStateList = new ArrayList<>();
} }
if (!this.statusList.contains(5)) {
this.statusList.add(5); this.statusList.add(5);
}
if (!this.airShipmentList.contains(1)) {
this.airShipmentList.add(1); this.airShipmentList.add(1);
}
if (!this.auditTypeList.contains(0)) {
this.auditTypeList.add(0); this.auditTypeList.add(0);
}
if (!this.abnormalStateList.contains(0)) {
this.abnormalStateList.add(0); this.abnormalStateList.add(0);
}
// this.transportId = 3; // 空运待出查询,只查空运的订单 // this.transportId = 3; // 空运待出查询,只查空运的订单
break; break;
case 10502: case 10502:
...@@ -800,8 +812,12 @@ public class OrderQueryVO { ...@@ -800,8 +812,12 @@ public class OrderQueryVO {
if (Objects.isNull(this.airShipmentList)){ if (Objects.isNull(this.airShipmentList)){
this.airShipmentList = new ArrayList<>(); this.airShipmentList = new ArrayList<>();
} }
if (!this.statusList.contains(5)) {
this.statusList.add(5); this.statusList.add(5);
}
if (!this.airShipmentList.contains(12)) {
this.airShipmentList.add(12); this.airShipmentList.add(12);
}
// this.transportId = 3; // 空运待出查询,只查空运的订单 // this.transportId = 3; // 空运待出查询,只查空运的订单
break; break;
case 10503: case 10503:
...@@ -809,8 +825,12 @@ public class OrderQueryVO { ...@@ -809,8 +825,12 @@ public class OrderQueryVO {
if (Objects.isNull(this.airShipmentList)){ if (Objects.isNull(this.airShipmentList)){
this.airShipmentList = new ArrayList<>(); this.airShipmentList = new ArrayList<>();
} }
if (!this.statusList.contains(5)) {
this.statusList.add(5); this.statusList.add(5);
}
if (!this.airShipmentList.contains(4)) {
this.airShipmentList.add(4); this.airShipmentList.add(4);
}
// this.transportId = 3; // 空运待出查询,只查空运的订单 // this.transportId = 3; // 空运待出查询,只查空运的订单
break; break;
case 10504: case 10504:
...@@ -824,25 +844,38 @@ public class OrderQueryVO { ...@@ -824,25 +844,38 @@ public class OrderQueryVO {
if (Objects.isNull(this.abnormalStateList)){ if (Objects.isNull(this.abnormalStateList)){
this.abnormalStateList = new ArrayList<>(); this.abnormalStateList = new ArrayList<>();
} }
if (!this.statusList.contains(5)) {
this.statusList.add(5); this.statusList.add(5);
}
if (!this.auditTypeList.contains(0)) {
this.auditTypeList.add(0); this.auditTypeList.add(0);
}
if (!this.abnormalStateList.contains(0)) {
this.abnormalStateList.add(0); this.abnormalStateList.add(0);
}
if (Objects.nonNull(transportId) && transportId == 3) { if (Objects.nonNull(transportId) && transportId == 3) {
// 空运无需判断备货状态 可出、备货中、已备货 // 空运无需判断备货状态 可出、备货中、已备货
if (!this.airShipmentList.contains(10)) {
this.airShipmentList.add(10); this.airShipmentList.add(10);
}
}else { }else {
// 兼容空运已入仓的可出、备货中、已备货,且无异常无审批,海运的已入仓无异常无审批 // 兼容空运已入仓的可出、备货中、已备货,且无异常无审批,海运的已入仓无异常无审批
if (!this.airShipmentList.contains(20)) {
this.airShipmentList.add(20); this.airShipmentList.add(20);
} }
}
break; break;
case 132411: case 132411:
// 空运已出货 // 空运已出货
if (Objects.isNull(this.shipmentStateList)){ if (Objects.isNull(this.shipmentStateList)){
this.shipmentStateList = new ArrayList<>(); this.shipmentStateList = new ArrayList<>();
} }
if (!this.statusList.contains(32)) {
this.statusList.add(32); this.statusList.add(32);
}
if (!this.shipmentStateList.contains(411)) {
this.shipmentStateList.add(411); this.shipmentStateList.add(411);
}
// this.transportId = 3; // 空运待出查询,只查空运的订单 // this.transportId = 3; // 空运待出查询,只查空运的订单
break; break;
case 132412: case 132412:
...@@ -850,8 +883,12 @@ public class OrderQueryVO { ...@@ -850,8 +883,12 @@ public class OrderQueryVO {
if (Objects.isNull(this.shipmentStateList)){ if (Objects.isNull(this.shipmentStateList)){
this.shipmentStateList = new ArrayList<>(); this.shipmentStateList = new ArrayList<>();
} }
if (!this.statusList.contains(32)) {
this.statusList.add(32); this.statusList.add(32);
}
if (!this.shipmentStateList.contains(412)) {
this.shipmentStateList.add(412); this.shipmentStateList.add(412);
}
// this.transportId = 3; // 空运待出查询,只查空运的订单 // this.transportId = 3; // 空运待出查询,只查空运的订单
break; break;
case 132409: case 132409:
...@@ -859,8 +896,12 @@ public class OrderQueryVO { ...@@ -859,8 +896,12 @@ public class OrderQueryVO {
if (Objects.isNull(this.shipmentStateList)){ if (Objects.isNull(this.shipmentStateList)){
this.shipmentStateList = new ArrayList<>(); this.shipmentStateList = new ArrayList<>();
} }
if (!this.statusList.contains(32)) {
this.statusList.add(32); this.statusList.add(32);
}
if (!this.shipmentStateList.contains(409)) {
this.shipmentStateList.add(409); this.shipmentStateList.add(409);
}
// this.transportId = 3; // 空运待出查询,只查空运的订单 // this.transportId = 3; // 空运待出查询,只查空运的订单
break; break;
case 118428: case 118428:
...@@ -868,14 +909,20 @@ public class OrderQueryVO { ...@@ -868,14 +909,20 @@ public class OrderQueryVO {
if (Objects.isNull(this.shipmentStateList)){ if (Objects.isNull(this.shipmentStateList)){
this.shipmentStateList = new ArrayList<>(); this.shipmentStateList = new ArrayList<>();
} }
if (!this.statusList.contains(32)) {
this.statusList.add(32); this.statusList.add(32);
}
if (!this.shipmentStateList.contains(428)) {
this.shipmentStateList.add(428); this.shipmentStateList.add(428);
}
// this.transportId = 3; // 空运待出查询,只查空运的订单 // this.transportId = 3; // 空运待出查询,只查空运的订单
break; break;
default: default:
if (!this.statusList.contains(asStatus)) {
this.statusList.add(asStatus); this.statusList.add(asStatus);
} }
} }
}
public void setShipmentState(Integer shipmentState) { public void setShipmentState(Integer shipmentState) {
......
...@@ -115,406 +115,38 @@ ...@@ -115,406 +115,38 @@
left join ecw_order_consignee nee on nee.order_id = o.order_id and nee.deleted = 0 left join ecw_order_consignee nee on nee.order_id = o.order_id and nee.deleted = 0
left join ecw_channel channel on channel.channel_id = o.channel_id left join ecw_channel channel on channel.channel_id = o.channel_id
where o.deleted = 0 where o.deleted = 0
<if test="query.pdaStartWareIds != null and query.pdaStartWareIds != '' "> <include refid="orderQuery"/>
AND FIND_IN_SET(ew_start.`id`, #{query.pdaStartWareIds}) </select>
</if>
<if test="query.pdaDestWareIds != null and query.pdaDestWareIds != '' ">
AND FIND_IN_SET(ew_dest.`id`, #{query.pdaDestWareIds})
</if>
<if test="query.status != null">
AND o.`status` = #{query.status}
</if>
<if test="query.pickState != null">
AND o.`pick_state` = #{query.pickState}
</if>
<if test="query.pickStateList != null and query.pickStateList.size()>0">
<if test="query.pickStateList != null and query.pickStateList.size()==1 ">
AND o.`pick_state` =
<foreach item='pickState' index="index" collection='query.pickStateList' >
#{pickState}
</foreach>
</if>
<if test="query.pickStateList != null and query.pickStateList.size()>1 ">
AND o.`pick_state` in
<foreach item='pickState' index="index" collection='query.pickStateList' open='(' separator=',' close=')'>
#{pickState}
</foreach>
</if>
</if>
<if test="query.statusList != null and query.statusList.size()>0">
<if test=" query.statusList.size()==1 ">
AND o.`status` =
<foreach item='status' index="index" collection='query.statusList' >
#{status}
</foreach>
</if>
<if test=" query.statusList.size()>1 ">
AND o.`status` in
<foreach item='status' index="index" collection='query.statusList' open='(' separator=',' close=')'>
#{status}
</foreach>
</if>
</if>
<if test="query.abnormalStateList != null and query.abnormalStateList.size()>0">
<if test="query.abnormalStateList != null and query.abnormalStateList.size()==1 ">
<foreach item='abnormalState' index="index" collection='query.abnormalStateList' >
<choose>
<when test="abnormalState != '0'">
<choose>
<when test="abnormalState != '-1'">
AND o.`abnormal_state` = #{abnormalState}
</when>
<otherwise>
AND o.`abnormal_state` != 0
</otherwise>
</choose>
</when>
<otherwise>
AND o.`abnormal_state` = 0
</otherwise>
</choose>
</foreach>
</if>
<if test="query.abnormalStateList != null and query.abnormalStateList.size()>1 ">
AND (1!=1
<foreach item='abnormalState' index="index" collection='query.abnormalStateList'>
<choose>
<when test="abnormalState != '0'">
<choose>
<when test="abnormalState != '-1'">
OR o.`abnormal_state` = #{abnormalState}
</when>
<otherwise>
OR o.`abnormal_state` != 0
</otherwise>
</choose>
</when>
<otherwise>
OR o.`abnormal_state` = 0
</otherwise>
</choose>
</foreach>
)
</if>
</if>
<if test="query.abnormalState != null">
<choose>
<when test="query.abnormalState != 0">
<choose>
<when test="query.abnormalState != -1">
AND o.`abnormal_state` = #{query.abnormalState}
</when>
<otherwise>
AND o.`abnormal_state` != 0
</otherwise>
</choose>
</when>
<otherwise>
AND o.`abnormal_state` = 0
</otherwise>
</choose>
</if>
<if test="query.inWarehouseState != null">
AND o.`in_warehouse_state` = #{query.inWarehouseState}
</if>
<if test="query.inWarehouseStateList != null and query.inWarehouseStateList.size()>0">
<if test="query.inWarehouseStateList != null and query.inWarehouseStateList.size()==1 ">
AND o.`in_warehouse_state` =
<foreach item='inWarehouseState' index="index" collection='query.inWarehouseStateList' >
#{inWarehouseState}
</foreach>
</if>
<if test="query.inWarehouseStateList != null and query.inWarehouseStateList.size()>1 ">
AND o.`in_warehouse_state` in
<foreach item='inWarehouseState' index="index" collection='query.inWarehouseStateList' open='(' separator=',' close=')'>
#{inWarehouseState}
</foreach>
</if>
</if>
<if test="query.shipmentState != null">
AND o.`shipment_State` = #{query.shipmentState}
</if>
<if test="query.shipmentStateList != null and query.shipmentStateList.size()>0">
<if test="query.shipmentStateList != null and query.shipmentStateList.size()==1 ">
AND o.`shipment_State` =
<foreach item='shipmentState' index="index" collection='query.shipmentStateList' >
#{shipmentState}
</foreach>
</if>
<if test="query.shipmentStateList != null and query.shipmentStateList.size()>1 ">
AND o.`shipment_State` in
<foreach item='shipmentState' index="index" collection='query.shipmentStateList' open='(' separator=',' close=')'>
#{shipmentState}
</foreach>
</if>
</if>
<if test="query.auditType != null">
<choose>
<when test="query.auditType != 0">
<choose>
<when test="query.auditType != -1">
AND o.`audit_type` = #{query.auditType}
</when>
<otherwise>
AND o.`audit_type` != 0
</otherwise>
</choose>
</when>
<otherwise>
AND o.`audit_type` = 0
</otherwise>
</choose>
</if>
<if test="query.auditTypeList != null and query.auditTypeList.size()>0">
<if test="query.auditTypeList != null and query.auditTypeList.size()==1 ">
<foreach item='auditType' index="index" collection='query.auditTypeList' >
<choose> <select id="getOrderExceptionStatisticsList"
<when test="auditType != 0"> resultType="cn.iocoder.yudao.module.order.vo.orderException.OrderExceptionStatisticsExcelVo">
<choose> SELECT
<when test="auditType != -1"> o.rucang_time AS warehouse_date,
AND o.`audit_type` = #{auditType} o.order_no as warehouse_no,
</when> o.status as order_status,
<otherwise> m.prod_title_zh as goods_name,
AND o.`audit_type` != 0 e.order_exception_type as exception_status,
</otherwise> r.phone AS `consignor_phone`,
</choose> c.phone AS `consignee_phone`
</when> FROM
<otherwise> ecw_order_exception e
AND o.`audit_type` = 0 LEFT JOIN ecw_order o ON e.order_id = o.order_id
</otherwise> LEFT JOIN ecw_order_item m ON e.order_item_id = m.order_item_id
</choose> LEFT JOIN ecw_order_consignee c ON o.order_id = c.order_id
</foreach> LEFT JOIN ecw_order_consignor r ON o.order_id = r.order_id
</if> WHERE
<if test="query.auditTypeList != null and query.auditTypeList.size()>1 "> e.order_exception_status !=2 and o.deleted=0
AND (1!=1 <include refid="myOrderQuery">
<foreach item='auditType' index="index" collection='query.auditTypeList'> </include>
<choose> </select>
<when test="auditType != 0">
<choose> <sql id="orderQuerySql">
<when test="auditType != -1">
or o.`audit_type` = #{auditType}
</when>
<otherwise>
or o.`audit_type` != 0
</otherwise>
</choose>
</when>
<otherwise>
or o.`audit_type` = 0
</otherwise>
</choose>
</foreach>
)
</if>
</if>
<if test="query.salesmanId != null and query.creator != null ">
AND (o.`salesman_id` = #{query.salesmanId} or o.`customer_id` in(select cus.id from ecw_customer cus where cus.is_customer_service_confirmed = 1 and cus.customer_service = #{query.salesmanId} ) or o.`creator` = #{query.creator})
</if>
<if test="query.customsType != null">
AND o.`customs_type` = #{query.customsType}
</if>
<if test="query.productRecord != null">
AND o.`product_record` = #{query.productRecord}
</if>
<if test="query.transportId != null">
AND o.`transport_id` = #{query.transportId}
</if>
<if test="query.warehouseType != null">
AND o.`warehouse_type` = #{query.warehouseType}
</if>
<if test="query.number != null and query.number != '' ">
AND (o.`number` like concat("%",concat(#{query.number},"%")) or o.order_id in( select distinct oi.order_id
from ecw_order_item oi
where oi.deleted = 0 and
((oi.warehouse_in_info is null and oi.express_no like concat('%',concat(#{query.number},'%')))
or (oi.warehouse_in_info is not null and oi.warehouse_in_info ->> '$.expressNo' like concat("%",concat(#{query.number},"%"))))))
</if>
<if test="query.notNumber != null and query.notNumber != '' ">
AND o.`number` not like concat("%",concat(#{query.notNumber},"%"))
and
o.order_id not in
(select distinct oi.order_id from ecw_order_item oi
where oi.deleted = 0 and
((oi.warehouse_in_info is null and oi.express_no like concat("%",concat(#{query.notNumber},"%")))
or
(oi.warehouse_in_info is not null and oi.warehouse_in_info ->> '$.expressNo' like
concat("%",concat(#{query.notNumber},"%")))))
</if>
<if test="query.marks != null and query.marks != '' ">
AND o.`marks` like concat("%",concat(#{query.marks},"%"))
</if>
<if test="query.departureId != null ">
AND de.`departure_id` = #{query.departureId}
</if>
<if test="query.objectiveId != null ">
AND ob.`objective_id` = #{query.objectiveId}
</if>
<if test="query.consignorId != null ">
AND nor.`customer_id` = #{query.consignorId}
</if>
<if test="query.consigneeId != null ">
AND nee.`customer_id` = #{query.consigneeId}
</if>
<if test="query.isCargoControl != null ">
AND o.`is_cargo_control` = #{query.isCargoControl}
</if>
<if test="query.orderNo != null and query.orderNo != '' ">
AND o.`order_no` like concat("%",concat(#{query.orderNo},"%"))
</if>
<if test="query.orderIdList != null and query.orderIdList.size() != 0">
AND o.`order_id` in
<foreach item='orderId' index='index' collection='query.orderIdList' open='(' separator=',' close=')'>
#{orderId}
</foreach>
</if>
<if test="query.tidanNo != null and query.tidanNo != '' ">
AND o.`tidan_no` like concat("%",concat(#{query.tidanNo},"%"))
</if>
<if test="query.userId != null">
AND o.`user_id` = #{query.userId}
</if>
<if test="query.customerId != null">
AND o.`customer_id` = #{query.customerId}
</if>
<if test="query.beginRucangTime != null and query.endRucangTime != null ">
AND o.`rucang_time` between #{query.beginRucangTime} and #{query.endRucangTime}
</if>
<if test="query.beginQingguanTime != null and query.endQingguanTime != null ">
AND o.`qingguan_time` between #{query.beginQingguanTime} and #{query.endQingguanTime}
</if>
<if test="query.beginDaogangTime != null and query.endDaogangTime != null ">
AND o.`daogang_time` between #{query.beginDaogangTime} and #{query.endDaogangTime}
</if>
<if test="query.beginPreLoadTime != null and query.endPreLoadTime != null ">
AND o.`pre_load_time` between #{query.beginPreLoadTime} and #{query.endPreLoadTime}
</if>
<if test="query.beginOutboundTime != null and query.endOutboundTime != null ">
AND o.`status` > 5 AND o.container_number in(select distinct b.self_no from ecw_box_air_checkout bc join ecw_box b ON bc.shipment_id = b.id
where b.deleted = 0 and bc.deleted = 0 and bc.`checkout_time` between #{query.beginOutboundTime} and #{query.endOutboundTime})
</if>
<if test="query.beginLoadTime != null and query.endLoadTime != null ">
AND o.`load_time` between #{query.beginLoadTime} and #{query.endLoadTime}
</if>
<if test="query.beginUnloadTime != null and query.endUnloadTime != null ">
AND o.`unload_time` between #{query.beginUnloadTime} and #{query.endUnloadTime}
</if>
<if test="query.beginTakeTime != null and query.endTakeTime != null ">
AND o.`take_time` between #{query.beginTakeTime} and #{query.endTakeTime}
</if>
<if test="query.beginSplitTime != null and query.endSplitTime != null ">
AND o.`split_time` between #{query.beginSplitTime} and #{query.endSplitTime}
</if>
<if test="query.beginCreateTime != null and query.endCreateTime != null ">
AND o.`create_time` between #{query.beginCreateTime} and #{query.endCreateTime}
</if>
<if test="query.lePickRatio != null ">
AND o.pick_ratio <![CDATA[ <= ]]> #{query.lePickRatio}
</if>
<if test="query.gePickRatio != null ">
AND o.pick_ratio <![CDATA[ >= ]]> #{query.gePickRatio}
</if>
<if test="query.eqPickRatio != null ">
AND o.pick_ratio = #{query.eqPickRatio}
</if>
<if test="query.leReleaseRatio != null ">
AND o.release_ratio <![CDATA[ <= ]]> #{query.leReleaseRatio}
</if>
<if test="query.geReleaseRatio != null ">
AND o.release_ratio <![CDATA[ >= ]]> #{query.geReleaseRatio}
</if>
<if test="query.eqReleaseRatio != null ">
AND o.release_ratio = #{query.eqReleaseRatio}
</if>
<if test="query.searchKey != null and query.searchKey != '' ">
AND concat(IFNULL(o.`order_no`,''),IFNULL(o.`parent_number`,''),IFNULL(o.`initial_parent_order_no`,''),
IFNULL(o.`old_numbers`,''),IFNULL(o.`marks`,''),IFNULL(nee.`name`,''),IFNULL(nee.`phone`,'')) like
concat("%",concat(#{query.searchKey},"%"))
</if>
<if test="query.numberKey != null and query.numberKey != '' ">
AND concat(IFNULL(o.`order_no`,''), IFNULL(o.`old_numbers`,''), IFNULL(o.`parent_number`,''), IFNULL(o.`initial_parent_order_no`,'')
,IFNULL(o.`marks`,''),IFNULL(o.`tidan_no`,''),IFNULL(o.`container_number`,'')) like concat("%",concat(#{query.numberKey},"%"))
</if>
<if test="query.prodKey != null and query.prodKey != '' ">
and (o.order_id in(
select oi.order_id
from ecw_order_item oi
left join ecw_product p
on oi.prod_id = p.id
left join ecw_product_type pt
on pt.id = oi.prod_type
left join ecw_product_brank pb
on pb.id = oi.brand
where oi.deleted = 0 and
concat(IFNULL(oi.`prod_title_zh`,''),IFNULL(oi.`prod_title_en`,''),IFNULL(pt.`title_zh`,''),IFNULL(pt.`title_en`,''),
IFNULL(pb.`title_zh`,''),IFNULL(pb.`title_en`,''))
like concat("%",concat(#{query.prodKey},"%"))
))
</if>
<if test="query.notProdKey != null and query.notProdKey != '' ">
and (o.order_id not in(
select oi.order_id
from ecw_order_item oi
left join ecw_product p
on oi.prod_id = p.id
left join ecw_product_type pt
on pt.id = oi.prod_type
left join ecw_product_brank pb
on pb.id = oi.brand
where oi.deleted = 0 and
concat(IFNULL(oi.`prod_title_zh`,''),IFNULL(oi.`prod_title_en`,''),IFNULL(pt.`title_zh`,''),IFNULL(pt.`title_en`,''),
IFNULL(pb.`title_zh`,''),IFNULL(pb.`title_en`,''))
like concat("%",concat(#{query.notProdKey},"%"))
))
</if>
<if test="query.eqProdKey != null and query.eqProdKey != '' ">
and (o.order_id in(
select oi.order_id
from ecw_order_item oi
left join ecw_product p
on oi.prod_id = p.id
left join ecw_product_type pt
on pt.id = oi.prod_type
left join ecw_product_brank pb
on pb.id = oi.brand
where oi.deleted = 0 and (oi.`prod_title_zh` = #{query.eqProdKey} or oi.`prod_title_en` = #{query.eqProdKey}
or pt.`title_zh` = #{query.eqProdKey} or pt.`title_en` = #{query.eqProdKey}
or pb.`title_zh` = #{query.eqProdKey} or pb.`title_en` = #{query.eqProdKey})
))
</if>
<if test="query.notEqProdKey != null and query.notEqProdKey != '' ">
and (o.order_id not in(
select oi.order_id
from ecw_order_item oi
left join ecw_product p
on oi.prod_id = p.id
left join ecw_product_type pt
on pt.id = oi.prod_type
left join ecw_product_brank pb
on pb.id = oi.brand
where oi.deleted = 0 and (oi.`prod_title_zh` = #{query.notEqProdKey} or oi.`prod_title_en` = #{query.notEqProdKey}
or pt.`title_zh` = #{query.notEqProdKey} or pt.`title_en` = #{query.notEqProdKey}
or pb.`title_zh` = #{query.notEqProdKey} or pb.`title_en` = #{query.notEqProdKey})
))
</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>
<if test="query.airShipmentList != null and query.airShipmentList.size() > 0"> <if test="query.airShipmentList != null and query.airShipmentList.size() > 0">
<if test="query.airShipmentList.size() == 0"> <if test="query.airShipmentList.size() == 1">
<foreach item='airShipment' index="index" collection='query.airShipmentList'> <foreach item='airShipment' index="index" collection='query.airShipmentList'>
<choose> <choose>
<when test="airShipment == 1"> <when test="airShipment == 1">
...@@ -549,28 +181,28 @@ ...@@ -549,28 +181,28 @@
<foreach item='airShipment' index="index" collection='query.airShipmentList'> <foreach item='airShipment' index="index" collection='query.airShipmentList'>
<choose> <choose>
<when test="airShipment == 1"> <when test="airShipment == 1">
or o.`status` = 5 AND o.air_shipment = 1 and abnormal_state = 0 and audit_type = 0 or (o.`status` = 5 AND o.air_shipment = 1 and abnormal_state = 0 and audit_type = 0)
</when> </when>
<when test="airShipment == 2"> <when test="airShipment == 2">
or o.`status` = 5 AND o.air_shipment = 2 or (o.`status` = 5 AND o.air_shipment = 2)
</when> </when>
<when test="airShipment == 3"> <when test="airShipment == 3">
or o.`status` = 5 AND o.air_shipment = 3 or (o.`status` = 5 AND o.air_shipment = 3)
</when> </when>
<when test="airShipment == 4"> <when test="airShipment == 4">
or o.`status` = 5 AND o.air_shipment = 4 or (o.`status` = 5 AND o.air_shipment = 4)
</when> </when>
<when test="airShipment == 10"> <when test="airShipment == 10">
or o.`status` = 5 AND o.air_shipment in(2,3,4) or (o.`status` = 5 AND o.air_shipment in(2,3,4))
</when> </when>
<when test="airShipment == 11"> <when test="airShipment == 11">
or o.`status` = 5 AND o.air_shipment in(1,2,3,4) and abnormal_state = 0 and audit_type = 0 or (o.`status` = 5 AND o.air_shipment in(1,2,3,4) and abnormal_state = 0 and audit_type = 0)
</when> </when>
<when test="airShipment == 12"> <when test="airShipment == 12">
or o.`status` = 5 AND o.air_shipment in(2,3) and abnormal_state = 0 and audit_type = 0 or (o.`status` = 5 AND o.air_shipment in(2,3) and abnormal_state = 0 and audit_type = 0)
</when> </when>
<when test="airShipment == 20"> <when test="airShipment == 20">
or o.`status` = 5 AND o.air_shipment in(0,2,3,4) and abnormal_state = 0 and audit_type = 0 or (o.`status` = 5 AND o.air_shipment in(0,2,3,4) and abnormal_state = 0 and audit_type = 0)
</when> </when>
</choose> </choose>
</foreach> </foreach>
...@@ -604,32 +236,6 @@ ...@@ -604,32 +236,6 @@
<if test="query.isNeat == true "> <if test="query.isNeat == true ">
AND o.sum_num = o.cost->>'$.totalNum' AND o.sum_num = o.cost->>'$.totalNum'
</if> </if>
</select>
<select id="getOrderExceptionStatisticsList"
resultType="cn.iocoder.yudao.module.order.vo.orderException.OrderExceptionStatisticsExcelVo">
SELECT
o.rucang_time AS warehouse_date,
o.order_no as warehouse_no,
o.status as order_status,
m.prod_title_zh as goods_name,
e.order_exception_type as exception_status,
r.phone AS `consignor_phone`,
c.phone AS `consignee_phone`
FROM
ecw_order_exception e
LEFT JOIN ecw_order o ON e.order_id = o.order_id
LEFT JOIN ecw_order_item m ON e.order_item_id = m.order_item_id
LEFT JOIN ecw_order_consignee c ON o.order_id = c.order_id
LEFT JOIN ecw_order_consignor r ON o.order_id = r.order_id
WHERE
e.order_exception_status !=2 and o.deleted=0
<include refid="myOrderQuery">
</include>
</select>
<sql id="orderQuerySql">
<if test="query.hasConsignee != null "> <if test="query.hasConsignee != null ">
AND has_consignee = #{query.hasConsignee} AND has_consignee = #{query.hasConsignee}
</if> </if>
...@@ -1132,11 +738,15 @@ ...@@ -1132,11 +738,15 @@
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>
</sql>
<sql id="myOrderQuerySql">
<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>
<if test="query.airShipmentList != null and query.airShipmentList.size() > 0"> <if test="query.airShipmentList != null and query.airShipmentList.size() > 0">
<if test="query.airShipmentList.size() == 0"> <if test="query.airShipmentList.size() == 1">
<foreach item='airShipment' index="index" collection='query.airShipmentList'> <foreach item='airShipment' index="index" collection='query.airShipmentList'>
<choose> <choose>
<when test="airShipment == 1"> <when test="airShipment == 1">
...@@ -1171,28 +781,28 @@ ...@@ -1171,28 +781,28 @@
<foreach item='airShipment' index="index" collection='query.airShipmentList'> <foreach item='airShipment' index="index" collection='query.airShipmentList'>
<choose> <choose>
<when test="airShipment == 1"> <when test="airShipment == 1">
or o.`status` = 5 AND o.air_shipment = 1 and abnormal_state = 0 and audit_type = 0 or (o.`status` = 5 AND o.air_shipment = 1 and abnormal_state = 0 and audit_type = 0)
</when> </when>
<when test="airShipment == 2"> <when test="airShipment == 2">
or o.`status` = 5 AND o.air_shipment = 2 or (o.`status` = 5 AND o.air_shipment = 2)
</when> </when>
<when test="airShipment == 3"> <when test="airShipment == 3">
or o.`status` = 5 AND o.air_shipment = 3 or (o.`status` = 5 AND o.air_shipment = 3)
</when> </when>
<when test="airShipment == 4"> <when test="airShipment == 4">
or o.`status` = 5 AND o.air_shipment = 4 or (o.`status` = 5 AND o.air_shipment = 4)
</when> </when>
<when test="airShipment == 10"> <when test="airShipment == 10">
or o.`status` = 5 AND o.air_shipment in(2,3,4) or (o.`status` = 5 AND o.air_shipment in(2,3,4))
</when> </when>
<when test="airShipment == 11"> <when test="airShipment == 11">
or o.`status` = 5 AND o.air_shipment in(1,2,3,4) and abnormal_state = 0 and audit_type = 0 or (o.`status` = 5 AND o.air_shipment in(1,2,3,4) and abnormal_state = 0 and audit_type = 0)
</when> </when>
<when test="airShipment == 12"> <when test="airShipment == 12">
or o.`status` = 5 AND o.air_shipment in(2,3) and abnormal_state = 0 and audit_type = 0 or (o.`status` = 5 AND o.air_shipment in(2,3) and abnormal_state = 0 and audit_type = 0)
</when> </when>
<when test="airShipment == 20"> <when test="airShipment == 20">
or o.`status` = 5 AND o.air_shipment in(0,2,3,4) and abnormal_state = 0 and audit_type = 0 or (o.`status` = 5 AND o.air_shipment in(0,2,3,4) and abnormal_state = 0 and audit_type = 0)
</when> </when>
</choose> </choose>
</foreach> </foreach>
...@@ -1226,9 +836,6 @@ ...@@ -1226,9 +836,6 @@
<if test="query.isNeat == true "> <if test="query.isNeat == true ">
AND o.sum_num = o.cost->>'$.totalNum' AND o.sum_num = o.cost->>'$.totalNum'
</if> </if>
</sql>
<sql id="myOrderQuerySql">
<if test="query.hasConsignee != null "> <if test="query.hasConsignee != null ">
AND has_consignee = #{query.hasConsignee} AND has_consignee = #{query.hasConsignee}
</if> </if>
...@@ -1611,100 +1218,7 @@ ...@@ -1611,100 +1218,7 @@
</foreach> </foreach>
)) ))
</if> </if>
<if test="query.isNeat == false ">
AND o.sum_num <![CDATA[ < ]]> o.cost->>'$.totalNum'
</if>
<if test="query.airShipmentList != null and query.airShipmentList.size() > 0">
<if test="query.airShipmentList.size() == 0">
<foreach item='airShipment' index="index" collection='query.airShipmentList'>
<choose>
<when test="airShipment == 1">
AND o.`status` = 5 AND o.air_shipment = 1 and abnormal_state = 0 and audit_type = 0
</when>
<when test="airShipment == 2">
AND o.`status` = 5 AND o.air_shipment = 2
</when>
<when test="airShipment == 3">
AND o.`status` = 5 AND o.air_shipment = 3
</when>
<when test="airShipment == 4">
AND o.`status` = 5 AND o.air_shipment = 4
</when>
<when test="airShipment == 10">
AND o.`status` = 5 AND o.air_shipment in(2,3,4)
</when>
<when test="airShipment == 11">
AND o.`status` = 5 AND o.air_shipment in(1,2,3,4) and abnormal_state = 0 and audit_type = 0
</when>
<when test="airShipment == 12">
AND o.`status` = 5 AND o.air_shipment in(2,3) and abnormal_state = 0 and audit_type = 0
</when>
<when test="airShipment == 20">
AND o.`status` = 5 AND o.air_shipment in(0,2,3,4) and abnormal_state = 0 and audit_type = 0
</when>
</choose>
</foreach>
</if>
<if test="query.airShipmentList.size() > 1">
AND (1!=1
<foreach item='airShipment' index="index" collection='query.airShipmentList'>
<choose>
<when test="airShipment == 1">
or o.`status` = 5 AND o.air_shipment = 1 and abnormal_state = 0 and audit_type = 0
</when>
<when test="airShipment == 2">
or o.`status` = 5 AND o.air_shipment = 2
</when>
<when test="airShipment == 3">
or o.`status` = 5 AND o.air_shipment = 3
</when>
<when test="airShipment == 4">
or o.`status` = 5 AND o.air_shipment = 4
</when>
<when test="airShipment == 10">
or o.`status` = 5 AND o.air_shipment in(2,3,4)
</when>
<when test="airShipment == 11">
or o.`status` = 5 AND o.air_shipment in(1,2,3,4) and abnormal_state = 0 and audit_type = 0
</when>
<when test="airShipment == 12">
or o.`status` = 5 AND o.air_shipment in(2,3) and abnormal_state = 0 and audit_type = 0
</when>
<when test="airShipment == 20">
or o.`status` = 5 AND o.air_shipment in(0,2,3,4) and abnormal_state = 0 and audit_type = 0
</when>
</choose>
</foreach>
)
</if>
</if>
<if test="query.airShipment != null and query.airShipment == 1">
AND o.`status` = 5 AND o.air_shipment = 1 and abnormal_state = 0 and audit_type = 0
</if>
<if test="query.airShipment != null and query.airShipment == 2">
AND o.`status` = 5 AND o.air_shipment = 2
</if>
<if test="query.airShipment != null and query.airShipment == 3">
AND o.`status` = 5 AND o.air_shipment = 3
</if>
<if test="query.airShipment != null and query.airShipment == 4">
AND o.`status` = 5 AND o.air_shipment = 4
</if>
<if test="query.airShipment != null and query.airShipment == 10">
AND o.`status` = 5 AND o.air_shipment in(2,3,4)
</if>
<if test="query.airShipment != null and query.airShipment == 11">
AND o.`status` = 5 AND o.air_shipment in(1,2,3,4) and abnormal_state = 0 and audit_type = 0
</if>
<if test="query.airShipment != null and query.airShipment == 12">
AND o.`status` = 5 AND o.air_shipment in(2,3) and abnormal_state = 0 and audit_type = 0
</if>
<if test="query.airShipment != null and query.airShipment == 20">
AND o.`status` = 5 AND o.air_shipment in(0,2,3,4) and abnormal_state = 0 and audit_type = 0
</if>
<if test="query.isNeat == true ">
AND o.sum_num = o.cost->>'$.totalNum'
</if>
</sql> </sql>
<select id="getHeavyOrderExcelList" <select id="getHeavyOrderExcelList"
...@@ -1890,8 +1404,6 @@ ...@@ -1890,8 +1404,6 @@
o.audit_result, o.audit_result,
o.guan_lian_order_status, o.guan_lian_order_status,
o.transport_id, o.transport_id,
-- (select ifnull(sum(ccp.pick_num),0) from ecw_order_cargo_control_pick ccp where ccp.order_id = o.order_id and
-- ccp.status in(1,2,3,4) ) as release_num,
o.release_num, o.release_num,
o.release_ratio, o.release_ratio,
o.is_cargo_control, o.is_cargo_control,
...@@ -2178,6 +1690,100 @@ ...@@ -2178,6 +1690,100 @@
</select> </select>
<sql id="myOrderQuery"> <sql id="myOrderQuery">
<if test="query.isNeat == false ">
AND o.sum_num <![CDATA[ < ]]> o.cost->>'$.totalNum'
</if>
<if test="query.airShipmentList != null and query.airShipmentList.size() > 0">
<if test="query.airShipmentList.size() == 1">
<foreach item='airShipment' index="index" collection='query.airShipmentList'>
<choose>
<when test="airShipment == 1">
AND o.`status` = 5 AND o.air_shipment = 1 and abnormal_state = 0 and audit_type = 0
</when>
<when test="airShipment == 2">
AND o.`status` = 5 AND o.air_shipment = 2
</when>
<when test="airShipment == 3">
AND o.`status` = 5 AND o.air_shipment = 3
</when>
<when test="airShipment == 4">
AND o.`status` = 5 AND o.air_shipment = 4
</when>
<when test="airShipment == 10">
AND o.`status` = 5 AND o.air_shipment in(2,3,4)
</when>
<when test="airShipment == 11">
AND o.`status` = 5 AND o.air_shipment in(1,2,3,4) and abnormal_state = 0 and audit_type = 0
</when>
<when test="airShipment == 12">
AND o.`status` = 5 AND o.air_shipment in(2,3) and abnormal_state = 0 and audit_type = 0
</when>
<when test="airShipment == 20">
AND o.`status` = 5 AND o.air_shipment in(0,2,3,4) and abnormal_state = 0 and audit_type = 0
</when>
</choose>
</foreach>
</if>
<if test="query.airShipmentList.size() > 1">
AND (1!=1
<foreach item='airShipment' index="index" collection='query.airShipmentList'>
<choose>
<when test="airShipment == 1">
or (o.`status` = 5 AND o.air_shipment = 1 and abnormal_state = 0 and audit_type = 0)
</when>
<when test="airShipment == 2">
or (o.`status` = 5 AND o.air_shipment = 2)
</when>
<when test="airShipment == 3">
or (o.`status` = 5 AND o.air_shipment = 3)
</when>
<when test="airShipment == 4">
or (o.`status` = 5 AND o.air_shipment = 4)
</when>
<when test="airShipment == 10">
or (o.`status` = 5 AND o.air_shipment in(2,3,4))
</when>
<when test="airShipment == 11">
or (o.`status` = 5 AND o.air_shipment in(1,2,3,4) and abnormal_state = 0 and audit_type = 0)
</when>
<when test="airShipment == 12">
or (o.`status` = 5 AND o.air_shipment in(2,3) and abnormal_state = 0 and audit_type = 0)
</when>
<when test="airShipment == 20">
or (o.`status` = 5 AND o.air_shipment in(0,2,3,4) and abnormal_state = 0 and audit_type = 0)
</when>
</choose>
</foreach>
)
</if>
</if>
<if test="query.airShipment != null and query.airShipment == 1">
AND o.`status` = 5 AND o.air_shipment = 1 and abnormal_state = 0 and audit_type = 0
</if>
<if test="query.airShipment != null and query.airShipment == 2">
AND o.`status` = 5 AND o.air_shipment = 2
</if>
<if test="query.airShipment != null and query.airShipment == 3">
AND o.`status` = 5 AND o.air_shipment = 3
</if>
<if test="query.airShipment != null and query.airShipment == 4">
AND o.`status` = 5 AND o.air_shipment = 4
</if>
<if test="query.airShipment != null and query.airShipment == 10">
AND o.`status` = 5 AND o.air_shipment in(2,3,4)
</if>
<if test="query.airShipment != null and query.airShipment == 11">
AND o.`status` = 5 AND o.air_shipment in(1,2,3,4) and abnormal_state = 0 and audit_type = 0
</if>
<if test="query.airShipment != null and query.airShipment == 12">
AND o.`status` = 5 AND o.air_shipment in(2,3) and abnormal_state = 0 and audit_type = 0
</if>
<if test="query.airShipment != null and query.airShipment == 20">
AND o.`status` = 5 AND o.air_shipment in(0,2,3,4) and abnormal_state = 0 and audit_type = 0
</if>
<if test="query.isNeat == true ">
AND o.sum_num = o.cost->>'$.totalNum'
</if>
<if test="query.hasConsignee != null "> <if test="query.hasConsignee != null ">
AND has_consignee = #{query.hasConsignee} AND has_consignee = #{query.hasConsignee}
</if> </if>
...@@ -2868,12 +2474,23 @@ ...@@ -2868,12 +2474,23 @@
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.customerDetailId != null">
AND (o.`customer_id` = #{query.customerDetailId} or nor.`customer_id` = #{query.customerDetailId} or
nee.`customer_id` = #{query.customerDetailId})
</if>
<if test="query.userType == 2 ">
AND ((o.user_id is not null AND o.user_id > 0 AND o.`status` != 0) or o.user_id is null or o.user_id = 0)
</if>
</sql>
<sql id="orderQuery">
<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>
<if test="query.airShipmentList != null and query.airShipmentList.size() > 0"> <if test="query.airShipmentList != null and query.airShipmentList.size() > 0">
<if test="query.airShipmentList.size() == 0"> <if test="query.airShipmentList.size() == 1">
<foreach item='airShipment' index="index" collection='query.airShipmentList'> <foreach item='airShipment' index="index" collection='query.airShipmentList'>
<choose> <choose>
<when test="airShipment == 1"> <when test="airShipment == 1">
...@@ -2908,28 +2525,28 @@ ...@@ -2908,28 +2525,28 @@
<foreach item='airShipment' index="index" collection='query.airShipmentList'> <foreach item='airShipment' index="index" collection='query.airShipmentList'>
<choose> <choose>
<when test="airShipment == 1"> <when test="airShipment == 1">
or o.`status` = 5 AND o.air_shipment = 1 and abnormal_state = 0 and audit_type = 0 or (o.`status` = 5 AND o.air_shipment = 1 and abnormal_state = 0 and audit_type = 0)
</when> </when>
<when test="airShipment == 2"> <when test="airShipment == 2">
or o.`status` = 5 AND o.air_shipment = 2 or (o.`status` = 5 AND o.air_shipment = 2)
</when> </when>
<when test="airShipment == 3"> <when test="airShipment == 3">
or o.`status` = 5 AND o.air_shipment = 3 or (o.`status` = 5 AND o.air_shipment = 3)
</when> </when>
<when test="airShipment == 4"> <when test="airShipment == 4">
or o.`status` = 5 AND o.air_shipment = 4 or (o.`status` = 5 AND o.air_shipment = 4)
</when> </when>
<when test="airShipment == 10"> <when test="airShipment == 10">
or o.`status` = 5 AND o.air_shipment in(2,3,4) or (o.`status` = 5 AND o.air_shipment in(2,3,4))
</when> </when>
<when test="airShipment == 11"> <when test="airShipment == 11">
or o.`status` = 5 AND o.air_shipment in(1,2,3,4) and abnormal_state = 0 and audit_type = 0 or (o.`status` = 5 AND o.air_shipment in(1,2,3,4) and abnormal_state = 0 and audit_type = 0)
</when> </when>
<when test="airShipment == 12"> <when test="airShipment == 12">
or o.`status` = 5 AND o.air_shipment in(2,3) and abnormal_state = 0 and audit_type = 0 or (o.`status` = 5 AND o.air_shipment in(2,3) and abnormal_state = 0 and audit_type = 0)
</when> </when>
<when test="airShipment == 20"> <when test="airShipment == 20">
or o.`status` = 5 AND o.air_shipment in(0,2,3,4) and abnormal_state = 0 and audit_type = 0 or (o.`status` = 5 AND o.air_shipment in(0,2,3,4) and abnormal_state = 0 and audit_type = 0)
</when> </when>
</choose> </choose>
</foreach> </foreach>
...@@ -2963,18 +2580,6 @@ ...@@ -2963,18 +2580,6 @@
<if test="query.isNeat == true "> <if test="query.isNeat == true ">
AND o.sum_num = o.cost->>'$.totalNum' AND o.sum_num = o.cost->>'$.totalNum'
</if> </if>
<if test="query.customerDetailId != null">
AND (o.`customer_id` = #{query.customerDetailId} or nor.`customer_id` = #{query.customerDetailId} or
nee.`customer_id` = #{query.customerDetailId})
</if>
<if test="query.userType == 2 ">
AND ((o.user_id is not null AND o.user_id > 0 AND o.`status` != 0) or o.user_id is null or o.user_id = 0)
</if>
</sql>
<sql id="orderQuery">
<if test="query.type != null and query.type != '' and query.type == 0 "> <if test="query.type != null and query.type != '' and query.type == 0 ">
AND (o.type is null or o.type = '' or o.type = '0') AND (o.type is null or o.type = '' or o.type = '0')
</if> </if>
...@@ -3817,11 +3422,22 @@ ...@@ -3817,11 +3422,22 @@
</foreach> </foreach>
)) ))
</if> </if>
<if test="query.customerDetailId != null">
AND (o.`customer_id` = #{query.customerDetailId} or nor.`customer_id` = #{query.customerDetailId} or
nee.`customer_id` = #{query.customerDetailId})
</if>
<if test="query.userType == 2 ">
AND ((o.user_id is not null AND o.user_id > 0 AND o.`status` != 0) or o.user_id is null or o.user_id = 0)
</if>
</sql>
<sql id="issuedOrderQuery">
<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>
<if test="query.airShipmentList != null and query.airShipmentList.size() > 0"> <if test="query.airShipmentList != null and query.airShipmentList.size() > 0">
<if test="query.airShipmentList.size() == 0"> <if test="query.airShipmentList.size() == 1">
<foreach item='airShipment' index="index" collection='query.airShipmentList'> <foreach item='airShipment' index="index" collection='query.airShipmentList'>
<choose> <choose>
<when test="airShipment == 1"> <when test="airShipment == 1">
...@@ -3856,28 +3472,28 @@ ...@@ -3856,28 +3472,28 @@
<foreach item='airShipment' index="index" collection='query.airShipmentList'> <foreach item='airShipment' index="index" collection='query.airShipmentList'>
<choose> <choose>
<when test="airShipment == 1"> <when test="airShipment == 1">
or o.`status` = 5 AND o.air_shipment = 1 and abnormal_state = 0 and audit_type = 0 or (o.`status` = 5 AND o.air_shipment = 1 and abnormal_state = 0 and audit_type = 0)
</when> </when>
<when test="airShipment == 2"> <when test="airShipment == 2">
or o.`status` = 5 AND o.air_shipment = 2 or (o.`status` = 5 AND o.air_shipment = 2)
</when> </when>
<when test="airShipment == 3"> <when test="airShipment == 3">
or o.`status` = 5 AND o.air_shipment = 3 or (o.`status` = 5 AND o.air_shipment = 3)
</when> </when>
<when test="airShipment == 4"> <when test="airShipment == 4">
or o.`status` = 5 AND o.air_shipment = 4 or (o.`status` = 5 AND o.air_shipment = 4)
</when> </when>
<when test="airShipment == 10"> <when test="airShipment == 10">
or o.`status` = 5 AND o.air_shipment in(2,3,4) or (o.`status` = 5 AND o.air_shipment in(2,3,4))
</when> </when>
<when test="airShipment == 11"> <when test="airShipment == 11">
or o.`status` = 5 AND o.air_shipment in(1,2,3,4) and abnormal_state = 0 and audit_type = 0 or (o.`status` = 5 AND o.air_shipment in(1,2,3,4) and abnormal_state = 0 and audit_type = 0)
</when> </when>
<when test="airShipment == 12"> <when test="airShipment == 12">
or o.`status` = 5 AND o.air_shipment in(2,3) and abnormal_state = 0 and audit_type = 0 or (o.`status` = 5 AND o.air_shipment in(2,3) and abnormal_state = 0 and audit_type = 0)
</when> </when>
<when test="airShipment == 20"> <when test="airShipment == 20">
or o.`status` = 5 AND o.air_shipment in(0,2,3,4) and abnormal_state = 0 and audit_type = 0 or (o.`status` = 5 AND o.air_shipment in(0,2,3,4) and abnormal_state = 0 and audit_type = 0)
</when> </when>
</choose> </choose>
</foreach> </foreach>
...@@ -3910,17 +3526,7 @@ ...@@ -3910,17 +3526,7 @@
</if> </if>
<if test="query.isNeat == true "> <if test="query.isNeat == true ">
AND o.sum_num = o.cost->>'$.totalNum' AND o.sum_num = o.cost->>'$.totalNum'
</if> </if>
<if test="query.customerDetailId != null">
AND (o.`customer_id` = #{query.customerDetailId} or nor.`customer_id` = #{query.customerDetailId} or
nee.`customer_id` = #{query.customerDetailId})
</if>
<if test="query.userType == 2 ">
AND ((o.user_id is not null AND o.user_id > 0 AND o.`status` != 0) or o.user_id is null or o.user_id = 0)
</if>
</sql>
<sql id="issuedOrderQuery">
<if test="query.type != null and query.type != '' and query.type == 0 "> <if test="query.type != null and query.type != '' and query.type == 0 ">
AND (o.type is null or o.type = '' or o.type = '0') AND (o.type is null or o.type = '' or o.type = '0')
</if> </if>
...@@ -4680,100 +4286,6 @@ ...@@ -4680,100 +4286,6 @@
</foreach> </foreach>
)) ))
</if> </if>
<if test="query.isNeat == false ">
AND o.sum_num <![CDATA[ < ]]> o.cost->>'$.totalNum'
</if>
<if test="query.airShipmentList != null and query.airShipmentList.size() > 0">
<if test="query.airShipmentList.size() == 0">
<foreach item='airShipment' index="index" collection='query.airShipmentList'>
<choose>
<when test="airShipment == 1">
AND o.`status` = 5 AND o.air_shipment = 1 and abnormal_state = 0 and audit_type = 0
</when>
<when test="airShipment == 2">
AND o.`status` = 5 AND o.air_shipment = 2
</when>
<when test="airShipment == 3">
AND o.`status` = 5 AND o.air_shipment = 3
</when>
<when test="airShipment == 4">
AND o.`status` = 5 AND o.air_shipment = 4
</when>
<when test="airShipment == 10">
AND o.`status` = 5 AND o.air_shipment in(2,3,4)
</when>
<when test="airShipment == 11">
AND o.`status` = 5 AND o.air_shipment in(1,2,3,4) and abnormal_state = 0 and audit_type = 0
</when>
<when test="airShipment == 12">
AND o.`status` = 5 AND o.air_shipment in(2,3) and abnormal_state = 0 and audit_type = 0
</when>
<when test="airShipment == 20">
AND o.`status` = 5 AND o.air_shipment in(0,2,3,4) and abnormal_state = 0 and audit_type = 0
</when>
</choose>
</foreach>
</if>
<if test="query.airShipmentList.size() > 1">
AND (1!=1
<foreach item='airShipment' index="index" collection='query.airShipmentList'>
<choose>
<when test="airShipment == 1">
or o.`status` = 5 AND o.air_shipment = 1 and abnormal_state = 0 and audit_type = 0
</when>
<when test="airShipment == 2">
or o.`status` = 5 AND o.air_shipment = 2
</when>
<when test="airShipment == 3">
or o.`status` = 5 AND o.air_shipment = 3
</when>
<when test="airShipment == 4">
or o.`status` = 5 AND o.air_shipment = 4
</when>
<when test="airShipment == 10">
or o.`status` = 5 AND o.air_shipment in(2,3,4)
</when>
<when test="airShipment == 11">
or o.`status` = 5 AND o.air_shipment in(1,2,3,4) and abnormal_state = 0 and audit_type = 0
</when>
<when test="airShipment == 12">
or o.`status` = 5 AND o.air_shipment in(2,3) and abnormal_state = 0 and audit_type = 0
</when>
<when test="airShipment == 20">
or o.`status` = 5 AND o.air_shipment in(0,2,3,4) and abnormal_state = 0 and audit_type = 0
</when>
</choose>
</foreach>
)
</if>
</if>
<if test="query.airShipment != null and query.airShipment == 1">
AND o.`status` = 5 AND o.air_shipment = 1 and abnormal_state = 0 and audit_type = 0
</if>
<if test="query.airShipment != null and query.airShipment == 2">
AND o.`status` = 5 AND o.air_shipment = 2
</if>
<if test="query.airShipment != null and query.airShipment == 3">
AND o.`status` = 5 AND o.air_shipment = 3
</if>
<if test="query.airShipment != null and query.airShipment == 4">
AND o.`status` = 5 AND o.air_shipment = 4
</if>
<if test="query.airShipment != null and query.airShipment == 10">
AND o.`status` = 5 AND o.air_shipment in(2,3,4)
</if>
<if test="query.airShipment != null and query.airShipment == 11">
AND o.`status` = 5 AND o.air_shipment in(1,2,3,4) and abnormal_state = 0 and audit_type = 0
</if>
<if test="query.airShipment != null and query.airShipment == 12">
AND o.`status` = 5 AND o.air_shipment in(2,3) and abnormal_state = 0 and audit_type = 0
</if>
<if test="query.airShipment != null and query.airShipment == 20">
AND o.`status` = 5 AND o.air_shipment in(0,2,3,4) and abnormal_state = 0 and audit_type = 0
</if>
<if test="query.isNeat == true ">
AND o.sum_num = o.cost->>'$.totalNum'
</if>
<if test="query.customerDetailId != null"> <if test="query.customerDetailId != null">
AND (o.`customer_id` = #{query.customerDetailId} or nor.`customer_id` = #{query.customerDetailId} or AND (o.`customer_id` = #{query.customerDetailId} or nor.`customer_id` = #{query.customerDetailId} or
nee.`customer_id` = #{query.customerDetailId}) nee.`customer_id` = #{query.customerDetailId})
...@@ -5561,6 +5073,100 @@ ...@@ -5561,6 +5073,100 @@
<include refid="appOrderQurey"/> <include refid="appOrderQurey"/>
</select> </select>
<sql id="appOrderQurey"> <sql id="appOrderQurey">
<if test="query.isNeat == false ">
AND o.sum_num <![CDATA[ < ]]> o.cost->>'$.totalNum'
</if>
<if test="query.airShipmentList != null and query.airShipmentList.size() > 0">
<if test="query.airShipmentList.size() == 1">
<foreach item='airShipment' index="index" collection='query.airShipmentList'>
<choose>
<when test="airShipment == 1">
AND o.`status` = 5 AND o.air_shipment = 1 and abnormal_state = 0 and audit_type = 0
</when>
<when test="airShipment == 2">
AND o.`status` = 5 AND o.air_shipment = 2
</when>
<when test="airShipment == 3">
AND o.`status` = 5 AND o.air_shipment = 3
</when>
<when test="airShipment == 4">
AND o.`status` = 5 AND o.air_shipment = 4
</when>
<when test="airShipment == 10">
AND o.`status` = 5 AND o.air_shipment in(2,3,4)
</when>
<when test="airShipment == 11">
AND o.`status` = 5 AND o.air_shipment in(1,2,3,4) and abnormal_state = 0 and audit_type = 0
</when>
<when test="airShipment == 12">
AND o.`status` = 5 AND o.air_shipment in(2,3) and abnormal_state = 0 and audit_type = 0
</when>
<when test="airShipment == 20">
AND o.`status` = 5 AND o.air_shipment in(0,2,3,4) and abnormal_state = 0 and audit_type = 0
</when>
</choose>
</foreach>
</if>
<if test="query.airShipmentList.size() > 1">
AND (1!=1
<foreach item='airShipment' index="index" collection='query.airShipmentList'>
<choose>
<when test="airShipment == 1">
or (o.`status` = 5 AND o.air_shipment = 1 and abnormal_state = 0 and audit_type = 0)
</when>
<when test="airShipment == 2">
or (o.`status` = 5 AND o.air_shipment = 2)
</when>
<when test="airShipment == 3">
or (o.`status` = 5 AND o.air_shipment = 3)
</when>
<when test="airShipment == 4">
or (o.`status` = 5 AND o.air_shipment = 4)
</when>
<when test="airShipment == 10">
or (o.`status` = 5 AND o.air_shipment in(2,3,4))
</when>
<when test="airShipment == 11">
or (o.`status` = 5 AND o.air_shipment in(1,2,3,4) and abnormal_state = 0 and audit_type = 0)
</when>
<when test="airShipment == 12">
or (o.`status` = 5 AND o.air_shipment in(2,3) and abnormal_state = 0 and audit_type = 0)
</when>
<when test="airShipment == 20">
or (o.`status` = 5 AND o.air_shipment in(0,2,3,4) and abnormal_state = 0 and audit_type = 0)
</when>
</choose>
</foreach>
)
</if>
</if>
<if test="query.airShipment != null and query.airShipment == 1">
AND o.`status` = 5 AND o.air_shipment = 1 and abnormal_state = 0 and audit_type = 0
</if>
<if test="query.airShipment != null and query.airShipment == 2">
AND o.`status` = 5 AND o.air_shipment = 2
</if>
<if test="query.airShipment != null and query.airShipment == 3">
AND o.`status` = 5 AND o.air_shipment = 3
</if>
<if test="query.airShipment != null and query.airShipment == 4">
AND o.`status` = 5 AND o.air_shipment = 4
</if>
<if test="query.airShipment != null and query.airShipment == 10">
AND o.`status` = 5 AND o.air_shipment in(2,3,4)
</if>
<if test="query.airShipment != null and query.airShipment == 11">
AND o.`status` = 5 AND o.air_shipment in(1,2,3,4) and abnormal_state = 0 and audit_type = 0
</if>
<if test="query.airShipment != null and query.airShipment == 12">
AND o.`status` = 5 AND o.air_shipment in(2,3) and abnormal_state = 0 and audit_type = 0
</if>
<if test="query.airShipment != null and query.airShipment == 20">
AND o.`status` = 5 AND o.air_shipment in(0,2,3,4) and abnormal_state = 0 and audit_type = 0
</if>
<if test="query.isNeat == true ">
AND o.sum_num = o.cost->>'$.totalNum'
</if>
<if test="query.type != null and query.type != '' and query.type == 0 "> <if test="query.type != null and query.type != '' and query.type == 0 ">
AND (o.type is null or o.type = '' or o.type = '0') AND (o.type is null or o.type = '' or o.type = '0')
</if> </if>
...@@ -6256,97 +5862,6 @@ ...@@ -6256,97 +5862,6 @@
</foreach> </foreach>
)) ))
</if> </if>
<if test="query.isNeat == false ">
AND o.sum_num <![CDATA[ < ]]> o.cost->>'$.totalNum'
</if>
<if test="query.airShipmentList != null and query.airShipmentList.size() > 0">
<if test="query.airShipmentList.size() == 0">
<foreach item='airShipment' index="index" collection='query.airShipmentList'>
<choose>
<when test="airShipment == 1">
AND o.`status` = 5 AND o.air_shipment = 1 and abnormal_state = 0 and audit_type = 0
</when>
<when test="airShipment == 2">
AND o.`status` = 5 AND o.air_shipment = 2
</when>
<when test="airShipment == 3">
AND o.`status` = 5 AND o.air_shipment = 3
</when>
<when test="airShipment == 4">
AND o.`status` = 5 AND o.air_shipment = 4
</when>
<when test="airShipment == 10">
AND o.`status` = 5 AND o.air_shipment in(2,3,4)
</when>
<when test="airShipment == 11">
AND o.`status` = 5 AND o.air_shipment in(1,2,3,4) and abnormal_state = 0 and audit_type = 0
</when>
<when test="airShipment == 12">
AND o.`status` = 5 AND o.air_shipment in(2,3) and abnormal_state = 0 and audit_type = 0
</when>
<when test="airShipment == 20">
AND o.`status` = 5 AND o.air_shipment in(0,2,3,4) and abnormal_state = 0 and audit_type = 0
</when>
</choose>
</foreach>
</if>
<if test="query.airShipmentList.size() > 1">
AND (1!=1
<foreach item='airShipment' index="index" collection='query.airShipmentList'>
<choose>
<when test="airShipment == 1">
or o.`status` = 5 AND o.air_shipment = 1 and abnormal_state = 0 and audit_type = 0
</when>
<when test="airShipment == 2">
or o.`status` = 5 AND o.air_shipment = 2
</when>
<when test="airShipment == 3">
or o.`status` = 5 AND o.air_shipment = 3
</when>
<when test="airShipment == 4">
or o.`status` = 5 AND o.air_shipment = 4
</when>
<when test="airShipment == 10">
or o.`status` = 5 AND o.air_shipment in(2,3,4)
</when>
<when test="airShipment == 11">
or o.`status` = 5 AND o.air_shipment in(1,2,3,4) and abnormal_state = 0 and audit_type = 0
</when>
<when test="airShipment == 12">
or o.`status` = 5 AND o.air_shipment in(2,3) and abnormal_state = 0 and audit_type = 0
</when>
<when test="airShipment == 20">
or o.`status` = 5 AND o.air_shipment in(0,2,3,4) and abnormal_state = 0 and audit_type = 0
</when>
</choose>
</foreach>
)
</if>
</if>
<if test="query.airShipment != null and query.airShipment == 1">
AND o.`status` = 5 AND o.air_shipment = 1 and abnormal_state = 0 and audit_type = 0
</if>
<if test="query.airShipment != null and query.airShipment == 2">
AND o.`status` = 5 AND o.air_shipment = 2
</if>
<if test="query.airShipment != null and query.airShipment == 3">
AND o.`status` = 5 AND o.air_shipment = 3
</if>
<if test="query.airShipment != null and query.airShipment == 4">
AND o.`status` = 5 AND o.air_shipment = 4
</if>
<if test="query.airShipment != null and query.airShipment == 10">
AND o.`status` = 5 AND o.air_shipment in(2,3,4)
</if>
<if test="query.airShipment != null and query.airShipment == 11">
AND o.`status` = 5 AND o.air_shipment in(1,2,3,4) and abnormal_state = 0 and audit_type = 0
</if>
<if test="query.airShipment != null and query.airShipment == 12">
AND o.`status` = 5 AND o.air_shipment in(2,3) and abnormal_state = 0 and audit_type = 0
</if>
<if test="query.airShipment != null and query.airShipment == 20">
AND o.`status` = 5 AND o.air_shipment in(0,2,3,4) and abnormal_state = 0 and audit_type = 0
</if>
<if test="query.type != null and query.type != '' and query.type == 0 "> <if test="query.type != null and query.type != '' and query.type == 0 ">
AND (o.type is null or o.type = '' or o.type = '0') AND (o.type is null or o.type = '' or o.type = '0')
</if> </if>
...@@ -6390,9 +5905,6 @@ ...@@ -6390,9 +5905,6 @@
<if test="query.marks != null and query.marks != '' "> <if test="query.marks != null and query.marks != '' ">
AND o.`marks` like concat("%",concat(#{query.marks},"%")) AND o.`marks` like concat("%",concat(#{query.marks},"%"))
</if> </if>
<if test="query.isNeat == true ">
AND o.sum_num = o.cost->>'$.totalNum'
</if>
<if test="query.containerNumber != null and query.containerNumber != '' "> <if test="query.containerNumber != null and query.containerNumber != '' ">
AND o.`container_number` = #{query.containerNumber} AND o.`container_number` = #{query.containerNumber}
</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