package com.jwipc.inquiry.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jwipc.inquiry.entity.InquiryCostTemplate;
import com.jwipc.inquiry.mapper.InquiryCostTemplateMapper;
import com.jwipc.inquiry.model.po.InquiryCostTemplatePO;
import com.jwipc.inquiry.model.query.InquiryCostTemplateQuery;
import com.jwipc.inquiry.service.IInquiryCostTemplateService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 询价成本构成模板 服务实现类
 * </p>
 *
 * @author shenyang.ou
 * @since 2024-02-21
 */
@Service
public class InquiryCostTemplateServiceImpl extends ServiceImpl<InquiryCostTemplateMapper, InquiryCostTemplate> implements IInquiryCostTemplateService {

    @Override
    public List<InquiryCostTemplatePO> findPageByQuery(Page<InquiryCostTemplate> dbPage, InquiryCostTemplateQuery query) {
        if (dbPage==null){
            return baseMapper.findPageByQuery(query);
        }
        return baseMapper.findPageByQuery(dbPage,query);
    }

    /**
     * 根据采购组编码获取成本模板且包含全部采购组
     *
     * @param purchaseGroupCode 采购组编码
     */
    @Override
    public List<InquiryCostTemplatePO> getAllListByPurchaseGroupCode(String purchaseGroupCode) {
        return baseMapper.getAllListByPurchaseGroupCode(purchaseGroupCode);
    }
}
