diff --git a/src/com/rjconsultores/ventaboletos/dao/ConexionCtrlDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConexionCtrlDAO.java index 33706891a..237cff54c 100644 --- a/src/com/rjconsultores/ventaboletos/dao/ConexionCtrlDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/ConexionCtrlDAO.java @@ -1,7 +1,11 @@ package com.rjconsultores.ventaboletos.dao; +import java.util.List; + import com.rjconsultores.ventaboletos.entidad.ConexionCtrl; public interface ConexionCtrlDAO extends GenericDAO { + + public List buscarConexionesCtrl(Integer origenId, Integer destinoId); } diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionCtrlHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionCtrlHibernateDAO.java index 9a8815cf5..fe66618de 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionCtrlHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionCtrlHibernateDAO.java @@ -1,5 +1,8 @@ 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; @@ -16,4 +19,24 @@ public class ConexionCtrlHibernateDAO extends GenericHibernateDAO buscarConexionesCtrl(Integer origenId, Integer destinoId) { + + StringBuilder sb = new StringBuilder(); + sb.append(" from ConexionCtrl "); + sb.append(" where activo = 1 "); + + if (origenId != null) { + sb.append(" and origenId = ").append(origenId); + } + if (destinoId != null) { + sb.append(" and destinoId = ").append(destinoId); + } + + Query query = getSession().createQuery(sb.toString()); + List list = query.list(); + + return list; + } } diff --git a/src/com/rjconsultores/ventaboletos/service/ConexionCtrlService.java b/src/com/rjconsultores/ventaboletos/service/ConexionCtrlService.java index 9da4bdd5f..c8a5c70cf 100644 --- a/src/com/rjconsultores/ventaboletos/service/ConexionCtrlService.java +++ b/src/com/rjconsultores/ventaboletos/service/ConexionCtrlService.java @@ -1,7 +1,11 @@ package com.rjconsultores.ventaboletos.service; +import java.util.List; + import com.rjconsultores.ventaboletos.entidad.ConexionCtrl; public interface ConexionCtrlService extends GenericService { + + public List buscarConexionesCtrl(Integer origenId, Integer destinoId); } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConexionCtrlServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConexionCtrlServiceImpl.java index b344b8c6b..f044e0cb6 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/ConexionCtrlServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConexionCtrlServiceImpl.java @@ -69,4 +69,9 @@ public class ConexionCtrlServiceImpl implements ConexionCtrlService { conexionCtrlDAO.actualizacion(entidad); } + + @Override + public List buscarConexionesCtrl(Integer origenId, Integer destinoId) { + return conexionCtrlDAO.buscarConexionesCtrl(origenId, destinoId); + } }