47 lines
1.5 KiB
Plaintext
Executable File
47 lines
1.5 KiB
Plaintext
Executable File
package com.fp.viaticos.rules.query.destino;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
import javax.persistence.Query;
|
|
|
|
import com.fp.bpm.query.QueryJsf;
|
|
import com.fp.dto.query.DtoQuery;
|
|
import com.fp.persistence.commondb.PersistenceHelper;
|
|
import com.fp.persistence.pviaticos.hra.Empleado;
|
|
|
|
public class DestinoQuery extends QueryJsf{
|
|
|
|
/**
|
|
* Consulta para obtener todas los destinos
|
|
*/
|
|
private static String SQL = "select t.COD_DESTINO, t.NOM_dESTINO, t.USU_AUD_LUGARES, t.FEC_AUD_LUGARES, t.STS_DESTINO from SCA.SCP_DESTINO t";
|
|
|
|
/**
|
|
* Método que obtiene los destinos segun los filtros enviados
|
|
* @param dtoquery Objeto DtoQuery
|
|
* @return list
|
|
* @throws Exception
|
|
*/
|
|
@SuppressWarnings("unchecked")
|
|
public List<Object[]> find(DtoQuery dtoquery) throws Exception{
|
|
super.buildCriteria(dtoquery);
|
|
Query qry = PersistenceHelper.getEntityManager().createNativeQuery(DestinoQuery.SQL + (super.where == null ? "" : super.where.toString()) );
|
|
super.setParameters(dtoquery, qry);
|
|
return qry.getResultList();
|
|
}
|
|
|
|
/**
|
|
* Entrega el destino
|
|
* @param codDestino Codigo destino
|
|
* @return obj Object[]
|
|
*/
|
|
public Object find(String codDestino)throws Exception{
|
|
Query qry = PersistenceHelper.getEntityManager().createNativeQuery(DestinoQuery.SQL + " WHERE t.COD_DESTINO = :CODDESTINO");
|
|
qry.setParameter("CODDESTINO", codDestino);
|
|
Object obj = qry.getSingleResult();
|
|
return obj;
|
|
}
|
|
}
|