package com.eactive.eai.rms.data.entity.man.bizKeyTran;

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.jpa.AbstractDataService;
import com.eactive.eai.rms.common.acl.bizKeyTran.BizKeyTranUI;
import com.querydsl.core.types.dsl.BooleanExpression;

@Service
@Transactional(transactionManager = "transactionManagerForEMS")
public class BizKeyTranService extends AbstractDataService<BizKeyTran, String, BizKeyTranRepository> {

	public Page<BizKeyTran> findAll(Pageable pageable, BizKeyTranUI bizKeyTranUI) {
		QBizKeyTran qBizKeyTran = QBizKeyTran.bizKeyTran;

		BooleanExpression predicate = qBizKeyTran.eaibzwkdstcd.containsIgnoreCase(bizKeyTranUI.getSearchEaiBzwkDstcd())
				.and(qBizKeyTran.apcode.containsIgnoreCase(bizKeyTranUI.getSearchApCode()));

		return repository.findAll(predicate, pageable);
	}

}
