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

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.errorcode.ErrorCode;
import com.eactive.eai.data.entity.onl.errorcode.QErrorCode;
import com.eactive.eai.data.jpa.AbstractDataService;
import com.querydsl.core.types.dsl.BooleanExpression;

@Service
@Transactional
public class ErrorCodeServiceImpl extends AbstractDataService<ErrorCode, String, ErrorCodeRepository>
		implements ErrorCodeService {

	@Override
	public Page<ErrorCode> findAll(Pageable pageable, String searchMsg, String searchMsgDesc) {
		QErrorCode qErrorCode = QErrorCode.errorCode;

		BooleanExpression predicate = qErrorCode.msg
				.containsIgnoreCase(searchMsg)
				.and(qErrorCode.msgctnt.containsIgnoreCase(searchMsgDesc));

		return repository.findAll(predicate, pageable);
	}
}
