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.OrderGoods;
import com.gxwebsoft.shop.param.OrderGoodsParam;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 订单商品记录表Mapper
 *
 * @author 科技小王子
 * @since 2022-12-09 17:15:31
 */
public interface OrderGoodsMapper extends BaseMapper<OrderGoods> {

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

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


    List<OrderGoods> selectByOrderIds(List<Integer> orderIds);

    @InterceptorIgnore(tenantLine = "true")
    @Select("SELECT * FROM shop_order_goods WHERE order_id = #{param.orderId}")
    List<OrderGoods> selectByOrderId(Integer orderId);

    @InterceptorIgnore(tenantLine = "true")
    int selectCountBySettled(@Param("param") OrderGoodsParam param);
}
