bug#21146
dev: Valvevir qua: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@104610 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
ad2fb715e1
commit
ad74231d0c
|
@ -13,4 +13,6 @@ import com.rjconsultores.ventaboletos.entidad.CategoriaDescuento;
|
||||||
public interface CategoriaDescuentoDAO extends GenericDAO<CategoriaDescuento, Integer> {
|
public interface CategoriaDescuentoDAO extends GenericDAO<CategoriaDescuento, Integer> {
|
||||||
|
|
||||||
public CategoriaDescuento pesquisarPorCategoriaEmpresa(Integer categoriaId, Integer empresaId);
|
public CategoriaDescuento pesquisarPorCategoriaEmpresa(Integer categoriaId, Integer empresaId);
|
||||||
|
|
||||||
|
public boolean isAplicaTarifaMinima(Integer categoriaId, Integer empresaId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,16 +4,20 @@
|
||||||
*/
|
*/
|
||||||
package com.rjconsultores.ventaboletos.dao.hibernate;
|
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.dao.CategoriaDescuentoDAO;
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.CategoriaDescuento;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.hibernate.Criteria;
|
import org.hibernate.Criteria;
|
||||||
|
import org.hibernate.Query;
|
||||||
import org.hibernate.SessionFactory;
|
import org.hibernate.SessionFactory;
|
||||||
import org.hibernate.criterion.Restrictions;
|
import org.hibernate.criterion.Restrictions;
|
||||||
|
import org.hibernate.type.BooleanType;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.dao.CategoriaDescuentoDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.CategoriaDescuento;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Administrador
|
* @author Administrador
|
||||||
|
@ -48,4 +52,29 @@ public class CategoriaDescuentoHibernateDAO
|
||||||
|
|
||||||
return (CategoriaDescuento) c.uniqueResult();
|
return (CategoriaDescuento) c.uniqueResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAplicaTarifaMinima(Integer categoriaId, Integer empresaId) {
|
||||||
|
|
||||||
|
StringBuilder sql = new StringBuilder();
|
||||||
|
|
||||||
|
sql.append(" SELECT cd.indnaoaplicatarifaminima as tarifa ");
|
||||||
|
sql.append(" from categoria_descuento cd ");
|
||||||
|
sql.append(" inner join categoria_ctrl cc ");
|
||||||
|
sql.append(" on cc.categoriactrl_id = cd.categoriactrl_id ");
|
||||||
|
sql.append(" and cc.empresa_id = :empresaId ");
|
||||||
|
sql.append(" and cc.activo = 1 ");
|
||||||
|
sql.append(" where cd.categoria_id = :categoriaId ");
|
||||||
|
sql.append(" and cd.activo = 1 ");
|
||||||
|
|
||||||
|
Query query = getSession().createSQLQuery(sql.toString())
|
||||||
|
.addScalar("tarifa", BooleanType.INSTANCE);
|
||||||
|
|
||||||
|
query.setParameter("empresaId", empresaId );
|
||||||
|
query.setParameter("categoriaId", categoriaId );
|
||||||
|
|
||||||
|
Boolean retorno = (Boolean)query.uniqueResult();
|
||||||
|
|
||||||
|
return Boolean.FALSE.equals(retorno);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue