git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@20490 d1611594-4594-4d17-8e1d-87c2c4800839
parent
7d84e96f94
commit
b59ba1dabd
|
@ -0,0 +1,10 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.CoeficienteTarifa;
|
||||||
|
|
||||||
|
public interface CoeficienteTarifaDAO extends GenericDAO<CoeficienteTarifa, Integer> {
|
||||||
|
|
||||||
|
public List<CoeficienteTarifa> buscar(String nomb);
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.hibernate.Criteria;
|
||||||
|
import org.hibernate.SessionFactory;
|
||||||
|
import org.hibernate.criterion.MatchMode;
|
||||||
|
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.CoeficienteTarifaDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.CoeficienteTarifa;
|
||||||
|
|
||||||
|
@Repository("coeficienteTarifaDAO")
|
||||||
|
public class CoeficienteTarifaHibernateDAO extends GenericHibernateDAO<CoeficienteTarifa, Integer>
|
||||||
|
implements CoeficienteTarifaDAO {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public CoeficienteTarifaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||||
|
setSessionFactory(factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public List<CoeficienteTarifa> obtenerTodos() {
|
||||||
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
|
c.addOrder(Order.asc("descCoeficiente"));
|
||||||
|
|
||||||
|
return c.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public List<CoeficienteTarifa> buscar(String nomb) {
|
||||||
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
|
c.add(Restrictions.ilike("descCoeficiente", nomb, MatchMode.START));
|
||||||
|
c.addOrder(Order.asc("descCoeficiente"));
|
||||||
|
|
||||||
|
return c.list();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,113 @@
|
||||||
|
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;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@SequenceGenerator(name = "COEFICIENTE_TARIFA_SEQ", sequenceName = "COEFICIENTE_TARIFA_SEQ", allocationSize = 1)
|
||||||
|
@Table(name = "COEFICIENTE_TARIFA")
|
||||||
|
public class CoeficienteTarifa implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
@Id
|
||||||
|
@Basic(optional = false)
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO, generator = "COEFICIENTE_TARIFA_SEQ")
|
||||||
|
@Column(name = "COEFICIENTETARIFA_ID")
|
||||||
|
private Integer coeficienteId;
|
||||||
|
@Column(name = "DESCCOEFICIENTE")
|
||||||
|
private String descCoeficiente;
|
||||||
|
@Column(name = "COEFICIENTE")
|
||||||
|
private BigDecimal coeficiente;
|
||||||
|
@Column(name = "ACTIVO")
|
||||||
|
private Boolean activo;
|
||||||
|
@Column(name = "FECMODIF")
|
||||||
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
|
private Date fecmodif;
|
||||||
|
@Column(name = "USUARIO_ID")
|
||||||
|
private Integer usuarioId;
|
||||||
|
|
||||||
|
public Integer getCoeficienteId() {
|
||||||
|
return coeficienteId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCoeficienteId(Integer coeficienteId) {
|
||||||
|
this.coeficienteId = coeficienteId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescCoeficiente() {
|
||||||
|
return descCoeficiente;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescCoeficiente(String descCoeficiente) {
|
||||||
|
this.descCoeficiente = descCoeficiente;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getCoeficiente() {
|
||||||
|
return coeficiente;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCoeficiente(BigDecimal coeficiente) {
|
||||||
|
this.coeficiente = coeficiente;
|
||||||
|
}
|
||||||
|
|
||||||
|
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() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = 1;
|
||||||
|
result = prime * result + ((coeficienteId == null) ? 0 : coeficienteId.hashCode());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (obj == null)
|
||||||
|
return false;
|
||||||
|
if (getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
CoeficienteTarifa other = (CoeficienteTarifa) obj;
|
||||||
|
if (coeficienteId == null) {
|
||||||
|
if (other.coeficienteId != null)
|
||||||
|
return false;
|
||||||
|
} else if (!coeficienteId.equals(other.coeficienteId))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
package com.rjconsultores.ventaboletos.service;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.CoeficienteTarifa;
|
||||||
|
|
||||||
|
public interface CoeficienteTarifaService extends GenericService<CoeficienteTarifa, Integer>{
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
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.CoeficienteTarifaDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.CoeficienteTarifa;
|
||||||
|
import com.rjconsultores.ventaboletos.service.CoeficienteTarifaService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
|
||||||
|
@Service("coeficienteTarifaService")
|
||||||
|
public class CoeficienteTarifaServiceImpl implements CoeficienteTarifaService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CoeficienteTarifaDAO coeficienteTarifaDAO;
|
||||||
|
|
||||||
|
public List<CoeficienteTarifa> obtenerTodos() {
|
||||||
|
return coeficienteTarifaDAO.obtenerTodos();
|
||||||
|
}
|
||||||
|
|
||||||
|
public CoeficienteTarifa obtenerID(Integer id) {
|
||||||
|
return coeficienteTarifaDAO.obtenerID(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public CoeficienteTarifa suscribir(CoeficienteTarifa entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.TRUE);
|
||||||
|
|
||||||
|
return coeficienteTarifaDAO.suscribir(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public CoeficienteTarifa actualizacion(CoeficienteTarifa entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.TRUE);
|
||||||
|
|
||||||
|
return coeficienteTarifaDAO.actualizacion(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void borrar(CoeficienteTarifa entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.FALSE);
|
||||||
|
|
||||||
|
coeficienteTarifaDAO.actualizacion(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<CoeficienteTarifa> buscar(String nomb) {
|
||||||
|
return coeficienteTarifaDAO.buscar(nomb);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue