package com.jwipc.sys.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jwipc.sys.entity.Factory;
import com.jwipc.sys.mapper.FactoryMapper;
import com.jwipc.sys.model.po.FactoryPO;
import com.jwipc.sys.model.query.FactoryQuery;
import com.jwipc.sys.service.IFactoryService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 工厂/分支机构（只同步WERKS、 NAME1） 服务实现类
 * </p>
 *
 * @author shenyang.ou
 * @since 2024-01-29
 */
@Service
public class FactoryServiceImpl extends ServiceImpl<FactoryMapper, Factory> implements IFactoryService {

    @Override
    public List<FactoryPO> findPageByQuery(Page<Factory> dbPage, FactoryQuery query) {
        if (dbPage==null){
            return baseMapper.findPageByQuery(query);
        }
        return baseMapper.findPageByQuery(dbPage,query);
    }

    @Override
    public FactoryPO getDataById(Long id) {
        return baseMapper.getDataById(id);
    }

    @Override
    public List<FactoryPO> findAllByQuery(FactoryQuery query) {
        return baseMapper.findPageByQuery(query);
    }
}
