bug#11650
dev:Lucas qua:Wallysson git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@84140 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
568f6db7f6
commit
c85e0579c4
|
@ -0,0 +1,9 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.PricingEspecificoCategoria;
|
||||||
|
|
||||||
|
public interface PricingEspecificoCategoriaDAO extends GenericDAO<PricingEspecificoCategoria, Long> {
|
||||||
|
|
||||||
|
Boolean isDuplicado(PricingEspecificoCategoria entidad);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
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.PricingEspecificoCategoriaDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.PricingEspecificoCategoria;
|
||||||
|
|
||||||
|
@Repository("pricingEspecificoCategoriaDAO")
|
||||||
|
public class PricingEspecificoCategoriaHibernateDAO extends GenericHibernateDAO<PricingEspecificoCategoria, Long> implements PricingEspecificoCategoriaDAO {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public PricingEspecificoCategoriaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||||
|
setSessionFactory(factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public List<PricingEspecificoCategoria> obtenerTodos() {
|
||||||
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
|
|
||||||
|
return c.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean isDuplicado(PricingEspecificoCategoria entidad) {
|
||||||
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
|
c.add(Restrictions.eq("categoria.categoriaId", entidad.getCategoria().getCategoriaId()));
|
||||||
|
|
||||||
|
return c.list().isEmpty();
|
||||||
|
}
|
||||||
|
}
|
|
@ -83,9 +83,6 @@ public class PricingEspecifico implements Serializable, Cloneable {
|
||||||
@JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID")
|
@JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID")
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
private ClaseServicio claseServicio;
|
private ClaseServicio claseServicio;
|
||||||
@JoinColumn(name = "CATEGORIA_ID", referencedColumnName = "CATEGORIA_ID")
|
|
||||||
@ManyToOne
|
|
||||||
private Categoria categoria;
|
|
||||||
@Column(name = "CORRIDA_ID")
|
@Column(name = "CORRIDA_ID")
|
||||||
private Integer corridaId;
|
private Integer corridaId;
|
||||||
@Column(name = "EXIBEVENDA")
|
@Column(name = "EXIBEVENDA")
|
||||||
|
@ -102,6 +99,10 @@ public class PricingEspecifico implements Serializable, Cloneable {
|
||||||
@Where(clause="ACTIVO=1")
|
@Where(clause="ACTIVO=1")
|
||||||
private List<PricingEspecificoCanalVendas> pricingEspecificoCanalVendasList;
|
private List<PricingEspecificoCanalVendas> pricingEspecificoCanalVendasList;
|
||||||
|
|
||||||
|
@OneToMany(mappedBy = "pricingEspecifico", cascade = CascadeType.ALL)
|
||||||
|
@LazyCollection(LazyCollectionOption.FALSE)
|
||||||
|
@Where(clause="ACTIVO=1")
|
||||||
|
private List<PricingEspecificoCategoria> pricingEspecificoCategoriaList;
|
||||||
|
|
||||||
public PricingEspecifico() {
|
public PricingEspecifico() {
|
||||||
}
|
}
|
||||||
|
@ -222,14 +223,6 @@ public class PricingEspecifico implements Serializable, Cloneable {
|
||||||
this.claseServicio = claseServicio;
|
this.claseServicio = claseServicio;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Categoria getCategoria() {
|
|
||||||
return categoria;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCategoria(Categoria categoria) {
|
|
||||||
this.categoria = categoria;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNombPricing() {
|
public String getNombPricing() {
|
||||||
return nombPricing;
|
return nombPricing;
|
||||||
}
|
}
|
||||||
|
@ -288,6 +281,17 @@ public class PricingEspecifico implements Serializable, Cloneable {
|
||||||
this.pricingEspecificoCanalVendasList = pricingEspecificoCanalVendasList;
|
this.pricingEspecificoCanalVendasList = pricingEspecificoCanalVendasList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<PricingEspecificoCategoria> getPricingEspecificoCategoriaList() {
|
||||||
|
if (this.pricingEspecificoCategoriaList == null) {
|
||||||
|
this.pricingEspecificoCategoriaList = new ArrayList<PricingEspecificoCategoria>();
|
||||||
|
}
|
||||||
|
return pricingEspecificoCategoriaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPricingEspecificoCategoriaList(List<PricingEspecificoCategoria> pricingEspecificoCategoriaList) {
|
||||||
|
this.pricingEspecificoCategoriaList = pricingEspecificoCategoriaList;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = 0;
|
int hash = 0;
|
||||||
|
|
|
@ -0,0 +1,145 @@
|
||||||
|
package com.rjconsultores.ventaboletos.entidad;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
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 = "PRICING_ESP_CATEGORIA_SEQ", sequenceName = "PRICING_ESP_CATEGORIA_SEQ", allocationSize = 1)
|
||||||
|
@Table(name = "PRICING_ESPECIFICO_CATEGORIA")
|
||||||
|
public class PricingEspecificoCategoria implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Integer pricingEspecificoCategoriaId;
|
||||||
|
private PricingEspecifico pricingEspecifico;
|
||||||
|
private Categoria categoria;
|
||||||
|
private Boolean activo;
|
||||||
|
private Date fecmodif;
|
||||||
|
private Integer usuarioId;
|
||||||
|
|
||||||
|
public PricingEspecificoCategoria() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public PricingEspecificoCategoria(Categoria categoria, PricingEspecifico pricingEspecifico, Integer usuarioId) {
|
||||||
|
this.pricingEspecifico = pricingEspecifico;
|
||||||
|
this.categoria = categoria;
|
||||||
|
this.usuarioId = usuarioId;
|
||||||
|
this.activo = true;
|
||||||
|
this.fecmodif = new Date();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@Basic(optional = false)
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_ESP_CATEGORIA_SEQ")
|
||||||
|
@Column(name = "PRICINGESPECIFICO_CATEGORIAID")
|
||||||
|
public Integer getPricingEspecificoCategoriaId() {
|
||||||
|
return pricingEspecificoCategoriaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPricingEspecificoCategoriaId(Integer pricingEspecificoCategoriaId) {
|
||||||
|
this.pricingEspecificoCategoriaId = pricingEspecificoCategoriaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JoinColumn(name = "PRICINGESPECIFICO_ID", referencedColumnName = "PRICINGESPECIFICO_ID")
|
||||||
|
@ManyToOne
|
||||||
|
public PricingEspecifico getPricingEspecifico() {
|
||||||
|
return pricingEspecifico;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPricingEspecifico(PricingEspecifico pricingEspecifico) {
|
||||||
|
this.pricingEspecifico = pricingEspecifico;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "CATEGORIA_ID", referencedColumnName = "CATEGORIA_ID")
|
||||||
|
public Categoria getCategoria() {
|
||||||
|
return categoria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCategoria(Categoria categoria) {
|
||||||
|
this.categoria = categoria;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Basic(optional = false)
|
||||||
|
@Column(name = "ACTIVO")
|
||||||
|
public Boolean getActivo() {
|
||||||
|
return activo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActivo(Boolean activo) {
|
||||||
|
this.activo = activo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Basic(optional = false)
|
||||||
|
@Column(name = "FECMODIF")
|
||||||
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
|
public Date getFecmodif() {
|
||||||
|
return fecmodif;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFecmodif(Date fecmodif) {
|
||||||
|
this.fecmodif = fecmodif;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Basic(optional = false)
|
||||||
|
@Column(name = "USUARIO_ID")
|
||||||
|
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 + ((activo == null) ? 0 : activo.hashCode());
|
||||||
|
result = prime * result + ((pricingEspecifico == null) ? 0 : pricingEspecifico.hashCode());
|
||||||
|
result = prime * result + ((categoria == null) ? 0 : categoria.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;
|
||||||
|
PricingEspecificoCategoria other = (PricingEspecificoCategoria) obj;
|
||||||
|
if (activo == null) {
|
||||||
|
if (other.activo != null)
|
||||||
|
return false;
|
||||||
|
} else if (!activo.equals(other.activo))
|
||||||
|
return false;
|
||||||
|
if (pricingEspecifico == null) {
|
||||||
|
if (other.pricingEspecifico != null)
|
||||||
|
return false;
|
||||||
|
} else if (!pricingEspecifico.equals(other.pricingEspecifico))
|
||||||
|
return false;
|
||||||
|
if (categoria == null) {
|
||||||
|
if (other.categoria != null)
|
||||||
|
return false;
|
||||||
|
} else if (!categoria.equals(other.categoria))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
package com.rjconsultores.ventaboletos.service;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.PricingEspecificoCategoria;
|
||||||
|
|
||||||
|
public interface PricingEspecificoCategoriaService extends GenericService<PricingEspecificoCategoria, Long> {
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
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.PricingEspecificoCategoriaDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.PricingEspecificoCategoria;
|
||||||
|
import com.rjconsultores.ventaboletos.service.PricingEspecificoCategoriaService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
|
||||||
|
@Service("pricingEspecificoCategoriaService")
|
||||||
|
public class PricingEspecificoCategoriaServiceImpl implements PricingEspecificoCategoriaService {
|
||||||
|
@Autowired
|
||||||
|
private PricingEspecificoCategoriaDAO pricingEspecificoCategoriaDAO;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PricingEspecificoCategoria> obtenerTodos() {
|
||||||
|
return pricingEspecificoCategoriaDAO.obtenerTodos();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PricingEspecificoCategoria obtenerID(Long id) {
|
||||||
|
return pricingEspecificoCategoriaDAO.obtenerID(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public PricingEspecificoCategoria suscribir(PricingEspecificoCategoria entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setActivo(Boolean.TRUE);
|
||||||
|
|
||||||
|
return pricingEspecificoCategoriaDAO.suscribir(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public PricingEspecificoCategoria actualizacion(PricingEspecificoCategoria entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
|
||||||
|
return pricingEspecificoCategoriaDAO.actualizacion(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void borrar(PricingEspecificoCategoria entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.FALSE);
|
||||||
|
|
||||||
|
pricingEspecificoCategoriaDAO.actualizacion(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -85,7 +85,6 @@ public class PricingEspecificoServiceImpl implements PricingEspecificoService {
|
||||||
PricingEspecifico clonePricing = new PricingEspecifico();
|
PricingEspecifico clonePricing = new PricingEspecifico();
|
||||||
|
|
||||||
clonePricing.setNombPricing(nome);
|
clonePricing.setNombPricing(nome);
|
||||||
clonePricing.setCategoria(pricingToClone.getCategoria());
|
|
||||||
clonePricing.setClaseServicio(pricingToClone.getClaseServicio());
|
clonePricing.setClaseServicio(pricingToClone.getClaseServicio());
|
||||||
clonePricing.setCorridaId(pricingToClone.getCorridaId());
|
clonePricing.setCorridaId(pricingToClone.getCorridaId());
|
||||||
clonePricing.setFechorfin(pricingToClone.getFechorfin());
|
clonePricing.setFechorfin(pricingToClone.getFechorfin());
|
||||||
|
|
Loading…
Reference in New Issue