desenvolvimento (fixes bug #5251)
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@35213 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
386d5c4574
commit
24c2872aac
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.rjconsultores.ventaboletos.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.SegVKM;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author RJ
|
||||
*/
|
||||
public interface SegVKMDAO extends GenericDAO<SegVKM, Integer> {
|
||||
|
||||
public List<SegVKM> buscar(String segVKm);
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.rjconsultores.ventaboletos.dao.SegVKMDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.SegVKM;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Administrador
|
||||
*/
|
||||
@Repository("segVKMDAO")
|
||||
public class SegVKMHibernateDAO extends GenericHibernateDAO<SegVKM, Integer>
|
||||
implements SegVKMDAO {
|
||||
|
||||
@Autowired
|
||||
public SegVKMHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||
setSessionFactory(factory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SegVKM> obtenerTodos() {
|
||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||
|
||||
return c.list();
|
||||
}
|
||||
|
||||
public List<SegVKM> buscar(String serie) {
|
||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||
|
||||
c.add(Restrictions.eq("serie", serie));
|
||||
|
||||
return c.list();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,137 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.rjconsultores.ventaboletos.entidad;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author RJ
|
||||
*/
|
||||
@Entity
|
||||
@SequenceGenerator(name = "SEGVKM_SEQ", sequenceName = "SEGVKM_SEQ", allocationSize = 1)
|
||||
@Table(name = "SEGVKM")
|
||||
public class SegVKM implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@Basic(optional = false)
|
||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "SEGVKM_SEQ")
|
||||
@Column(name = "SEGVKM_ID")
|
||||
private Integer segVKMId;
|
||||
@Column(name = "KM")
|
||||
private BigDecimal km;
|
||||
@Column(name = "VALOR")
|
||||
private BigDecimal valor;
|
||||
@Column(name = "SERIE")
|
||||
private String serie;
|
||||
@Column(name = "ACTIVO")
|
||||
private Boolean activo;
|
||||
@Column(name = "FECMODIF")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date fecmodif;
|
||||
@Column(name = "USUARIO_ID")
|
||||
private Integer usuarioId;
|
||||
|
||||
public SegVKM() {
|
||||
}
|
||||
|
||||
public SegVKM(Integer segVKMId) {
|
||||
this.segVKMId = segVKMId;
|
||||
}
|
||||
|
||||
public Integer getSegVKMId() {
|
||||
return segVKMId;
|
||||
}
|
||||
|
||||
public void setSegVKMId(Integer segVKMId) {
|
||||
this.segVKMId = segVKMId;
|
||||
}
|
||||
|
||||
public BigDecimal getKm() {
|
||||
return km;
|
||||
}
|
||||
|
||||
public void setKm(BigDecimal km) {
|
||||
this.km = km;
|
||||
}
|
||||
|
||||
public BigDecimal getValor() {
|
||||
return valor;
|
||||
}
|
||||
|
||||
public void setValor(BigDecimal valor) {
|
||||
this.valor = valor;
|
||||
}
|
||||
|
||||
public String getSerie() {
|
||||
return serie;
|
||||
}
|
||||
|
||||
public void setSerie(String serie) {
|
||||
this.serie = serie;
|
||||
}
|
||||
|
||||
public Boolean getActivo() {
|
||||
return activo;
|
||||
}
|
||||
|
||||
public void setActivo(Boolean activo) {
|
||||
this.activo = activo;
|
||||
}
|
||||
|
||||
public Date getFecmodif() {
|
||||
return fecmodif;
|
||||
}
|
||||
|
||||
public void setFecmodif(Date fecmodif) {
|
||||
this.fecmodif = fecmodif;
|
||||
}
|
||||
|
||||
public Integer getUsuarioId() {
|
||||
return usuarioId;
|
||||
}
|
||||
|
||||
public void setUsuarioId(Integer usuarioId) {
|
||||
this.usuarioId = usuarioId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 0;
|
||||
hash += (segVKMId != null ? segVKMId.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (!(object instanceof SegVKM)) {
|
||||
return false;
|
||||
}
|
||||
SegVKM other = (SegVKM) object;
|
||||
if ((this.segVKMId == null && other.segVKMId != null) || (this.segVKMId != null && !this.segVKMId.equals(other.segVKMId))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "com.rjconsultores.ventaboletos.entidad.SegVKM[ segVKMId=" + segVKMId + " ]";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.rjconsultores.ventaboletos.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.SegVKM;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author RJ
|
||||
*/
|
||||
public interface SegVKMService extends GenericService<SegVKM, Integer> {
|
||||
|
||||
public List<SegVKM> buscar(String serie);
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
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.SegVKMDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.SegVKM;
|
||||
import com.rjconsultores.ventaboletos.service.SegVKMService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author RJ
|
||||
*/
|
||||
@Service("segVKMService")
|
||||
public class SegVKMServiceImpl implements SegVKMService {
|
||||
|
||||
@Autowired
|
||||
private SegVKMDAO segVKMDAO;
|
||||
|
||||
public List<SegVKM> obtenerTodos() {
|
||||
return segVKMDAO.obtenerTodos();
|
||||
}
|
||||
|
||||
public SegVKM obtenerID(Integer id) {
|
||||
return segVKMDAO.obtenerID(id);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public SegVKM suscribir(SegVKM entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
|
||||
return segVKMDAO.suscribir(entidad);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public SegVKM actualizacion(SegVKM entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
|
||||
return segVKMDAO.actualizacion(entidad);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void borrar(SegVKM entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.FALSE);
|
||||
|
||||
segVKMDAO.actualizacion(entidad);
|
||||
}
|
||||
|
||||
public List<SegVKM> buscar(String serie) {
|
||||
return segVKMDAO.buscar(serie);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue