Pricing - Ocupação / Antecipação
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@32054 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
350f42a11a
commit
7ce6de0cf9
|
@ -15,7 +15,5 @@ import com.rjconsultores.ventaboletos.entidad.PricingOcupaAntecipa;
|
|||
*/
|
||||
public interface PricingOcupaAntecipaDAO extends GenericDAO<PricingOcupaAntecipa, Integer> {
|
||||
|
||||
public Boolean podeSalvar(Pricing pricing, PricingOcupaAntecipa pricingOcupaAntecipa);
|
||||
|
||||
public List<PricingOcupaAntecipa> podeSalvar(Pricing pricing);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ package com.rjconsultores.ventaboletos.dao.hibernate;
|
|||
import java.util.List;
|
||||
|
||||
import org.hibernate.Criteria;
|
||||
import org.hibernate.Query;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.criterion.Restrictions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -38,37 +37,6 @@ public class PricingOcupaAntecipaHibernateDAO extends GenericHibernateDAO<Pricin
|
|||
return c.list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean podeSalvar(Pricing pricing, PricingOcupaAntecipa poa) {
|
||||
|
||||
StringBuilder hql = new StringBuilder();
|
||||
hql.append(" SELECT pv FROM PricingOcupaAntecipa pv ");
|
||||
hql.append(" WHERE pv.activo = :activo ");
|
||||
hql.append(" AND pv.pricing.pricingId = :pricingId ");
|
||||
|
||||
if (poa.getCantasientosmin() != null && poa.getCantasientosmax() != null) {
|
||||
hql.append(" AND (( :cantasientosmin BETWEEN cantasientosmin AND cantasientosmax) ");
|
||||
hql.append(" OR (:cantasientosmax BETWEEN cantasientosmin AND cantasientosmax) ");
|
||||
hql.append(" OR ((cantasientosmin BETWEEN :cantasientosmin AND :cantasientosmax) ");
|
||||
hql.append(" OR (cantasientosmax BETWEEN :cantasientosmin AND :cantasientosmax )))");
|
||||
}
|
||||
|
||||
Query sq = getSession().createQuery(hql.toString());
|
||||
sq.setInteger("activo", Pricing.ATIVO);
|
||||
sq.setInteger("pricingId", pricing.getPricingId());
|
||||
|
||||
if (poa.getCantasientosmin() != null && poa.getCantasientosmax() != null) {
|
||||
sq.setInteger("cantasientosmin", poa.getCantasientosmin());
|
||||
sq.setInteger("cantasientosmax", poa.getCantasientosmax());
|
||||
}
|
||||
|
||||
List ls = sq.list();
|
||||
if (!ls.isEmpty()) {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PricingOcupaAntecipa> podeSalvar(Pricing pricing) {
|
||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||
|
|
|
@ -7,7 +7,5 @@ import com.rjconsultores.ventaboletos.entidad.PricingOcupaAntecipa;
|
|||
|
||||
public interface PricingOcupaAntecipaService extends GenericService<PricingOcupaAntecipa, Integer> {
|
||||
|
||||
public Boolean podeSalvar(Pricing pricing, PricingOcupaAntecipa pricingOcupaAntecipa);
|
||||
|
||||
public List<PricingOcupaAntecipa> obtenerPorPricing(Pricing pricing);
|
||||
}
|
||||
|
|
|
@ -54,11 +54,6 @@ public class PricingOcupaAntecipaServiceImpl implements PricingOcupaAntecipaServ
|
|||
pricingOcupacionDAO.actualizacion(entidad);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean podeSalvar(Pricing pricing, PricingOcupaAntecipa pricingOcupaAntecipa) {
|
||||
return pricingOcupacionDAO.podeSalvar(pricing, pricingOcupaAntecipa);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PricingOcupaAntecipa> obtenerPorPricing(Pricing pricing) {
|
||||
return pricingOcupacionDAO.podeSalvar(pricing);
|
||||
|
|
Loading…
Reference in New Issue