Open
Conversation
…ceJpa # Conflicts: # src/main/resources/application.properties
adrianbucur83
requested changes
Apr 17, 2024
| private Long totalAmount; | ||
| private LocalDateTime dateTime; | ||
| private String address; | ||
| private boolean orderStatus; |
| private Long orderId; | ||
| private String customerName; | ||
| private Long totalAmount; | ||
| private LocalDateTime dateTime; |
| private String address; | ||
| private boolean orderStatus; | ||
| private String notes; | ||
| private Long userId; |
| return "orders/order"; | ||
| } | ||
|
|
||
| @GetMapping("/statustrue") |
Owner
There was a problem hiding this comment.
/status/{status} <--- pathvariable
| public interface OrderRepository extends JpaRepository<Order, Long> { | ||
|
|
||
| List<Order> findAllByOrderStatusTrue(); | ||
|
|
Owner
There was a problem hiding this comment.
findAllByStatus(String status) (would work if you have a field called status)
| } | ||
|
|
||
| @GetMapping("/new") | ||
| public String createOrder(Model model){ |
| } | ||
|
|
||
| @PostMapping | ||
| public String showOrders(@ModelAttribute("order") OrderDto orderDto){ |
| public String editOrder(@PathVariable("orderId") Long orderId , Model model) { | ||
|
|
||
| Order order = orderService.getOrderById(orderId); | ||
|
|
| @NoArgsConstructor | ||
| public class OrderDto { | ||
|
|
||
| private Long orderId; |
Owner
There was a problem hiding this comment.
Should have separate DTOs for different actions. C R U D <--
| order.setDateTime(orderDto.getDateTime()); | ||
| order.setOrderStatus(orderDto.isOrderStatus()); | ||
| order.setAddress(orderDto.getAddress()); | ||
| order.setNotes(orderDto.getNotes()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Order controler service jpa