From 7d9abe0d0eb8b184acbde621ce90446d515c232f Mon Sep 17 00:00:00 2001 From: ahah525 Date: Wed, 26 Oct 2022 10:05:54 +0900 Subject: [PATCH] =?UTF-8?q?#7=20-=20Feat:=20=EC=9E=A5=EB=B0=94=EA=B5=AC?= =?UTF-8?q?=EB=8B=88,=20=EC=A3=BC=EB=AC=B8=20=EC=83=9D=EC=84=B1=20?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/base/initData/DevInitData.java | 6 ++++-- .../app/base/initData/InitDataBefore.java | 20 ++++++++++++++++--- .../app/base/initData/TestInitData.java | 6 ++++-- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/2Week_Mission/mutbooks/src/main/java/com/example/mutbooks/app/base/initData/DevInitData.java b/2Week_Mission/mutbooks/src/main/java/com/example/mutbooks/app/base/initData/DevInitData.java index 066d79f..6aa7d78 100644 --- a/2Week_Mission/mutbooks/src/main/java/com/example/mutbooks/app/base/initData/DevInitData.java +++ b/2Week_Mission/mutbooks/src/main/java/com/example/mutbooks/app/base/initData/DevInitData.java @@ -2,6 +2,7 @@ import com.example.mutbooks.app.cart.service.CartService; import com.example.mutbooks.app.member.service.MemberService; +import com.example.mutbooks.app.order.service.OrderService; import com.example.mutbooks.app.post.service.PostService; import com.example.mutbooks.app.product.service.ProductService; import org.springframework.boot.CommandLineRunner; @@ -17,10 +18,11 @@ CommandLineRunner initData( MemberService memberService, PostService postService, ProductService productService, - CartService cartService + CartService cartService, + OrderService orderService ) { return args -> { - before(memberService, postService, productService, cartService); + before(memberService, postService, productService, cartService, orderService); }; } } \ No newline at end of file diff --git a/2Week_Mission/mutbooks/src/main/java/com/example/mutbooks/app/base/initData/InitDataBefore.java b/2Week_Mission/mutbooks/src/main/java/com/example/mutbooks/app/base/initData/InitDataBefore.java index 7ad7473..fbbbc6f 100644 --- a/2Week_Mission/mutbooks/src/main/java/com/example/mutbooks/app/base/initData/InitDataBefore.java +++ b/2Week_Mission/mutbooks/src/main/java/com/example/mutbooks/app/base/initData/InitDataBefore.java @@ -4,6 +4,7 @@ import com.example.mutbooks.app.member.entity.Member; import com.example.mutbooks.app.member.form.JoinForm; import com.example.mutbooks.app.member.service.MemberService; +import com.example.mutbooks.app.order.service.OrderService; import com.example.mutbooks.app.post.form.WriteForm; import com.example.mutbooks.app.post.service.PostService; import com.example.mutbooks.app.product.entity.Product; @@ -11,7 +12,13 @@ import com.example.mutbooks.app.product.service.ProductService; public interface InitDataBefore { - default void before(MemberService memberService, PostService postService, ProductService productService, CartService cartService) { + default void before( + MemberService memberService, + PostService postService, + ProductService productService, + CartService cartService, + OrderService orderService + ) { // 1번 회원(작가) Member member1 = memberService.join(new JoinForm("user1", "1234", "딸기", "user1@test.com")); // 2번 회원(작가) @@ -39,11 +46,18 @@ default void before(MemberService memberService, PostService postService, Produc // 2번 회원이 2번(로맨스) 글 키워드 선택 -> 4, 5번 글 도서 등록(3번 도서) Product product3 = productService.create(member2, new ProductForm("하트모양 크래커", "로맨스 소설입니다.", 15000, 3L, "#로맨스 #소설")); - // 1번 회원이 3번 도서 장바구니 품목 추가 + // 1번 회원이 3번 도서 장바구니 품목 추가(1번 CartItem) cartService.addCartItem(member1, product3); - // 3번 회원이 1, 2번 도서 장바구니 품목 추가 + // 3번 회원이 1, 2, 3번 도서 장바구니 품목 추가(2, 3, 4번 CartItem) cartService.addCartItem(member3, product1); cartService.addCartItem(member3, product2); + cartService.addCartItem(member3, product3); + + // 1번 회원 1번 주문 생성 + orderService.createOrder(member1, "1"); + // 3번 회원 2, 3번 주문 생성 + orderService.createOrder(member3, "2,3"); + orderService.createOrder(member3, "4"); } } diff --git a/2Week_Mission/mutbooks/src/main/java/com/example/mutbooks/app/base/initData/TestInitData.java b/2Week_Mission/mutbooks/src/main/java/com/example/mutbooks/app/base/initData/TestInitData.java index 34b6abc..0542090 100644 --- a/2Week_Mission/mutbooks/src/main/java/com/example/mutbooks/app/base/initData/TestInitData.java +++ b/2Week_Mission/mutbooks/src/main/java/com/example/mutbooks/app/base/initData/TestInitData.java @@ -2,6 +2,7 @@ import com.example.mutbooks.app.cart.service.CartService; import com.example.mutbooks.app.member.service.MemberService; +import com.example.mutbooks.app.order.service.OrderService; import com.example.mutbooks.app.post.service.PostService; import com.example.mutbooks.app.product.service.ProductService; import org.springframework.boot.CommandLineRunner; @@ -17,10 +18,11 @@ CommandLineRunner initData( MemberService memberService, PostService postService, ProductService productService, - CartService cartService + CartService cartService, + OrderService orderService ) { return args -> { - before(memberService, postService, productService, cartService); + before(memberService, postService, productService, cartService, orderService); }; } } \ No newline at end of file