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

订单查询参数重构

parent c323c4d1
...@@ -646,12 +646,12 @@ public interface OrderMapper extends AbstractMapper<OrderDO> { ...@@ -646,12 +646,12 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
List<OrderBackPageVO> orderList(@Param("start") int start, @Param("size") int size, @Param("query") OrderQueryVO query); List<OrderBackPageVO> orderList(@Param("start") int start, @Param("size") int size, @Param("query") OrderQueryVO query);
List<OrderBackPageVO> myOrderPageList(@Param("start") int start, @Param("size") int size, @Param("query") OrderQueryDTO query); List<OrderBackPageVO> myOrderPageList(@Param("start") int start, @Param("size") int size, @Param("query") OrderQueryVO query);
long orderCount(@Param("query") OrderQueryVO query); long orderCount(@Param("query") OrderQueryVO query);
long myOrderCount(@Param("query") OrderQueryDTO query); long myOrderCount(@Param("query") OrderQueryVO query);
List<OrderExcelVO> exportOrderExcelList(@Param("start")int start, @Param("size") int size,@Param("query") OrderQueryVO query); List<OrderExcelVO> exportOrderExcelList(@Param("start")int start, @Param("size") int size,@Param("query") OrderQueryVO query);
......
...@@ -61,7 +61,7 @@ public class ContainerNumberOrderExcelExportListener { ...@@ -61,7 +61,7 @@ public class ContainerNumberOrderExcelExportListener {
PageVO page = new PageVO(); PageVO page = new PageVO();
page.setRows(10000); page.setRows(10000);
page.setPage(1); page.setPage(1);
OrderQueryDTO query = JSONObject.parseObject(event.getRequestParams(), OrderQueryDTO.class); OrderQueryVO query = JSONObject.parseObject(event.getRequestParams(), OrderQueryVO.class);
query.setLang(event.getLang()); query.setLang(event.getLang());
PageResult<OrderBackPageVO> orderPage = orderQueryService.myOrderPage(query, page); PageResult<OrderBackPageVO> orderPage = orderQueryService.myOrderPage(query, page);
if (CollectionUtil.isNotEmpty(orderPage.getList())) { if (CollectionUtil.isNotEmpty(orderPage.getList())) {
......
...@@ -154,7 +154,7 @@ public interface OrderQueryService { ...@@ -154,7 +154,7 @@ public interface OrderQueryService {
PageResult<OrderBackPageVO> orderPage(OrderQueryVO query, PageVO page); PageResult<OrderBackPageVO> orderPage(OrderQueryVO query, PageVO page);
PageResult<OrderBackPageVO> myOrderPage(OrderQueryDTO query, PageVO page); PageResult<OrderBackPageVO> myOrderPage(OrderQueryVO query, PageVO page);
long orderCount(OrderQueryVO query); long orderCount(OrderQueryVO query);
......
...@@ -966,18 +966,17 @@ public class OrderQueryServiceImpl implements OrderQueryService { ...@@ -966,18 +966,17 @@ public class OrderQueryServiceImpl implements OrderQueryService {
} }
@Override @Override
public PageResult<OrderBackPageVO> myOrderPage(OrderQueryDTO query, PageVO page) { public PageResult<OrderBackPageVO> myOrderPage(OrderQueryVO query, PageVO page) {
if (Objects.isNull(query.getLang())) { if (Objects.isNull(query.getLang())) {
query.setLang(I18nMessage.getLang()); query.setLang(I18nMessage.getLang());
} }
caseStatus(query.getStatus(), query); // caseStatus(query.getStatus(), query);
IPage<OrderBackPageVO> mpPage = MyBatisUtils.buildPage(page); IPage<OrderBackPageVO> mpPage = MyBatisUtils.buildPage(page);
long total = orderMapper.myOrderCount(query);
log.warn(I18nMessage.getLang().toString()); log.warn(I18nMessage.getLang().toString());
int start = (page.getPage() - 1) * page.getRows(); int start = (page.getPage() - 1) * page.getRows();
int size = page.getRows(); int size = page.getRows();
List<OrderBackPageVO> list = orderMapper.myOrderPageList(start, size, query); List<OrderBackPageVO> list = orderMapper.myOrderPageList(start, size, query);
long total = orderMapper.myOrderCount(query);
return new PageResult<>(list, total, mpPage.getSize(), page.getPage(), (total + mpPage.getSize() - 1) / mpPage.getSize()); return new PageResult<>(list, total, mpPage.getSize(), page.getPage(), (total + mpPage.getSize() - 1) / mpPage.getSize());
} }
...@@ -1005,8 +1004,6 @@ public class OrderQueryServiceImpl implements OrderQueryService { ...@@ -1005,8 +1004,6 @@ public class OrderQueryServiceImpl implements OrderQueryService {
private void combinedState(Integer asStatus, OrderQueryDTO query, List<Integer> statusList) { private void combinedState(Integer asStatus, OrderQueryDTO query, List<Integer> statusList) {
switch (asStatus) { switch (asStatus) {
case 12325: case 12325:
//this.status = 12; //this.status = 12;
...@@ -1158,7 +1155,7 @@ public class OrderQueryServiceImpl implements OrderQueryService { ...@@ -1158,7 +1155,7 @@ public class OrderQueryServiceImpl implements OrderQueryService {
@Override @Override
public PageResult<OrderBackPageVO> deptOrderPage1(OrderQueryDTO query, PageVO page) { public PageResult<OrderBackPageVO> deptOrderPage1(OrderQueryDTO query, PageVO page) {
query.setLang(I18nMessage.getLang()); query.setLang(I18nMessage.getLang());
caseStatus(query.getStatus(), query); // caseStatus(query.getStatus(), query);
IPage<OrderBackPageVO> mpPage = MyBatisUtils.buildPage(page); IPage<OrderBackPageVO> mpPage = MyBatisUtils.buildPage(page);
long total = orderMapper.deptOrderCount1(query); long total = orderMapper.deptOrderCount1(query);
log.warn(I18nMessage.getLang().toString()); log.warn(I18nMessage.getLang().toString());
......
package cn.iocoder.yudao.module.order.vo.order; package cn.iocoder.yudao.module.order.vo.order;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*; import lombok.*;
...@@ -524,6 +525,50 @@ public class OrderQueryVO { ...@@ -524,6 +525,50 @@ public class OrderQueryVO {
@ApiModelProperty(value = "是否在公海") @ApiModelProperty(value = "是否在公海")
private Boolean isInOpenSea; private Boolean isInOpenSea;
@ApiModelProperty(value = "订单异常状态(字典 order_abnormal_state)")
private List<Integer> abnormalStates;
@ApiModelProperty(value = "订单异常状态(字典 order_abnormal_state)")
private List<Long> objectiveIds;
@ApiModelProperty(value = "始发仓IDs")
private List<Long> startWarehouseIds;
@ApiModelProperty(value = "目的仓IDs")
private List<Long> destWarehouseIds;
@ApiModelProperty(value = "目的国ids")
private List<Long> destCountryIds ;
@ApiModelProperty(value = "入仓类型")
private List<Integer> warehouseTypes;
@ApiModelProperty(value = "报关类别:我司全代:1,自单代报:2,混合报关:3")
private List<Integer> customsTypes;
@ApiModelProperty(value = "审核类型(字典 order_approval_type) 0 为正常")
private List<Integer> auditTypeList;
@ApiModelProperty(value = "订单状态详情见字典:order_status")
private List<Integer> statusList;
@ApiModelProperty(value = "订单异常状态(字典 order_abnormal_state)")
private List<Integer> abnormalStateList;
@ApiModelProperty(value = "订单入仓状态(字典 order_warehouse_in_status)")
private List<Integer> inWarehouseStateList;
@ApiModelProperty(value = "订单出货状态(字典 order_shipment_state)")
private List<Integer> shipmentStateList;
@ApiModelProperty(value = "空运可出货状态:0 默认值 1 待出 2 可出 3 备货中 4 已备货 10 可出、备货中、已备货 11 待出、可出、备货中、已备货 12 可出、备货中")
private List<Integer> airShipmentList;
@ApiModelProperty(value = "内部转换状态字段")
private List<Integer> asStatusList;
@ApiModelProperty(value = "是否预警控货订单: 1 是") @ApiModelProperty(value = "是否预警控货订单: 1 是")
private Integer warningOrder; private Integer warningOrder;
...@@ -536,11 +581,25 @@ public class OrderQueryVO { ...@@ -536,11 +581,25 @@ public class OrderQueryVO {
} }
} }
public void setAsStatusList(List<Integer> asStatusList) {
this.asStatusList = asStatusList;
if (CollectionUtil.isNotEmpty(this.asStatusList)) {
for (Integer asStatus : asStatusList) {
combinedStateList(asStatus, this.transportId);
}
}
}
public void setTransportId(Integer transportId) { public void setTransportId(Integer transportId) {
this.transportId = transportId; this.transportId = transportId;
if (Objects.nonNull(transportId) && Objects.nonNull(this.asStatus)) { if (Objects.nonNull(transportId) && Objects.nonNull(this.asStatus)) {
combinedState(this.asStatus, this.transportId); combinedState(this.asStatus, this.transportId);
} }
if (Objects.nonNull(transportId) && CollectionUtil.isNotEmpty(this.asStatusList)) {
for (Integer asStatus : asStatusList) {
combinedStateList(asStatus, this.transportId);
}
}
} }
private void combinedState(Integer asStatus, Integer transportId) { private void combinedState(Integer asStatus, Integer transportId) {
...@@ -609,6 +668,139 @@ public class OrderQueryVO { ...@@ -609,6 +668,139 @@ public class OrderQueryVO {
} }
} }
private void combinedStateList(Integer asStatus, Integer transportId) {
switch (asStatus) {
case 12325:
if (Objects.isNull(this.statusList)){
this.statusList = new ArrayList<>();
}
if (Objects.isNull(this.shipmentStateList)){
this.shipmentStateList = new ArrayList<>();
}
this.statusList.add(12);
this.shipmentStateList.add(325);
break;
case 10501:
// 空运待出
if (Objects.isNull(this.statusList)){
this.statusList = new ArrayList<>();
}
if (Objects.isNull(this.airShipmentList)){
this.airShipmentList = new ArrayList<>();
}
if (Objects.isNull(this.auditTypeList)){
this.auditTypeList = new ArrayList<>();
}
if (Objects.isNull(this.abnormalStateList)){
this.abnormalStateList = new ArrayList<>();
}
this.statusList.add(5);
this.airShipmentList.add(1);
this.auditTypeList.add(0);
this.abnormalStateList.add(0);
this.transportId = 3; // 空运待出查询,只查空运的订单
break;
case 10502:
// 空运可出
if (Objects.isNull(this.statusList)){
this.statusList = new ArrayList<>();
}
if (Objects.isNull(this.airShipmentList)){
this.airShipmentList = new ArrayList<>();
}
this.statusList.add(5);
this.airShipmentList.add(12);
this.transportId = 3; // 空运待出查询,只查空运的订单
break;
case 10503:
// 空运已备货
if (Objects.isNull(this.statusList)){
this.statusList = new ArrayList<>();
}
if (Objects.isNull(this.airShipmentList)){
this.airShipmentList = new ArrayList<>();
}
this.statusList.add(5);
this.airShipmentList.add(4);
this.transportId = 3; // 空运待出查询,只查空运的订单
break;
case 10504:
// 待排单
if (Objects.isNull(this.statusList)){
this.statusList = new ArrayList<>();
}
if (Objects.isNull(this.airShipmentList)){
this.airShipmentList = new ArrayList<>();
}
if (Objects.isNull(this.auditTypeList)){
this.auditTypeList = new ArrayList<>();
}
if (Objects.isNull(this.abnormalStateList)){
this.abnormalStateList = new ArrayList<>();
}
this.statusList.add(5);
this.auditTypeList.add(0);
this.abnormalStateList.add(0);
if (Objects.nonNull(transportId) && transportId == 3) {
// 空运无需判断备货状态 可出、备货中、已备货
this.airShipmentList.add(10);
}else {
// 兼容空运已入仓的可出、备货中、已备货,且无异常无审批,海运的已入仓无异常无审批
this.airShipmentList.add(20);
}
break;
case 132411:
// 空运已出货
if (Objects.isNull(this.statusList)){
this.statusList = new ArrayList<>();
}
if (Objects.isNull(this.shipmentStateList)){
this.shipmentStateList = new ArrayList<>();
}
this.statusList.add(32);
this.shipmentStateList.add(411);
this.transportId = 3; // 空运待出查询,只查空运的订单
break;
case 132412:
// 空运已出仓
if (Objects.isNull(this.statusList)){
this.statusList = new ArrayList<>();
}
if (Objects.isNull(this.shipmentStateList)){
this.shipmentStateList = new ArrayList<>();
}
this.statusList.add(32);
this.shipmentStateList.add(412);
this.transportId = 3; // 空运待出查询,只查空运的订单
break;
case 132409:
// 空运已理货
if (Objects.isNull(this.statusList)){
this.statusList = new ArrayList<>();
}
if (Objects.isNull(this.shipmentStateList)){
this.shipmentStateList = new ArrayList<>();
}
this.statusList.add(32);
this.shipmentStateList.add(409);
this.transportId = 3; // 空运待出查询,只查空运的订单
break;
case 118428:
// 空运已到港
if (Objects.isNull(this.statusList)){
this.statusList = new ArrayList<>();
}
if (Objects.isNull(this.shipmentStateList)){
this.shipmentStateList = new ArrayList<>();
}
this.statusList.add(32);
this.shipmentStateList.add(428);
this.transportId = 3; // 空运待出查询,只查空运的订单
break;
}
}
public void setShipmentState(Integer shipmentState) { public void setShipmentState(Integer shipmentState) {
if (Objects.nonNull(shipmentState)) { if (Objects.nonNull(shipmentState)) {
......
...@@ -347,6 +347,81 @@ ...@@ -347,6 +347,81 @@
<if test="query.warehouseType != null"> <if test="query.warehouseType != null">
AND o.`warehouse_type` = #{query.warehouseType} AND o.`warehouse_type` = #{query.warehouseType}
</if> </if>
<if test="query.warehouseTypes != null and query.warehouseTypes.size()>0">
<if test="query.warehouseTypes != null and query.warehouseTypes.size()==1 ">
AND o.`warehouse_type` =
<foreach item='warehouseType' index="index" collection='query.warehouseTypes' >
#{warehouseType}
</foreach>
</if>
<if test="query.warehouseTypes != null and query.warehouseTypes.size()>1 ">
AND o.`warehouse_type` in
<foreach item='warehouseType' index="index" collection='query.warehouseTypes' open='(' separator=',' close=')'>
#{warehouseType}
</foreach>
</if>
</if>
<if test="query.objectiveId != null and query.objectiveId.size() != 0">
<if test="query.objectiveIds != null and query.objectiveIds.size()==1 ">
AND ob.`objective_id` =
<foreach item='objectiveId' index='index' collection='query.objectiveId' open='(' separator=',' close=')'>
#{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.objectiveIds.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.startWarehouseId !=null and query.startWarehouseIds.size() > 0 and (query.destWarehouseId==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.packageType != null and query.packageType != '' "> <if test="query.packageType != null and query.packageType != '' ">
AND CONCAT(',',o.package_type,',') REGEXP CONCAT(',',REPLACE(#{query.packageType},',',',|,'), ',') AND CONCAT(',',o.package_type,',') REGEXP CONCAT(',',REPLACE(#{query.packageType},',',',|,'), ',')
</if> </if>
...@@ -539,18 +614,18 @@ ...@@ -539,18 +614,18 @@
<!-- <if test="query.productRecord != null">--> <!-- <if test="query.productRecord != null">-->
<!-- AND o.`product_record` = #{query.productRecord}--> <!-- AND o.`product_record` = #{query.productRecord}-->
<!-- </if>--> <!-- </if>-->
<if test="query.customsType != null and query.customsType.size()>0"> <if test="query.customsTypes != null and query.customsTypes.size()>0">
<if test="query.customsType != null and query.customsType != '' and query.customsType.size()==1 "> <if test="query.customsTypes != null and query.customsTypes.size()==1 ">
AND o.`customs_type` = AND o.`customs_type` =
<foreach item='customsType' index="index" collection='query.customsType' > <foreach item='customsType' index="index" collection='query.customsTypes' >
#{customsType} #{customsType}
</foreach> </foreach>
</if> </if>
<if test="query.customsType != null and query.customsType != '' and query.customsType.size()>1 "> <if test="query.customsTypes != null and query.customsTypes.size()>1 ">
AND o.`customs_type` in AND o.`customs_type` in
<foreach item='customsType' index="index" collection='query.customsType' open='(' separator=',' close=')'> <foreach item='customsType' index="index" collection='query.customsTypes' open='(' separator=',' close=')'>
#{customsType} #{customsType}
</foreach> </foreach>
</if> </if>
...@@ -578,26 +653,84 @@ ...@@ -578,26 +653,84 @@
<if test="query.transportId != null"> <if test="query.transportId != null">
AND o.`transport_id` = #{query.transportId} AND o.`transport_id` = #{query.transportId}
</if> </if>
<!-- <if test="query.warehouseType != null">--> <if test="query.warehouseType != null">
<!-- AND o.`warehouse_type` = #{query.warehouseType}--> AND o.`warehouse_type` = #{query.warehouseType}
<!-- </if>--> </if>
<if test="query.warehouseType != null and query.warehouseType.size()>0"> <!-- <if test="query.warehouseTypes != null and query.warehouseTypes.size()>0">-->
<if test="query.warehouseType != null and query.warehouseType != '' and query.warehouseType.size()==1 "> <!-- <if test="query.warehouseTypes != null and query.warehouseTypes.size()==1 ">-->
AND o.`warehouse_type` = <!-- AND o.`warehouse_type` =-->
<foreach item='warehouseType' index="index" collection='query.warehouseType' > <!-- <foreach item='warehouseType' index="index" collection='query.warehouseTypes' >-->
#{warehouseType} <!-- #{warehouseType}-->
</foreach> <!-- </foreach>-->
</if> <!-- </if>-->
<if test="query.warehouseType != null and query.warehouseType != '' and query.warehouseType.size()>1 "> <!-- <if test="query.warehouseTypes != null and query.warehouseTypes.size()>1 ">-->
AND o.`warehouse_type` in <!-- AND o.`warehouse_type` in-->
<foreach item='warehouseType' index="index" collection='query.warehouseType' open='(' separator=',' close=')'> <!-- <foreach item='warehouseType' index="index" collection='query.warehouseTypes' open='(' separator=',' close=')'>-->
#{warehouseType} <!-- #{warehouseType}-->
</foreach> <!-- </foreach>-->
</if> <!-- </if>-->
</if> <!-- </if>-->
<!-- <if test="query.objectiveId != null and query.objectiveId.size() != 0">-->
<!-- <if test="query.objectiveIds != null and query.objectiveIds.size()==1 ">-->
<!-- AND ob.`objective_id` =-->
<!-- <foreach item='objectiveId' index='index' collection='query.objectiveId' open='(' separator=',' close=')'>-->
<!-- #{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.objectiveIds.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.startWarehouseId !=null and query.startWarehouseIds.size() > 0 and (query.destWarehouseId==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.packageType != null and query.packageType != '' "> <if test="query.packageType != null and query.packageType != '' ">
AND CONCAT(',',o.package_type,',') REGEXP CONCAT(',',REPLACE(#{query.packageType},',',',|,'), ',') AND CONCAT(',',o.package_type,',') REGEXP CONCAT(',',REPLACE(#{query.packageType},',',',|,'), ',')
</if> </if>
...@@ -752,53 +885,53 @@ ...@@ -752,53 +885,53 @@
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.objectiveId != null and query.objectiveId.size() != 0"> <!-- <if test="query.objectiveId != null and query.objectiveId.size() != 0">-->
AND ob.`objective_id` in <!-- AND ob.`objective_id` in-->
<foreach item='orderId' index='index' collection='query.objectiveId' open='(' separator=',' close=')'> <!-- <foreach item='orderId' index='index' collection='query.objectiveId' open='(' separator=',' close=')'>-->
#{orderId} <!-- #{orderId}-->
</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.startWarehouseId != null and query.destWarehouseId != null ">-->
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='startWarehouseId' index='index' collection='query.startWarehouseId' open='(' separator=',' close=')'>-->
#{startWarehouseId} <!-- #{startWarehouseId}-->
</foreach> <!-- </foreach>-->
and whl.dest_warehouse_id in <!-- and whl.dest_warehouse_id in-->
<foreach item='destWarehouseId' index='index' collection='query.destWarehouseId' open='(' separator=',' close=')'> <!-- <foreach item='destWarehouseId' index='index' collection='query.destWarehouseId' open='(' separator=',' close=')'>-->
#{destWarehouseId} <!-- #{destWarehouseId}-->
</foreach> <!-- </foreach>-->
)) <!-- ))-->
</if> <!-- </if>-->
<if test = "query.startWarehouseId != null and query.destWarehouseId == null "> <!-- <if test = "query.startWarehouseId != null and query.destWarehouseId == null ">-->
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='startWarehouseId' index='index' collection='query.startWarehouseId' open='(' separator=',' close=')'>-->
#{startWarehouseId} <!-- #{startWarehouseId}-->
</foreach> <!-- </foreach>-->
)) <!-- ))-->
</if> <!-- </if>-->
<if test = "query.startWarehouseId == null and query.destWarehouseId != null "> <!-- <if test = "query.startWarehouseId == null and query.destWarehouseId != null ">-->
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 whl.dest_warehouse_id in-->
<foreach item='destWarehouseId' index='index' collection='query.destWarehouseId' open='(' separator=',' close=')'> <!-- <foreach item='destWarehouseId' index='index' collection='query.destWarehouseId' open='(' separator=',' close=')'>-->
#{destWarehouseId} <!-- #{destWarehouseId}-->
</foreach> <!-- </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>
...@@ -1308,6 +1441,9 @@ ...@@ -1308,6 +1441,9 @@
</if> </if>
</if> </if>
<if test="query.status != null">
AND o.`status` = #{query.status}
</if>
<if test="query.statusList != null and query.statusList.size()>0"> <if test="query.statusList != null and query.statusList.size()>0">
<if test="query.statusList != null and query.statusList != '' and query.statusList.size()==1 "> <if test="query.statusList != null and query.statusList != '' and query.statusList.size()==1 ">
...@@ -1325,55 +1461,29 @@ ...@@ -1325,55 +1461,29 @@
</if> </if>
</if> </if>
<!-- <if test="query.status != null">--> <if test="query.abnormalStateList != null and query.abnormalStateList.size()>0">
<!-- AND o.`status` = #{query.status}--> <if test="query.abnormalStateList != null and query.abnormalStateList.size()==1 ">
<!-- </if>--> <foreach item='abnormalState' index="index" collection='query.abnormalStateList' >
<!-- <if test="query.abnormalState != null">--> <choose>
<!-- <choose>--> <when test="abnormalState != '0'">
<!-- <when test="query.abnormalState != 0">--> <choose>
<!-- <choose>--> <when test="abnormalState != '-1'">
<!-- <when test="query.abnormalState != -1">--> AND o.`abnormal_state` = #{abnormalState}
<!-- AND o.`abnormal_state` = #{query.abnormalState}--> </when>
<!-- </when>--> <otherwise>
<!-- <otherwise>--> AND o.`abnormal_state` != 0
<!-- AND o.`abnormal_state` != 0--> </otherwise>
<!-- </otherwise>--> </choose>
<!-- </choose>--> </when>
<!-- </when>--> <otherwise>
<!-- <otherwise>--> AND o.`abnormal_state` = 0
<!-- AND o.`abnormal_state` = 0--> </otherwise>
<!-- </otherwise>--> </choose>
<!-- </choose>-->
<!-- </if>-->
<if test="query.abnormalState != null and query.abnormalState.size()>0">
<if test="query.abnormalState != null and query.abnormalState != '' and query.abnormalState.size()==1 ">
<foreach item='abnormalState' index="index" collection='query.abnormalState' >
<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> </foreach>
</if> </if>
<if test="query.abnormalStateList != null and query.abnormalStateList.size()>1 ">
<if test="query.abnormalState != null and query.abnormalState != '' and query.abnormalState.size()>1 "> AND (1!=1
AND (1!=1 <foreach item='abnormalState' index="index" collection='query.abnormalStateList'>
<foreach item='abnormalState' index="index" collection='query.abnormalState'>
<choose> <choose>
<when test="abnormalState != '0'"> <when test="abnormalState != '0'">
<choose> <choose>
...@@ -1390,40 +1500,70 @@ ...@@ -1390,40 +1500,70 @@
</otherwise> </otherwise>
</choose> </choose>
</foreach> </foreach>
) )
</if> </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>
<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.inWarehouseState != null"> <if test="query.inWarehouseState != null">
AND o.`in_warehouse_state` = #{query.inWarehouseState} AND o.`in_warehouse_state` = #{query.inWarehouseState}
</if> </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.shipmentState != null"> <if test="query.shipmentState != null">
AND o.`shipment_State` = #{query.shipmentState} AND o.`shipment_State` = #{query.shipmentState}
</if> </if>
<!-- <if test="query.auditType != null">--> <if test="query.auditTypeList != null and query.auditTypeList.size()>0">
<!-- <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.auditType != null and query.auditType.size()>0">
<if test="query.auditType != null and query.auditType != '' and query.auditType.size()==1 "> <if test="query.auditTypeList != null and query.auditTypeList.size()==1 ">
<foreach item='auditType' index="index" collection='query.auditType' > <foreach item='auditType' index="index" collection='query.auditTypeList' >
<choose> <choose>
<when test="auditType != 0"> <when test="auditType != 0">
...@@ -1442,9 +1582,47 @@ ...@@ -1442,9 +1582,47 @@
</choose> </choose>
</foreach> </foreach>
</if> </if>
<if test="query.auditTypeList != null and query.auditTypeList.size()>1 ">
AND (1!=1
<foreach item='auditType' index="index" collection='query.auditTypeList'>
<choose>
<when test="auditType != 0">
<choose>
<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>
<if test="query.auditType != null">
<if test="query.salesmanId != 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.salesmanId != null ">
AND (o.`salesman_id` = #{query.salesmanId} or AND (o.`salesman_id` = #{query.salesmanId} or
o.`customer_id` in( o.`customer_id` in(
select cus.id from ecw_customer cus select cus.id from ecw_customer cus
...@@ -1496,23 +1674,7 @@ ...@@ -1496,23 +1674,7 @@
<if test="query.channelId != null"> <if test="query.channelId != null">
AND o.`channel_id` = #{query.channelId} AND o.`channel_id` = #{query.channelId}
</if> </if>
<if test="query.warehouseType != null and query.warehouseType.size()>0">
<if test="query.warehouseType != null and query.warehouseType != '' and query.warehouseType.size()==1 ">
AND o.`warehouse_type` =
<foreach item='warehouseType' index="index" collection='query.warehouseType' >
#{warehouseType}
</foreach>
</if>
<if test="query.warehouseType != null and query.warehouseType != '' and query.warehouseType.size()>1 ">
AND o.`warehouse_type` in
<foreach item='warehouseType' index="index" collection='query.warehouseType' open='(' separator=',' close=')'>
#{warehouseType}
</foreach>
</if>
</if>
<if test="query.number != null and query.number != '' "> <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 AND (o.`number` like concat("%",concat(#{query.number},"%")) or o.order_id in( select distinct oi.order_id
from ecw_order_item oi from ecw_order_item oi
...@@ -1537,19 +1699,81 @@ ...@@ -1537,19 +1699,81 @@
<if test="query.departureId != null "> <if test="query.departureId != null ">
AND de.`departure_id` = #{query.departureId} AND de.`departure_id` = #{query.departureId}
</if> </if>
<if test="query.objectiveId != null and query.objectiveId.size() != 0"> <if test="query.warehouseTypes != null and query.warehouseTypes.size()>0">
AND ob.`objective_id` in
<foreach item='orderId' index='index' collection='query.objectiveId' open='(' separator=',' close=')'> <if test="query.warehouseTypes != null and query.warehouseTypes.size()==1 ">
#{orderId} AND o.`warehouse_type` =
</foreach> <foreach item='warehouseType' index="index" collection='query.warehouseTypes' >
#{warehouseType}
</foreach>
</if>
<if test="query.warehouseTypes != null and query.warehouseTypes.size()>1 ">
AND o.`warehouse_type` in
<foreach item='warehouseType' index="index" collection='query.warehouseTypes' open='(' separator=',' close=')'>
#{warehouseType}
</foreach>
</if>
</if> </if>
<if test="query.destCountryId != null "> <if test="query.objectiveId != null and query.objectiveId.size() != 0">
<if test="query.objectiveIds != null and query.objectiveIds.size()==1 ">
AND ob.`objective_id` =
<foreach item='objectiveId' index='index' collection='query.objectiveId' open='(' separator=',' close=')'>
#{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.objectiveIds.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>
<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.startWarehouseId !=null and query.startWarehouseIds.size() > 0 and (query.destWarehouseId==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.consignorId != null "> <if test="query.consignorId != null ">
AND nor.`customer_id` = #{query.consignorId} AND nor.`customer_id` = #{query.consignorId}
</if> </if>
...@@ -1762,47 +1986,74 @@ ...@@ -1762,47 +1986,74 @@
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.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='warehouseId' collection='query.startWarehouseId' open='(' separator=',' close=')'>
#{warehouseId}
</foreach>
and whl.dest_warehouse_id in
<foreach item='destWarehouseId' 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='warehouseId' collection='query.startWarehouseId' open='(' separator=',' close=')'>
#{warehouseId}
</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' collection='query.destWarehouseId' 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>
<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">
(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"> <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 AND o.`status` = 5 AND o.air_shipment = 1 and abnormal_state = 0 and audit_type = 0
</if> </if>
...@@ -1895,12 +2146,89 @@ ...@@ -1895,12 +2146,89 @@
</otherwise> </otherwise>
</choose> </choose>
</if> </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.inWarehouseState != null"> <if test="query.inWarehouseState != null">
AND o.`in_warehouse_state` = #{query.inWarehouseState} AND o.`in_warehouse_state` = #{query.inWarehouseState}
</if> </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.shipmentState != null"> <if test="query.shipmentState != null">
AND o.`shipment_State` = #{query.shipmentState} AND o.`shipment_State` = #{query.shipmentState}
</if> </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>
<when test="auditType != 0">
<choose>
<when test="auditType != -1">
AND o.`audit_type` = #{auditType}
</when>
<otherwise>
AND o.`audit_type` != 0
</otherwise>
</choose>
</when>
<otherwise>
AND o.`audit_type` = 0
</otherwise>
</choose>
</foreach>
</if>
<if test="query.auditTypeList != null and query.auditTypeList.size()>1 ">
AND (1!=1
<foreach item='auditType' index="index" collection='query.auditTypeList'>
<choose>
<when test="auditType != 0">
<choose>
<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.auditType != null"> <if test="query.auditType != null">
<choose> <choose>
<when test="query.auditType != 0"> <when test="query.auditType != 0">
...@@ -1936,6 +2264,79 @@ ...@@ -1936,6 +2264,79 @@
<if test="query.warehouseType != null"> <if test="query.warehouseType != null">
AND o.`warehouse_type` = #{query.warehouseType} AND o.`warehouse_type` = #{query.warehouseType}
</if> </if>
<if test="query.warehouseTypes != null and query.warehouseTypes.size()>0">
<if test="query.warehouseTypes != null and query.warehouseTypes.size()==1 ">
AND o.`warehouse_type` =
<foreach item='warehouseType' index="index" collection='query.warehouseTypes' >
#{warehouseType}
</foreach>
</if>
<if test="query.warehouseTypes != null and query.warehouseTypes.size()>1 ">
AND o.`warehouse_type` in
<foreach item='warehouseType' index="index" collection='query.warehouseTypes' open='(' separator=',' close=')'>
#{warehouseType}
</foreach>
</if>
</if>
<if test="query.objectiveId != null and query.objectiveId.size() != 0">
<if test="query.objectiveIds != null and query.objectiveIds.size()==1 ">
AND ob.`objective_id` =
<foreach item='objectiveId' index='index' collection='query.objectiveId' open='(' separator=',' close=')'>
#{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.objectiveIds.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.startWarehouseId !=null and query.startWarehouseIds.size() > 0 and (query.destWarehouseId==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.number != null and query.number != '' "> <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 AND (o.`number` like concat("%",concat(#{query.number},"%")) or o.order_id in( select distinct oi.order_id
from ecw_order_item oi from ecw_order_item oi
...@@ -2202,6 +2603,70 @@ ...@@ -2202,6 +2603,70 @@
<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.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">
(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"> <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 AND o.`status` = 5 AND o.air_shipment = 1 and abnormal_state = 0 and audit_type = 0
</if> </if>
...@@ -2260,6 +2725,66 @@ ...@@ -2260,6 +2725,66 @@
<if test="query.status != null"> <if test="query.status != null">
AND o.`status` = #{query.status} AND o.`status` = #{query.status}
</if> </if>
<if test="query.statusList != null and query.statusList.size()>0">
<if test="query.statusList != null and query.statusList != '' and query.statusList.size()==1 ">
AND o.`status` =
<foreach item='status' index="index" collection='query.statusList' >
#{status}
</foreach>
</if>
<if test="query.statusList != null and query.statusList != '' and 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"> <if test="query.abnormalState != null">
<choose> <choose>
<when test="query.abnormalState != 0"> <when test="query.abnormalState != 0">
...@@ -2318,6 +2843,81 @@ ...@@ -2318,6 +2843,81 @@
<if test="query.warehouseType != null"> <if test="query.warehouseType != null">
AND o.`warehouse_type` = #{query.warehouseType} AND o.`warehouse_type` = #{query.warehouseType}
</if> </if>
<if test="query.warehouseTypes != null and query.warehouseTypes.size()>0">
<if test="query.warehouseTypes != null and query.warehouseTypes.size()==1 ">
AND o.`warehouse_type` =
<foreach item='warehouseType' index="index" collection='query.warehouseTypes' >
#{warehouseType}
</foreach>
</if>
<if test="query.warehouseTypes != null and query.warehouseTypes.size()>1 ">
AND o.`warehouse_type` in
<foreach item='warehouseType' index="index" collection='query.warehouseTypes' open='(' separator=',' close=')'>
#{warehouseType}
</foreach>
</if>
</if>
<if test="query.objectiveId != null and query.objectiveId.size() != 0">
<if test="query.objectiveIds != null and query.objectiveIds.size()==1 ">
AND ob.`objective_id` =
<foreach item='objectiveId' index='index' collection='query.objectiveId' open='(' separator=',' close=')'>
#{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.objectiveIds.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.startWarehouseId !=null and query.startWarehouseIds.size() > 0 and (query.destWarehouseId==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.number != null and query.number != '' "> <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 AND (o.`number` like concat("%",concat(#{query.number},"%")) or o.order_id in( select distinct oi.order_id
from ecw_order_item oi from ecw_order_item oi
......
...@@ -318,7 +318,7 @@ public class OrderController { ...@@ -318,7 +318,7 @@ public class OrderController {
@GetMapping("/page") @GetMapping("/page")
@ApiOperation("获得订单分页") @ApiOperation("获得订单分页")
// @PreAuthorize("@ss.hasPermission('ecw:order:query')") // @PreAuthorize("@ss.hasPermission('ecw:order:query')")
public CommonResult<PageResult<OrderBackPageVO>> getOrderPage(OrderQueryDTO query, PageVO page) { public CommonResult<PageResult<OrderBackPageVO>> getOrderPage(OrderQueryVO query, PageVO page) {
query.setUserType(UserTypeEnum.ADMIN.getValue()); query.setUserType(UserTypeEnum.ADMIN.getValue());
PageResult<OrderBackPageVO> pageResult = orderQueryService.myOrderPage(query, page); PageResult<OrderBackPageVO> pageResult = orderQueryService.myOrderPage(query, page);
return success(pageResult); return success(pageResult);
...@@ -336,7 +336,7 @@ public class OrderController { ...@@ -336,7 +336,7 @@ public class OrderController {
@GetMapping("/my/page") @GetMapping("/my/page")
@ApiOperation("获得我的订单分页") @ApiOperation("获得我的订单分页")
public CommonResult<PageResult<OrderBackPageVO>> myOrderPage(OrderQueryDTO query, PageVO page) { public CommonResult<PageResult<OrderBackPageVO>> myOrderPage(OrderQueryVO query, PageVO page) {
Long salesmanId = SecurityFrameworkUtils.getLoginUserId(); // 获取当前登录用户ID Long salesmanId = SecurityFrameworkUtils.getLoginUserId(); // 获取当前登录用户ID
query.setUserType(UserTypeEnum.ADMIN.getValue()); query.setUserType(UserTypeEnum.ADMIN.getValue());
// query.setSalesmanId(salesmanId); // query.setSalesmanId(salesmanId);
...@@ -350,11 +350,11 @@ public class OrderController { ...@@ -350,11 +350,11 @@ public class OrderController {
@GetMapping("/dept-order-page") @GetMapping("/dept-order-page")
@ApiOperation("部门订单分页") @ApiOperation("部门订单分页")
// @PreAuthorize("@ss.hasPermission('ecw:order:query')") // @PreAuthorize("@ss.hasPermission('ecw:order:query')")
public CommonResult<PageResult<OrderBackPageVO>> getDeptOrderPage(OrderQueryDTO query, PageVO page) { public CommonResult<PageResult<OrderBackPageVO>> getDeptOrderPage(OrderQueryVO query, PageVO page) {
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
query.setUserType(UserTypeEnum.ADMIN.getValue()); query.setUserType(UserTypeEnum.ADMIN.getValue());
query.setDeptId(Objects.isNull(loginUser) ? 0L : loginUser.getDeptId()); query.setDeptId(Objects.isNull(loginUser) ? 0L : loginUser.getDeptId());
PageResult<OrderBackPageVO> pageResult = orderQueryService.deptOrderPage1(query, page); PageResult<OrderBackPageVO> pageResult = orderQueryService.deptOrderPage(query, page);
return success(pageResult); return success(pageResult);
} }
......
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