fixes bug #7672
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@57783 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
b9c722d7b6
commit
64c0c7ed63
|
@ -223,6 +223,26 @@ public class TarifaHibernateDAO extends GenericHibernateDAO<Tarifa, Integer> imp
|
|||
+ "INNER JOIN MARCA marca ON marca.MARCA_ID = tarifa.MARCA_ID "
|
||||
+ "WHERE tarifa.ACTIVO = 1 AND VIGENCIATARIFA_ID = :VIGENCIATARIFAIDORIGEM");
|
||||
|
||||
if (!excluirTarifasDestino) {
|
||||
sQuery.append(" AND NOT EXISTS(SELECT"
|
||||
+ " tDestino.TRAMO_ID,"
|
||||
+ " tDestino.MARCA_ID,"
|
||||
+ " tDestino.CLASESERVICIO_ID,"
|
||||
+ " tDestino.MONEDA_ID,"
|
||||
+ " tDestino.ORGAOCONCEDENTE_ID,"
|
||||
+ " tDestino.RUTA_ID"
|
||||
+ " FROM TARIFA tDestino"
|
||||
+ " WHERE"
|
||||
+ " tDestino.TRAMO_ID = tarifa.TRAMO_ID"
|
||||
+ " AND tDestino.MARCA_ID = tarifa.MARCA_ID"
|
||||
+ " AND tDestino.CLASESERVICIO_ID = tarifa.CLASESERVICIO_ID"
|
||||
+ " AND tDestino.MONEDA_ID = tarifa.MONEDA_ID"
|
||||
+ " AND tDestino.ORGAOCONCEDENTE_ID = tarifa.ORGAOCONCEDENTE_ID"
|
||||
+ " AND tDestino.RUTA_ID = tarifa.RUTA_ID"
|
||||
+ " AND tdestino.ACTIVO = 1"
|
||||
+ " AND VIGENCIATARIFA_ID = :VIGENCIATARIFAIDDESTINO)");
|
||||
}
|
||||
|
||||
if (empresa != null) {
|
||||
sQuery.append(" AND marca.EMPRESA_ID = :EMPRESA_ID");
|
||||
}
|
||||
|
@ -254,62 +274,62 @@ public class TarifaHibernateDAO extends GenericHibernateDAO<Tarifa, Integer> imp
|
|||
|
||||
@Override
|
||||
public void excluirTodasTarifas(Moneda moneda, Marca marca, ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa, Parada origem,
|
||||
Parada destino, Categoria categoria, TipoPuntoVenta tipoPuntoVenta, Ruta ruta, Via via){
|
||||
Parada destino, Categoria categoria, TipoPuntoVenta tipoPuntoVenta, Ruta ruta, Via via) {
|
||||
StringBuilder hql = new StringBuilder();
|
||||
hql.append(" update Tarifa set activo = 0 where tarifaId in (");
|
||||
hql.append(" select t.tarifaId from Tarifa t " );
|
||||
hql.append(" select t.tarifaId from Tarifa t ");
|
||||
|
||||
if(categoria == null && tipoPuntoVenta == null){
|
||||
if (categoria == null && tipoPuntoVenta == null) {
|
||||
hql.append(" where 0 = 0 ");
|
||||
}
|
||||
|
||||
if(categoria != null){
|
||||
hql.append(" inner join t.lsTarifaCategoria as tarifascategoria " );
|
||||
if (categoria != null) {
|
||||
hql.append(" inner join t.lsTarifaCategoria as tarifascategoria ");
|
||||
hql.append(" where 0 = 0 and tarifascategoria.categoria.categoriaId = " + categoria.getCategoriaId());
|
||||
}
|
||||
|
||||
if(tipoPuntoVenta != null){
|
||||
hql.append(" inner join t.lsTarifaTipoptovta as tarifastipoptovta " );
|
||||
if(categoria == null){
|
||||
if (tipoPuntoVenta != null) {
|
||||
hql.append(" inner join t.lsTarifaTipoptovta as tarifastipoptovta ");
|
||||
if (categoria == null) {
|
||||
hql.append(" where 0 = 0 and tarifastipoptovta.tipoPuntoVenta.tipoptovtaId = " + tipoPuntoVenta.getTipoptovtaId());
|
||||
}else{
|
||||
} else {
|
||||
hql.append(" and tarifastipoptovta.tipoPuntoVenta.tipoptovtaId = " + tipoPuntoVenta.getTipoptovtaId());
|
||||
}
|
||||
}
|
||||
|
||||
if(moneda != null){
|
||||
if (moneda != null) {
|
||||
hql.append(" and t.moneda.monedaId = " + moneda.getMonedaId());
|
||||
}
|
||||
|
||||
if(marca != null){
|
||||
if (marca != null) {
|
||||
hql.append(" and t.marca.marcaId = " + marca.getMarcaId());
|
||||
}
|
||||
|
||||
if(claseServicio != null){
|
||||
if (claseServicio != null) {
|
||||
hql.append(" and t.claseServicio.claseservicioId = " + claseServicio.getClaseservicioId());
|
||||
}
|
||||
|
||||
if(vigenciaTarifa != null){
|
||||
if (vigenciaTarifa != null) {
|
||||
hql.append(" and t.vigenciaTarifa.vigenciatarifaId = " + vigenciaTarifa.getVigenciatarifaId());
|
||||
}
|
||||
|
||||
if(origem != null){
|
||||
if (origem != null) {
|
||||
hql.append(" and t.origen.paradaId = " + origem.getParadaId());
|
||||
}
|
||||
|
||||
if(destino != null){
|
||||
if (destino != null) {
|
||||
hql.append(" and t.destino.paradaId = " + destino.getParadaId());
|
||||
}
|
||||
|
||||
if(ruta != null){
|
||||
if (ruta != null) {
|
||||
hql.append(" and t.ruta.rutaId = " + ruta.getRutaId());
|
||||
}
|
||||
|
||||
if(via != null){
|
||||
if (via != null) {
|
||||
hql.append(" and t.via.viaId = " + via.getViaId());
|
||||
}
|
||||
|
||||
hql.append(")") ;
|
||||
hql.append(")");
|
||||
|
||||
Query sq = getSession().createQuery(hql.toString());
|
||||
sq.executeUpdate();
|
||||
|
|
Loading…
Reference in New Issue