insert into work_checkin (
id,
user_id,
checkin_date,
checkin_time,
longitude,
latitude,
location_text,
remark,
status,
created_at,
updated_at
) values (
(select coalesce(max(id), 0) + 1 from work_checkin),
#{userId},
current_date,
now(),
#{request.longitude},
#{request.latitude},
#{request.locationText},
#{request.remark},
'normal',
now(),
now()
)
update work_checkin
set checkin_time = now(),
longitude = #{request.longitude},
latitude = #{request.latitude},
location_text = #{request.locationText},
remark = #{request.remark},
status = 'normal',
updated_at = now()
where id = #{checkInId}
insert into work_daily_report (
user_id,
report_date,
work_content,
tomorrow_plan,
source_type,
submit_time,
status,
created_at,
updated_at
) values (
#{userId},
current_date,
#{request.workContent},
#{request.tomorrowPlan},
#{request.sourceType},
now(),
'submitted',
now(),
now()
)
update work_daily_report
set work_content = #{request.workContent},
tomorrow_plan = #{request.tomorrowPlan},
source_type = #{request.sourceType},
submit_time = now(),
status = 'submitted',
updated_at = now()
where id = #{reportId}
insert into work_todo (
id,
user_id,
title,
biz_type,
biz_id,
due_date,
status,
priority,
created_at,
updated_at
) values (
#{todoId},
#{userId},
#{title},
#{bizType},
#{bizId},
current_date::timestamp + interval '1 day' + time '09:00',
'todo',
'medium',
now(),
now()
)
update work_todo
set title = #{title},
due_date = current_date::timestamp + interval '1 day' + time '09:00',
status = 'todo',
priority = 'medium',
updated_at = now()
where id = #{todoId}