[Spring][쇼핑몰 프로젝트][41] 주문 구현(주문 페이지) - 6

https://kimvampa.tistory.com/277
This commit is contained in:
SeoJin Kim
2021-12-13 00:41:30 +09:00
parent 2881eced69
commit 658106e6ec
8 changed files with 124 additions and 10 deletions

View File

@@ -1,5 +1,7 @@
package com.vam.model;
import java.util.List;
public class OrderPageItemDTO {
/* 뷰로부터 전달받을 값 */
@@ -23,6 +25,9 @@ public class OrderPageItemDTO {
private int totalPoint;
/* 상품 이미지 */
private List<AttachImageVO> imageList;
public int getBookId() {
return bookId;
}
@@ -103,11 +108,20 @@ public class OrderPageItemDTO {
}
public List<AttachImageVO> getImageList() {
return imageList;
}
public void setImageList(List<AttachImageVO> imageList) {
this.imageList = imageList;
}
@Override
public String toString() {
return "OrderPageItemDTO [bookId=" + bookId + ", bookCount=" + bookCount + ", bookName=" + bookName
+ ", bookPrice=" + bookPrice + ", bookDiscount=" + bookDiscount + ", salePrice=" + salePrice
+ ", totalPrice=" + totalPrice + ", point=" + point + ", totalPoint=" + totalPoint + "]";
+ ", totalPrice=" + totalPrice + ", point=" + point + ", totalPoint=" + totalPoint + ", imageList="
+ imageList + "]";
}

View File

@@ -6,7 +6,10 @@ import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.vam.mapper.AttachMapper;
import com.vam.mapper.OrderMapper;
import com.vam.model.AttachImageVO;
import com.vam.model.AttachImageVO;
import com.vam.model.OrderPageItemDTO;
@Service
@@ -15,6 +18,10 @@ public class OrderServiceImpl implements OrderService{
@Autowired
private OrderMapper orderMapper;
@Autowired
private AttachMapper attachMapper;
@Override
public List<OrderPageItemDTO> getGoodsInfo(List<OrderPageItemDTO> orders) {
@@ -28,6 +35,10 @@ public class OrderServiceImpl implements OrderService{
goodsInfo.initSaleTotal();
List<AttachImageVO> imageList = attachMapper.getAttachList(goodsInfo.getBookId());
goodsInfo.setImageList(imageList);
result.add(goodsInfo);
}

View File

@@ -192,7 +192,9 @@
<c:forEach items="${orderList}" var="ol">
<tr>
<td>
<!-- 이미지 <td>-->
<div class="image_wrap" data-bookid="${ol.imageList[0].bookId}" data-path="${ol.imageList[0].uploadPath}" data-uuid="${ol.imageList[0].uuid}" data-filename="${ol.imageList[0].fileName}">
<img>
</div>
</td>
<td>${ol.bookName}</td>
<td class="goods_table_price_td">
@@ -324,6 +326,26 @@ $(document).ready(function(){
/* 주문 조합정보란 최신화 */
setTotalInfo();
/* 이미지 삽입 */
$(".image_wrap").each(function(i, obj){
const bobj = $(obj);
if(bobj.data("bookid")){
const uploadPath = bobj.data("path");
const uuid = bobj.data("uuid");
const fileName = bobj.data("filename");
const fileCallPath = encodeURIComponent(uploadPath + "/s_" + uuid + "_" + fileName);
$(this).find("img").attr('src', '/display?fileName=' + fileCallPath);
} else {
$(this).find("img").attr('src', '/resources/img/goodsNoImage.png');
}
});
});

View File

@@ -389,6 +389,17 @@ height: 110px;
font-weight: bold;
}
/* 이미지 */
.image_wrap{
width: 100%;
height: 100%;
}
.image_wrap img{
max-width: 85%;
height: auto;
display: block;
}

View File

@@ -1,5 +1,7 @@
package com.vam.model;
import java.util.List;
public class OrderPageItemDTO {
/* 뷰로부터 전달받을 값 */
@@ -23,6 +25,9 @@ public class OrderPageItemDTO {
private int totalPoint;
/* 상품 이미지 */
private List<AttachImageVO> imageList;
public int getBookId() {
return bookId;
}
@@ -103,11 +108,20 @@ public class OrderPageItemDTO {
}
public List<AttachImageVO> getImageList() {
return imageList;
}
public void setImageList(List<AttachImageVO> imageList) {
this.imageList = imageList;
}
@Override
public String toString() {
return "OrderPageItemDTO [bookId=" + bookId + ", bookCount=" + bookCount + ", bookName=" + bookName
+ ", bookPrice=" + bookPrice + ", bookDiscount=" + bookDiscount + ", salePrice=" + salePrice
+ ", totalPrice=" + totalPrice + ", point=" + point + ", totalPoint=" + totalPoint + "]";
+ ", totalPrice=" + totalPrice + ", point=" + point + ", totalPoint=" + totalPoint + ", imageList="
+ imageList + "]";
}
}

View File

@@ -6,7 +6,9 @@ import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.vam.mapper.AttachMapper;
import com.vam.mapper.OrderMapper;
import com.vam.model.AttachImageVO;
import com.vam.model.OrderPageItemDTO;
@Service
@@ -15,6 +17,9 @@ public class OrderServiceImpl implements OrderService{
@Autowired
private OrderMapper orderMapper;
@Autowired
private AttachMapper attachMapper;
@Override
public List<OrderPageItemDTO> getGoodsInfo(List<OrderPageItemDTO> orders) {
@@ -28,6 +33,10 @@ public class OrderServiceImpl implements OrderService{
goodsInfo.initSaleTotal();
List<AttachImageVO> imageList = attachMapper.getAttachList(goodsInfo.getBookId());
goodsInfo.setImageList(imageList);
result.add(goodsInfo);
}

View File

@@ -192,7 +192,9 @@
<c:forEach items="${orderList}" var="ol">
<tr>
<td>
<!-- 이미지 <td>-->
<div class="image_wrap" data-bookid="${ol.imageList[0].bookId}" data-path="${ol.imageList[0].uploadPath}" data-uuid="${ol.imageList[0].uuid}" data-filename="${ol.imageList[0].fileName}">
<img>
</div>
</td>
<td>${ol.bookName}</td>
<td class="goods_table_price_td">
@@ -324,6 +326,26 @@ $(document).ready(function(){
/* 주문 조합정보란 최신화 */
setTotalInfo();
/* 이미지 삽입 */
$(".image_wrap").each(function(i, obj){
const bobj = $(obj);
if(bobj.data("bookid")){
const uploadPath = bobj.data("path");
const uuid = bobj.data("uuid");
const fileName = bobj.data("filename");
const fileCallPath = encodeURIComponent(uploadPath + "/s_" + uuid + "_" + fileName);
$(this).find("img").attr('src', '/display?fileName=' + fileCallPath);
} else {
$(this).find("img").attr('src', '/resources/img/goodsNoImage.png');
}
});
});

View File

@@ -389,6 +389,17 @@ height: 110px;
font-weight: bold;
}
/* 이미지 */
.image_wrap{
width: 100%;
height: 100%;
}
.image_wrap img{
max-width: 85%;
height: auto;
display: block;
}