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; package com.rjconsultores.ventaboletos.dao;
import java.util.List;
import org.hibernate.criterion.Criterion;
import com.rjconsultores.ventaboletos.entidad.Pacote; import com.rjconsultores.ventaboletos.entidad.Pacote;
public interface PacoteDAO extends GenericDAO<Pacote, Integer> { public interface PacoteDAO extends GenericDAO<Pacote, Integer> {

View File

@ -1,6 +1,10 @@
package com.rjconsultores.ventaboletos.dao.hibernate; package com.rjconsultores.ventaboletos.dao.hibernate;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.SessionFactory; import org.hibernate.SessionFactory;
import org.hibernate.criterion.Restrictions;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
@ -19,7 +23,13 @@ public class PacoteHibernateDAO extends GenericHibernateDAO<Pacote, Integer> imp
setSessionFactory(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 @Override
public String toString() { 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() { public Empresa getEmpresa() {

View File

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

View File

@ -24,4 +24,17 @@ public enum LocalEnderecoApanhe {
return this.descricao; 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;
}
} }