insert into business_purchase_apply (operate, res_order_type, description, apply_order_id, state, store_id, user_id, user_name, b_id, end_user_name, end_user_tel, community_id) values (#{operate}, #{resOrderType}, #{description}, #{applyOrderId}, #{state}, #{storeId}, #{userId}, #{userName}, #{bId}, #{endUserName}, #{endUserTel}, #{communityId}) insert into business_purchase_apply_detail (apply_order_id,res_id,quantity,remark,b_id,operate,status_cd) values ( #{item.applyOrderId}, #{item.resId}, #{item.quantity}, #{item.remark}, #{item.bId}, #{item.operate}, #{item.statusCd} ) insert into purchase_apply_detail (id,rs_id,apply_order_id,res_id,quantity,remark,b_id,operate,status_cd,price,purchase_quantity,purchase_remark,original_stock,times_id,consult_price) values ( #{item.id}, #{item.rsId}, #{item.applyOrderId}, #{item.resId}, #{item.quantity}, #{item.remark}, '-1', 'ADD', '0', #{item.price}, #{item.purchaseQuantity}, #{item.purchaseRemark}, #{item.originalStock}, #{item.timesId}, #{item.consultPrice} ) insert into purchase_apply (res_order_type,description,apply_order_id,status_cd,state,store_id,user_name,b_id,user_id,end_user_name,end_user_tel,community_id) select t.res_order_type,t.description,t.apply_order_id,'0',t.state,t.store_id,t.user_name,t.b_id,t.user_id,t.end_user_name,t.end_user_tel, t.community_id from business_purchase_apply t where 1=1 and t.operate= 'ADD' and t.res_order_type= #{resOrderType} and t.description= #{description} and t.apply_order_id= #{applyOrderId} and t.state= #{state} and t.store_id= #{storeId} and t.b_id= #{bId} and t.user_id= #{userId} and t.community_id= #{communityId} update purchase_apply t set t.status_cd = #{statusCd} ,t.b_id = #{newBId} , t.apply_detail_id= #{applyDetailId} , t.res_order_type= #{resOrderType} , t.description= #{description} , t.state= #{state} , t.store_id= #{storeId} , t.user_id= #{userId} , t.end_user_name= #{endUserName} , t.end_user_tel= #{endUserTel} , t.community_id= #{communityId} where 1=1 and t.apply_order_id= #{applyOrderId} and t.b_id= #{bId} insert into purchase_apply (status_cd, res_order_type, description, apply_order_id, state, store_id, user_id, user_name, b_id, end_user_name, end_user_tel, create_time, create_user_id, create_user_name, warehousing_way, community_id) values ('0', #{resOrderType}, #{description}, #{applyOrderId}, #{state}, #{storeId}, #{userId}, #{userName}, '-1', #{endUserName}, #{endUserTel}, #{createTime}, #{createUserId}, #{createUserName}, #{warehousingWay}, #{communityId}) update ACT_RU_TASK t set SUSPENSION_STATE_=1 ,t.ASSIGNEE_ = #{assigneeUser} where 1=1 and t.ID_= #{actRuTaskId}