diff --git a/src/com/rjconsultores/ventaboletos/dao/PuntoVentaDAO.java b/src/com/rjconsultores/ventaboletos/dao/PuntoVentaDAO.java index 3e39c1549..0c757df90 100644 --- a/src/com/rjconsultores/ventaboletos/dao/PuntoVentaDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/PuntoVentaDAO.java @@ -18,7 +18,7 @@ import com.rjconsultores.ventaboletos.entidad.PuntoVenta; public interface PuntoVentaDAO extends GenericDAO { - public List buscaLike(String strEstacion); + public List buscaLike(String strEstacion, boolean sinTodos); public List busca(String nomPuntoVenta, String numPuntoVenta); diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PuntoVentaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PuntoVentaHibernateDAO.java index eb375be2d..96185d7bd 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/PuntoVentaHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PuntoVentaHibernateDAO.java @@ -36,6 +36,8 @@ import com.rjconsultores.ventaboletos.entidad.Usuario; @Repository("puntoVentaDAO") public class PuntoVentaHibernateDAO extends GenericHibernateDAO implements PuntoVentaDAO { + + public static final int ID_PUNTO_VENTA_TODOS = -1; @Autowired private PtovtaTipoEstoqueDAO ptovtaTipoEstoqueDAO; @@ -55,21 +57,21 @@ public class PuntoVentaHibernateDAO extends GenericHibernateDAO buscaLike(String strEstacion) { - // Criteria c = getSession().createCriteria(getPersistentClass()); - // c.add(Restrictions.eq("activo", Boolean.TRUE)); - // c.add(Restrictions.like("nombpuntoventa", strEstacion, MatchMode.START)); - // - // return c.list(); - // } - public List buscaLike(String strEstacion) { + public List buscaLike(String strEstacion, boolean sinTodos) { Criteria c = getSession().createCriteria(getPersistentClass()); Criterion cr1 = Restrictions.like("nombpuntoventa", strEstacion, MatchMode.START); Criterion crActivo = Restrictions.eq("activo", Boolean.TRUE); + + if (sinTodos){ + Criterion crSinTodos = Restrictions.ne("puntoventaId", ID_PUNTO_VENTA_TODOS); + c.add(crSinTodos); + } + + PtovtaTipoEstoque supr = ptovtaTipoEstoqueDAO.buscarTipoSuprimento(); PtovtaTipoEstoque cont = ptovtaTipoEstoqueDAO.buscarTipoContabilidade(); @@ -102,10 +104,8 @@ public class PuntoVentaHibernateDAO extends GenericHibernateDAO buscaPuntoVentaParada(Parada parada) { Criteria c = getSession().createCriteria(getPersistentClass()); - c.add(Restrictions.eq("activo", Boolean.TRUE)); c.add(Restrictions.eq("parada", parada)); - c.addOrder(Order.asc("nombpuntoventa")); return c.list(); diff --git a/src/com/rjconsultores/ventaboletos/service/PuntoVentaService.java b/src/com/rjconsultores/ventaboletos/service/PuntoVentaService.java index 53f230c06..25dd32da2 100644 --- a/src/com/rjconsultores/ventaboletos/service/PuntoVentaService.java +++ b/src/com/rjconsultores/ventaboletos/service/PuntoVentaService.java @@ -30,7 +30,7 @@ public interface PuntoVentaService { public void borrar(PuntoVenta entidad)throws BusinessException; - public List buscaLike(String strEstacion); + public List buscaLike(String strEstacion, boolean sinTodos); public List buscar(String nomPuntoVenta, String numPuntoVenta); diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java index 819006f8c..0b4979899 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java @@ -249,8 +249,8 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { puntoVentaDAO.actualizacion(entidad); } - public List buscaLike(String strEstacion) { - return puntoVentaDAO.buscaLike(strEstacion); + public List buscaLike(String strEstacion, boolean sinTodos) { + return puntoVentaDAO.buscaLike(strEstacion, sinTodos); } public List buscar(String nomPuntoVenta, String numPuntoVenta) {