70 lines
2.1 KiB
Java
70 lines
2.1 KiB
Java
/*
|
|
* To change this template, choose Tools | Templates
|
|
* and open the template in the editor.
|
|
*/
|
|
package com.rjconsultores.ventaboletos.dao.hibernate;
|
|
|
|
import com.rjconsultores.ventaboletos.dao.ParamCompraPuntoDAO;
|
|
import com.rjconsultores.ventaboletos.entidad.ParamCompraPunto;
|
|
import java.math.BigDecimal;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import org.hibernate.Criteria;
|
|
import org.hibernate.SessionFactory;
|
|
import org.hibernate.criterion.Restrictions;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
import org.springframework.stereotype.Repository;
|
|
|
|
/**
|
|
*
|
|
* @author Rafius
|
|
*/
|
|
@Repository("paramCompraPuntoDAO")
|
|
public class ParamCompraPuntoHibernateDAO extends GenericHibernateDAO<ParamCompraPunto, Integer>
|
|
implements ParamCompraPuntoDAO {
|
|
|
|
@Autowired
|
|
public ParamCompraPuntoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
|
setSessionFactory(factory);
|
|
}
|
|
|
|
public List<ParamCompraPunto> buscar(Date ini, Date fim) {
|
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
|
|
|
if (ini != null) {
|
|
c.add(Restrictions.ge("feciniciovigencia", ini));
|
|
}
|
|
if (fim != null) {
|
|
c.add(Restrictions.le("fecfinvigencia", fim));
|
|
}
|
|
|
|
return c.list();
|
|
|
|
}
|
|
|
|
public List<ParamCompraPunto> buscar(Date ini, Date fim, Integer cantPuntos, BigDecimal costoPunto) {
|
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
|
|
|
if (ini != null) {
|
|
c.add(Restrictions.eq("feciniciovigencia", ini));
|
|
}
|
|
if (fim != null) {
|
|
c.add(Restrictions.eq("fecfinvigencia", fim));
|
|
}
|
|
|
|
if (cantPuntos != null) {
|
|
c.add(Restrictions.eq("cantpunto", cantPuntos));
|
|
}
|
|
|
|
if (costoPunto != null) {
|
|
c.add(Restrictions.eq("valcostopunto", costoPunto));
|
|
}
|
|
|
|
return c.list();
|
|
|
|
}
|
|
}
|