package com.jwipc.supplier.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jwipc.supplier.clent.dto.SupplierPurchaseCategoryDTO;
import com.jwipc.supplier.entity.SupplierPurchaseCategory;
import com.jwipc.supplier.mapper.SupplierPurchaseCategoryMapper;
import com.jwipc.supplier.model.po.SupplierProductTypeDMPO;
import com.jwipc.supplier.model.po.SupplierPurchaseCategoryListPO;
import com.jwipc.supplier.model.query.SupplierPurchaseCategoryBaseQuery;
import com.jwipc.supplier.service.ISupplierPurchaseCategoryService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Objects;

/**
 * <p>
 * 供应商物料品类关联表 服务实现类
 * </p>
 *
 * @author ZhangJie
 * @since 2024-02-21
 */
@Service
public class SupplierPurchaseCategoryServiceImpl
        extends ServiceImpl<SupplierPurchaseCategoryMapper, SupplierPurchaseCategory>
        implements ISupplierPurchaseCategoryService
{

    @Override
    public List<SupplierPurchaseCategoryListPO> findPage(Page<SupplierPurchaseCategoryListPO> page,
                                                         SupplierPurchaseCategoryBaseQuery query)
    {
        if(Objects.isNull(query)){
            return this.baseMapper.findPage( query);
        }else{
            return this.baseMapper.findPage(page, query);
        }

    }

    @Override
    public List<SupplierPurchaseCategoryListPO> findMainPage(Page<SupplierPurchaseCategoryListPO> page,
                                                             SupplierPurchaseCategoryBaseQuery query)
    {
        if (Objects.isNull(page)) {
            return this.baseMapper.findMainPage(query);
        }
        return this.baseMapper.findMainPage(page, query);
    }

    @Override
    public List<SupplierProductTypeDMPO> findForProducttypedmReportExport(SupplierPurchaseCategoryBaseQuery query) {
        return this.baseMapper.findForProducttypedmReportExport(query);
    }

    @Override
    public List<SupplierPurchaseCategoryListPO> findPOForIds(List<String> list) {
        return this.baseMapper.findPOForIds(list);
    }

    @Override
    public SupplierPurchaseCategory findCurryCode(String supplierCode){
        return this.baseMapper.findCurryCode(supplierCode);
    }

}
