fixes bug#al-1099
qua: dev:Gleisson git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@114479 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
c4893b9be6
commit
a53f5f12c7
|
@ -1,5 +1,7 @@
|
|||
package com.rjconsultores.ventaboletos.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.ConfRestricaoCanalVenta;
|
||||
|
||||
public interface ConfRestricaoCanalVentaDAO{
|
||||
|
@ -13,4 +15,6 @@ public interface ConfRestricaoCanalVentaDAO{
|
|||
public void borrar(ConfRestricaoCanalVenta entidad);
|
||||
|
||||
public Long count(String campo, Object o);
|
||||
|
||||
public Boolean inativarListConfRestricaoCanalVenta(List<Integer> idsConfRestricaoCanalVenta, Integer usuarioId);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.hibernate.Query;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
|
@ -15,4 +19,24 @@ public class ConfRestricaoCanalVentaHibernateDAO extends GenericHibernateDAO<Con
|
|||
public ConfRestricaoCanalVentaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||
setSessionFactory(factory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean inativarListConfRestricaoCanalVenta(List<Integer> idsConfRestricaoCanalVenta, Integer usuarioId) {
|
||||
if(idsConfRestricaoCanalVenta.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(" UPDATE ConfRestricaoCanalVenta SET activo=0, ");
|
||||
sb.append(" usuarioId=:usuarioId, ");
|
||||
sb.append(" fecmodif=:data" );
|
||||
sb.append(" where confRestricaoCanalVentaId in (");
|
||||
sb.append(idsConfRestricaoCanalVenta.toString().substring(1, idsConfRestricaoCanalVenta.toString().length() - 1)).append(" ) ");
|
||||
Query queryConfRestricaoCanalVenta = getSession().createQuery(sb.toString());
|
||||
queryConfRestricaoCanalVenta.setInteger("usuarioId", usuarioId);
|
||||
queryConfRestricaoCanalVenta.setDate("data", new Date());
|
||||
|
||||
return queryConfRestricaoCanalVenta.executeUpdate()>1?true:false;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.rjconsultores.ventaboletos.service;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.ConfRestricaoCanalVenta;
|
||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||
|
||||
|
@ -10,5 +12,8 @@ public interface ConfRestricaoCanalVentaService{
|
|||
public void borrar(ConfRestricaoCanalVenta entidad);
|
||||
|
||||
public ConfRestricaoCanalVenta suscribirActualizar(ConfRestricaoCanalVenta entidad) throws BusinessException;
|
||||
|
||||
public void borrarList(Set<ConfRestricaoCanalVenta> confRestricaoCanalVentaSelecionadas);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.rjconsultores.ventaboletos.service.impl;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -47,6 +48,22 @@ public class ConfRestricaoCanalVentaServiceImpl implements ConfRestricaoCanalVen
|
|||
confRestricaoCanalVentaDAO.actualizacion(entidad);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void borrarList(Set<ConfRestricaoCanalVenta> confRestricaoCanalVentaSelecionadas) {
|
||||
List<Integer> listConfRestricaoCanalVentaIds =retornarListConfRestricaoCanalVentaIds(confRestricaoCanalVentaSelecionadas);
|
||||
confRestricaoCanalVentaDAO.inativarListConfRestricaoCanalVenta(listConfRestricaoCanalVentaIds, UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
}
|
||||
|
||||
|
||||
private List<Integer> retornarListConfRestricaoCanalVentaIds(Set<ConfRestricaoCanalVenta> ConfRestricaoCanalVentaSelecionadas) {
|
||||
List<Integer> listConfRestricaoCanalVentaIds = new ArrayList<Integer>();
|
||||
for (ConfRestricaoCanalVenta c : ConfRestricaoCanalVentaSelecionadas) {
|
||||
listConfRestricaoCanalVentaIds.add(c.getConfRestricaoCanalVentaId().intValue());
|
||||
}
|
||||
return listConfRestricaoCanalVentaIds;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private boolean isBloqueoExistente(ConfRestricaoCanalVenta c , List<ConfRestricaoCanalVenta> confRestricaoCanalVentaList){
|
||||
|
||||
|
|
Loading…
Reference in New Issue