package com.fdkankan.ucenter.mapper;

import com.fdkankan.ucenter.entity.Order;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 * 订单表 Mapper 接口
 * </p>
 *
 * @author 
 * @since 2022-07-13
 */
@Mapper
public interface IOrderMapper extends BaseMapper<Order> {

    @Update(" UPDATE t_order Left JOIN t_trade_log on t_order.order_sn = t_trade_log.order_sn set t_order.shipping_status = 'received', t_order.finish_time = NOW() WHERE (DATE_SUB(CURDATE(), INTERVAL 15 DAY) < date(t_trade_log.trade_time)) and (t_order.shipping_status = 'shipped') ")
    void autoUpdateOrderStatus();
}
