package com.jwipc.shopping.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jwipc.shopping.entity.ShoppingAfterSales;
import com.jwipc.shopping.entity.ShoppingCart;
import com.jwipc.shopping.mapper.ShoppingCartMapper;
import com.jwipc.shopping.model.po.ShoppingAfterSalesPO;
import com.jwipc.shopping.model.query.MyAfterSalesQuery;
import com.jwipc.shopping.model.query.OnlineMallCartQuery;
import com.jwipc.shopping.model.vo.OnlineMallCart;
import com.jwipc.shopping.service.IShoppingCartService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 商城购物车商品信息 服务实现类
 * </p>
 *
 * @author zx
 * @since 2024-03-14
 */
@Service
public class ShoppingCartServiceImpl extends ServiceImpl<ShoppingCartMapper, ShoppingCart> implements IShoppingCartService {

    @Resource
    ShoppingCartMapper shoppingCartMapper;

    @Override
    public List<OnlineMallCart> selectDataByQuery(Page<OnlineMallCart> toPage, OnlineMallCartQuery query) {
        return shoppingCartMapper.selectDataByQuery(toPage,query);
    }

    @Override
    public OnlineMallCart selectByQuery(OnlineMallCartQuery query) {
        return shoppingCartMapper.selectByQuery(query);
    }

    @Override
    public OnlineMallCart findHeadById(Long cartId) {
        return shoppingCartMapper.findHeadById(cartId);
    }

    @Override
    public List<OnlineMallCart> bidFindByPage(Page<OnlineMallCart> dbPage, OnlineMallCartQuery query) {

        if (dbPage==null){
            return baseMapper.bidFindByPage(query);
        }
        return baseMapper.bidFindByPage(dbPage,query);
//        if (dbPage==null){
//            return baseMapper.selectDataByQuery(query);
//        }
//        return baseMapper.selectDataByQuery(dbPage,query);

    }

    @Override
    public List<ShoppingAfterSalesPO> selectAsDataByQuery(Page<ShoppingAfterSales> page, MyAfterSalesQuery query) {
        if (page==null){
            return baseMapper.asFindByPage(query);
        }
        return baseMapper.asFindByPage(page,query);

    }

    @Override
    public ShoppingCart getByOArderCode(String cartId) {
        return baseMapper.getByOrderCode(cartId);
    }

    @Override
    public List<OnlineMallCart> selectDataExport(String thirdOrder) {
        return baseMapper.selectDataExport(thirdOrder);
    }

    @Override
    public List<OnlineMallCart> selectDataExport1(OnlineMallCartQuery query) {
        return baseMapper.selectDataExport1(query);
    }

    @Override
    public List<OnlineMallCart> selectInfoDataByQuery(Page<OnlineMallCart> page, OnlineMallCartQuery query) {
        return shoppingCartMapper.selectInfoDataByQuery(page,query);
    }

}
