insert into ai_command(user_id, username, action, required_permission, request_text, plan_json, command_status, expires_at, create_time) values(#{userId}, #{username}, #{action}, #{requiredPermission}, #{requestText}, cast(#{planJson} as json), #{commandStatus}, #{expiresAt}, sysdate()) update ai_command set command_status = 'EXECUTING', confirmed_at = sysdate(), update_time = sysdate() where id = #{id} and user_id = #{userId} and command_status = 'WAIT_CONFIRM' and expires_at > sysdate() update ai_command set command_status = 'SUCCEEDED', result_json = cast(#{resultJson} as json), executed_at = sysdate(), update_time = sysdate() where id = #{id} and command_status = 'EXECUTING'