-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
43d0eab
commit 19dac09
Showing
15 changed files
with
220 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
20 changes: 20 additions & 0 deletions
20
src/main/java/org/ecommerce/spring/boot/vegetable/project/entity/OrderItem.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.ecommerce.spring.boot.vegetable.project.entity; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Builder | ||
public class OrderItem { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
private Long productId; | ||
private int quantity; | ||
} |
9 changes: 9 additions & 0 deletions
9
...main/java/org/ecommerce/spring/boot/vegetable/project/repository/OrderItemRepository.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.ecommerce.spring.boot.vegetable.project.repository; | ||
|
||
import org.ecommerce.spring.boot.vegetable.project.entity.OrderItem; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface OrderItemRepository extends JpaRepository<OrderItem, Long> { | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/org/ecommerce/spring/boot/vegetable/project/repository/OrderRepository.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.ecommerce.spring.boot.vegetable.project.repository; | ||
|
||
import org.ecommerce.spring.boot.vegetable.project.entity.Order; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface OrderRepository extends JpaRepository<Order, Long> { | ||
|
||
@Query( | ||
value = "SELECT * FROM Order where status = 'not yet' AND user_id = :userId", | ||
nativeQuery = true | ||
) | ||
Order findOrderByUserIdAndStatusNotYet(@Param("userId") Long userId); | ||
} |
4 changes: 4 additions & 0 deletions
4
src/main/java/org/ecommerce/spring/boot/vegetable/project/service/OrderItemService.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package org.ecommerce.spring.boot.vegetable.project.service; | ||
|
||
public interface OrderItemService { | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/org/ecommerce/spring/boot/vegetable/project/service/OrderService.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org.ecommerce.spring.boot.vegetable.project.service; | ||
|
||
import org.ecommerce.spring.boot.vegetable.project.entity.Order; | ||
|
||
public interface OrderService { | ||
Order findOderNotYetByUserId(Long userId); | ||
} |
This file contains 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
8 changes: 8 additions & 0 deletions
8
...va/org/ecommerce/spring/boot/vegetable/project/service/implement/OrderItemServiceImp.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.ecommerce.spring.boot.vegetable.project.service.implement; | ||
|
||
import org.ecommerce.spring.boot.vegetable.project.service.OrderItemService; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class OrderItemServiceImp implements OrderItemService { | ||
} |
20 changes: 20 additions & 0 deletions
20
...n/java/org/ecommerce/spring/boot/vegetable/project/service/implement/OrderServiceImp.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.ecommerce.spring.boot.vegetable.project.service.implement; | ||
|
||
import org.ecommerce.spring.boot.vegetable.project.entity.Order; | ||
import org.ecommerce.spring.boot.vegetable.project.repository.OrderRepository; | ||
import org.ecommerce.spring.boot.vegetable.project.service.OrderService; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class OrderServiceImp implements OrderService { | ||
|
||
@Autowired | ||
private OrderRepository orderRepository; | ||
|
||
@Override | ||
public Order findOderNotYetByUserId(Long userId) { | ||
Order order = orderRepository.findOrderByUserIdAndStatusNotYet(userId); | ||
return order; | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" th:lang="en" xmlns:th="http://www.thymeleaf.org"> | ||
<head> | ||
<meta content="text/html; charset=utf-8" /> | ||
<title>Shopping Cart</title> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.min.css"> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" | ||
rel="stylesheet" | ||
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous"> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" | ||
integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" | ||
crossorigin="anonymous"></script> | ||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> | ||
<script th:src="@{/js/home.js}"></script> | ||
<link rel="stylesheet" th:href="@{/css/header.css}"> | ||
<link rel="stylesheet" th:href="@{/css/home.css}"> | ||
<link rel="stylesheet" th:href="@{/css/page_title_img.css}"> | ||
<link rel="stylesheet" th:href="@{/css/footer.css}"> | ||
<link rel="stylesheet" th:href="@{/css/shop.css}"> | ||
<link rel="stylesheet" th:href="@{/css/productDetail.css}"> | ||
<body> | ||
<div th:insert="fragments/fragments :: header"></div> | ||
<div class="container col-9 search-content"> | ||
<div th:insert="home :: header-search-bar"></div> | ||
</div> | ||
<div th:insert="fragments/fragments :: page-title-image"></div> | ||
|
||
</body> | ||
</html> |