package com.jwipc.sys.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jwipc.sys.entity.ProductInfo;
import com.jwipc.sys.mapper.ProductInfoMapper;
import com.jwipc.sys.model.po.ProductInfoPO;
import com.jwipc.sys.model.query.ProductQuery;
import com.jwipc.sys.service.IProductInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

import static com.baomidou.dynamic.datasource.support.DdConstants.SLAVE;

/**
 * <p>
 * 物料主数据 服务实现类
 * </p>
 *
 * @author shenyang.ou
 * @since 2024-02-03
 */
@Service
@DS(SLAVE)
public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, ProductInfo> implements IProductInfoService {

    @Override
    public List<ProductInfoPO> findPageByQuery(Page<ProductInfo> dbPage, ProductQuery query) {
        if (dbPage==null){
            return baseMapper.findPageByQuery(query);
        }
        return baseMapper.findPageByQuery(dbPage,query);
    }

    @Override
    public List<ProductInfoPO> findByQuery(Page<ProductInfo> dbPage, ProductQuery query) {
        if (dbPage==null){
            return baseMapper.findByQuery(query);
        }
        return baseMapper.findByQuery(dbPage,query);
    }

    @Override
    public List<ProductInfoPO> findByQuery1(Page<ProductInfo> dbPage, ProductQuery query) {
        if (dbPage==null){
            return baseMapper.getData(query);
        }
        return baseMapper.getData(dbPage,query);
    }
}
