main
Last change
on this file was 9dcbf44, checked in by andrejtodorovski <82031894+andrejtodorovski@…>, 23 months ago |
Added full functionality for changing delivery status,
added bootstrap for some pages
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | package com.example.autopartz.service.impl;
|
---|
2 |
|
---|
3 | import com.example.autopartz.model.Delivery;
|
---|
4 | import com.example.autopartz.model.Deliveryman;
|
---|
5 | import com.example.autopartz.model.Order;
|
---|
6 | import com.example.autopartz.repository.DeliveryRepository;
|
---|
7 | import com.example.autopartz.service.DeliveryService;
|
---|
8 | import org.springframework.stereotype.Service;
|
---|
9 |
|
---|
10 | import java.util.List;
|
---|
11 |
|
---|
12 | @Service
|
---|
13 | public class DeliveryServiceImpl implements DeliveryService {
|
---|
14 | private final DeliveryRepository deliveryRepository;
|
---|
15 |
|
---|
16 | public DeliveryServiceImpl(DeliveryRepository deliveryRepository) {
|
---|
17 | this.deliveryRepository = deliveryRepository;
|
---|
18 | }
|
---|
19 |
|
---|
20 | @Override
|
---|
21 | public List<Delivery> findAllByDeliverer(Deliveryman dm) {
|
---|
22 | return deliveryRepository.findAllByDeliveryman(dm);
|
---|
23 | }
|
---|
24 |
|
---|
25 | @Override
|
---|
26 | public Delivery findById(Integer id) {
|
---|
27 | return deliveryRepository.findById(id).get();
|
---|
28 | }
|
---|
29 |
|
---|
30 | @Override
|
---|
31 | public void update(Delivery d) {
|
---|
32 | deliveryRepository.save(d);
|
---|
33 | }
|
---|
34 |
|
---|
35 | @Override
|
---|
36 | public Delivery findByOrder(Order o) {
|
---|
37 | return deliveryRepository.findAllByOrder(o).stream().findFirst().orElseThrow(RuntimeException::new);
|
---|
38 | }
|
---|
39 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.