<iftest="query.salesmanId != null and query.creator != null ">
AND (o.`salesman_id` = #{query.salesmanId} or o.`customer_id` in(select cus.id from ecw_customer cus where cus.is_customer_service_confirmed = 1 and cus.customer_service = #{query.salesmanId} ) or o.`creator` = #{query.creator})
</if>
<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.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 ob.`objective_id` = #{query.objectiveId}
</if>
<iftest="query.consignorId != null ">
AND nor.`customer_id` = #{query.consignorId}
</if>
<iftest="query.consigneeId != null ">
AND nee.`customer_id` = #{query.consigneeId}
</if>
<iftest="query.isCargoControl != null ">
AND o.`is_cargo_control` = #{query.isCargoControl}
</if>
<iftest="query.orderNo != null and query.orderNo != '' ">
AND o.`order_no` like concat("%",concat(#{query.orderNo},"%"))
</if>
<iftest="query.orderIdList != null and query.orderIdList.size() != 0">