INSERT INTO student_goods_sell (user_id_,teacher_id_,goods_json_,total_amount_,market_amount_, create_time_,update_time_,order_no_,organ_id_,author_user_,cooperation_organ_id_,coupon_market_amount_,coupon_ids_,tenant_id_,goods_type_) VALUES(#{userId},#{teacherId},#{goodsJson},#{totalAmount},#{marketAmount}, NOW(),NOW(),#{orderNo},#{organId},#{authorUser},#{cooperationOrganId},#{couponMarketAmount},#{couponIds},#{tenantId},#{goodsType}) UPDATE student_goods_sell coupon_ids_ = #{couponIds}, coupon_market_amount_ = #{couponMarketAmount}, cooperation_organ_id_ = #{cooperationOrganId}, author_user_ = #{authorUser}, organ_id_ = #{organId}, order_no_ = #{orderNo}, user_id_ = #{userId}, total_amount_ = #{totalAmount}, market_amount_ = #{marketAmount}, teacher_id_ = #{teacherId}, goods_json_ = #{goodsJson}, goods_type_ = #{goodsType}, update_time_ = NOW() WHERE id_ = #{id} and tenant_id_ = #{tenantId} UPDATE student_payment_order SET receive_status_ = #{status},update_time_ = NOW() WHERE FIND_IN_SET(order_no_,#{orderNo}) DELETE FROM student_goods_sell WHERE id_ = #{id} sgs.tenant_id_ = #{tenantId} and sgs.goods_type_ = 'MALL' and sgs.goods_type_ is null AND sgs.teacher_id_ = #{teacherId} AND sgs.user_id_ = #{studentId} AND spo.status_ = #{status} AND spo.receive_status_ = #{receiveStatus} AND (su.username_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%')) spo.type_ IN ('GOODS_SELL','APPLY','SUBJECT_CHANGE') AND so.id_ IS NOT NULL and spo.tenant_id_ = #{tenantId} AND spo.status_ = #{status} AND spo.receive_status_ = #{receiveStatus} AND spo.user_id_ = #{studentId}