package org.jeecg.modules.shop.order.service.impl;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.modules.shop.order.entity.PartnerOrder;
import org.jeecg.modules.shop.order.entity.query.queryList;
import org.jeecg.modules.shop.order.entity.vo.PartnerOrderVO;
import org.jeecg.modules.shop.order.mapper.PartnerOrderMapper;
import org.jeecg.modules.shop.order.service.IPartnerOrderService;
import org.jeecg.modules.shop.user.entity.PartnerUser;
import org.jeecg.modules.shop.user.util.partnerUserHolder;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * @Description: 合作伙伴订单
 * @Author: jeecg-boot
 * @Date:   2025-07-16
 * @Version: V1.0
 */
@Service
public class PartnerOrderServiceImpl extends ServiceImpl<PartnerOrderMapper, PartnerOrder> implements IPartnerOrderService {

    @Override
    public IPage<PartnerOrderVO> queryPageList(queryList query, Integer pageNo, Integer pageSize) {
        String userId = partnerUserHolder.currentLoginUserId();
        query.setUserId(userId);
        return baseMapper.queryPageList(query,new Page<>(pageNo, pageSize));
    }

    @Override
    public Integer getOrderCountByUserAndYear(String userId, String year) {
        return baseMapper.getOrderCountByUserAndYear(userId,year);
    }
    @Override
    public Integer getTakeOrderUserCountByUserAndYear(String userId, String year) {
        return baseMapper.getOrderCountByUserAndYear(userId,year);
    }
}
