fixes bug#21146
dev: Valvevir qua: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@104574 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
5a04dc778c
commit
f059fe5966
|
@ -21,6 +21,10 @@ import org.hibernate.SessionFactory;
|
||||||
import org.hibernate.criterion.Order;
|
import org.hibernate.criterion.Order;
|
||||||
import org.hibernate.criterion.Projections;
|
import org.hibernate.criterion.Projections;
|
||||||
import org.hibernate.criterion.Restrictions;
|
import org.hibernate.criterion.Restrictions;
|
||||||
|
import org.hibernate.transform.Transformers;
|
||||||
|
import org.hibernate.type.BooleanType;
|
||||||
|
import org.hibernate.type.IntegerType;
|
||||||
|
import org.hibernate.type.StringType;
|
||||||
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;
|
||||||
|
@ -935,8 +939,49 @@ public class CorridaHibernateDAO extends GenericHibernateDAO<Corrida, Corrida.Id
|
||||||
@Override
|
@Override
|
||||||
public CorridaVO buscarVOPorId(Id corridaId){
|
public CorridaVO buscarVOPorId(Id corridaId){
|
||||||
|
|
||||||
Corrida co = buscarPorId(corridaId);
|
StringBuilder sb = new StringBuilder();
|
||||||
return new CorridaVO( co );
|
sb.append(" select ");
|
||||||
|
sb.append(" c.corrida_id as corridaId, ");
|
||||||
|
sb.append(" to_char(c.feccorrida, 'dd/MM/yyyy') as feccorrida, ");
|
||||||
|
sb.append(" c.corrida_id as numCorrida, ");
|
||||||
|
sb.append(" to_char(c.fechorsalida, 'dd/MM/yyyy HH24:mi:ss')||'.000' as fechorsalida, ");
|
||||||
|
sb.append(" c.origen_id as origenId, ");
|
||||||
|
sb.append(" c.destino_id as destinoId, ");
|
||||||
|
sb.append(" c.tiposervicio_id as tipoServicioId, ");
|
||||||
|
sb.append(" c.roloperativo_id as rolOperativoId, ");
|
||||||
|
sb.append(" c.claseservicio_id as claseServicioId, ");
|
||||||
|
sb.append(" c.empresacorrida_id as empresaId, ");
|
||||||
|
sb.append(" mar.marca_id as marcaId, ");
|
||||||
|
sb.append(" emp.indtabelaprecoembarcada as tarifaEmbarcada, ");
|
||||||
|
sb.append(" c.ruta_id as rutaId ");
|
||||||
|
sb.append(" from corrida c ");
|
||||||
|
sb.append(" JOIN empresa emp ON emp.empresa_id = c.empresacorrida_id ");
|
||||||
|
sb.append(" JOIN marca mar ON mar.empresa_id = emp.empresa_id ");
|
||||||
|
sb.append(" AND mar.activo = 1 ");
|
||||||
|
sb.append(" where c.activo = 1 ");
|
||||||
|
sb.append(" and C.CORRIDA_ID = :corridaId ");
|
||||||
|
sb.append(" and C.FECCORRIDA = :feccorrida ");
|
||||||
|
|
||||||
|
Query query = getSession().createSQLQuery(sb.toString())
|
||||||
|
.addScalar("corridaId", IntegerType.INSTANCE)
|
||||||
|
.addScalar("feccorrida", StringType.INSTANCE)
|
||||||
|
.addScalar("numCorrida", IntegerType.INSTANCE)
|
||||||
|
.addScalar("fechorsalida", StringType.INSTANCE)
|
||||||
|
.addScalar("origenId", IntegerType.INSTANCE)
|
||||||
|
.addScalar("destinoId", IntegerType.INSTANCE)
|
||||||
|
.addScalar("tipoServicioId", IntegerType.INSTANCE)
|
||||||
|
.addScalar("rolOperativoId", IntegerType.INSTANCE)
|
||||||
|
.addScalar("claseServicioId", IntegerType.INSTANCE)
|
||||||
|
.addScalar("empresaId", IntegerType.INSTANCE)
|
||||||
|
.addScalar("marcaId", IntegerType.INSTANCE)
|
||||||
|
.addScalar("tarifaEmbarcada", BooleanType.INSTANCE)
|
||||||
|
.addScalar("rutaId", IntegerType.INSTANCE)
|
||||||
|
.setResultTransformer(Transformers.aliasToBean(CorridaVO.class));
|
||||||
|
|
||||||
|
query.setParameter("corridaId", corridaId.getCorridaId());
|
||||||
|
query.setParameter("feccorrida", corridaId.getFeccorrida());
|
||||||
|
|
||||||
|
return (CorridaVO)query.uniqueResult();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue