@@ -16,6 +16,7 @@ import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
@@ -117,6 +118,17 @@ public class BookController {
|
||||
|
||||
}
|
||||
|
||||
/* 상품 상세 */
|
||||
@GetMapping("/goodsDetail/{bookId}")
|
||||
public String goodsDetailGET(@PathVariable("bookId")int bookId, Model model) {
|
||||
|
||||
logger.info("goodsDetailGET()..........");
|
||||
|
||||
model.addAttribute("goodsInfo", bookService.getGoodsInfo(bookId));
|
||||
|
||||
return "/goodsDetail";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -30,4 +30,7 @@ public interface BookMapper {
|
||||
/* 카테고리 정보(+검색대상 갯수) */
|
||||
public CateFilterDTO getCateInfo(Criteria cri);
|
||||
|
||||
/* 상품 정보 */
|
||||
public BookVO getGoodsInfo(int bookId);
|
||||
|
||||
}
|
||||
|
||||
@@ -24,4 +24,7 @@ public interface BookService {
|
||||
/* 검색결과 카테고리 필터 정보 */
|
||||
public List<CateFilterDTO> getCateInfoList(Criteria cri);
|
||||
|
||||
/* 상품 정보 */
|
||||
public BookVO getGoodsInfo(int bookId);
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.vam.mapper.AdminMapper;
|
||||
import com.vam.mapper.AttachMapper;
|
||||
import com.vam.mapper.BookMapper;
|
||||
import com.vam.model.AttachImageVO;
|
||||
@@ -26,6 +27,9 @@ public class BookServiceImpl implements BookService{
|
||||
@Autowired
|
||||
private AttachMapper attachMapper;
|
||||
|
||||
@Autowired
|
||||
private AdminMapper adminMapper;
|
||||
|
||||
/* 상품 검색 */
|
||||
@Override
|
||||
public List<BookVO> getGoodsList(Criteria cri) {
|
||||
@@ -127,4 +131,15 @@ public class BookServiceImpl implements BookService{
|
||||
return filterInfoList;
|
||||
}
|
||||
|
||||
/* 상품 정보 */
|
||||
@Override
|
||||
public BookVO getGoodsInfo(int bookId) {
|
||||
|
||||
BookVO goodsInfo = bookMapper.getGoodsInfo(bookId);
|
||||
goodsInfo.setImageList(adminMapper.getAttachInfo(bookId));
|
||||
|
||||
|
||||
return goodsInfo;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -155,6 +155,17 @@
|
||||
group by a.cateCode, b.cateName
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 상품 정보 -->
|
||||
<select id="getGoodsInfo" resultType="com.vam.model.BookVO">
|
||||
|
||||
select a.BOOKID, a.BOOKNAME, a.AUTHORID, b.AUTHORNAME, a.PUBLEYEAR, a.PUBLISHER, a.CATECODE, c.CATENAME, a.BOOKPRICE, a.BOOKSTOCK, a.BOOKDISCOUNT, a.BOOKINTRO, a.BOOKCONTENTS
|
||||
from vam_book a left outer join vam_author b on a.authorId = b.authorId
|
||||
left outer join vam_bcate c on a.catecode = c.catecode
|
||||
where bookid = ${bookId}
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -79,7 +79,7 @@ public class BookMapperTests {
|
||||
*/
|
||||
|
||||
/* 검색 (동적 쿼리 적용) - 작가*/
|
||||
|
||||
/*
|
||||
@Test
|
||||
public void getGoodsListTest1() {
|
||||
//
|
||||
@@ -100,7 +100,7 @@ public class BookMapperTests {
|
||||
System.out.println("list : " + list);
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -199,6 +199,7 @@ public class BookMapperTests {
|
||||
|
||||
|
||||
/* 카테고리 리스트 */
|
||||
/*
|
||||
@Test
|
||||
public void getCateListTest1() {
|
||||
|
||||
@@ -220,9 +221,10 @@ public class BookMapperTests {
|
||||
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/* 카테고리 정보 얻기 */
|
||||
/* 카테고리 정보 얻기 */
|
||||
/*
|
||||
@Test
|
||||
public void getCateInfoTest1() {
|
||||
|
||||
@@ -239,9 +241,18 @@ public class BookMapperTests {
|
||||
mapper.getCateInfo(cri);
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/* 상품 정보 */
|
||||
@Test
|
||||
public void getGoodsInfo() {
|
||||
int bookId = 26;
|
||||
BookVO goodsInfo = mapper.getGoodsInfo(bookId);
|
||||
System.out.println("===========================");
|
||||
System.out.println(goodsInfo);
|
||||
System.out.println("===========================");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import com.vam.model.Criteria;
|
||||
import com.vam.model.BookVO;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("file:src/main/webapp/WEB-INF/spring/root-context.xml")
|
||||
@@ -15,6 +15,7 @@ public class BookServiceTests {
|
||||
@Autowired
|
||||
BookService service;
|
||||
|
||||
/*
|
||||
@Test
|
||||
public void getCateInfoListTest1() {
|
||||
Criteria cri = new Criteria();
|
||||
@@ -31,7 +32,9 @@ public class BookServiceTests {
|
||||
System.out.println("List<CateFilterDTO> : " + service.getCateInfoList(cri));
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
@Test
|
||||
public void getCateInfoListTest2() {
|
||||
Criteria cri = new Criteria();
|
||||
@@ -48,7 +51,9 @@ public class BookServiceTests {
|
||||
System.out.println("List<CateFilterDTO> : " + service.getCateInfoList(cri));
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
@Test
|
||||
public void getCateInfoListTest3() {
|
||||
Criteria cri = new Criteria();
|
||||
@@ -64,7 +69,9 @@ public class BookServiceTests {
|
||||
System.out.println("List<CateFilterDTO> : " + service.getCateInfoList(cri));
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
@Test
|
||||
public void getCateInfoListTest4() {
|
||||
Criteria cri = new Criteria();
|
||||
@@ -80,7 +87,23 @@ public class BookServiceTests {
|
||||
System.out.println("List<CateFilterDTO> : " + service.getCateInfoList(cri));
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
/*상품 상세 정보*/
|
||||
@Test
|
||||
public void getGoodsInfoTest() {
|
||||
|
||||
int bookId = 1166;
|
||||
|
||||
BookVO goodsInfo = service.getGoodsInfo(bookId);
|
||||
|
||||
System.out.println("==결과==");
|
||||
System.out.println("전체 : " + goodsInfo);
|
||||
System.out.println("bookId : " + goodsInfo.getBookId() );
|
||||
System.out.println("이미지 정보 : " + goodsInfo.getImageList().isEmpty());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -155,6 +155,17 @@
|
||||
group by a.cateCode, b.cateName
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 상품 정보 -->
|
||||
<select id="getGoodsInfo" resultType="com.vam.model.BookVO">
|
||||
|
||||
select a.BOOKID, a.BOOKNAME, a.AUTHORID, b.AUTHORNAME, a.PUBLEYEAR, a.PUBLISHER, a.CATECODE, c.CATENAME, a.BOOKPRICE, a.BOOKSTOCK, a.BOOKDISCOUNT, a.BOOKINTRO, a.BOOKCONTENTS
|
||||
from vam_book a left outer join vam_author b on a.authorId = b.authorId
|
||||
left outer join vam_bcate c on a.catecode = c.catecode
|
||||
where bookid = ${bookId}
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -1,5 +1,5 @@
|
||||
#Generated by Maven Integration for Eclipse
|
||||
#Sun Oct 03 21:07:48 KST 2021
|
||||
#Wed Nov 10 13:50:38 KST 2021
|
||||
m2e.projectLocation=C\:\\Users\\sjinj\\git\\Blog_Project2\\VamPa
|
||||
m2e.projectName=VamPa
|
||||
groupId=com.vam
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
@@ -117,5 +118,17 @@ public class BookController {
|
||||
|
||||
}
|
||||
|
||||
/* 상품 상세 */
|
||||
@GetMapping("/goodsDetail/{bookId}")
|
||||
public String goodsDetailGET(@PathVariable("bookId")int bookId, Model model) {
|
||||
|
||||
logger.info("goodsDetailGET()..........");
|
||||
|
||||
model.addAttribute("goodsInfo", bookService.getGoodsInfo(bookId));
|
||||
|
||||
return "/goodsDetail";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -30,4 +30,7 @@ public interface BookMapper {
|
||||
/* 카테고리 정보(+검색대상 갯수) */
|
||||
public CateFilterDTO getCateInfo(Criteria cri);
|
||||
|
||||
/* 상품 정보 */
|
||||
public BookVO getGoodsInfo(int bookId);
|
||||
|
||||
}
|
||||
|
||||
@@ -22,6 +22,9 @@ public interface BookService {
|
||||
public List<CateVO> getCateCode2();
|
||||
|
||||
/* 검색결과 카테고리 필터 정보 */
|
||||
public List<CateFilterDTO> getCateInfoList(Criteria cri);
|
||||
public List<CateFilterDTO> getCateInfoList(Criteria cri);
|
||||
|
||||
/* 상품 정보 */
|
||||
public BookVO getGoodsInfo(int bookId);
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.vam.mapper.AdminMapper;
|
||||
import com.vam.mapper.AttachMapper;
|
||||
import com.vam.mapper.BookMapper;
|
||||
import com.vam.model.AttachImageVO;
|
||||
@@ -26,6 +27,9 @@ public class BookServiceImpl implements BookService{
|
||||
@Autowired
|
||||
private AttachMapper attachMapper;
|
||||
|
||||
@Autowired
|
||||
private AdminMapper adminMapper;
|
||||
|
||||
/* 상품 검색 */
|
||||
@Override
|
||||
public List<BookVO> getGoodsList(Criteria cri) {
|
||||
@@ -126,4 +130,15 @@ public class BookServiceImpl implements BookService{
|
||||
return filterInfoList;
|
||||
}
|
||||
|
||||
/* 상품 정보 */
|
||||
@Override
|
||||
public BookVO getGoodsInfo(int bookId) {
|
||||
|
||||
BookVO goodsInfo = bookMapper.getGoodsInfo(bookId);
|
||||
goodsInfo.setImageList(adminMapper.getAttachInfo(bookId));
|
||||
|
||||
|
||||
return goodsInfo;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -141,6 +141,16 @@
|
||||
</foreach>
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 상품 정보 -->
|
||||
<select id="getGoodsInfo" resultType="com.vam.model.BookVO">
|
||||
|
||||
select a.BOOKID, a.BOOKNAME, a.AUTHORID, b.AUTHORNAME, a.PUBLEYEAR, a.PUBLISHER, a.CATECODE, c.CATENAME, a.BOOKPRICE, a.BOOKSTOCK, a.BOOKDISCOUNT, a.BOOKINTRO, a.BOOKCONTENTS
|
||||
from vam_book a left outer join vam_author b on a.authorId = b.authorId
|
||||
left outer join vam_bcate c on a.catecode = c.catecode
|
||||
where bookid = ${bookId}
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -6,6 +6,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import com.vam.model.BookVO;
|
||||
import com.vam.model.CateFilterDTO;
|
||||
import com.vam.model.Criteria;
|
||||
|
||||
@@ -53,7 +54,7 @@ public class BookMapperTests {
|
||||
*/
|
||||
|
||||
/* 카테고리 리스트 얻기 */
|
||||
|
||||
/*
|
||||
@Test
|
||||
public void getCateListTest1() {
|
||||
|
||||
@@ -75,10 +76,11 @@ public class BookMapperTests {
|
||||
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/* 카테고리 정보 얻기 */
|
||||
/*
|
||||
@Test
|
||||
public void getCateInfoTest1() {
|
||||
|
||||
@@ -95,8 +97,17 @@ public class BookMapperTests {
|
||||
mapper.getCateInfo(cri);
|
||||
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
/* 상품 정보 */
|
||||
@Test
|
||||
public void getGoodsInfo() {
|
||||
int bookId = 26;
|
||||
BookVO goodsInfo = mapper.getGoodsInfo(bookId);
|
||||
System.out.println("===========================");
|
||||
System.out.println(goodsInfo);
|
||||
System.out.println("===========================");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import com.vam.model.BookVO;
|
||||
import com.vam.model.Criteria;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@@ -81,4 +82,20 @@ public class BookServiceTests {
|
||||
|
||||
}
|
||||
|
||||
/*상품 상세 정보*/
|
||||
@Test
|
||||
public void getGoodsInfoTest() {
|
||||
|
||||
int bookId = 1166;
|
||||
|
||||
BookVO goodsInfo = service.getGoodsInfo(bookId);
|
||||
|
||||
System.out.println("==결과==");
|
||||
System.out.println("전체 : " + goodsInfo);
|
||||
System.out.println("bookId : " + goodsInfo.getBookId() );
|
||||
System.out.println("이미지 정보 : " + goodsInfo.getImageList().isEmpty());
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -141,6 +141,16 @@
|
||||
</foreach>
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 상품 정보 -->
|
||||
<select id="getGoodsInfo" resultType="com.vam.model.BookVO">
|
||||
|
||||
select a.BOOKID, a.BOOKNAME, a.AUTHORID, b.AUTHORNAME, a.PUBLEYEAR, a.PUBLISHER, a.CATECODE, c.CATENAME, a.BOOKPRICE, a.BOOKSTOCK, a.BOOKDISCOUNT, a.BOOKINTRO, a.BOOKCONTENTS
|
||||
from vam_book a left outer join vam_author b on a.authorId = b.authorId
|
||||
left outer join vam_bcate c on a.catecode = c.catecode
|
||||
where bookid = ${bookId}
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -1,5 +1,5 @@
|
||||
#Generated by Maven Integration for Eclipse
|
||||
#Sun Oct 03 21:07:49 KST 2021
|
||||
#Wed Nov 10 13:48:51 KST 2021
|
||||
m2e.projectLocation=C\:\\Users\\sjinj\\git\\Blog_Project2\\VamPa_MySQL
|
||||
m2e.projectName=VamPa_MySQL
|
||||
groupId=com.vam
|
||||
|
||||
Reference in New Issue
Block a user