<iftest="param.customerIdentification != null and param.customerIdentification == 1 ">
and lawo.work_order_status IN ( '10', '20', '21', '30', '40', '50', '60', '70', '80', '90' ,'100','110')
</if>
<iftest="param.handleStatus!= null and param.handleStatus == 30">and lawo.work_order_status in (21,30) and lap.processing_status = '4' and lap.business_id = #{param.warehouseId} </if>
<iftest="param.handleStatus!= null and param.handleStatus == 20 ">and lawo.work_order_status in (80,100) and lacr.warehouse_id=#{param.warehouseId} </if>
<iftest="param.handleStatus != null "> or 1=1 </if>
<iftest="param.workOrderNumber != null and param.workOrderNumber != '' ">and lawo.work_order_number like concat('%',#{param.workOrderNumber },'%') </if>
<iftest="param.waybillNumber != null and param.waybillNumber != '' ">and lawo.waybill_number like concat('%', #{param.waybillNumber },'%') </if>
<iftest="param.orderCode != null and param.orderCode != '' ">and lawo.order_code like concat('%', #{param.orderCode },'%') </if>
<iftest="param.trainNumber != null and param.trainNumber != '' ">and lawo.train_number like concat('%', #{param.trainNumber },'%') </if>
<iftest="param.first != null and param.first != '' ">and lawo.first like concat('%', #{param.first },'%') </if>
<iftest="param.secondary != null and param.secondary != '' ">and lawo.secondary like concat('%', #{param.secondary },'%') </if>
<iftest="param.vehicleRoute != null and param.vehicleRoute != '' ">and lawo.vehicle_route like concat('%', #{param.vehicleRoute },'%') </if>
<iftest="param.warehouseId != null and param.warehouseId != '' and param.handleStatus != 20 "> and lap.business_id = #{param.warehouseId} </if>
<iftest="param.workOrderStatus != null and param.workOrderStatus != '' and param.handleStatus != 40 "> and lawo.work_order_status in ( #{param.workOrderStatus }) </if>
<!-- <if test="param.workOrderStatus != null and param.workOrderStatus != '' and param.customerServiceState == null "> and lawo.work_order_status in ( #{param.workOrderStatus }) and lap.types_of = '2' </if>-->
<iftest="param.handleStatus != null and param.handleStatus == 40 "> and lawo.work_order_status in ('10','20' ) and lap.types_of = '2' and lap.processing_status in ('1') </if>
<iftest="param.handleStatus!= null and param.handleStatus == 30">and lawo.work_order_status in (21,30,40) and lap.processing_status = '4' </if>
<iftest="param.handleStatus!= null and param.handleStatus == 20 ">and lawo.work_order_status in (80,100) and lacr.warehouse_id=#{param.warehouseId} </if>
LEFT JOIN logpm_aftersales_work_order law on lap.work_order_id = law.id
SELECT DISTINCT
law.id,
law.work_order_type,
law.initiation_identification,
law.discovery_node,
law.work_order_number,
law.waybill_number,
law.order_code,
law.train_number,
law.FIRST,
law.secondary,
law.vehicle_route,
law.deliver_goods_time,
law.discovery_time,
law.warehousing_time,
law.waybill_mall,
law.remarks,
law.delivery_time,
law.delivery_driver,
law.work_order_status,
law.customer_service_id,
law.customer_service_name,
law.waybill_mall_id,
law.over_time,
law.problem_description,
law.warehouse_id,
law.person_responsible,
law.process_number,
law.reviewed_by,
law.audit_time,
law.entry_time,
law.operator
FROM
logpm_aftersales_processor lap
LEFT JOIN logpm_aftersales_work_order law ON lap.work_order_id = law.id
<where>
lap.conditions != '3' and lap.is_deleted = 0 and law.id is not null and lap.processing_status in ('1','3') and lap.types_of = '2' and law.work_order_status in ('10','20','30')
<iftest="param.workOrderStatus != null and param.workOrderStatus != ''">and law.work_order_status = #{param.workOrderStatus}</if>
<iftest="param.warehouseId != null and param.warehouseId != ''">and lap.business_id = #{param.warehouseId}</if>
<iftest="param.workOrderTypeNameS != null and param.workOrderTypeNameS != ''">and law.work_order_type = #{param.workOrderTypeNameS}</if>
las.processing_status = '4' and las.is_deleted = 0
<iftest="param.businessId != null"> and las.business_id = #{param.businessId }</if>
<iftest="param.businessName != null and param.businessName != ''"> and las.business_name = #{param.businessName }</if>
<iftest="param.workOrderNumber != null and param.workOrderNumber != ''"> and las.work_order_number = #{param.workOrderNumber }</if>
<iftest="param.businessName != null and param.businessName != '' "> and las.business_name = #{param.businessName }</if>
<iftest="param.brandName != null and param.brandName != '' "> and las.brand_name = #{param.brandName }</if>
<iftest="param.mallName != null and param.mallName != '' "> and las.mall_name = #{param.mallName }</if>
<iftest="param.waybillNumber != null and param.waybillNumber != '' "> and las.waybill_number = #{param.waybillNumber }</if>
<iftest="param.workOrderType != null and param.workOrderType != '' "> and las.work_order_type = #{param.workOrderType }</if>
<iftest="param.resultType != null and param.resultType != '' "> and las.result_type = #{param.resultType }</if>
<iftest="param.discoveryNode != null and param.discoveryNode != '' "> and las.discovery_node = #{param.discoveryNode }</if>
<iftest="param.resultDescription != null and param.resultDescription != '' "> and las.result_description = #{param.resultDescription }</if>
<iftest="param.vehicleRoute != null and param.vehicleRoute != '' "> and las.vehicle_route = #{param.vehicleRoute }</if>
<iftest="param.indemnitor != null and param.indemnitor != '' "> and las.indemnitor = #{param.indemnitor }</if>
<iftest="param.reason != null and param.reason != '' "> and las.reason = #{param.reason }</if>
<iftest="param.createTime != null and param.createTime != '' "> and date_format(from_unixtime(las.create_time),'%Y-%m-%d') = date_format(#{param.createTime}),'%Y-%m-%d') </if>
<iftest="param.processNumber != null and param.processNumber != '' "> and las.process_number = #{param.processNumber }</if>
<iftest="param.businessId != null"> and las.business_id LIKE CONCAT('%', #{param.businessId}, '%')</if>
<iftest="param.businessName != null and param.businessName != ''"> and las.business_name LIKE CONCAT('%', #{param.businessName}, '%')</if>
<iftest="param.workOrderNumber != null and param.workOrderNumber != ''"> and las.work_order_number LIKE CONCAT('%', #{param.workOrderNumber}, '%')</if>
<iftest="param.brandName != null and param.brandName != ''"> and las.brand_name LIKE CONCAT('%', #{param.brandName}, '%')</if>
<iftest="param.mallName != null and param.mallName != ''"> and las.mall_name LIKE CONCAT('%', #{param.mallName}, '%')</if>
<iftest="param.waybillNumber != null and param.waybillNumber != ''"> and las.waybill_number LIKE CONCAT('%', #{param.waybillNumber}, '%')</if>
<iftest="param.workOrderType != null and param.workOrderType != ''"> and las.work_order_type LIKE CONCAT('%', #{param.workOrderType}, '%')</if>
<iftest="param.resultType != null and param.resultType != ''"> and las.result_type LIKE CONCAT('%', #{param.resultType}, '%')</if>
<iftest="param.discoveryNode != null and param.discoveryNode != ''"> and las.discovery_node LIKE CONCAT('%', #{param.discoveryNode}, '%')</if>
<iftest="param.resultDescription != null and param.resultDescription != ''"> and las.result_description LIKE CONCAT('%', #{param.resultDescription}, '%')</if>
<iftest="param.vehicleRoute != null and param.vehicleRoute != ''"> and las.vehicle_route LIKE CONCAT('%', #{param.vehicleRoute}, '%')</if>
<iftest="param.indemnitor != null and param.indemnitor != ''"> and las.indemnitor LIKE CONCAT('%', #{param.indemnitor}, '%')</if>
<iftest="param.reason != null and param.reason != ''"> and las.reason LIKE CONCAT('%', #{param.reason}, '%')</if>
<iftest="param.createTime != null and param.createTime != ''"> and date_format(from_unixtime(las.create_time),'%Y-%m-%d') LIKE date_format(CONCAT('%', #{param.createTime}, '%'),'%Y-%m-%d')</if>
<iftest="param.processNumber != null and param.processNumber != ''"> and las.process_number LIKE CONCAT('%', #{param.processNumber}, '%')</if>