Skip to content

Commit

Permalink
서하 야채 페이지까지 커밋 끗!!!!
Browse files Browse the repository at this point in the history
  • Loading branch information
Baeseoha committed Oct 13, 2021
1 parent 21b4c16 commit 60b2aed
Show file tree
Hide file tree
Showing 9 changed files with 324 additions and 201 deletions.
132 changes: 124 additions & 8 deletions src/main/java/com/lec/spring/crawling/Seoha_Controller.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,25 @@ public Seoha_Controller() {
}

@RequestMapping("/all/vegetable")
public String list(Model model) {
public String list(Model model, Principal principal, UserDTO dto) throws Exception {

if(principal == null) {
model.addAttribute("message", "Hello Spring Security");
// System.out.println("실패");
}
else {
model.addAttribute("user", principal.getName());
System.out.println("user : " + principal.getName());

String id = principal.getName();
dto.setM_id(id);
userService.login(dto);
System.out.println("userService: " + userService.login(dto));

model.addAttribute("dto", userService.login(dto));
}



model.addAttribute("list", vegetableService.list());

Expand All @@ -73,8 +91,24 @@ public String list(Model model) {

// 장바구니 리스트
@RequestMapping("/user/basket")
public String basket(Model model) {
public String basket(Model model, Principal principal, UserDTO dto) throws Exception {
// System.out.println("찍혀라");
if(principal == null) {
model.addAttribute("message", "Hello Spring Security");
// System.out.println("실패");
}
else {
model.addAttribute("user", principal.getName());
System.out.println("user : " + principal.getName());

String id = principal.getName();
dto.setM_id(id);
userService.login(dto);
System.out.println("userService: " + userService.login(dto));

model.addAttribute("dto", userService.login(dto));
}


// System.out.println(seoha_BoardService.list().get(0));
model.addAttribute("list", seoha_BoardService.list());
Expand All @@ -100,6 +134,7 @@ public String order(int o_qty[], String o_name[], int o_price[], String o_img[],
int result = 0;


System.out.println("인서트");

for(int i = 0; i < o_qty.length; i++) {
OrderDTO dto = new OrderDTO();
Expand All @@ -112,7 +147,7 @@ public String order(int o_qty[], String o_name[], int o_price[], String o_img[],
dto.setO_img(o_img[i]);
dto.setM_uid(m_uid[i]);

System.out.println("인서트 DTO" + dto);
System.out.println("인서트 DTO" + o_img[i]);
result += seoha_BoardService.insertOrder(dto);
}

Expand Down Expand Up @@ -187,7 +222,23 @@ public String myPage(Model model, Principal principal, UserDTO dto) throws Excep
@GetMapping("/user/insertCheckOutOK")
// @ResponseBody
public String pay(@Valid PayDTO user, int o_uid[], String p_name[], int p_qty[], String p_img[], int m_uid[], int p_price[],
String p_addr1, String p_addr2, String p_phone, String p_message, String p_way, BindingResult result2, Model model) {
String p_addr1, String p_addr2, String p_phone, String p_message, String p_way, BindingResult result2, Model model, Principal principal, UserDTO dtoU) throws Exception {

if(principal == null) {
model.addAttribute("message", "Hello Spring Security");
// System.out.println("실패");
}
else {
model.addAttribute("user", principal.getName());
System.out.println("user : " + principal.getName());

String id = principal.getName();
dtoU.setM_id(id);
userService.login(dtoU);
System.out.println("userService: " + userService.login(dtoU));

model.addAttribute("dto", userService.login(dtoU));
}

int result = 0;
int deleteresult = 0;
Expand Down Expand Up @@ -234,8 +285,23 @@ public String pay(@Valid PayDTO user, int o_uid[], String p_name[], int p_qty[],

@GetMapping("/user/deleteOrderOk")
// @ResponseBody
public String pay(int o_uid[], Model model) {
public String pay(int o_uid[], Model model, Principal principal, UserDTO dto) throws Exception {

if(principal == null) {
model.addAttribute("message", "Hello Spring Security");
// System.out.println("실패");
}
else {
model.addAttribute("user", principal.getName());
System.out.println("user : " + principal.getName());

String id = principal.getName();
dto.setM_id(id);
userService.login(dto);
System.out.println("userService: " + userService.login(dto));

model.addAttribute("dto", userService.login(dto));
}

int deleteresult = 0;
for(int i = 0; i < o_uid.length; i++) {
Expand Down Expand Up @@ -271,9 +337,25 @@ public String pay(int o_uid[], Model model) {

// 주문내역 리스트
@RequestMapping("/user/orderList")
public String listPay(Model model) {
public String listPay(Model model, Principal principal, UserDTO dto) throws Exception {
// System.out.println("찍혀라");

if(principal == null) {
model.addAttribute("message", "Hello Spring Security");
// System.out.println("실패");
}
else {
model.addAttribute("user", principal.getName());
System.out.println("user : " + principal.getName());

String id = principal.getName();
dto.setM_id(id);
userService.login(dto);
System.out.println("userService: " + userService.login(dto));

model.addAttribute("dto", userService.login(dto));
}

// System.out.println(seoha_BoardService.list().get(0));
model.addAttribute("listPay", seoha_BoardService.listPay());
// model.addAttribute("listShipping", seoha_BoardService.listShipping());
Expand All @@ -283,8 +365,25 @@ public String listPay(Model model) {

// 주문내역 상세 페이지
@RequestMapping("/user/orderDetail")
public String listDetail(int p_uid, Model model) {
public String listDetail(int p_uid, Model model, Principal principal, UserDTO dto) throws Exception {
// System.out.println("찍혀라");
if(principal == null) {
model.addAttribute("message", "Hello Spring Security");
// System.out.println("실패");
}
else {
model.addAttribute("user", principal.getName());
System.out.println("user : " + principal.getName());

String id = principal.getName();
dto.setM_id(id);
userService.login(dto);
System.out.println("userService: " + userService.login(dto));

model.addAttribute("dto", userService.login(dto));
}



// System.out.println(seoha_BoardService.list().get(0));
model.addAttribute("listPay", seoha_BoardService.viewByUidPay(p_uid));
Expand All @@ -294,7 +393,24 @@ public String listDetail(int p_uid, Model model) {

// 상세내역 결제취소로 업데이트
@GetMapping("/user/updatePay")
public String updatePay(int p_uid, Model model) {
public String updatePay(int p_uid, Model model, Principal principal, UserDTO dto) throws Exception {

if(principal == null) {
model.addAttribute("message", "Hello Spring Security");
// System.out.println("실패");
}
else {
model.addAttribute("user", principal.getName());
System.out.println("user : " + principal.getName());

String id = principal.getName();
dto.setM_id(id);
userService.login(dto);
System.out.println("userService: " + userService.login(dto));

model.addAttribute("dto", userService.login(dto));
}

System.out.println("업데이트 실행");
model.addAttribute("updatePay", seoha_BoardService.updatePay(p_uid));
model.addAttribute("p_uid", p_uid);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
FROM
ic_product
WHERE
pro_kind = "간식"
pro_kind = "과자"
</select>

<select id="selecthealth" resultType="com.lec.spring.crawling.VegetablesDTO">
Expand All @@ -202,7 +202,7 @@
FROM
ic_product
WHERE
pro_kind = "건강식품"
pro_kind = "건강기능"
</select>


Expand Down
5 changes: 3 additions & 2 deletions src/main/webapp/WEB-INF/views/icmall/basket.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function chkDelete(uid){
var r = confirm("주문하시겠습니까?");
if(r){
location.href = 'insertOrderOk';
location.href = '/icmall/user/insertOrderOk';
}
} // chkDelete
</script>
Expand Down Expand Up @@ -97,8 +97,9 @@ function chkDelete(uid){

<td>
<input type="hidden" style="" name="o_price" value="${list.b_price }">
<input type="hidden" style="" name="o_img" value="${list.b_img }">
<%-- <input type="text" style="" name="o_img" value="'${list.b_img }'"> --%>
<input type="hidden" style="" name="name" value="${list.b_proName }">
<textarea name="o_img">${list.b_img }</textarea>
<input type="hidden" style="" name="m_uid" value="${list.m_uid }">
<input type="hidden" name="o_name" class="sumname" value="">
<div id="deleteOk" onclick="chkDelete(${list.b_uid })"></div>
Expand Down
Loading

0 comments on commit 60b2aed

Please sign in to comment.