Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions src/main/java/com/cos/unishop/domain/bucket/Bucket.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.cos.unishop.domain.bucket;

import java.util.List;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import com.cos.unishop.domain.post.Post;
import com.cos.unishop.domain.user.User;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import lombok.Data;

@Data
@Entity
public class Bucket {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;

private int totalpay;
private int count;


@JsonIgnoreProperties({ "user" })
@JoinColumn(name = "user_id")
@ManyToOne
private User user;

@JsonIgnoreProperties({"payment"})
@OneToMany(mappedBy = "payment",fetch = FetchType.LAZY)
private List<Post> posts;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.cos.unishop.domain.bucket;

import org.springframework.data.jpa.repository.JpaRepository;

public interface BucketRepository extends JpaRepository<Bucket, Integer>{

}
2 changes: 2 additions & 0 deletions src/main/java/com/cos/unishop/domain/post/Post.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,6 @@ public class Post {
@JoinColumn(name ="post_id")
@ManyToOne
private Payment payment;


}
32 changes: 16 additions & 16 deletions src/main/java/com/cos/unishop/web/MyPageController.java
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
package com.cos.unishop.web;

import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;

import com.cos.unishop.domain.payment.PayMentRepository;
import com.cos.unishop.domain.post.PostRepository;
import com.cos.unishop.domain.user.UserRepository;

import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor
@Controller
public class MyPageController {

private final PostRepository postRepository;
private final UserRepository userRepository;
private final PayMentRepository paymetMentRepository;
private final HttpSession session;

//마이페이지로 가는 컨트롤러
@GetMapping("/myPage")
public String bucket() {
public String myPage() {
return"user/myPage";
}

//상품평관리하기로 가는 컨트롤러
@GetMapping("/CommentsManagement")
public String CommentsManagement() {
return"user/commentsManagement";
}

//장바구니로 가는 컨트롤러
//지금은 페이지만 연결해놓은거
//나중에 모델에 담에서뿌려야함 ㅇㅋ?

@GetMapping("/bucket")
public String myPage() {
public String bucket() {
System.out.println("어?");
return"user/bucket";
}

@PostMapping("/bucket")
public String bucketlist(int count, Model model) {
model.addAttribute("count", 2);
System.out.println("뭐?");
return"user/bucket";
}

//구매목록으로 가는 컨트롤러
@GetMapping("/paymentList")
public String paymentList(Model model) {


public String paymentList() {
return "user/paymentList";
}

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/cos/unishop/web/PostController.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
@Controller
public class PostController {

private final PostRepository postRepository;
private final UserRepository userRepository;
private final HttpSession session;
private final PostRepository postRepository;
private final UserRepository userRepository;
private final HttpSession session;


// 최초 사이트 유입시에 들어가는 페이지 메인페이지로 가는 컨트롤러
Expand Down
12 changes: 4 additions & 8 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
server:
port: 8001
servlet:
port: 8000
servlet:
encoding:
charset: UTF-8


spring:
mvc:
view:
prefix: /WEB-INF/views/
suffix: .jsp


datasource:
driver-class-name: org.mariadb.jdbc.Driver
username: unishop
password: korea1234
url: jdbc:mysql://localhost:3306/unishopdb


url: jdbc:mysql://localhost:3306/unishopdb

jpa:
hibernate:
ddl-auto: none #create:, update, none
show-sql: true

Loading