package serviceImpl;

import java.util.List;

import org.springframework.transaction.annotation.Transactional;

import pojo.PrintOption;
import service.PrintOptionService;

public class PrintOptionServiceImpl extends BaseServiceImpl<PrintOption> implements
		PrintOptionService {
	@Transactional(readOnly=true)
	public List<PrintOption> findOptionList(String keywords) throws RuntimeException {
		List<PrintOption> options = null;
		String hql = "FROM PrintOption AS p WHERE p.companyName LIKE ? AND p.status = 1";
		options = this.baseDao.findByHQL(hql,"%"+keywords+"%");
		return options;
	}
	@Transactional(readOnly=true)
	public PrintOption findOption() throws RuntimeException {
		PrintOption printOption;
		String hql = "FROM PrintOption";
		List<PrintOption> options = this.baseDao.findByHQL(hql);
		if(options!=null && options.size()>0){
			printOption = options.get(0);
			return printOption;
		}
		return null;
	}

	
	
}
