insert into business_task( operate,task_cron,task_name,state,b_id,template_id,task_id ) values ( #{operate},#{taskCron},#{taskName},#{state},#{bId},#{templateId},#{taskId} ) insert into task( task_cron,create_time,task_name,status_cd,state,b_id,template_id,task_id ) select t.task_cron,t.create_time,t.task_name,'0',t.state,t.b_id,t.template_id,t.task_id from business_task t where 1=1 and t.operate= 'ADD' and t.task_cron= #{taskCron} and t.create_time= #{createTime} and t.task_name= #{taskName} and t.state= #{state} and t.b_id= #{bId} and t.template_id= #{templateId} and t.task_id= #{taskId} update task t set t.status_cd = #{statusCd} ,t.b_id = #{newBId} , t.task_cron= #{taskCron} , t.task_name= #{taskName} , t.state= #{state} , t.template_id= #{templateId} where 1=1 and t.b_id= #{bId} and t.task_id= #{taskId}