package com.gxwebsoft.shop.mapper;

import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gxwebsoft.shop.entity.Order;
import com.gxwebsoft.shop.param.OrderParam;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 订单记录表Mapper
 *
 * @author WebSoft
 * @since 2022-11-16 11:25:58
 */
public interface OrderMapper extends BaseMapper<Order> {

    /**
     * 分页查询
     *
     * @param page  分页对象
     * @param param 查询参数
     * @return List<Order>
     */
    List<Order> selectPageRel(@Param("page") IPage<Order> page,
                             @Param("param") OrderParam param);

    /**
     * 查询全部
     *
     * @param param 查询参数
     * @return List<User>
     */
    List<Order> selectListRel(@Param("param") OrderParam param);


    @InterceptorIgnore(tenantLine = "true")
    List<Order> getOne(@Param("param") OrderParam param);

    @InterceptorIgnore(tenantLine = "true")
    boolean updatePayStatus(@Param("param") OrderParam param);

    @InterceptorIgnore(tenantLine = "true")
    @Select("UPDATE shop_order SET pay_status = #{param.payStatus} where order_no = #{param.orderNo}")
    List<Order> getAll(@Param("param") OrderParam param);

//    @InterceptorIgnore(tenantLine = "true")
    boolean updateByIdRel(@Param("param") Order order);

    @InterceptorIgnore(tenantLine = "true")
    List<Order> selectPageSettled(@Param("page") IPage<Order> page,
                              @Param("param") OrderParam param);

    @InterceptorIgnore(tenantLine = "true")
    void updateByIdSettled(@Param("param") Order order);
}
