54
This commit is contained in:
parent
c24dace777
commit
cc1a023999
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
data.mv.db
BIN
data.mv.db
Binary file not shown.
@ -23,7 +23,7 @@ public class OrderEntity extends BaseEntity {
|
|||||||
@JoinColumn()
|
@JoinColumn()
|
||||||
private UserEntity user;
|
private UserEntity user;
|
||||||
@JsonManagedReference
|
@JsonManagedReference
|
||||||
@OneToMany(fetch = FetchType.EAGER)
|
@OneToMany
|
||||||
private final List<OrderLineEntity> lines = new ArrayList<>();
|
private final List<OrderLineEntity> lines = new ArrayList<>();
|
||||||
private Double totalPrice;
|
private Double totalPrice;
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ public class OrderService {
|
|||||||
return repository.findAll();
|
return repository.findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(readOnly = true)
|
||||||
public OrderEntity get(Long id) {
|
public OrderEntity get(Long id) {
|
||||||
return repository.findById(id)
|
return repository.findById(id)
|
||||||
.orElseThrow(() -> new NotFoundException(OrderEntity.class, id));
|
.orElseThrow(() -> new NotFoundException(OrderEntity.class, id));
|
||||||
@ -41,6 +42,7 @@ public class OrderService {
|
|||||||
return repository.save(entity);
|
return repository.save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
public OrderEntity update(Long id, OrderEntity entity) {
|
public OrderEntity update(Long id, OrderEntity entity) {
|
||||||
final OrderEntity existEntity = get(id);
|
final OrderEntity existEntity = get(id);
|
||||||
existEntity.setUser(entity.getUser());
|
existEntity.setUser(entity.getUser());
|
||||||
@ -54,6 +56,7 @@ public class OrderService {
|
|||||||
return repository.save(existEntity);
|
return repository.save(existEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
public OrderEntity delete(Long id) {
|
public OrderEntity delete(Long id) {
|
||||||
final OrderEntity existsEntity = get(id);
|
final OrderEntity existsEntity = get(id);
|
||||||
repository.delete(existsEntity);
|
repository.delete(existsEntity);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user