Rev 623 | Details | Compare with Previous | 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 | |||
| 35 | } |