package com.eactive.eai.rms.data.entity.onl.b2bextract;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.eactive.eai.data.entity.onl.b2bextractor.B2BExtract;
import com.eactive.eai.data.entity.onl.b2bextractor.B2BExtractId;
import com.eactive.eai.data.entity.onl.b2bextractor.QB2BExtract;
import com.eactive.eai.data.jpa.AbstractDataService;

@Service
@Transactional
public class B2bExtractService extends AbstractDataService<B2BExtract, B2BExtractId, B2BExtractEMSRepository> {

	public Page<B2BExtract> findAll(Pageable pageable, String searchEaiSvcName) {
		return repository.findAll(QB2BExtract.b2BExtract.id.eaisvcname.containsIgnoreCase(searchEaiSvcName), pageable);
	}

	public Iterable<B2BExtract> findAll(String searchEaiSvcName) {
		return repository.findAll(QB2BExtract.b2BExtract.id.eaisvcname.containsIgnoreCase(searchEaiSvcName));
	}

	public long count(String eaiSvcName) {
		return repository.count(QB2BExtract.b2BExtract.id.eaisvcname.eq(eaiSvcName));
	}

	public void delete(B2BExtractId id) {
		repository.deleteById(id);
	}

}
