fixes bug#22299
dev: GLEIMAR qua: Silvania git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@108350 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
90b2cd4aae
commit
0b4cc3ef85
|
@ -16,4 +16,6 @@ public interface CategoriaDAO extends GenericDAO<Categoria, Integer> {
|
|||
public List<Categoria> buscar(String desccategoria);
|
||||
|
||||
public List<Categoria> buscarCategoriaPesquisada(String desccategoria);
|
||||
|
||||
public List<String> buscarCategoriaOrgaoConcedente(String orgaoConcedente);
|
||||
}
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
*/
|
||||
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||
|
||||
import com.rjconsultores.ventaboletos.dao.CategoriaDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.Categoria;
|
||||
import java.util.List;
|
||||
|
||||
import org.hibernate.Criteria;
|
||||
import org.hibernate.Query;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.criterion.MatchMode;
|
||||
import org.hibernate.criterion.Order;
|
||||
|
@ -16,6 +16,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.rjconsultores.ventaboletos.dao.CategoriaDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.Categoria;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Administrador
|
||||
|
@ -54,4 +57,23 @@ public class CategoriaHibernateDAO extends GenericHibernateDAO<Categoria, Intege
|
|||
|
||||
return c.list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> buscarCategoriaOrgaoConcedente(String orgaoConcedente) {
|
||||
|
||||
StringBuilder sql = new StringBuilder();
|
||||
|
||||
orgaoConcedente = "'%" + orgaoConcedente + "%'";
|
||||
|
||||
sql.append("SELECT DISTINCT c.desccategoria ");
|
||||
sql.append(" FROM Categoria c ");
|
||||
sql.append(" left join categoria_descuento cd on (c.categoria_id = cd.categoria_id and cd.activo=1 ) ");
|
||||
sql.append(" left join CATEGORIA_ORGAO co on (co.categoriactrl_id = cd.categoriactrl_id and co.activo = 1) ");
|
||||
sql.append(" left join orgao_concedente oc on (co.orgaoconcedente_id = oc.orgaoconcedente_id) ");
|
||||
sql.append(" WHERE oc.descorgao like '%DAER%'");
|
||||
|
||||
Query sq = getSession().createSQLQuery(sql.toString());
|
||||
|
||||
return sq.list();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,8 @@ public interface CategoriaService extends GenericService<Categoria, Integer> {
|
|||
public Categoria buscarUmaCategoria(String desccategoria);
|
||||
|
||||
public List<Categoria> buscarCategoriaPesquisada(String desccategoria);
|
||||
|
||||
public List<Categoria> buscarCategoriaOrgaoConcedente(String orgaoConcedente);
|
||||
|
||||
/**
|
||||
* Hance una búsqueda de todas las categorias que son visibles al usuario Ejemplo de categorias que no son vis
|
||||
|
|
|
@ -97,4 +97,18 @@ public class CategoriaServiceImpl implements CategoriaService {
|
|||
}
|
||||
return categoriaList.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Categoria> buscarCategoriaOrgaoConcedente(String orgaoConcedente) {
|
||||
List<Categoria> listCategorias = new ArrayList<Categoria>();
|
||||
List<String> categoriaList = categoriaDAO.buscarCategoriaOrgaoConcedente(orgaoConcedente);
|
||||
int listSize = categoriaList.size();
|
||||
|
||||
for (int c =0; c<listSize ; c++ ) {
|
||||
Categoria categoriaTemp = buscarUmaCategoria(categoriaList.get(c));
|
||||
listCategorias.add(categoriaTemp);
|
||||
}
|
||||
|
||||
return listCategorias;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue