Criação do cadastro de clientes
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@22548 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
f04cc3ea3f
commit
a973adf28f
|
@ -0,0 +1,16 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ClienteDireccion;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public interface ClienteDireccionDAO extends GenericDAO<ClienteDireccion, Integer> {
|
||||||
|
|
||||||
|
public List<ClienteDireccion> buscar(Integer clienteId);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.hibernate.Criteria;
|
||||||
|
import org.hibernate.SessionFactory;
|
||||||
|
import org.hibernate.criterion.Order;
|
||||||
|
import org.hibernate.criterion.Restrictions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.dao.ClienteDireccionDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ClienteDireccion;
|
||||||
|
|
||||||
|
|
||||||
|
@Repository("clienteDireccionDAO")
|
||||||
|
public class ClienteDireccionHibernateDAO extends GenericHibernateDAO<ClienteDireccion, Integer>
|
||||||
|
implements ClienteDireccionDAO {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public ClienteDireccionHibernateDAO(
|
||||||
|
@Qualifier("sessionFactory") SessionFactory factory) {
|
||||||
|
setSessionFactory(factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ClienteDireccion> obtenerTodos() {
|
||||||
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
|
c.addOrder(Order.asc("id"));
|
||||||
|
|
||||||
|
return c.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ClienteDireccion> buscar(Integer clienteId) {
|
||||||
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
|
c.add(Restrictions.eq("clienteId", clienteId));
|
||||||
|
|
||||||
|
|
||||||
|
return c.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ import javax.persistence.JoinColumn;
|
||||||
import javax.persistence.NamedQueries;
|
import javax.persistence.NamedQueries;
|
||||||
import javax.persistence.NamedQuery;
|
import javax.persistence.NamedQuery;
|
||||||
import javax.persistence.OneToMany;
|
import javax.persistence.OneToMany;
|
||||||
|
import javax.persistence.OneToOne;
|
||||||
import javax.persistence.SequenceGenerator;
|
import javax.persistence.SequenceGenerator;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.persistence.Temporal;
|
import javax.persistence.Temporal;
|
||||||
|
@ -73,13 +74,17 @@ public class Cliente implements Serializable {
|
||||||
@Column(name = "NUMEXTENSIONDOS")
|
@Column(name = "NUMEXTENSIONDOS")
|
||||||
private String numextensiondos;
|
private String numextensiondos;
|
||||||
|
|
||||||
@Column(name = "TIPOOCUPACION_ID")
|
|
||||||
|
@JoinColumn(name = "TIPOOCUPACION_ID")
|
||||||
|
@OneToOne(cascade=CascadeType.ALL)
|
||||||
private TipoOcupacion tipoocupacionId;
|
private TipoOcupacion tipoocupacionId;
|
||||||
|
|
||||||
@Column(name = "MEDIOINFORMATIVO_ID")
|
@Column(name = "MEDIOINFORMATIVO_ID")
|
||||||
private Integer medioinformativoId;
|
private Integer medioinformativoId;
|
||||||
|
|
||||||
@Column(name = "MOTIVOVIAJE_ID")
|
|
||||||
|
@JoinColumn(name = "MOTIVOVIAJE_ID")
|
||||||
|
@OneToOne(cascade=CascadeType.ALL)
|
||||||
private MotivoViaje motivoviajeId;
|
private MotivoViaje motivoviajeId;
|
||||||
|
|
||||||
@Column(name = "INDSEXO")
|
@Column(name = "INDSEXO")
|
||||||
|
@ -125,10 +130,10 @@ public class Cliente implements Serializable {
|
||||||
@Column(name = "INDCAMBIOCONTRASENA")
|
@Column(name = "INDCAMBIOCONTRASENA")
|
||||||
private Integer indcambiocontrasena;
|
private Integer indcambiocontrasena;
|
||||||
|
|
||||||
//
|
|
||||||
// @OneToMany(cascade = CascadeType.ALL)
|
@OneToMany(cascade = CascadeType.ALL)
|
||||||
// @JoinColumn(name = "CLIENTE_ID", referencedColumnName = "CLIENTE_ID")
|
private List<ClienteDireccion> lsClienteDireccion;
|
||||||
// private List<ClienteDireccion> lsClienteDireccion;
|
|
||||||
|
|
||||||
public Cliente() {
|
public Cliente() {
|
||||||
}
|
}
|
||||||
|
@ -362,13 +367,13 @@ public class Cliente implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// public List<ClienteDireccion> getLsClienteDireccion() {
|
public List<ClienteDireccion> getLsClienteDireccion() {
|
||||||
// return lsClienteDireccion;
|
return lsClienteDireccion;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// public void setLsClienteDireccion(List<ClienteDireccion> lsClienteDireccion) {
|
public void setLsClienteDireccion(List<ClienteDireccion> lsClienteDireccion) {
|
||||||
// this.lsClienteDireccion = lsClienteDireccion;
|
this.lsClienteDireccion = lsClienteDireccion;
|
||||||
// }
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
|
|
|
@ -7,6 +7,7 @@ package com.rjconsultores.ventaboletos.entidad;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import javax.persistence.Basic;
|
import javax.persistence.Basic;
|
||||||
|
import javax.persistence.CascadeType;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
|
@ -16,6 +17,7 @@ import javax.persistence.JoinColumn;
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
import javax.persistence.NamedQueries;
|
import javax.persistence.NamedQueries;
|
||||||
import javax.persistence.NamedQuery;
|
import javax.persistence.NamedQuery;
|
||||||
|
import javax.persistence.OneToOne;
|
||||||
import javax.persistence.SequenceGenerator;
|
import javax.persistence.SequenceGenerator;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.persistence.Temporal;
|
import javax.persistence.Temporal;
|
||||||
|
@ -41,26 +43,36 @@ public class ClienteDireccion implements Serializable {
|
||||||
|
|
||||||
@Column(name = "DESCCALLE")
|
@Column(name = "DESCCALLE")
|
||||||
private String desccalle;
|
private String desccalle;
|
||||||
|
|
||||||
@Column(name = "DESCCALLECOMP")
|
@Column(name = "DESCCALLECOMP")
|
||||||
private String desccallecomp;
|
private String desccallecomp;
|
||||||
|
|
||||||
@Column(name = "DESCDELEGACION")
|
@Column(name = "DESCDELEGACION")
|
||||||
private String descdelegacion;
|
private String descdelegacion;
|
||||||
@Column(name = "TIPODOMICILIO_ID")
|
|
||||||
private Short tipodomicilioId;
|
@JoinColumn(name = "TIPODOMICILIO_ID")
|
||||||
|
@OneToOne(cascade=CascadeType.ALL)
|
||||||
|
private TipoDomicilio tipodomicilioId;
|
||||||
|
|
||||||
@Column(name = "DESCPLANO")
|
@Column(name = "DESCPLANO")
|
||||||
private String descplano;
|
private String descplano;
|
||||||
|
|
||||||
@Column(name = "DESCCOORDENADA")
|
@Column(name = "DESCCOORDENADA")
|
||||||
private String desccoordenada;
|
private String desccoordenada;
|
||||||
|
|
||||||
@Column(name = "FECHORINICIOENTREGA")
|
@Column(name = "FECHORINICIOENTREGA")
|
||||||
@Temporal(TemporalType.TIMESTAMP)
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
private Date fechorinicioentrega;
|
private Date fechorinicioentrega;
|
||||||
|
|
||||||
@Column(name = "FECHORFINENTREGA")
|
@Column(name = "FECHORFINENTREGA")
|
||||||
@Temporal(TemporalType.TIMESTAMP)
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
private Date fechorfinentrega;
|
private Date fechorfinentrega;
|
||||||
|
|
||||||
@Column(name = "COLONIA_ID")
|
@Column(name = "COLONIA_ID")
|
||||||
private Integer coloniaId;
|
private Integer coloniaId;
|
||||||
|
|
||||||
@Column(name = "ACTIVO")
|
@Column(name = "ACTIVO")
|
||||||
private Short activo;
|
private Boolean activo;
|
||||||
@Column(name = "FECMODIF")
|
@Column(name = "FECMODIF")
|
||||||
@Temporal(TemporalType.TIMESTAMP)
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
private Date fecmodif;
|
private Date fecmodif;
|
||||||
|
@ -78,12 +90,15 @@ public class ClienteDireccion implements Serializable {
|
||||||
private String desciudad;
|
private String desciudad;
|
||||||
@Column(name = "DESESTADO")
|
@Column(name = "DESESTADO")
|
||||||
private String desestado;
|
private String desestado;
|
||||||
|
|
||||||
|
|
||||||
// @JoinColumn(name = "CLIENTE_ID", referencedColumnName = "CLIENTE_ID")
|
@JoinColumn(name = "CLIENTE_ID", referencedColumnName = "CLIENTE_ID")
|
||||||
// @ManyToOne
|
@ManyToOne
|
||||||
// private Cliente clienteId;
|
private Cliente clienteId;
|
||||||
|
|
||||||
|
|
||||||
public ClienteDireccion() {
|
public ClienteDireccion() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClienteDireccion(Integer clientedireccionId) {
|
public ClienteDireccion(Integer clientedireccionId) {
|
||||||
|
@ -99,13 +114,13 @@ public class ClienteDireccion implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// public Cliente getClienteId() {
|
public Cliente getClienteId() {
|
||||||
// return clienteId;
|
return clienteId;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// public void setClienteId(Cliente clienteId) {
|
public void setClienteId(Cliente clienteId) {
|
||||||
// this.clienteId = clienteId;
|
this.clienteId = clienteId;
|
||||||
// }
|
}
|
||||||
|
|
||||||
public String getDesccalle() {
|
public String getDesccalle() {
|
||||||
return desccalle;
|
return desccalle;
|
||||||
|
@ -131,11 +146,11 @@ public class ClienteDireccion implements Serializable {
|
||||||
this.descdelegacion = descdelegacion;
|
this.descdelegacion = descdelegacion;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Short getTipodomicilioId() {
|
public TipoDomicilio getTipodomicilioId() {
|
||||||
return tipodomicilioId;
|
return tipodomicilioId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTipodomicilioId(Short tipodomicilioId) {
|
public void setTipodomicilioId(TipoDomicilio tipodomicilioId) {
|
||||||
this.tipodomicilioId = tipodomicilioId;
|
this.tipodomicilioId = tipodomicilioId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,11 +194,11 @@ public class ClienteDireccion implements Serializable {
|
||||||
this.coloniaId = coloniaId;
|
this.coloniaId = coloniaId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Short getActivo() {
|
public Boolean getActivo() {
|
||||||
return activo;
|
return activo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setActivo(Short activo) {
|
public void setActivo(Boolean activo) {
|
||||||
this.activo = activo;
|
this.activo = activo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,6 +131,7 @@ public class TipoOcupacion implements Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "com.rjconsultores.ventaboletos.entidad.TipoOcupacion[tipoocupacionId=" + tipoocupacionId + "]";
|
// return "com.rjconsultores.ventaboletos.entidad.TipoOcupacion[tipoocupacionId=" + tipoocupacionId + "]";
|
||||||
|
return this.desctipo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.rjconsultores.ventaboletos.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ClienteDireccion;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public interface ClienteDireccionService extends GenericService<ClienteDireccion, Integer> {
|
||||||
|
|
||||||
|
public List<ClienteDireccion> buscar(Integer clienteId);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,70 @@
|
||||||
|
package com.rjconsultores.ventaboletos.service.impl;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.dao.ClienteDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.dao.ClienteDireccionDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Cliente;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ClienteDireccion;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ClienteDireccionService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ClienteService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Desenvolvimento
|
||||||
|
*/
|
||||||
|
@Service("clienteDireccionService")
|
||||||
|
public class ClienteDireccionServiceImpl implements ClienteDireccionService{
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ClienteDireccionDAO clienteDAO;
|
||||||
|
|
||||||
|
public List<ClienteDireccion> obtenerTodos() {
|
||||||
|
return clienteDAO.obtenerTodos();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClienteDireccion obtenerID(Integer id) {
|
||||||
|
return clienteDAO.obtenerID(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public ClienteDireccion suscribir(ClienteDireccion entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.TRUE);
|
||||||
|
|
||||||
|
return clienteDAO.suscribir(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public ClienteDireccion actualizacion(ClienteDireccion entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.TRUE);
|
||||||
|
|
||||||
|
return clienteDAO.actualizacion(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void borrar(ClienteDireccion entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.FALSE);
|
||||||
|
|
||||||
|
clienteDAO.actualizacion(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<ClienteDireccion> buscar(Integer clienteId) {
|
||||||
|
return clienteDAO.buscar(clienteId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue