select todo_id, task_type, title, summary, cast(content as char) as content,
business_type, business_id, route_name, route_params,
assignee_user_id, assignee_merchant_id, priority, task_status,
read_status, read_time, due_time, completed_time, completed_by,
cancel_reason, idempotent_key, active_idempotent_key,
create_by, create_time, update_by, update_time, remark, del_flag
from sys_todo_task
insert into sys_todo_task (
task_type, title, summary, content, business_type, business_id,
route_name, route_params, assignee_user_id, assignee_merchant_id,
priority, task_status, read_status, due_time, idempotent_key,
active_idempotent_key, create_by, create_time, remark, del_flag
) values (
#{taskType}, #{title}, #{summary}, #{content}, #{businessType}, #{businessId},
#{routeName}, #{routeParams}, #{assigneeUserId}, #{assigneeMerchantId},
#{priority}, #{taskStatus}, #{readStatus}, #{dueTime}, #{idempotentKey},
#{activeIdempotentKey}, #{createBy}, sysdate(), #{remark}, #{delFlag}
)
update sys_todo_task
set read_status = '1',
read_time = sysdate(),
update_by = #{updateBy},
update_time = sysdate()
where todo_id = #{todoId}
and assignee_user_id = #{assigneeUserId}
and read_status = '0'
and del_flag = '0'
update sys_todo_task
set read_status = '1',
read_time = sysdate(),
update_by = #{updateBy},
update_time = sysdate()
where assignee_user_id = #{assigneeUserId}
and read_status = '0'
and del_flag = '0'
update sys_todo_task
set task_status = 'COMPLETED',
completed_time = sysdate(),
completed_by = #{completedBy},
active_idempotent_key = null,
update_by = #{updateBy},
update_time = sysdate()
where todo_id = #{todoId}
and assignee_user_id = #{assigneeUserId}
and task_status in ('PENDING', 'PROCESSING')
and del_flag = '0'
update sys_todo_task
set task_status = 'COMPLETED',
completed_time = sysdate(),
completed_by = #{completedBy},
active_idempotent_key = null,
update_by = #{updateBy},
update_time = sysdate()
where business_type = #{businessType}
and business_id = #{businessId}
and assignee_user_id = #{assigneeUserId}
and task_status in ('PENDING', 'PROCESSING')
and del_flag = '0'
update sys_todo_task
set task_status = 'CANCELLED',
cancel_reason = #{reason},
active_idempotent_key = null,
update_by = #{updateBy},
update_time = sysdate()
where todo_id = #{todoId}
and assignee_user_id = #{assigneeUserId}
and task_status in ('PENDING', 'PROCESSING')
and del_flag = '0'
update sys_todo_task
set task_status = 'CANCELLED',
cancel_reason = #{reason},
active_idempotent_key = null,
update_by = #{updateBy},
update_time = sysdate()
where todo_id = #{todoId}
and task_status in ('PENDING', 'PROCESSING')
and del_flag = '0'