[Spring][쇼핑몰 프로젝트][28] 상품 상세 페이지 이미지 출력 - 1

https://kimvampa.tistory.com/233
This commit is contained in:
SeoJin Kim
2021-07-04 23:58:15 +09:00
parent bb8db75b6a
commit 3ba8743632
16 changed files with 260 additions and 3 deletions

View File

@@ -3,11 +3,14 @@ package com.vam.controller;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.util.FileCopyUtils;
@@ -15,11 +18,17 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.vam.mapper.AttachMapper;
import com.vam.model.AttachImageVO;
@Controller
public class BookController {
private static final Logger logger = LoggerFactory.getLogger(BookController.class);
@Autowired
private AttachMapper attachMapper;
//메인 페이지 이동
@RequestMapping(value="/main", method = RequestMethod.GET)
public void mainPageGET() {
@@ -53,4 +62,17 @@ public class BookController {
}
/* 이미지 정보 반환 */
@GetMapping(value="/getAttachList", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity<List<AttachImageVO>> getAttachList(int bookId){
logger.info("getAttachList.........." + bookId);
return new ResponseEntity<List<AttachImageVO>>(attachMapper.getAttachList(bookId), HttpStatus.OK);
}
}