Seguro Tarifa
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@20998 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
4ee9e59926
commit
b74a6c5275
|
@ -1,12 +1,18 @@
|
|||
package com.rjconsultores.ventaboletos.dao;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
||||
import com.rjconsultores.ventaboletos.entidad.SeguroTarifa;
|
||||
import java.util.List;
|
||||
|
||||
public interface SeguroTarifaDAO {
|
||||
/**
|
||||
* Indica se existe seguroTarifa para o orgaoConcedenteId informado
|
||||
*
|
||||
* @param orgaoConcedenteId
|
||||
* @return
|
||||
*/
|
||||
public boolean existe(Integer orgaoConcedenteId);
|
||||
public interface SeguroTarifaDAO extends GenericDAO<SeguroTarifa, Integer> {
|
||||
|
||||
/**
|
||||
* Indica se existe seguroTarifa para o orgaoConcedenteId informado
|
||||
*
|
||||
* @param orgaoConcedenteId
|
||||
* @return
|
||||
*/
|
||||
public boolean existe(Integer orgaoConcedenteId);
|
||||
|
||||
public List<SeguroTarifa> buscarPorOrgao(OrgaoConcedente orgao);
|
||||
}
|
||||
|
|
|
@ -9,25 +9,34 @@ import org.springframework.beans.factory.annotation.Qualifier;
|
|||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.rjconsultores.ventaboletos.dao.SeguroTarifaDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
||||
import com.rjconsultores.ventaboletos.entidad.SeguroTarifa;
|
||||
import java.util.List;
|
||||
|
||||
@Repository("seguroTarifaDAO")
|
||||
public class SeguroTarifaHibernateDAO extends GenericHibernateDAO<SeguroTarifa, Integer> implements SeguroTarifaDAO {
|
||||
|
||||
@Autowired
|
||||
public SeguroTarifaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||
setSessionFactory(factory);
|
||||
}
|
||||
@Autowired
|
||||
public SeguroTarifaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||
setSessionFactory(factory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean existe(Integer orgaoConcedenteId) {
|
||||
Criteria c= makeCriteria();
|
||||
c.add(Restrictions.eq("orgaoconcedente.orgaoConcedenteId", orgaoConcedenteId));
|
||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||
c.setProjection(Projections.rowCount());
|
||||
|
||||
|
||||
return HibernateFix.count(c.list()) > 0;
|
||||
}
|
||||
@Override
|
||||
public boolean existe(Integer orgaoConcedenteId) {
|
||||
Criteria c = makeCriteria();
|
||||
c.add(Restrictions.eq("orgaoconcedente.orgaoConcedenteId", orgaoConcedenteId));
|
||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||
c.setProjection(Projections.rowCount());
|
||||
|
||||
|
||||
return HibernateFix.count(c.list()) > 0;
|
||||
}
|
||||
|
||||
public List<SeguroTarifa> buscarPorOrgao(OrgaoConcedente orgao) {
|
||||
Criteria c = makeCriteria();
|
||||
c.add(Restrictions.eq("orgaoconcedente", orgao));
|
||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||
|
||||
return c.list();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,9 +11,12 @@ 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.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
|
@ -23,14 +26,17 @@ import javax.persistence.TemporalType;
|
|||
* @author gleimar
|
||||
*/
|
||||
@Entity
|
||||
@SequenceGenerator(name = "SEGURO_TARIFA_SEQ", sequenceName = "SEGURO_TARIFA_SEQ", allocationSize = 1)
|
||||
@Table(name = "SEGURO_TARIFA")
|
||||
public class SeguroTarifa implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@Basic(optional = false)
|
||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "SEGURO_TARIFA_SEQ")
|
||||
@Column(name = "SEGUROTARIFA_ID")
|
||||
private Integer segurotarifaId;
|
||||
@Column(name = "VALORTARIFA")
|
||||
@Column(name = "VALORTAXA")
|
||||
private BigDecimal valortarifa;
|
||||
@Column(name = "VALORTARIFAATE")
|
||||
private BigDecimal valortarifaate;
|
||||
|
@ -44,7 +50,7 @@ public class SeguroTarifa implements Serializable {
|
|||
private Date fecmodif;
|
||||
@Column(name = "USUARIO_ID")
|
||||
private Integer usuarioId;
|
||||
|
||||
|
||||
public SeguroTarifa() {
|
||||
}
|
||||
|
||||
|
@ -68,8 +74,6 @@ public class SeguroTarifa implements Serializable {
|
|||
this.valortarifa = valortarifa;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 0;
|
||||
|
@ -95,44 +99,43 @@ public class SeguroTarifa implements Serializable {
|
|||
return "com.rjconsultores.ventaboletos.entidad.SeguroTarifa[ segurotarifaId=" + segurotarifaId + " ]";
|
||||
}
|
||||
|
||||
public BigDecimal getValortarifaate() {
|
||||
return valortarifaate;
|
||||
}
|
||||
public BigDecimal getValortarifaate() {
|
||||
return valortarifaate;
|
||||
}
|
||||
|
||||
public void setValortarifaate(BigDecimal valortarifaate) {
|
||||
this.valortarifaate = valortarifaate;
|
||||
}
|
||||
public void setValortarifaate(BigDecimal valortarifaate) {
|
||||
this.valortarifaate = valortarifaate;
|
||||
}
|
||||
|
||||
public OrgaoConcedente getOrgaoconcedente() {
|
||||
return orgaoconcedente;
|
||||
}
|
||||
public OrgaoConcedente getOrgaoconcedente() {
|
||||
return orgaoconcedente;
|
||||
}
|
||||
|
||||
public void setOrgaoconcedente(OrgaoConcedente orgaoconcedente) {
|
||||
this.orgaoconcedente = orgaoconcedente;
|
||||
}
|
||||
public void setOrgaoconcedente(OrgaoConcedente orgaoconcedente) {
|
||||
this.orgaoconcedente = orgaoconcedente;
|
||||
}
|
||||
|
||||
public Boolean getActivo() {
|
||||
return activo;
|
||||
}
|
||||
public Boolean getActivo() {
|
||||
return activo;
|
||||
}
|
||||
|
||||
public void setActivo(Boolean activo) {
|
||||
this.activo = activo;
|
||||
}
|
||||
public void setActivo(Boolean activo) {
|
||||
this.activo = activo;
|
||||
}
|
||||
|
||||
public Date getFecmodif() {
|
||||
return fecmodif;
|
||||
}
|
||||
public Date getFecmodif() {
|
||||
return fecmodif;
|
||||
}
|
||||
|
||||
public void setFecmodif(Date fecmodif) {
|
||||
this.fecmodif = fecmodif;
|
||||
}
|
||||
public void setFecmodif(Date fecmodif) {
|
||||
this.fecmodif = fecmodif;
|
||||
}
|
||||
|
||||
public Integer getUsuarioId() {
|
||||
return usuarioId;
|
||||
}
|
||||
public Integer getUsuarioId() {
|
||||
return usuarioId;
|
||||
}
|
||||
|
||||
public void setUsuarioId(Integer usuarioId) {
|
||||
this.usuarioId = usuarioId;
|
||||
}
|
||||
|
||||
public void setUsuarioId(Integer usuarioId) {
|
||||
this.usuarioId = usuarioId;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
package com.rjconsultores.ventaboletos.service;
|
||||
|
||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
||||
import com.rjconsultores.ventaboletos.entidad.SeguroTarifa;
|
||||
import java.util.List;
|
||||
|
||||
public interface SeguroTarifaService {
|
||||
|
||||
public interface SeguroTarifaService extends GenericService<SeguroTarifa, Integer>{
|
||||
|
||||
public List<SeguroTarifa> buscarPorOrgao(OrgaoConcedente orgao);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,17 +1,56 @@
|
|||
package com.rjconsultores.ventaboletos.service.impl;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
||||
import com.rjconsultores.ventaboletos.entidad.SeguroTarifa;
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.rjconsultores.ventaboletos.dao.SeguroTarifaDAO;
|
||||
import com.rjconsultores.ventaboletos.service.SeguroTarifaService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
import java.util.Calendar;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service("seguroTarifaService")
|
||||
public class SeguroTarifaServiceImpl implements SeguroTarifaService {
|
||||
|
||||
@Autowired
|
||||
private SeguroTarifaDAO seguroTarifaDAO;
|
||||
|
||||
|
||||
@Autowired
|
||||
private SeguroTarifaDAO seguroTarifaDAO;
|
||||
|
||||
public List<SeguroTarifa> obtenerTodos() {
|
||||
return seguroTarifaDAO.obtenerTodos();
|
||||
}
|
||||
|
||||
public SeguroTarifa obtenerID(Integer id) {
|
||||
return seguroTarifaDAO.obtenerID(id);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public SeguroTarifa suscribir(SeguroTarifa entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
return seguroTarifaDAO.suscribir(entidad);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public SeguroTarifa actualizacion(SeguroTarifa entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
return seguroTarifaDAO.actualizacion(entidad);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void borrar(SeguroTarifa entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
seguroTarifaDAO.borrar(entidad);
|
||||
}
|
||||
|
||||
public List<SeguroTarifa> buscarPorOrgao(OrgaoConcedente orgao) {
|
||||
return seguroTarifaDAO.buscarPorOrgao(orgao);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue