fixes bug #7663
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@57823 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
64c0c7ed63
commit
294349534b
|
@ -33,16 +33,15 @@ import com.rjconsultores.ventaboletos.entidad.Usuario;
|
|||
@Repository("puntoVentaDAO")
|
||||
public class PuntoVentaHibernateDAO extends GenericHibernateDAO<PuntoVenta, Integer>
|
||||
implements PuntoVentaDAO {
|
||||
|
||||
|
||||
@Autowired
|
||||
private PtovtaTipoEstoqueDAO ptovtaTipoEstoqueDAO;
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
public PuntoVentaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||
setSessionFactory(factory);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<PuntoVenta> obtenerTodos() {
|
||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||
|
@ -53,34 +52,33 @@ public class PuntoVentaHibernateDAO extends GenericHibernateDAO<PuntoVenta, Inte
|
|||
return c.list();
|
||||
}
|
||||
|
||||
// public List<PuntoVenta> 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<PuntoVenta> 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<PuntoVenta> buscaLike(String strEstacion) {
|
||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||
|
||||
|
||||
Criterion cr1 = Restrictions.like("nombpuntoventa", strEstacion, MatchMode.START);
|
||||
|
||||
|
||||
Criterion crActivo = Restrictions.eq("activo", Boolean.TRUE);
|
||||
|
||||
|
||||
PtovtaTipoEstoque supr = ptovtaTipoEstoqueDAO.buscarTipoSuprimento();
|
||||
PtovtaTipoEstoque cont = ptovtaTipoEstoqueDAO.buscarTipoContabilidade();
|
||||
|
||||
Criterion suprCont = Restrictions.in("ptovtaTipoEstoque", new PtovtaTipoEstoque[]{ supr, cont});
|
||||
|
||||
|
||||
Criterion suprCont = Restrictions.in("ptovtaTipoEstoque", new PtovtaTipoEstoque[] { supr, cont });
|
||||
|
||||
Criterion pt2 = Restrictions.or(crActivo, suprCont);
|
||||
|
||||
|
||||
c.add(Restrictions.and(cr1, pt2));
|
||||
|
||||
|
||||
return c.list();
|
||||
}
|
||||
|
||||
|
||||
public List<PuntoVenta> busca(String nomPuntoVenta, String numPuntoVenta) {
|
||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||
|
@ -101,10 +99,7 @@ public class PuntoVentaHibernateDAO extends GenericHibernateDAO<PuntoVenta, Inte
|
|||
|
||||
public List<PuntoVenta> 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();
|
||||
|
@ -121,76 +116,75 @@ public class PuntoVentaHibernateDAO extends GenericHibernateDAO<PuntoVenta, Inte
|
|||
|
||||
@Override
|
||||
public List<PuntoVenta> buscarPuntosVentaMovimentacionBilhetes(List<Empresa> empresas) {
|
||||
|
||||
|
||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||
|
||||
Criterion crtPtovta =
|
||||
Restrictions.and(Restrictions.eq("activo", Boolean.TRUE), Restrictions.in("empresa", empresas));
|
||||
|
||||
|
||||
Criterion crtPtovta = Restrictions.and(Restrictions.eq("activo", Boolean.TRUE), Restrictions.in("empresa", empresas));
|
||||
|
||||
PtovtaTipoEstoque supr = ptovtaTipoEstoqueDAO.buscarTipoSuprimento();
|
||||
PtovtaTipoEstoque cont = ptovtaTipoEstoqueDAO.buscarTipoContabilidade();
|
||||
|
||||
Criterion suprCont = Restrictions.in("ptovtaTipoEstoque", new PtovtaTipoEstoque[]{ supr, cont});
|
||||
|
||||
|
||||
Criterion suprCont = Restrictions.in("ptovtaTipoEstoque", new PtovtaTipoEstoque[] { supr, cont });
|
||||
|
||||
c.add(Restrictions.or(suprCont, crtPtovta));
|
||||
|
||||
c.addOrder(Order.asc("nombpuntoventa"));
|
||||
|
||||
c.addOrder(Order.asc("nombpuntoventa"));
|
||||
List<PuntoVenta> puntosVenta = c.list();
|
||||
|
||||
// List<PuntoVenta> puntosVenta = geraListaDummy();
|
||||
|
||||
|
||||
// List<PuntoVenta> puntosVenta = geraListaDummy();
|
||||
|
||||
return puntosVenta;
|
||||
}
|
||||
|
||||
public List<PuntoVenta> buscarPuntoVentaPorTipoEstoque(PtovtaTipoEstoque tipoEstoque) {
|
||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||
c.add(Restrictions.eq("ptovtaTipoEstoque", tipoEstoque));
|
||||
|
||||
|
||||
List<PuntoVenta> puntosVenta = c.list();
|
||||
|
||||
|
||||
return puntosVenta;
|
||||
}
|
||||
|
||||
private List<PuntoVenta> geraListaDummy(){
|
||||
|
||||
|
||||
private List<PuntoVenta> geraListaDummy() {
|
||||
|
||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||
|
||||
PtovtaTipoEstoque supr = ptovtaTipoEstoqueDAO.buscarTipoSuprimento();
|
||||
PtovtaTipoEstoque cont = ptovtaTipoEstoqueDAO.buscarTipoContabilidade();
|
||||
|
||||
Criterion suprCont = Restrictions.in("ptovtaTipoEstoque", new PtovtaTipoEstoque[]{ supr, cont});
|
||||
|
||||
Criterion crtPtovta = Restrictions.in("puntoventaId", new Integer[]{1,2,3,786,1321,1722});
|
||||
|
||||
|
||||
Criterion suprCont = Restrictions.in("ptovtaTipoEstoque", new PtovtaTipoEstoque[] { supr, cont });
|
||||
|
||||
Criterion crtPtovta = Restrictions.in("puntoventaId", new Integer[] { 1, 2, 3, 786, 1321, 1722 });
|
||||
|
||||
c.add(Restrictions.or(suprCont, crtPtovta));
|
||||
List<PuntoVenta> puntosVenta = c.list();
|
||||
|
||||
// PuntoVenta pv1 = new PuntoVenta(Integer.valueOf(1));
|
||||
// pv1.setNombpuntoventa("pv1");
|
||||
//
|
||||
// PuntoVenta pv2 = new PuntoVenta(Integer.valueOf(2));
|
||||
// pv2.setNombpuntoventa("pv2");
|
||||
//
|
||||
// PuntoVenta pv3 = new PuntoVenta(Integer.valueOf(3));
|
||||
// pv3.setNombpuntoventa("pv3");
|
||||
//
|
||||
// PuntoVenta pv4 = new PuntoVenta(Integer.valueOf(786));
|
||||
// pv4.setNombpuntoventa("pv4");
|
||||
//
|
||||
// PuntoVenta pv5 = new PuntoVenta(Integer.valueOf(1321));
|
||||
// pv5.setNombpuntoventa("pv5");
|
||||
//
|
||||
// PuntoVenta pv6 = new PuntoVenta(Integer.valueOf(1722));
|
||||
// pv6.setNombpuntoventa("SUPRIMENTO");
|
||||
//
|
||||
// List<PuntoVenta> puntosVenta = new ArrayList<PuntoVenta>();
|
||||
// puntosVenta.add(pv6);
|
||||
// puntosVenta.add(pv1);
|
||||
// puntosVenta.add(pv2);
|
||||
// puntosVenta.add(pv3);
|
||||
// puntosVenta.add(pv4);
|
||||
// puntosVenta.add(pv5);
|
||||
|
||||
|
||||
// PuntoVenta pv1 = new PuntoVenta(Integer.valueOf(1));
|
||||
// pv1.setNombpuntoventa("pv1");
|
||||
//
|
||||
// PuntoVenta pv2 = new PuntoVenta(Integer.valueOf(2));
|
||||
// pv2.setNombpuntoventa("pv2");
|
||||
//
|
||||
// PuntoVenta pv3 = new PuntoVenta(Integer.valueOf(3));
|
||||
// pv3.setNombpuntoventa("pv3");
|
||||
//
|
||||
// PuntoVenta pv4 = new PuntoVenta(Integer.valueOf(786));
|
||||
// pv4.setNombpuntoventa("pv4");
|
||||
//
|
||||
// PuntoVenta pv5 = new PuntoVenta(Integer.valueOf(1321));
|
||||
// pv5.setNombpuntoventa("pv5");
|
||||
//
|
||||
// PuntoVenta pv6 = new PuntoVenta(Integer.valueOf(1722));
|
||||
// pv6.setNombpuntoventa("SUPRIMENTO");
|
||||
//
|
||||
// List<PuntoVenta> puntosVenta = new ArrayList<PuntoVenta>();
|
||||
// puntosVenta.add(pv6);
|
||||
// puntosVenta.add(pv1);
|
||||
// puntosVenta.add(pv2);
|
||||
// puntosVenta.add(pv3);
|
||||
// puntosVenta.add(pv4);
|
||||
// puntosVenta.add(pv5);
|
||||
|
||||
return puntosVenta;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue