DELETE
FROM
stats_staff_patrol_record_daily
WHERE
customer_id = #{customerId}
AND date_id = #{dateId}
LIMIT 1000
INSERT INTO stats_staff_patrol_record_daily
(
id,
source_type,
customer_id,
source_customer_id,
date_id,
week_id,
month_id,
quarter_id,
year_id,
grid_id,
agency_id,
grid_pids,
staff_id,
patrol_total,
total_time,
report_project_count,
latest_patrol_time,
latest_patrol_status,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time
)
VALUES
(
REPLACE(UUID(), '-', ''),
#{i.sourceType},
#{i.parentCustomerId},
#{i.customerId},
#{i.dateId},
#{i.weekId},
#{i.monthId},
#{i.quarterId},
#{i.yearId},
#{i.gridId},
#{i.agencyId},
#{i.gridPids},
#{i.staffId},
#{i.patrolTotal},
#{i.totalTime},
#{i.reportProjectCount},
#{i.latestPatrolTime},
#{i.latestPatrolStatus},
0,
0,
'BASE_REPORT',
NOW(),
'BASE_REPORT',
NOW()
)
ON DUPLICATE KEY
UPDATE
source_type = values(source_type),
customer_id = values(customer_id),
source_customer_id = values(source_customer_id),
report_project_count = values(report_project_count),
updated_by = 'BASE_REPORT',
updated_time = NOW()