package com.tykj.dev.device.storage.service.impl;

import com.tykj.dev.device.storage.repository.StorageBillDao;
import com.tykj.dev.device.storage.service.StorageBillService;
import com.tykj.dev.device.storage.subject.domin.StorageBill;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

/**
 * @author dengdiyi
 */
@Service
public class StorageBillServiceImpl implements StorageBillService {

    @Autowired
    private StorageBillDao storageBillDao;

    @Override
    public StorageBill addEntity(StorageBill storageBillEntity) {
        return storageBillDao.save(storageBillEntity);
    }

    @Override
    public Page<StorageBill> getPage(StorageBill storageBillEntity, Pageable pageable) {
        return null;
    }

    @Override
    public List<StorageBill> getList(StorageBill storageBillEntity) {
        return null;
    }

    @Override
    public StorageBill update(StorageBill storageBillEntity) {
        return storageBillDao.save(storageBillEntity);
    }

    @Override
    public StorageBill getOne(Integer id) {
        Optional<StorageBill> storageBillEntity = storageBillDao.findById(id);
        return storageBillEntity.orElse(null);
    }

    @Override
    public void delete(Integer id) {
        storageBillDao.deleteById(id);
    }
}
