"and o.order_id in(select distinct oi.order_id from ecw_order_item oi where oi.deleted = 0 and oi.`warehouse_in_info` is not null and oi.`warehouse_in_info`->>'$.cartonsNum' > 0 and oi.commission_type > 0)",
"</script>"
})
List<OrderDO>commissionOrderList();
@ResultType(StatisticsOrderVO.class)
@Select({
"<script>",
"select ",
"SUM(IFNULL(wi.cartons_num, 0)) as total_num, ",
"SUM(IFNULL(wi.volume, 0)) as total_volume, ",
"SUM(IFNULL(wi.weight, 0)) as total_weight, ",
"SUM(IFNULL(wi.quantity_all, 0)) as order_quantity ",
"from ecw_order_warehouse_in wi ",
"SUM(IFNULL(IF(it.warehouse_in_info is null, 0, it.warehouse_in_info->>'$.cartonsNum'), 0)) as total_num, ",
"SUM(IFNULL(IF(it.warehouse_in_info is null, 0, it.warehouse_in_info->>'$.volume'), 0)) as total_volume, ",
"SUM(IFNULL(IF(it.warehouse_in_info is null, 0, it.warehouse_in_info->>'$.weight'), 0)) as total_weight, ",
"SUM(IFNULL(IF(it.warehouse_in_info is null, 0, it.warehouse_in_info->>'$.quantityAll'), 0)) as order_quantity, ",
"SUM(IFNULL(it.w_volume,0)) as total_w_volume, ",
"SUM(IFNULL(it.v_weight,0)) as total_v_weight, ",
"SUM(IFNULL(IF(it.warehouse_in_info is null, 0, IF(it.charge_weight > it.min_metering_weight ,it.charge_weight,it.min_metering_weight)), 0)) as total_charge_weight, ",
"SUM(IFNULL(IF(it.warehouse_in_info is null, 0, IF(it.charge_volume > it.min_metering_volume,it.charge_volume,it.min_metering_volume)), 0)) as total_charge_volume,",
"SUM(IFNULL(IF(it.warehouse_in_info is null, 0, IF(it.charge_quantity > it.min_metering_quantity,it.charge_quantity,it.min_metering_quantity)), 0)) as total_charge_quantity",
"from ecw_order_item it ",
"left join ecw_order o ",
"ON wi.order_id = o.order_id ",
"ON it.order_id = o.order_id and it.deleted = 0",
"left join ecw_order_departure de on de.order_id = o.order_id ",
"left join ecw_order_objective ob on ob.order_id = o.order_id ",
"left join ecw_order_consignor nor on nor.order_id = o.order_id ",
"left join ecw_order_consignee nee on nee.order_id = o.order_id ",
"left join ecw_channel channel on channel.channel_id = o.channel_id ",
"where o.deleted = 0 and o.in_warehouse_state != 211 and o.in_warehouse_state != 208 and o.status != 10 and wi.deleted = 0",
"where o.deleted = 0 and o.in_warehouse_state != 211 and o.in_warehouse_state != 208 and o.status != 10 ",
"<when test = 'query.deptId != null '>",
"AND o.dept_id = #{query.deptId} ",
"</when>",
...
...
@@ -3631,15 +3571,6 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
"<when test = 'query.departureId != null '>",
"AND de.`departure_id` = #{query.departureId}",
"</when>",
"<when test = 'query.type != null and query.type != \"\" and query.type == 0 '>",
"AND (o.type is null or o.type = '' or o.type = '0')",
"</when>",
"<when test = 'query.type == 1 '>",
"AND FIND_IN_SET(1, o.type)",
"</when>",
"<when test = 'query.type == 2 '>",
"AND FIND_IN_SET(2, o.type)",
"</when>",
"<when test = 'query.objectiveId != null '>",
"AND ob.`objective_id` = #{query.objectiveId}",
"</when>",
...
...
@@ -3673,7 +3604,7 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
"</when>",
"<when test = 'query.beginRucangTime != null and query.endRucangTime != null '>",
// "AND o.`rucang_time` between #{query.beginRucangTime} and #{query.endRucangTime}",
"AND wi.`in_time` between #{query.beginRucangTime} and #{query.endRucangTime}",
"AND o.order_id in(select distinct wi.order_id from ecw_order_warehouse_in wi where wi.deleted = 0 and wi.`in_time` between #{query.beginRucangTime} and #{query.endRucangTime})",
"</when>",
"<when test = 'query.beginQingguanTime != null and query.endQingguanTime != null '>",
"AND o.`qingguan_time` between #{query.beginQingguanTime} and #{query.endQingguanTime}",
...
...
@@ -3710,10 +3641,10 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
"AND o.order_no in(select distinct op.order_id from ecw_order_pickup op where op.deleted = 0 and op.`create_time` between #{query.beginPickUpTime} and #{query.endPickUpTime})",
"</when>",
"<when test = 'query.beginWarehouseInTime != null and query.endWarehouseInTime != null '>",
"AND wi.`update_time` between #{query.beginWarehouseInTime} and #{query.endWarehouseInTime}",
"AND o.order_id in(select distinct wi.order_id from ecw_order_warehouse_in wi where wi.deleted = 0 and wi.`update_time` between #{query.beginWarehouseInTime} and #{query.endWarehouseInTime})",
"</when>",
"<when test = 'query.creator != null and query.creator != \"\" '>",
"AND o.`creator` = #{query.creator}",
"AND o.`creator` = #{query.creator} and (o.user_id is null or o.user_id = 0)",
"</when>",
"<when test = 'query.searchKey != null and query.searchKey != \"\" '>",
"AND concat(IFNULL(o.`order_no`,''), IFNULL(o.`old_numbers`,'') ,IFNULL(o.`marks`,''),IFNULL(o.`tidan_no`,''),IFNULL(o.`container_number`,''),IFNULL(nee.`name`,''),IFNULL(nee.`phone`,'')) like concat('%',concat(#{query.searchKey},'%'))",
...
...
@@ -3735,10 +3666,10 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
"AND nee.customer_id not in (select c.id from ecw_customer c where c.number like concat('%',concat(#{query.notConsigneeKey},'%'))))",
"</when>",
"<when 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`,''),IFNULL(o.`no_charge_record`,'')) like concat('%',concat(#{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`,''),IFNULL(o.`no_charge_record`,'')) like concat('%',concat(#{query.numberKey},'%'))",
"</when>",
"<when test = 'query.notNumberKey != null and query.notNumberKey != \"\" '>",
"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`,''),IFNULL(o.`no_charge_record`,'')) not like concat('%',concat(#{query.notNumberKey},'%'))",
"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`,''),IFNULL(o.`no_charge_record`,'')) not like concat('%',concat(#{query.notNumberKey},'%'))",
"</when>",
"<when test = 'query.eqNumberKey != null and query.eqNumberKey != \"\" '>",
"AND (o.`order_no` = #{query.eqNumberKey}",
...
...
@@ -3753,6 +3684,7 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
"<when test = 'query.notEqNumberKey != null and query.notEqNumberKey != \"\" '>",
"AND o.`order_no` != #{query.notEqNumberKey}",
"AND (o.`old_numbers` is null or o.`old_numbers` = '' or o.`old_numbers` != #{query.notEqNumberKey})",
"AND (o.`parent_number` is null or o.`parent_number` = '' or o.`parent_number` != #{query.notEqNumberKey})",
"AND (o.`marks` is null or o.`marks` = '' or o.`marks` != #{query.notEqNumberKey})",
"AND (o.`tidan_no` is null or o.`tidan_no` = '' or o.`tidan_no` != #{query.notEqNumberKey})",
"AND (o.`container_number` is null or o.`container_number` = '' or o.`container_number` != #{query.notEqNumberKey})",
...
...
@@ -3871,6 +3803,15 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
"<when test = 'query.isNeat == true '>",
" AND o.sum_num = o.cost->>'$.totalNum' ",
"</when>",
"<when test = 'query.type != null and query.type != \"\" and query.type == 0 '>",
"AND (o.type is null or o.type = '' or o.type = '0')",
"</when>",
"<when test = 'query.type == 1 '>",
"AND FIND_IN_SET(1, o.type)",
"</when>",
"<when test = 'query.type == 2 '>",
"AND FIND_IN_SET(2, o.type)",
"</when>",
"<when test = 'query.customerDetailId != null'>",
"AND (o.`customer_id` = #{query.customerDetailId} or nor.`customer_id` = #{query.customerDetailId} or nee.`customer_id` = #{query.customerDetailId})",
"</when>",
...
...
@@ -3878,22 +3819,98 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
"and o.order_id in(select distinct oi.order_id from ecw_order_item oi where oi.deleted = 0 and oi.`warehouse_in_info` is not null and oi.`warehouse_in_info`->>'$.cartonsNum' > 0 and oi.commission_type > 0)",
"</script>"
})
List<OrderDO>commissionOrderList();
@ResultType(StatisticsOrderVO.class)
@Select({
"<script>",
"select ",
"SUM(IFNULL(op.pick_num, 0)) as total_num",
"from ecw_order_pickup op",
"SUM(IFNULL(wi.cartons_num, 0)) as total_num, ",
"SUM(IFNULL(wi.volume, 0)) as total_volume, ",
"SUM(IFNULL(wi.weight, 0)) as total_weight, ",
"SUM(IFNULL(wi.quantity_all, 0)) as order_quantity ",
"from ecw_order_warehouse_in wi ",
"left join ecw_order o ",
"ON op.order_id = o.order_no ",
"ON wi.order_id = o.order_id ",
"left join ecw_order_departure de on de.order_id = o.order_id ",
"left join ecw_order_objective ob on ob.order_id = o.order_id ",
"left join ecw_order_consignor nor on nor.order_id = o.order_id ",
"left join ecw_order_consignee nee on nee.order_id = o.order_id ",
"left join ecw_channel channel on channel.channel_id = o.channel_id ",
"where o.deleted = 0 and o.in_warehouse_state != 211 and o.in_warehouse_state != 208 and o.status != 10 and op.deleted = 0",
"where o.deleted = 0 and o.in_warehouse_state != 211 and o.in_warehouse_state != 208 and o.status != 10 and wi.deleted = 0",
"<when test = 'query.deptId != null '>",
"AND o.dept_id = #{query.deptId} ",
"</when>",
...
...
@@ -4003,6 +4020,15 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
"<when test = 'query.departureId != null '>",
"AND de.`departure_id` = #{query.departureId}",
"</when>",
"<when test = 'query.type != null and query.type != \"\" and query.type == 0 '>",
"AND (o.type is null or o.type = '' or o.type = '0')",
"</when>",
"<when test = 'query.type == 1 '>",
"AND FIND_IN_SET(1, o.type)",
"</when>",
"<when test = 'query.type == 2 '>",
"AND FIND_IN_SET(2, o.type)",
"</when>",
"<when test = 'query.objectiveId != null '>",
"AND ob.`objective_id` = #{query.objectiveId}",
"</when>",
...
...
@@ -4036,7 +4062,7 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
"</when>",
"<when test = 'query.beginRucangTime != null and query.endRucangTime != null '>",
// "AND o.`rucang_time` between #{query.beginRucangTime} and #{query.endRucangTime}",
"AND o.order_id in(select distinct wi.order_id from ecw_order_warehouse_in wi where wi.deleted = 0 and wi.`in_time` between #{query.beginRucangTime} and #{query.endRucangTime})",
"AND wi.`in_time` between #{query.beginRucangTime} and #{query.endRucangTime}",
"</when>",
"<when test = 'query.beginQingguanTime != null and query.endQingguanTime != null '>",
"AND o.`qingguan_time` between #{query.beginQingguanTime} and #{query.endQingguanTime}",
...
...
@@ -4069,7 +4095,12 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
"<when test = 'query.beginPickTime != null and query.endPickTime != null '>",
"AND o.order_id in(select distinct op.order_id from ecw_order_cargo_control_pick op where op.deleted = 0 and op.status in(1,3) and op.`create_time` between #{query.beginPickTime} and #{query.endPickTime})",
"</when>",
"and op.`create_time` between #{query.beginPickUpTime} and #{query.endPickUpTime}",
"<when test = 'query.beginPickUpTime != null and query.endPickUpTime != null '>",
"AND o.order_no in(select distinct op.order_id from ecw_order_pickup op where op.deleted = 0 and op.`create_time` between #{query.beginPickUpTime} and #{query.endPickUpTime})",
"</when>",
"<when test = 'query.beginWarehouseInTime != null and query.endWarehouseInTime != null '>",
"AND wi.`update_time` between #{query.beginWarehouseInTime} and #{query.endWarehouseInTime}",
"</when>",
"<when test = 'query.creator != null and query.creator != \"\" '>",
"AND o.`creator` = #{query.creator}",
"</when>",
...
...
@@ -4093,10 +4124,10 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
"AND nee.customer_id not in (select c.id from ecw_customer c where c.number like concat('%',concat(#{query.notConsigneeKey},'%'))))",
"</when>",
"<when 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`,''),IFNULL(o.`no_charge_record`,'')) like concat('%',concat(#{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`,''),IFNULL(o.`no_charge_record`,'')) like concat('%',concat(#{query.numberKey},'%'))",
"</when>",
"<when test = 'query.notNumberKey != null and query.notNumberKey != \"\" '>",
"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`,''),IFNULL(o.`no_charge_record`,'')) not like concat('%',concat(#{query.notNumberKey},'%'))",
"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`,''),IFNULL(o.`no_charge_record`,'')) not like concat('%',concat(#{query.notNumberKey},'%'))",
"</when>",
"<when test = 'query.eqNumberKey != null and query.eqNumberKey != \"\" '>",
"AND (o.`order_no` = #{query.eqNumberKey}",
...
...
@@ -4105,16 +4136,17 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
"or (o.`marks` is not null and o.`marks` != '' and o.`marks` = #{query.eqNumberKey}) ",
"or (o.`tidan_no` is not null and o.`tidan_no` != '' and o.`tidan_no` = #{query.eqNumberKey}) ",
"or (o.`container_number` is not null and o.`container_number` != '' and o.`container_number` = #{query.eqNumberKey}) ",
"or (o.`no_charge_record` is not null and o.`no_charge_record` != '' and o.`no_charge_record` = #{query.eqNumberKey}))",
"or (o.`no_charge_record` is not null and o.`no_charge_record` != '' and o.`no_charge_record` = #{query.eqNumberKey})",
"or (o.`initial_parent_order_no` is not null and o.`initial_parent_order_no` != '' and o.`initial_parent_order_no` = #{query.eqNumberKey}))",
"</when>",
"<when test = 'query.notEqNumberKey != null and query.notEqNumberKey != \"\" '>",
"AND o.`order_no` != #{query.notEqNumberKey}",
"AND (o.`old_numbers` is null or o.`old_numbers` = '' or o.`old_numbers` != #{query.notEqNumberKey})",
"AND (o.`parent_number` is null or o.`parent_number` = '' or o.`parent_number` != #{query.notEqNumberKey})",
"AND (o.`marks` is null or o.`marks` = '' or o.`marks` != #{query.notEqNumberKey})",
"AND (o.`tidan_no` is null or o.`tidan_no` = '' or o.`tidan_no` != #{query.notEqNumberKey})",
"AND (o.`container_number` is null or o.`container_number` = '' or o.`container_number` != #{query.notEqNumberKey})",
"AND (o.`no_charge_record` is null or o.`no_charge_record` = '' or o.`no_charge_record` != #{query.notEqNumberKey})",
"AND (o.`initial_parent_order_no` is null or o.`initial_parent_order_no` = '' or o.`initial_parent_order_no` != #{query.notEqNumberKey})",
"</when>",
"<when test = 'query.prodKey != null and query.prodKey != \"\" '>",
"and (o.order_id in(",
...
...
@@ -4235,7 +4267,1099 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
"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} ))",
"<when test = 'query.tidanNo != null and query.tidanNo != \"\" '>",
"AND o.`tidan_no` like concat('%',concat(#{query.tidanNo},'%'))",
"</when>",
"<when test = 'query.customerId != null'>",
"AND o.`customer_id` = #{query.customerId}",
"</when>",
"<when test = 'query.beginRucangTime != null and query.endRucangTime != null '>",
// "AND o.`rucang_time` between #{query.beginRucangTime} and #{query.endRucangTime}",
"AND wi.`in_time` between #{query.beginRucangTime} and #{query.endRucangTime}",
"</when>",
"<when test = 'query.beginQingguanTime != null and query.endQingguanTime != null '>",
"AND o.`qingguan_time` between #{query.beginQingguanTime} and #{query.endQingguanTime}",
"</when>",
"<when test = 'query.beginDaogangTime != null and query.endDaogangTime != null '>",
"AND o.`daogang_time` between #{query.beginDaogangTime} and #{query.endDaogangTime}",
"</when>",
"<when test = 'query.beginPreLoadTime != null and query.endPreLoadTime != null '>",
"AND o.`status` > 5 AND o.`pre_load_time` between #{query.beginPreLoadTime} and #{query.endPreLoadTime}",
"</when>",
"<when 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})",
"</when>",
"<when test = 'query.beginLoadTime != null and query.endLoadTime != null '>",
"AND o.`load_time` between #{query.beginLoadTime} and #{query.endLoadTime}",
"</when>",
"<when test = 'query.beginUnloadTime != null and query.endUnloadTime != null '>",
"AND o.`unload_time` between #{query.beginUnloadTime} and #{query.endUnloadTime}",
"</when>",
"<when test = 'query.beginTakeTime != null and query.endTakeTime != null '>",
"AND o.`status` > 19 AND o.`take_time` between #{query.beginTakeTime} and #{query.endTakeTime}",
"</when>",
"<when test = 'query.beginSplitTime != null and query.endSplitTime != null '>",
"AND o.`split_time` between #{query.beginSplitTime} and #{query.endSplitTime}",
"</when>",
"<when test = 'query.beginCreateTime != null and query.endCreateTime != null '>",
"AND o.`create_time` between #{query.beginCreateTime} and #{query.endCreateTime}",
"</when>",
"<when test = 'query.beginPickTime != null and query.endPickTime != null '>",
"AND o.order_id in(select distinct op.order_id from ecw_order_cargo_control_pick op where op.deleted = 0 and op.status in(1,3) and op.`create_time` between #{query.beginPickTime} and #{query.endPickTime})",
"</when>",
"<when test = 'query.beginPickUpTime != null and query.endPickUpTime != null '>",
"AND o.order_no in(select distinct op.order_id from ecw_order_pickup op where op.deleted = 0 and op.`create_time` between #{query.beginPickUpTime} and #{query.endPickUpTime})",
"</when>",
"<when test = 'query.beginWarehouseInTime != null and query.endWarehouseInTime != null '>",
"AND wi.`update_time` between #{query.beginWarehouseInTime} and #{query.endWarehouseInTime}",
"</when>",
"<when test = 'query.creator != null and query.creator != \"\" '>",
"AND o.`creator` = #{query.creator}",
"</when>",
"<when test = 'query.searchKey != null and query.searchKey != \"\" '>",
"AND concat(IFNULL(o.`order_no`,''), IFNULL(o.`old_numbers`,'') ,IFNULL(o.`marks`,''),IFNULL(o.`tidan_no`,''),IFNULL(o.`container_number`,''),IFNULL(nee.`name`,''),IFNULL(nee.`phone`,'')) like concat('%',concat(#{query.searchKey},'%'))",
"</when>",
"<when test = 'query.consignorKey != null and query.consignorKey != \"\" '>",
"AND (concat(IFNULL(nor.`name`,''),IFNULL(nor.`name_en`,''),IFNULL(nor.`phone`,'')) like concat('%',concat(#{query.consignorKey},'%'))",
"OR nor.customer_id in (select c.id from ecw_customer c where c.number like concat('%',concat(#{query.consignorKey},'%'))))",
"</when>",
"<when test = 'query.notConsignorKey != null and query.notConsignorKey != \"\" '>",
"AND (concat(IFNULL(nor.`name`,''),IFNULL(nor.`name_en`,''),IFNULL(nor.`phone`,'')) not like concat('%',concat(#{query.notConsignorKey},'%'))",
"AND nor.customer_id not in (select c.id from ecw_customer c where c.number like concat('%',concat(#{query.notConsignorKey},'%'))))",
"</when>",
"<when test = 'query.consigneeKey != null and query.consigneeKey != \"\" '>",
"AND (concat(IFNULL(nee.`name`,''),IFNULL(nee.`name_en`,''),IFNULL(nee.`phone`,'')) like concat('%',concat(#{query.consigneeKey},'%'))",
"OR nee.customer_id in (select c.id from ecw_customer c where c.number like concat('%',concat(#{query.consigneeKey},'%'))))",
"</when>",
"<when test = 'query.notConsigneeKey != null and query.notConsigneeKey != \"\" '>",
"AND (concat(IFNULL(nee.`name`,''),IFNULL(nee.`name_en`,''),IFNULL(nee.`phone`,'')) not like concat('%',concat(#{query.notConsigneeKey},'%'))",
"AND nee.customer_id not in (select c.id from ecw_customer c where c.number like concat('%',concat(#{query.notConsigneeKey},'%'))))",
"</when>",
"<when 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`,''),IFNULL(o.`no_charge_record`,'')) like concat('%',concat(#{query.numberKey},'%'))",
"</when>",
"<when test = 'query.notNumberKey != null and query.notNumberKey != \"\" '>",
"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`,''),IFNULL(o.`no_charge_record`,'')) not like concat('%',concat(#{query.notNumberKey},'%'))",
"</when>",
"<when test = 'query.eqNumberKey != null and query.eqNumberKey != \"\" '>",
"AND (o.`order_no` = #{query.eqNumberKey}",
"or (o.`old_numbers` is not null and o.`old_numbers` != '' and o.`old_numbers` = #{query.eqNumberKey}) ",
"or (o.`parent_number` is not null and o.`parent_number` != '' and o.`parent_number` = #{query.eqNumberKey}) ",
"or (o.`marks` is not null and o.`marks` != '' and o.`marks` = #{query.eqNumberKey}) ",
"or (o.`tidan_no` is not null and o.`tidan_no` != '' and o.`tidan_no` = #{query.eqNumberKey}) ",
"or (o.`container_number` is not null and o.`container_number` != '' and o.`container_number` = #{query.eqNumberKey}) ",
"or (o.`no_charge_record` is not null and o.`no_charge_record` != '' and o.`no_charge_record` = #{query.eqNumberKey})",
"or (o.`initial_parent_order_no` is not null and o.`initial_parent_order_no` != '' and o.`initial_parent_order_no` = #{query.eqNumberKey}))",
"</when>",
"<when test = 'query.notEqNumberKey != null and query.notEqNumberKey != \"\" '>",
"AND o.`order_no` != #{query.notEqNumberKey}",
"AND (o.`old_numbers` is null or o.`old_numbers` = '' or o.`old_numbers` != #{query.notEqNumberKey})",
"AND (o.`marks` is null or o.`marks` = '' or o.`marks` != #{query.notEqNumberKey})",
"AND (o.`tidan_no` is null or o.`tidan_no` = '' or o.`tidan_no` != #{query.notEqNumberKey})",
"AND (o.`container_number` is null or o.`container_number` = '' or o.`container_number` != #{query.notEqNumberKey})",
"AND (o.`no_charge_record` is null or o.`no_charge_record` = '' or o.`no_charge_record` != #{query.notEqNumberKey})",
"AND (o.`initial_parent_order_no` is null or o.`initial_parent_order_no` = '' or o.`initial_parent_order_no` != #{query.notEqNumberKey})",
"</when>",
"<when test = 'query.prodKey != null and query.prodKey != \"\" '>",
"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} ))",
"<when test = 'query.tidanNo != null and query.tidanNo != \"\" '>",
"AND o.`tidan_no` like concat('%',concat(#{query.tidanNo},'%'))",
"</when>",
"<when test = 'query.customerId != null'>",
"AND o.`customer_id` = #{query.customerId}",
"</when>",
"<when test = 'query.beginRucangTime != null and query.endRucangTime != null '>",
// "AND o.`rucang_time` between #{query.beginRucangTime} and #{query.endRucangTime}",
"AND o.order_id in(select distinct wi.order_id from ecw_order_warehouse_in wi where wi.deleted = 0 and wi.`in_time` between #{query.beginRucangTime} and #{query.endRucangTime})",
"</when>",
"<when test = 'query.beginQingguanTime != null and query.endQingguanTime != null '>",
"AND o.`qingguan_time` between #{query.beginQingguanTime} and #{query.endQingguanTime}",
"</when>",
"<when test = 'query.beginDaogangTime != null and query.endDaogangTime != null '>",
"AND o.`daogang_time` between #{query.beginDaogangTime} and #{query.endDaogangTime}",
"</when>",
"<when test = 'query.beginPreLoadTime != null and query.endPreLoadTime != null '>",
"AND o.`status` > 5 AND o.`pre_load_time` between #{query.beginPreLoadTime} and #{query.endPreLoadTime}",
"</when>",
"<when 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})",
"</when>",
"<when test = 'query.beginLoadTime != null and query.endLoadTime != null '>",
"AND o.`load_time` between #{query.beginLoadTime} and #{query.endLoadTime}",
"</when>",
"<when test = 'query.beginUnloadTime != null and query.endUnloadTime != null '>",
"AND o.`unload_time` between #{query.beginUnloadTime} and #{query.endUnloadTime}",
"</when>",
"<when test = 'query.beginTakeTime != null and query.endTakeTime != null '>",
"AND o.`status` > 19 AND o.`take_time` between #{query.beginTakeTime} and #{query.endTakeTime}",
"</when>",
"<when test = 'query.beginSplitTime != null and query.endSplitTime != null '>",
"AND o.`split_time` between #{query.beginSplitTime} and #{query.endSplitTime}",
"</when>",
"<when test = 'query.beginCreateTime != null and query.endCreateTime != null '>",
"AND o.`create_time` between #{query.beginCreateTime} and #{query.endCreateTime}",
"</when>",
"<when test = 'query.beginPickTime != null and query.endPickTime != null '>",
"AND o.order_id in(select distinct op.order_id from ecw_order_cargo_control_pick op where op.deleted = 0 and op.status in(1,3) and op.`create_time` between #{query.beginPickTime} and #{query.endPickTime})",
"</when>",
"and op.`create_time` between #{query.beginPickUpTime} and #{query.endPickUpTime}",
"<when test = 'query.creator != null and query.creator != \"\" '>",
"AND o.`creator` = #{query.creator}",
"</when>",
"<when test = 'query.searchKey != null and query.searchKey != \"\" '>",
"AND concat(IFNULL(o.`order_no`,''), IFNULL(o.`old_numbers`,'') ,IFNULL(o.`marks`,''),IFNULL(o.`tidan_no`,''),IFNULL(o.`container_number`,''),IFNULL(nee.`name`,''),IFNULL(nee.`phone`,'')) like concat('%',concat(#{query.searchKey},'%'))",
"</when>",
"<when test = 'query.consignorKey != null and query.consignorKey != \"\" '>",
"AND (concat(IFNULL(nor.`name`,''),IFNULL(nor.`name_en`,''),IFNULL(nor.`phone`,'')) like concat('%',concat(#{query.consignorKey},'%'))",
"OR nor.customer_id in (select c.id from ecw_customer c where c.number like concat('%',concat(#{query.consignorKey},'%'))))",
"</when>",
"<when test = 'query.notConsignorKey != null and query.notConsignorKey != \"\" '>",
"AND (concat(IFNULL(nor.`name`,''),IFNULL(nor.`name_en`,''),IFNULL(nor.`phone`,'')) not like concat('%',concat(#{query.notConsignorKey},'%'))",
"AND nor.customer_id not in (select c.id from ecw_customer c where c.number like concat('%',concat(#{query.notConsignorKey},'%'))))",
"</when>",
"<when test = 'query.consigneeKey != null and query.consigneeKey != \"\" '>",
"AND (concat(IFNULL(nee.`name`,''),IFNULL(nee.`name_en`,''),IFNULL(nee.`phone`,'')) like concat('%',concat(#{query.consigneeKey},'%'))",
"OR nee.customer_id in (select c.id from ecw_customer c where c.number like concat('%',concat(#{query.consigneeKey},'%'))))",
"</when>",
"<when test = 'query.notConsigneeKey != null and query.notConsigneeKey != \"\" '>",
"AND (concat(IFNULL(nee.`name`,''),IFNULL(nee.`name_en`,''),IFNULL(nee.`phone`,'')) not like concat('%',concat(#{query.notConsigneeKey},'%'))",
"AND nee.customer_id not in (select c.id from ecw_customer c where c.number like concat('%',concat(#{query.notConsigneeKey},'%'))))",
"</when>",
"<when 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`,''),IFNULL(o.`no_charge_record`,'')) like concat('%',concat(#{query.numberKey},'%'))",
"</when>",
"<when test = 'query.notNumberKey != null and query.notNumberKey != \"\" '>",
"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`,''),IFNULL(o.`no_charge_record`,'')) not like concat('%',concat(#{query.notNumberKey},'%'))",
"</when>",
"<when test = 'query.eqNumberKey != null and query.eqNumberKey != \"\" '>",
"AND (o.`order_no` = #{query.eqNumberKey}",
"or (o.`old_numbers` is not null and o.`old_numbers` != '' and o.`old_numbers` = #{query.eqNumberKey}) ",
"or (o.`parent_number` is not null and o.`parent_number` != '' and o.`parent_number` = #{query.eqNumberKey}) ",
"or (o.`marks` is not null and o.`marks` != '' and o.`marks` = #{query.eqNumberKey}) ",
"or (o.`tidan_no` is not null and o.`tidan_no` != '' and o.`tidan_no` = #{query.eqNumberKey}) ",
"or (o.`container_number` is not null and o.`container_number` != '' and o.`container_number` = #{query.eqNumberKey}) ",
"or (o.`no_charge_record` is not null and o.`no_charge_record` != '' and o.`no_charge_record` = #{query.eqNumberKey}))",
"</when>",
"<when test = 'query.notEqNumberKey != null and query.notEqNumberKey != \"\" '>",
"AND o.`order_no` != #{query.notEqNumberKey}",
"AND (o.`old_numbers` is null or o.`old_numbers` = '' or o.`old_numbers` != #{query.notEqNumberKey})",
"AND (o.`parent_number` is null or o.`parent_number` = '' or o.`parent_number` != #{query.notEqNumberKey})",
"AND (o.`marks` is null or o.`marks` = '' or o.`marks` != #{query.notEqNumberKey})",
"AND (o.`tidan_no` is null or o.`tidan_no` = '' or o.`tidan_no` != #{query.notEqNumberKey})",
"AND (o.`container_number` is null or o.`container_number` = '' or o.`container_number` != #{query.notEqNumberKey})",
"AND (o.`no_charge_record` is null or o.`no_charge_record` = '' or o.`no_charge_record` != #{query.notEqNumberKey})",
"</when>",
"<when test = 'query.prodKey != null and query.prodKey != \"\" '>",
"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} ))",
"<when test = 'query.tidanNo != null and query.tidanNo != \"\" '>",
"AND o.`tidan_no` like concat('%',concat(#{query.tidanNo},'%'))",
"</when>",
"<when test = 'query.customerId != null'>",
"AND o.`customer_id` = #{query.customerId}",
"</when>",
"<when test = 'query.beginRucangTime != null and query.endRucangTime != null '>",
// "AND o.`rucang_time` between #{query.beginRucangTime} and #{query.endRucangTime}",
"AND o.order_id in(select distinct wi.order_id from ecw_order_warehouse_in wi where wi.deleted = 0 and wi.`in_time` between #{query.beginRucangTime} and #{query.endRucangTime})",
"</when>",
"<when test = 'query.beginQingguanTime != null and query.endQingguanTime != null '>",
"AND o.`qingguan_time` between #{query.beginQingguanTime} and #{query.endQingguanTime}",
"</when>",
"<when test = 'query.beginDaogangTime != null and query.endDaogangTime != null '>",
"AND o.`daogang_time` between #{query.beginDaogangTime} and #{query.endDaogangTime}",
"</when>",
"<when test = 'query.beginPreLoadTime != null and query.endPreLoadTime != null '>",
"AND o.`status` > 5 AND o.`pre_load_time` between #{query.beginPreLoadTime} and #{query.endPreLoadTime}",
"</when>",
"<when 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})",
"</when>",
"<when test = 'query.beginLoadTime != null and query.endLoadTime != null '>",
"AND o.`load_time` between #{query.beginLoadTime} and #{query.endLoadTime}",
"</when>",
"<when test = 'query.beginUnloadTime != null and query.endUnloadTime != null '>",
"AND o.`unload_time` between #{query.beginUnloadTime} and #{query.endUnloadTime}",
"</when>",
"<when test = 'query.beginTakeTime != null and query.endTakeTime != null '>",
"AND o.`status` > 19 AND o.`take_time` between #{query.beginTakeTime} and #{query.endTakeTime}",
"</when>",
"<when test = 'query.beginSplitTime != null and query.endSplitTime != null '>",
"AND o.`split_time` between #{query.beginSplitTime} and #{query.endSplitTime}",
"</when>",
"<when test = 'query.beginCreateTime != null and query.endCreateTime != null '>",
"AND o.`create_time` between #{query.beginCreateTime} and #{query.endCreateTime}",
"</when>",
"<when test = 'query.beginPickTime != null and query.endPickTime != null '>",
"AND o.order_id in(select distinct op.order_id from ecw_order_cargo_control_pick op where op.deleted = 0 and op.status in(1,3) and op.`create_time` between #{query.beginPickTime} and #{query.endPickTime})",
"</when>",
"and op.`create_time` between #{query.beginPickUpTime} and #{query.endPickUpTime}",
"<when test = 'query.creator != null and query.creator != \"\" '>",
"AND o.`creator` = #{query.creator}",
"</when>",
"<when test = 'query.searchKey != null and query.searchKey != \"\" '>",
"AND concat(IFNULL(o.`order_no`,''), IFNULL(o.`old_numbers`,'') ,IFNULL(o.`marks`,''),IFNULL(o.`tidan_no`,''),IFNULL(o.`container_number`,''),IFNULL(nee.`name`,''),IFNULL(nee.`phone`,'')) like concat('%',concat(#{query.searchKey},'%'))",
"</when>",
"<when test = 'query.consignorKey != null and query.consignorKey != \"\" '>",
"AND (concat(IFNULL(nor.`name`,''),IFNULL(nor.`name_en`,''),IFNULL(nor.`phone`,'')) like concat('%',concat(#{query.consignorKey},'%'))",
"OR nor.customer_id in (select c.id from ecw_customer c where c.number like concat('%',concat(#{query.consignorKey},'%'))))",
"</when>",
"<when test = 'query.notConsignorKey != null and query.notConsignorKey != \"\" '>",
"AND (concat(IFNULL(nor.`name`,''),IFNULL(nor.`name_en`,''),IFNULL(nor.`phone`,'')) not like concat('%',concat(#{query.notConsignorKey},'%'))",
"AND nor.customer_id not in (select c.id from ecw_customer c where c.number like concat('%',concat(#{query.notConsignorKey},'%'))))",
"</when>",
"<when test = 'query.consigneeKey != null and query.consigneeKey != \"\" '>",
"AND (concat(IFNULL(nee.`name`,''),IFNULL(nee.`name_en`,''),IFNULL(nee.`phone`,'')) like concat('%',concat(#{query.consigneeKey},'%'))",
"OR nee.customer_id in (select c.id from ecw_customer c where c.number like concat('%',concat(#{query.consigneeKey},'%'))))",
"</when>",
"<when test = 'query.notConsigneeKey != null and query.notConsigneeKey != \"\" '>",
"AND (concat(IFNULL(nee.`name`,''),IFNULL(nee.`name_en`,''),IFNULL(nee.`phone`,'')) not like concat('%',concat(#{query.notConsigneeKey},'%'))",
"AND nee.customer_id not in (select c.id from ecw_customer c where c.number like concat('%',concat(#{query.notConsigneeKey},'%'))))",
"</when>",
"<when 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`,''),IFNULL(o.`no_charge_record`,'')) like concat('%',concat(#{query.numberKey},'%'))",
"</when>",
"<when test = 'query.notNumberKey != null and query.notNumberKey != \"\" '>",
"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`,''),IFNULL(o.`no_charge_record`,'')) not like concat('%',concat(#{query.notNumberKey},'%'))",
"</when>",
"<when test = 'query.eqNumberKey != null and query.eqNumberKey != \"\" '>",
"AND (o.`order_no` = #{query.eqNumberKey}",
"or (o.`old_numbers` is not null and o.`old_numbers` != '' and o.`old_numbers` = #{query.eqNumberKey}) ",
"or (o.`parent_number` is not null and o.`parent_number` != '' and o.`parent_number` = #{query.eqNumberKey}) ",
"or (o.`marks` is not null and o.`marks` != '' and o.`marks` = #{query.eqNumberKey}) ",
"or (o.`tidan_no` is not null and o.`tidan_no` != '' and o.`tidan_no` = #{query.eqNumberKey}) ",
"or (o.`container_number` is not null and o.`container_number` != '' and o.`container_number` = #{query.eqNumberKey}) ",
"or (o.`no_charge_record` is not null and o.`no_charge_record` != '' and o.`no_charge_record` = #{query.eqNumberKey}))",
"</when>",
"<when test = 'query.notEqNumberKey != null and query.notEqNumberKey != \"\" '>",
"AND o.`order_no` != #{query.notEqNumberKey}",
"AND (o.`old_numbers` is null or o.`old_numbers` = '' or o.`old_numbers` != #{query.notEqNumberKey})",
"AND (o.`parent_number` is null or o.`parent_number` = '' or o.`parent_number` != #{query.notEqNumberKey})",
"AND (o.`marks` is null or o.`marks` = '' or o.`marks` != #{query.notEqNumberKey})",
"AND (o.`tidan_no` is null or o.`tidan_no` = '' or o.`tidan_no` != #{query.notEqNumberKey})",
"AND (o.`container_number` is null or o.`container_number` = '' or o.`container_number` != #{query.notEqNumberKey})",
"AND (o.`no_charge_record` is null or o.`no_charge_record` = '' or o.`no_charge_record` != #{query.notEqNumberKey})",
"</when>",
"<when test = 'query.prodKey != null and query.prodKey != \"\" '>",
<iftest="query.type != null and query.type != '' and query.type == 0 ">
AND (o.type is null or o.type = '' or o.type = '0')
</if>
<iftest="query.type == 1 ">
AND FIND_IN_SET(1, o.type)
</if>
<iftest="query.type == 2 ">
AND FIND_IN_SET(2, o.type)
</if>
<iftest="query.pdaStartWareIds != null and query.pdaStartWareIds != '' ">
AND FIND_IN_SET(ew_start.`id`, #{query.pdaStartWareIds})
</if>
<iftest="query.pdaDestWareIds != null and query.pdaDestWareIds != '' ">
AND FIND_IN_SET(ew_dest.`id`, #{query.pdaDestWareIds})
</if>
<iftest="query.isExternalWarehouse != null">
AND o.`is_external_warehouse` = #{query.isExternalWarehouse}
</if>
<iftest="query.status != null">
AND o.`status` = #{query.status}
</if>
<iftest="query.abnormalState != null">
<choose>
<whentest="query.abnormalState != 0">
<choose>
<whentest="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>
<iftest="query.inWarehouseState != null">
AND o.`in_warehouse_state` = #{query.inWarehouseState}
</if>
<iftest="query.shipmentState != null">
AND o.`shipment_State` = #{query.shipmentState}
</if>
<iftest="query.auditType != null">
<choose>
<whentest="query.auditType != 0">
<choose>
<whentest="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>
<iftest="query.salesmanId != 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} ))
</if>
<iftest="query.customsType != null">
AND o.`customs_type` = #{query.customsType}
</if>
<iftest="query.productRecord != null">
AND o.`product_record` = #{query.productRecord}
</if>
<iftest="query.transportId != null">
AND o.`transport_id` = #{query.transportId}
</if>
<iftest="query.channelId != null">
AND o.`channel_id` = #{query.channelId}
</if>
<iftest="query.warehouseType != null">
AND o.`warehouse_type` = #{query.warehouseType}
</if>
<iftest="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>
<iftest="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>
<iftest="query.marks != null and query.marks != '' ">
AND o.`marks` like concat("%",concat(#{query.marks},"%"))
</if>
<iftest="query.departureId != null ">
AND de.`departure_id` = #{query.departureId}
</if>
<iftest="query.objectiveId != null and query.objectiveId.size() != 0">