delete from cloud_teacher_order where id_ = #{id} INSERT INTO cloud_teacher_order (organ_id_,student_id_, type_, level_, time_, amount_, operating_amount_, refund_amount_, status_, order_id_,platform_order_id_,start_time_,end_time_,remark_, create_time_, update_time_,music_group_id_,active_remark_,tenant_id_) VALUES (#{organId},#{studentId}, #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{level}, #{time}, #{amount}, #{operatingAmount}, #{refundAmount}, #{status},#{orderId},#{platformOrderId},#{startTime},#{endTime}, #{remark}, NOW(), NOW(),#{musicGroupId},#{activeRemark},#{tenantId}) update cloud_teacher_order active_remark_ = #{activeRemark}, music_group_id_ = #{musicGroupId}, organ_id_ = #{organId}, student_id_ = #{studentId}, type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, level_ = #{level}, time_ = #{time}, amount_ = #{amount}, operating_amount_ = #{operatingAmount}, refund_amount_ = #{refundAmount}, status_ = #{status}, start_time_ = #{startTime}, end_time_ = #{endTime}, order_id_ = #{orderId}, platform_order_id_ = #{platformOrderId}, remark_ = #{remark}, version_ = version_+1, update_time_ = NOW(), where id_ = #{id} AND version_ = #{version} and tenant_id_ = #{tenantId} update cloud_teacher_order set status_ = 2, `start_time_` = CURRENT_DATE(), `end_time_` = case when type_ = 1 then concat(date_add(CURRENT_DATE(), interval `time_` day) , ' 00:00:00') when type_ = 2 then concat(date_add(CURRENT_DATE(), interval `time_` month) , ' 00:00:00') when type_ = 3 then concat(date_add(CURRENT_DATE(), interval `time_` * 3 month) , ' 00:00:00') when type_ = 4 then concat(date_add(CURRENT_DATE(), interval `time_` * 6 month) , ' 00:00:00') when type_ = 5 then concat(date_add(CURRENT_DATE(), interval `time_` year) , ' 00:00:00') end where platform_order_id_ = #{platformOrderId} update cloud_teacher_order set platform_order_id_ = #{platformOrderId} , pay_amount_ = #{amount} where id_ = #{cloudTeacherOrderId} cto.status_ != 0 AND cto.active_remark_ = '202109' AND FIND_IN_SET(su.organ_id_,#{organIds}) AND (su.id_ = #{search} OR su.username_ LIKE CONCAT('%',#{search},'%') OR mg.id_ LIKE CONCAT('%',#{search},'%')) AND st.subject_id_list_ = #{subjectId} AND cto.tenant_id_ = #{tenantId} AND cto.remark_ = #{remarkType} INSERT INTO cloud_teacher_order (organ_id_,student_id_, type_, level_, time_, amount_,status_, remark_,create_time_, update_time_,tenant_id_) VALUES (#{bean.organId},#{userId},#{bean.type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{bean.level}, #{bean.time}, #{bean.amount},#{bean.status},#{bean.remark},NOW(),NOW(),#{bean.tenantId})