wilian 2015-06-12 21:59:56 +00:00
parent be948813f0
commit e79f4da427
5 changed files with 43 additions and 4 deletions

View File

@ -1,5 +1,9 @@
package com.rjconsultores.ventaboletos.dao;
import java.util.List;
import org.hibernate.criterion.Criterion;
import com.rjconsultores.ventaboletos.entidad.Pacote;
public interface PacoteDAO extends GenericDAO<Pacote, Integer> {

View File

@ -1,6 +1,10 @@
package com.rjconsultores.ventaboletos.dao.hibernate;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Restrictions;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
@ -18,8 +22,14 @@ public class PacoteHibernateDAO extends GenericHibernateDAO<Pacote, Integer> imp
public PacoteHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
setSessionFactory(factory);
}
@Override
@SuppressWarnings("unchecked")
public List<Pacote> obtenerTodos() {
Criteria c = this.makeCriteria();
c.add(Restrictions.eq("activo", Boolean.TRUE));
return c.list();
}
}

View File

@ -197,7 +197,7 @@ public class Pacote implements Serializable {
@Override
public String toString() {
return "Pacote [pacoteId=" + pacoteId + ", nompacote=" + nompacote + ", descpacote=" + descpacote + ", indvendaagencia=" + indvendaagencia + ", activo=" + activo + ", fecmodif=" + fecmodif + ", usuarioId=" + usuarioId + ", ruta=" + ruta + "]";
return this.getNompacote();
}
public Empresa getEmpresa() {

View File

@ -63,6 +63,10 @@ public class VendaPacote implements Serializable {
@Column(name = "USUARIO_CANCELAMENTO_ID")
private Integer usuarioCancelamentoId;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "USUARIO_ID")
private Usuario usuario;
@Column(name = "SUBTOTAL")
private BigDecimal subtotal;
@ -169,4 +173,12 @@ public class VendaPacote implements Serializable {
this.enderecoApanhes = enderecoApanhes;
}
public Usuario getUsuario() {
return usuario;
}
public void setUsuario(Usuario usuario) {
this.usuario = usuario;
}
}

View File

@ -23,5 +23,18 @@ public enum LocalEnderecoApanhe {
public String toString() {
return this.descricao;
}
public static LocalEnderecoApanhe getLocalEnderecoApanhe(Integer valor) {
if(APANHE_EM_CASA.getValor().equals(valor)) {
return APANHE_EM_CASA;
} else if(HOTEL.getValor().equals(valor)) {
return HOTEL;
} else if(NENHUM.getValor().equals(valor)) {
return NENHUM;
} else if(REGIAO_METROPOLITANA.getValor().equals(valor)) {
return REGIAO_METROPOLITANA;
}
return null;
}
}