From 7dd3d39f7624e6ac7bed2bfcc8d91cc25576a290 Mon Sep 17 00:00:00 2001 From: gleimar Date: Sat, 16 Jul 2016 16:33:44 +0000 Subject: [PATCH] =?UTF-8?q?Corre=C3=A7=C3=A3o=20para=20n=C3=A3o=20listar?= =?UTF-8?q?=20TODOS=20no=20convecio.fixes=20bug#7637?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@57955 d1611594-4594-4d17-8e1d-87c2c4800839 --- .../ventaboletos/dao/PuntoVentaDAO.java | 2 +- .../dao/hibernate/PuntoVentaHibernateDAO.java | 20 +++++++++---------- .../service/PuntoVentaService.java | 2 +- .../service/impl/PuntoVentaServiceImpl.java | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) 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) {