55 lines
1.5 KiB
Java
55 lines
1.5 KiB
Java
/*
|
|
* To change this template, choose Tools | Templates
|
|
* and open the template in the editor.
|
|
*/
|
|
package com.rjconsultores.ventaboletos.dao.hibernate;
|
|
|
|
import java.util.List;
|
|
|
|
import org.hibernate.Query;
|
|
import org.hibernate.SessionFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
import org.springframework.stereotype.Repository;
|
|
|
|
import com.rjconsultores.ventaboletos.dao.PrecioVentajaDAO;
|
|
import com.rjconsultores.ventaboletos.entidad.ConexionCtrl;
|
|
import com.rjconsultores.ventaboletos.entidad.PrecioVentaja;
|
|
|
|
/**
|
|
*
|
|
* @author Igor
|
|
*/
|
|
@Repository("precioVentajaDAO")
|
|
public class PrecioVentajaHibernateDAO extends GenericHibernateDAO<PrecioVentaja, Integer>
|
|
implements PrecioVentajaDAO {
|
|
|
|
@Autowired
|
|
public PrecioVentajaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
|
setSessionFactory(factory);
|
|
}
|
|
|
|
@Override
|
|
public List<PrecioVentaja> buscarPrecioVentaja(Integer origenId, Integer destinoId, Integer rutaId) {
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(" from PrecioVentaja ");
|
|
sb.append(" where activo = 1 ");
|
|
|
|
if (origenId != null) {
|
|
sb.append(" and origenOriginalId = ").append(origenId);
|
|
}
|
|
if (destinoId != null) {
|
|
sb.append(" and destinoOriginalId = ").append(destinoId);
|
|
}
|
|
if (rutaId != null) {
|
|
sb.append(" and rutaOriginalId = ").append(rutaId);
|
|
}
|
|
|
|
Query query = getSession().createQuery(sb.toString());
|
|
List<PrecioVentaja> list = query.list();
|
|
|
|
return list;
|
|
}
|
|
|
|
}
|