diff --git a/src/com/rjconsultores/ventaboletos/dao/PtovtaContaMDDAO.java b/src/com/rjconsultores/ventaboletos/dao/PtovtaContaMDDAO.java new file mode 100644 index 000000000..0a844f08d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PtovtaContaMDDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.PtovtaContaMD; + +public interface PtovtaContaMDDAO extends GenericDAO { + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaContaMDHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaContaMDHibernateDAO.java new file mode 100644 index 000000000..0c66aba7e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaContaMDHibernateDAO.java @@ -0,0 +1,33 @@ +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.PtovtaContaMDDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaContaMD; + +@Repository("PtovtaContaMDDAO") +public class PtovtaContaMDHibernateDAO extends GenericHibernateDAO implements PtovtaContaMDDAO { + + + @Autowired + public PtovtaContaMDHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ContaMD.java b/src/com/rjconsultores/ventaboletos/entidad/ContaMD.java index 656f34254..4c8df10e5 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/ContaMD.java +++ b/src/com/rjconsultores/ventaboletos/entidad/ContaMD.java @@ -177,6 +177,6 @@ public class ContaMD implements Serializable { @Override public String toString() { - return "ContaMD [contaId=" + contaId + ", nome=" + nome + ", tipo=" + tipo + ", codigoContabil=" + codigoContabil + ", docAssociado=" + docAssociado + ", cancelamento=" + cancelamento + ", status=" + status + ", origem=" + origem + ", referencia=" + referencia + ", fecmodif=" + fecmodif + ", usuarioId=" + usuarioId + ", activo=" + activo + "]"; + return getNome(); } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaContaMD.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaContaMD.java new file mode 100644 index 000000000..98bc57cd8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaContaMD.java @@ -0,0 +1,126 @@ +package com.rjconsultores.ventaboletos.entidad; + +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.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "PTOVTACONTA_SEQ", sequenceName = "PTOVTACONTA_SEQ", allocationSize = 1) +@Table(name = "PTOVTA_CONTA") +public class PtovtaContaMD { + + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PTOVTACONTA_SEQ") + @Column(name = "PTOVTACONTA_ID") + private Integer ptovtaContaId; + + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresaId; + + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoventaId; + + @JoinColumn(name = "CONTA_ID", referencedColumnName = "CONTA_ID") + @ManyToOne + private ContaMD contaId; + + @Column(name = "PERCENTUAL") + private BigDecimal percentual; + + @Column(name = "USUARIO_ID") + private int usuarioId; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "ACTIVO") + private Boolean activo; + + public Integer getPtovtaContaId() { + return ptovtaContaId; + } + + public void setPtovtaContaId(Integer ptovtaContaId) { + this.ptovtaContaId = ptovtaContaId; + } + + public Empresa getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(Empresa empresaId) { + this.empresaId = empresaId; + } + + public PuntoVenta getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(PuntoVenta puntoventaId) { + this.puntoventaId = puntoventaId; + } + + public ContaMD getContaId() { + return contaId; + } + + public void setContaId(ContaMD contaId) { + this.contaId = contaId; + } + + public BigDecimal getPercentual() { + return percentual; + } + + public void setPercentual(BigDecimal percentual) { + this.percentual = percentual; + } + + public int getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(int usuarioId) { + this.usuarioId = usuarioId; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Override + public String toString() { + return "PtovtaConta [ptovtaContaId=" + ptovtaContaId + ", empresaId=" + empresaId + ", puntoventaId=" + puntoventaId + ", contaId=" + contaId + ", percentual=" + percentual + ", usuarioId=" + usuarioId + ", fecmodif=" + fecmodif + ", activo=" + activo + "]"; + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/PtovtaContaMDService.java b/src/com/rjconsultores/ventaboletos/service/PtovtaContaMDService.java new file mode 100644 index 000000000..48a78d42c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PtovtaContaMDService.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.PtovtaContaMD; + +public interface PtovtaContaMDService extends GenericService { + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PtovtaContaMDServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaContaMDServiceImpl.java new file mode 100644 index 000000000..8f9d47254 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaContaMDServiceImpl.java @@ -0,0 +1,47 @@ +package com.rjconsultores.ventaboletos.service.impl; + +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.PtovtaContaMDDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaContaMD; +import com.rjconsultores.ventaboletos.service.PtovtaContaMDService; + +@Service("PtovtaContaMDService") +public class PtovtaContaMDServiceImpl implements PtovtaContaMDService { + + @Autowired + private PtovtaContaMDDAO ptovtaContaMDDAO; + + @Override + public List obtenerTodos() { + return ptovtaContaMDDAO.obtenerTodos(); + } + + @Override + public PtovtaContaMD obtenerID(Long id) { + return ptovtaContaMDDAO.obtenerID(id); + } + + @Transactional + @Override + public PtovtaContaMD suscribir(PtovtaContaMD entidad) { + return ptovtaContaMDDAO.suscribir(entidad); + } + + @Transactional + @Override + public PtovtaContaMD actualizacion(PtovtaContaMD entidad) { + return ptovtaContaMDDAO.actualizacion(entidad); + } + + @Transactional + @Override + public void borrar(PtovtaContaMD entidad) { + ptovtaContaMDDAO.borrar(entidad); + } + +}