select
p.id, p.application_id, p.application_no, p.process_name, p.process_status,
p.total_nodes, p.current_node, p.start_time, p.end_time,
p.submitter_id, p.submitter_name,
p.create_by, p.create_time, p.update_by, p.update_time,
a.project_name,
u.nick_name as submitter_nick_name
from cw_project_approval_process p
left join cw_project_application a on p.application_id = a.id
left join sys_user u on p.submitter_id = u.user_id
update cw_project_approval_process
set current_node = #{currentNode}, update_by = #{updateBy}, update_time = now()
where id = #{id} and deleted = 0
update cw_project_approval_process
set process_status = #{status},
end_time = case when #{status} in ('completed', 'terminated') then now() else end_time end,
update_by = #{updateBy},
update_time = now()
where id = #{id} and deleted = 0