select thisTab.id, thisTab.dispatch_no, thisTab.customer_id, thisTab.customer_name, thisTab.customer_code, thisTab.project_id, thisTab.project_name, thisTab.contract_id, thisTab.contract_name, thisTab.order_type, thisTab.transport_line, thisTab.sign_type, thisTab.vehicle_provider_id, thisTab.vehicle_provider_name, thisTab.loading_service_provider_id, thisTab.loading_service_provider_name, thisTab.customs_service_provider_id, thisTab.customs_service_provider_name, thisTab.is_urgent, thisTab.transport_type, thisTab.load_method, thisTab.main_driver_id, thisTab.main_driver_name, thisTab.assistant_driver_id, thisTab.required_vehicle_types, thisTab.assistant_driver_name, thisTab.vehicle_id, thisTab.container_no, thisTab.license_plate, thisTab.shipper_id, thisTab.earliest_departure, thisTab.shipper_name, thisTab.latest_departure, thisTab.shipper_mobile, thisTab.earliest_arrival, thisTab.shipper_address, thisTab.latest_arrival, thisTab.departure_address, thisTab.shipper_region_code, thisTab.receiver_id, thisTab.destination_address, thisTab.receiver_name, thisTab.actual_vehicle_type, thisTab.receiver_mobile, thisTab.actual_load_start, thisTab.shipper_region_label, thisTab.receiver_address, thisTab.actual_unload_end, thisTab.receiver_region_code, thisTab.actual_departure, thisTab.actual_arrival, thisTab.actual_quantity, thisTab.actual_weight, thisTab.receiver_region_label, thisTab.actual_volume, thisTab.reweigh_weight, thisTab.container_id, thisTab.electronic_lock, thisTab.empty_mileage, thisTab.shelf_id, thisTab.empty_fuel, thisTab.shelf_code, thisTab.loaded_mileage, thisTab.loaded_fuel, thisTab.shift_no, thisTab.line_no, thisTab.status, thisTab.create_by, thisTab.create_time, thisTab.update_by, thisTab.update_time, thisTab.remark, thisTab.accounts_receivable_status, thisTab.accounts_payable_status, thisTab.collection_plan_id, thisTab.payment_plan_id , thisTab.is_customs, thisTab.start_region_code, thisTab.end_region_code, thisTab.quote_detail_id, thisTab.operation_mode, thisTab.quote_plan_id, thisTab.ok_time, thisTab.confirm_time, thisTab.is_load ,thisTab.commission_model from tms_dispatch_order AS thisTab
select count(0) from tms_dispatch_order as thisTab
and thisTab.dispatch_no = #{dispatchNo}
and thisTab.customer_id = #{customerId}
and thisTab.customer_code = #{customerCode}
and thisTab.customer_name like concat('%', #{customerName}, '%')
and thisTab.project_name like concat('%', #{projectName}, '%')
and thisTab.project_id = #{projectId}
and thisTab.contract_id = #{contractId}
and thisTab.contract_name like concat('%', #{contractName}, '%')
and thisTab.transport_line = #{transportLine}
and thisTab.order_type = #{orderType}
and thisTab.sign_type = #{signType}
and thisTab.vehicle_provider_id = #{vehicleProviderId}
and thisTab.vehicle_provider_name like concat('%', #{vehicleProviderName}, '%')
and thisTab.loading_service_provider_id = #{loadingServiceProviderId}
and thisTab.loading_service_provider_name like concat('%', #{loadingServiceProviderName}, '%')
and thisTab.customs_service_provider_id = #{customsServiceProviderId}
and thisTab.customs_service_provider_name like concat('%', #{customsServiceProviderName}, '%')
and thisTab.is_urgent = #{isUrgent}
and thisTab.transport_type = #{transportType}
and thisTab.load_method = #{loadMethod}
and thisTab.main_driver_id = #{mainDriverId}
and thisTab.main_driver_name like concat('%', #{mainDriverName}, '%')
and thisTab.assistant_driver_id = #{assistantDriverId}
and thisTab.assistant_driver_name like concat('%', #{assistantDriverName}, '%')
and thisTab.required_vehicle_types = #{requiredVehicleTypes}
and thisTab.vehicle_id = #{vehicleId}
and thisTab.license_plate = #{licensePlate}
and thisTab.shipper_id = #{shipperId}
and thisTab.shipper_name like concat('%', #{shipperName}, '%')
and thisTab.shipper_mobile = #{shipperMobile}
and thisTab.shipper_address = #{shipperAddress}
and thisTab.shipper_region_code = #{shipperRegionCode}
and thisTab.shipper_region_label = #{shipperRegionLabel}
and thisTab.receiver_id = #{receiverId}
and thisTab.receiver_name like concat('%', #{receiverName}, '%')
and thisTab.receiver_mobile = #{receiverMobile}
and thisTab.receiver_address = #{receiverAddress}
and thisTab.receiver_region_code = #{receiverRegionCode}
and thisTab.receiver_region_label = #{receiverRegionLabel}
and thisTab.container_id = #{containerId}
and thisTab.shelf_id = #{shelfId}
and thisTab.shelf_code = #{shelfCode}
and thisTab.status = #{status}
and thisTab.accounts_receivable_status = #{accountsReceivableStatus}
and thisTab.accounts_payable_status = #{accountsPayableStatus}
and thisTab.collection_plan_id = #{collectionPlanId}
and thisTab.payment_plan_id = #{paymentPlanId}
and thisTab.is_customs = #{isCustoms}
and thisTab.start_region_code = #{startRegionCode}
and thisTab.end_region_code = #{endRegionCode}
and thisTab.quote_detail_id = #{quoteDetailId}
and thisTab.operation_mode = #{operationMode}
and thisTab.quote_plan_id = #{quotePlanId}
and thisTab.create_time between #{createTimeBegin} and #{createTimeEnd}
and thisTab.update_time between #{updateTimeBegin} and #{updateTimeEnd}
and thisTab.confirm_time between #{confirmTimeBegin} and #{confirmTimeEnd}
and thisTab.ok_time between #{okTimeBegin} and #{okTimeEnd}
and thisTab.is_load = #{isLoad}
and thisTab.commission_model = #{commissionModel}
insert into tms_dispatch_order
dispatch_no,
customer_id,
customer_name,
customer_code,
project_id,
project_name,
contract_id,
contract_name,
order_type,
transport_line,
sign_type,
vehicle_provider_id,
vehicle_provider_name,
loading_service_provider_id,
loading_service_provider_name,
customs_service_provider_id,
customs_service_provider_name,
is_urgent,
transport_type,
load_method,
main_driver_id,
main_driver_name,
assistant_driver_id,
required_vehicle_types,
assistant_driver_name,
vehicle_id,
container_no,
license_plate,
shipper_id,
earliest_departure,
shipper_name,
latest_departure,
shipper_mobile,
earliest_arrival,
shipper_address,
latest_arrival,
departure_address,
shipper_region_code,
receiver_id,
destination_address,
receiver_name,
actual_vehicle_type,
receiver_mobile,
actual_load_start,
shipper_region_label,
receiver_address,
actual_unload_end,
receiver_region_code,
actual_departure,
actual_arrival,
actual_quantity,
actual_weight,
receiver_region_label,
actual_volume,
reweigh_weight,
container_id,
electronic_lock,
empty_mileage,
shelf_id,
empty_fuel,
shelf_code,
loaded_mileage,
loaded_fuel,
shift_no,
line_no,
status,
create_by,
create_time,
update_by,
update_time,
remark,
accounts_receivable_status,
accounts_payable_status,
collection_plan_id,
payment_plan_id,
is_customs,
start_region_code,
end_region_code,
quote_detail_id,
operation_mode,
quote_plan_id,
is_load,
commission_model,
#{dispatchNo},
#{customerId},
#{customerName},
#{customerCode},
#{projectId},
#{projectName},
#{contractId},
#{contractName},
#{orderType},
#{transportLine},
#{signType},
#{vehicleProviderId},
#{vehicleProviderName},
#{loadingServiceProviderId},
#{loadingServiceProviderName},
#{customsServiceProviderId},
#{customsServiceProviderName},
#{isUrgent},
#{transportType},
#{loadMethod},
#{mainDriverId},
#{mainDriverName},
#{assistantDriverId},
#{requiredVehicleTypes},
#{assistantDriverName},
#{vehicleId},
#{containerNo},
#{licensePlate},
#{shipperId},
#{earliestDeparture},
#{shipperName},
#{latestDeparture},
#{shipperMobile},
#{earliestArrival},
#{shipperAddress},
#{latestArrival},
#{departureAddress},
#{shipperRegionCode},
#{receiverId},
#{destinationAddress},
#{receiverName},
#{actualVehicleType},
#{receiverMobile},
#{actualLoadStart},
#{shipperRegionLabel},
#{receiverAddress},
#{actualUnloadEnd},
#{receiverRegionCode},
#{actualDeparture},
#{actualArrival},
#{actualQuantity},
#{actualWeight},
#{receiverRegionLabel},
#{actualVolume},
#{reweighWeight},
#{containerId},
#{electronicLock},
#{emptyMileage},
#{shelfId},
#{emptyFuel},
#{shelfCode},
#{loadedMileage},
#{loadedFuel},
#{shiftNo},
#{lineNo},
#{status},
#{createBy},
#{createTime},
#{updateBy},
#{updateTime},
#{remark},
#{accountsReceivableStatus},
#{accountsPayableStatus},
#{collectionPlanId},
#{paymentPlanId},
#{isCustoms},
#{startRegionCode},
#{endRegionCode},
#{quoteDetailId},
#{operationMode},
#{quotePlanId},
#{isLoad},
#{commissionModel},
insert into tms_dispatch_order
id,dispatch_no,customer_id,customer_name,customer_code,project_id,project_name,contract_id,contract_name,order_type,transport_line,sign_type,vehicle_provider_id,vehicle_provider_name,loading_service_provider_id,loading_service_provider_name,customs_service_provider_id,customs_service_provider_name,is_urgent,transport_type,load_method,main_driver_id,main_driver_name,assistant_driver_id,required_vehicle_types,assistant_driver_name,vehicle_id,container_no,license_plate,shipper_id,earliest_departure,shipper_name,latest_departure,shipper_mobile,earliest_arrival,shipper_address,latest_arrival,departure_address,shipper_region_code,receiver_id,destination_address,receiver_name,actual_vehicle_type,receiver_mobile,actual_load_start,shipper_region_label,receiver_address,actual_unload_end,receiver_region_code,actual_departure,actual_arrival,actual_quantity,actual_weight,receiver_region_label,actual_volume,reweigh_weight,container_id,electronic_lock,empty_mileage,shelf_id,empty_fuel,shelf_code,loaded_mileage,loaded_fuel,shift_no,line_no,status,create_by,create_time,update_by,update_time,remark,accounts_receivable_status,accounts_payable_status,collection_plan_id,payment_plan_id,is_customs,start_region_code,end_region_code,quote_detail_id,operation_mode,quote_plan_id,is_load,commission_model
#{item.id},#{item.dispatchNo},#{item.customerId},#{item.customerName},#{item.customerCode},#{item.projectId},#{item.projectName},#{item.contractId},#{item.contractName},#{item.orderType},#{item.transportLine},#{item.signType},#{item.vehicleProviderId},#{item.vehicleProviderName},#{item.loadingServiceProviderId},#{item.loadingServiceProviderName},#{item.customsServiceProviderId},#{item.customsServiceProviderName},#{item.isUrgent},#{item.transportType},#{item.loadMethod},#{item.mainDriverId},#{item.mainDriverName},#{item.assistantDriverId},#{item.requiredVehicleTypes},#{item.assistantDriverName},#{item.vehicleId},#{item.containerNo},#{item.licensePlate},#{item.shipperId},#{item.earliestDeparture},#{item.shipperName},#{item.latestDeparture},#{item.shipperMobile},#{item.earliestArrival},#{item.shipperAddress},#{item.latestArrival},#{item.departureAddress},#{item.shipperRegionCode},#{item.receiverId},#{item.destinationAddress},#{item.receiverName},#{item.actualVehicleType},#{item.receiverMobile},#{item.actualLoadStart},#{item.shipperRegionLabel},#{item.receiverAddress},#{item.actualUnloadEnd},#{item.receiverRegionCode},#{item.actualDeparture},#{item.actualArrival},#{item.actualQuantity},#{item.actualWeight},#{item.receiverRegionLabel},#{item.actualVolume},#{item.reweighWeight},#{item.containerId},#{item.electronicLock},#{item.emptyMileage},#{item.shelfId},#{item.emptyFuel},#{item.shelfCode},#{item.loadedMileage},#{item.loadedFuel},#{item.shiftNo},#{item.lineNo},#{item.status},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.remark},#{item.accountsReceivableStatus},#{item.accountsPayableStatus},#{item.collectionPlanId},#{item.paymentPlanId},#{item.isCustoms},#{item.startRegionCode},#{item.endRegionCode},#{item.quoteDetailId},#{item.operationMode},#{item.quotePlanId},#{item.isLoad},#{item.commissionModel}
update tms_dispatch_order
dispatch_no = #{dispatchNo},
customer_id = #{customerId},
customer_name = #{customerName},
customer_code = #{customerCode},
project_id = #{projectId},
project_name = #{projectName},
contract_id = #{contractId},
contract_name = #{contractName},
order_type = #{orderType},
transport_line = #{transportLine},
sign_type = #{signType},
vehicle_provider_id = #{vehicleProviderId},
vehicle_provider_name = #{vehicleProviderName},
loading_service_provider_id = #{loadingServiceProviderId},
loading_service_provider_name = #{loadingServiceProviderName},
customs_service_provider_id = #{customsServiceProviderId},
customs_service_provider_name = #{customsServiceProviderName},
is_urgent = #{isUrgent},
transport_type = #{transportType},
load_method = #{loadMethod},
main_driver_id = #{mainDriverId},
main_driver_name = #{mainDriverName},
assistant_driver_id = #{assistantDriverId},
required_vehicle_types = #{requiredVehicleTypes},
assistant_driver_name = #{assistantDriverName},
vehicle_id = #{vehicleId},
container_no = #{containerNo},
license_plate = #{licensePlate},
shipper_id = #{shipperId},
earliest_departure = #{earliestDeparture},
shipper_name = #{shipperName},
latest_departure = #{latestDeparture},
shipper_mobile = #{shipperMobile},
earliest_arrival = #{earliestArrival},
shipper_address = #{shipperAddress},
latest_arrival = #{latestArrival},
departure_address = #{departureAddress},
shipper_region_code = #{shipperRegionCode},
receiver_id = #{receiverId},
destination_address = #{destinationAddress},
receiver_name = #{receiverName},
actual_vehicle_type = #{actualVehicleType},
receiver_mobile = #{receiverMobile},
actual_load_start = #{actualLoadStart},
shipper_region_label = #{shipperRegionLabel},
receiver_address = #{receiverAddress},
actual_unload_end = #{actualUnloadEnd},
receiver_region_code = #{receiverRegionCode},
actual_departure = #{actualDeparture},
actual_arrival = #{actualArrival},
actual_quantity = #{actualQuantity},
actual_weight = #{actualWeight},
receiver_region_label = #{receiverRegionLabel},
actual_volume = #{actualVolume},
reweigh_weight = #{reweighWeight},
container_id = #{containerId},
electronic_lock = #{electronicLock},
empty_mileage = #{emptyMileage},
shelf_id = #{shelfId},
empty_fuel = #{emptyFuel},
shelf_code = #{shelfCode},
loaded_mileage = #{loadedMileage},
loaded_fuel = #{loadedFuel},
shift_no = #{shiftNo},
line_no = #{lineNo},
status = #{status},
create_by = #{createBy},
create_time = #{createTime},
update_by = #{updateBy},
update_time = #{updateTime},
remark = #{remark},
accounts_receivable_status = #{accountsReceivableStatus},
accounts_payable_status = #{accountsPayableStatus},
collection_plan_id = #{collectionPlanId},
payment_plan_id = #{paymentPlanId},
is_customs = #{isCustoms},
start_region_code = #{startRegionCode},
end_region_code = #{endRegionCode},
quote_detail_id = #{quoteDetailId},
operation_mode = #{operationMode},
quote_plan_id = #{quotePlanId},
confirm_time = #{confirmTime},
ok_time = #{okTime},
is_load = #{isLoad},
commission_model = #{commissionModel},
where id = #{id}
update tms_dispatch_order
dispatch_no = #{item.dispatchNo},
customer_id = #{item.customerId},
customer_name = #{item.customerName},
customer_code = #{item.customerCode},
project_id = #{item.projectId},
project_name = #{item.projectName},
contract_id = #{item.contractId},
contract_name = #{item.contractName},
order_type = #{item.orderType},
transport_line = #{item.transportLine},
sign_type = #{item.signType},
vehicle_provider_id = #{item.vehicleProviderId},
vehicle_provider_name = #{item.vehicleProviderName},
loading_service_provider_id = #{item.loadingServiceProviderId},
loading_service_provider_name = #{item.loadingServiceProviderName},
customs_service_provider_id = #{item.customsServiceProviderId},
customs_service_provider_name = #{item.customsServiceProviderName},
is_urgent = #{item.isUrgent},
transport_type = #{item.transportType},
load_method = #{item.loadMethod},
main_driver_id = #{item.mainDriverId},
main_driver_name = #{item.mainDriverName},
assistant_driver_id = #{item.assistantDriverId},
required_vehicle_types = #{item.requiredVehicleTypes},
assistant_driver_name = #{item.assistantDriverName},
vehicle_id = #{item.vehicleId},
container_no = #{item.containerNo},
license_plate = #{item.licensePlate},
shipper_id = #{item.shipperId},
earliest_departure = #{item.earliestDeparture},
shipper_name = #{item.shipperName},
latest_departure = #{item.latestDeparture},
shipper_mobile = #{item.shipperMobile},
earliest_arrival = #{item.earliestArrival},
shipper_address = #{item.shipperAddress},
latest_arrival = #{item.latestArrival},
departure_address = #{item.departureAddress},
shipper_region_code = #{item.shipperRegionCode},
receiver_id = #{item.receiverId},
destination_address = #{item.destinationAddress},
receiver_name = #{item.receiverName},
actual_vehicle_type = #{item.actualVehicleType},
receiver_mobile = #{item.receiverMobile},
actual_load_start = #{item.actualLoadStart},
shipper_region_label = #{item.shipperRegionLabel},
receiver_address = #{item.receiverAddress},
actual_unload_end = #{item.actualUnloadEnd},
receiver_region_code = #{item.receiverRegionCode},
actual_departure = #{item.actualDeparture},
actual_arrival = #{item.actualArrival},
actual_quantity = #{item.actualQuantity},
actual_weight = #{item.actualWeight},
receiver_region_label = #{item.receiverRegionLabel},
actual_volume = #{item.actualVolume},
reweigh_weight = #{item.reweighWeight},
container_id = #{item.containerId},
electronic_lock = #{item.electronicLock},
empty_mileage = #{item.emptyMileage},
shelf_id = #{item.shelfId},
empty_fuel = #{item.emptyFuel},
shelf_code = #{item.shelfCode},
loaded_mileage = #{item.loadedMileage},
loaded_fuel = #{item.loadedFuel},
shift_no = #{item.shiftNo},
line_no = #{item.lineNo},
status = #{item.status},
create_by = #{item.createBy},
create_time = #{item.createTime},
update_by = #{item.updateBy},
update_time = #{item.updateTime},
remark = #{item.remark},
accounts_receivable_status = #{item.accountsReceivableStatus},
accounts_payable_status = #{item.accountsPayableStatus},
collection_plan_id = #{item.collectionPlanId},
payment_plan_id = #{item.paymentPlanId},
is_customs = #{item.isCustoms},
start_region_code = #{item.startRegionCode},
end_region_code = #{item.endRegionCode},
quote_detail_id = #{item.quoteDetailId},
operation_mode = #{item.operationMode},
quote_plan_id = #{item.quotePlanId},
is_load = #{item.isLoad},
commission_model = #{item.commissionModel},
where id = #{item.id}
delete from tms_dispatch_order where id = #{id}
delete from tms_dispatch_order where id in
#{id}