Go to most recent revision | Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 623 | blopes | 1 | package br.com.ec.repository.jpa; |
| 2 | |||
| 3 | import java.util.List; |
||
| 4 | |||
| 5 | import org.springframework.stereotype.Repository; |
||
| 6 | |||
| 7 | import br.com.ec.domain.dto.PosVendaDTO; |
||
| 8 | import br.com.ec.domain.model.PosVenda; |
||
| 9 | import br.com.ec.repository.PosVendaRepository; |
||
| 10 | import br.com.ec.repository.SistemaAbstractRepository; |
||
| 11 | |||
| 12 | @Repository |
||
| 13 | public class PosVendaRepositoryJpaImpl extends SistemaAbstractRepository<PosVenda> implements PosVendaRepository { |
||
| 14 | |||
| 15 | @Override |
||
| 16 | protected String getColunaOrdenadora() { |
||
| 17 | return "dataCadastro DESC"; |
||
| 18 | } |
||
| 19 | |||
| 20 | @Override |
||
| 21 | public List<PosVendaDTO> consultarNaoFinalizadas() { |
||
| 22 | StringBuilder jpql = new StringBuilder(); |
||
| 23 | jpql.append("SELECT new br.com.ec.domain.dto.PosVendaDTO("); |
||
| 24 | jpql.append(PosVendaDTO.CONSULTA_DTO_SIMPLES); |
||
| 25 | jpql.append(") FROM PosVenda e "); |
||
| 26 | jpql.append("WHERE e.dataFinalizacao IS NULL "); |
||
| 27 | try { |
||
| 28 | return getEntityManager().createQuery(jpql.toString(), PosVendaDTO.class).getResultList(); |
||
| 29 | } catch(Exception ex) { |
||
| 30 | ex.printStackTrace(); |
||
| 31 | return null; |
||
| 32 | } |
||
| 33 | /* |
||
| 34 | StringBuilder jpql = new StringBuilder(); |
||
| 35 | try { |
||
| 36 | jpql.append("SELECT e FROM Transferencia e "); |
||
| 37 | // jpql.append("LEFT JOIN FETCH t.listaProdutos p "); |
||
| 38 | jpql.append("WHERE e.lojaSaida.sequencial = :sequencialLojaSaida "); |
||
| 39 | jpql.append("AND e.lojaEntrada.sequencial = :sequencialLojaEntrada "); |
||
| 40 | jpql.append("AND e.dataFinalizacao is null "); |
||
| 41 | jpql.append("AND e.conferido is false "); |
||
| 42 | return getEntityManager().createQuery(jpql.toString(), Transferencia.class) |
||
| 43 | .setParameter("sequencialLojaSaida", transferencia.getSequencialDaLojaSaida()) |
||
| 44 | .setParameter("sequencialLojaEntrada", transferencia.getSequencialDaLojaEntrada()) |
||
| 45 | .getResultList(); |
||
| 46 | } catch (NoResultException e) { |
||
| 47 | return null; |
||
| 48 | } |
||
| 49 | */ |
||
| 50 | } |
||
| 51 | |||
| 52 | } |