@@ -41,10 +41,25 @@ public class AdminController {
|
||||
|
||||
}
|
||||
|
||||
/* 상품 등록 페이지 접속 */
|
||||
/* 상품 관리(상품목록) 페이지 접속 */
|
||||
@RequestMapping(value = "goodsManage", method = RequestMethod.GET)
|
||||
public void goodsManageGET() throws Exception{
|
||||
logger.info("상품 등록 페이지 접속");
|
||||
public void goodsManageGET(Criteria cri, Model model) throws Exception{
|
||||
|
||||
logger.info("상품 관리(상품목록) 페이지 접속");
|
||||
|
||||
/* 상품 리스트 데이터 */
|
||||
List list = adminService.goodsGetList(cri);
|
||||
|
||||
if(!list.isEmpty()) {
|
||||
model.addAttribute("list", list);
|
||||
} else {
|
||||
model.addAttribute("listCheck", "empty");
|
||||
return;
|
||||
}
|
||||
|
||||
/* 페이지 인터페이스 데이터 */
|
||||
model.addAttribute("pageMaker", new PageDTO(cri, adminService.goodsGetTotal(cri)));
|
||||
|
||||
}
|
||||
|
||||
/* 상품 등록 페이지 접속 */
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.List;
|
||||
|
||||
import com.vam.model.BookVO;
|
||||
import com.vam.model.CateVO;
|
||||
import com.vam.model.Criteria;
|
||||
|
||||
public interface AdminMapper {
|
||||
|
||||
@@ -13,4 +14,10 @@ public interface AdminMapper {
|
||||
/* 카테고리 리스트 */
|
||||
public List<CateVO> cateList();
|
||||
|
||||
/* 상품 리스트 */
|
||||
public List<BookVO> goodsGetList(Criteria cri);
|
||||
|
||||
/* 상품 총 개수 */
|
||||
public int goodsGetTotal(Criteria cri);
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.List;
|
||||
|
||||
import com.vam.model.BookVO;
|
||||
import com.vam.model.CateVO;
|
||||
import com.vam.model.Criteria;
|
||||
|
||||
public interface AdminService {
|
||||
|
||||
@@ -13,4 +14,10 @@ public interface AdminService {
|
||||
/* 카테고리 리스트 */
|
||||
public List<CateVO> cateList();
|
||||
|
||||
/* 상품 리스트 */
|
||||
public List<BookVO> goodsGetList(Criteria cri);
|
||||
|
||||
/* 상품 총 개수 */
|
||||
public int goodsGetTotal(Criteria cri);
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import org.springframework.stereotype.Service;
|
||||
import com.vam.mapper.AdminMapper;
|
||||
import com.vam.model.BookVO;
|
||||
import com.vam.model.CateVO;
|
||||
import com.vam.model.Criteria;
|
||||
|
||||
import lombok.extern.log4j.Log4j;
|
||||
|
||||
@@ -35,6 +36,19 @@ public class AdminServiceImpl implements AdminService {
|
||||
log.info("(service)cateList........");
|
||||
|
||||
return adminMapper.cateList();
|
||||
}
|
||||
|
||||
/* 상품 리스트 */
|
||||
@Override
|
||||
public List<BookVO> goodsGetList(Criteria cri) {
|
||||
log.info("goodsGetTotalList()..........");
|
||||
return adminMapper.goodsGetList(cri);
|
||||
}
|
||||
|
||||
/* 상품 총 갯수 */
|
||||
public int goodsGetTotal(Criteria cri) {
|
||||
log.info("goodsGetTotal().........");
|
||||
return adminMapper.goodsGetTotal(cri);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,5 +18,43 @@
|
||||
select * from vam_bcate order by catecode
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 상품 리스트 -->
|
||||
<select id="goodsGetList" resultType="com.vam.model.BookVO">
|
||||
|
||||
<![CDATA[
|
||||
select * from(
|
||||
select /*+INDEX_DESC(vam_book SYS_C007551)*/ rownum as rn, bookId, bookName,
|
||||
(select authorName from vam_author where vam_book.authorId = vam_author.authorId) authorName,
|
||||
(select cateName from vam_bcate where vam_book.cateCode = vam_bcate.cateCode) cateName,bookStock,regDate
|
||||
from vam_book
|
||||
where
|
||||
]]>
|
||||
|
||||
<if test="keyword != null">
|
||||
|
||||
bookName like '%' || #{keyword} || '%' and
|
||||
|
||||
</if>
|
||||
|
||||
<![CDATA[
|
||||
rownum <= #{pageNum} * #{amount}
|
||||
)
|
||||
where rn > (#{pageNum} -1) * #{amount}
|
||||
]]>
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 상품 총 개수 -->
|
||||
<select id="goodsGetTotal" resultType="int">
|
||||
|
||||
select count(*) from vam_book
|
||||
|
||||
<if test="keyword != null">
|
||||
|
||||
where bookName like '%' || #{keyword} || '%'
|
||||
</if>
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -21,6 +21,86 @@
|
||||
|
||||
<div class="admin_content_wrap">
|
||||
<div class="admin_content_subject"><span>상품 관리</span></div>
|
||||
<div class="goods_table_wrap">
|
||||
<!-- 상품 리스트 O -->
|
||||
<c:if test="${listcheck != 'empty'}">
|
||||
<table class="goods_table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="th_column_1">상품 번호</td>
|
||||
<td class="th_column_2">상품 이름</td>
|
||||
<td class="th_column_3">작가 이름</td>
|
||||
<td class="th_column_4">카테고리</td>
|
||||
<td class="th_column_5">재고</td>
|
||||
<td class="th_column_6">등록날짜</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<c:forEach items="${list}" var="list">
|
||||
<tr>
|
||||
<td><c:out value="${list.bookId}"></c:out></td>
|
||||
<td><c:out value="${list.bookName}"></c:out></td>
|
||||
<td><c:out value="${list.authorName}"></c:out></td>
|
||||
<td><c:out value="${list.cateName}"></c:out></td>
|
||||
<td><c:out value="${list.bookStock}"></c:out></td>
|
||||
<td><fmt:formatDate value="${list.regDate}" pattern="yyyy-MM-dd"/></td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</table>
|
||||
</c:if>
|
||||
<!-- 상품 리스트 X -->
|
||||
<c:if test="${listCheck == 'empty'}">
|
||||
<div class="table_empty">
|
||||
등록된 작가가 없습니다.
|
||||
</div>
|
||||
</c:if>
|
||||
</div>
|
||||
|
||||
<!-- 검색 영역 -->
|
||||
<div class="search_wrap">
|
||||
<form id="searchForm" action="/admin/goodsManage" method="get">
|
||||
<div class="search_input">
|
||||
<input type="text" name="keyword" value='<c:out value="${pageMaker.cri.keyword}"></c:out>'>
|
||||
<input type="hidden" name="pageNum" value='<c:out value="${pageMaker.cri.pageNum }"></c:out>'>
|
||||
<input type="hidden" name="amount" value='${pageMaker.cri.amount}'>
|
||||
<input type="hidden" name="type" value="G">
|
||||
<button class='btn search_btn'>검 색</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- 페이지 이름 인터페이스 영역 -->
|
||||
<div class="pageMaker_wrap">
|
||||
<ul class="pageMaker">
|
||||
|
||||
<!-- 이전 버튼 -->
|
||||
<c:if test="${pageMaker.prev }">
|
||||
<li class="pageMaker_btn prev">
|
||||
<a href="${pageMaker.pageStart -1}">이전</a>
|
||||
</li>
|
||||
</c:if>
|
||||
|
||||
<!-- 페이지 번호 -->
|
||||
<c:forEach begin="${pageMaker.pageStart }" end="${pageMaker.pageEnd }" var="num">
|
||||
<li class="pageMaker_btn ${pageMaker.cri.pageNum == num ? 'active':''}">
|
||||
<a href="${num}">${num}</a>
|
||||
</li>
|
||||
</c:forEach>
|
||||
|
||||
<!-- 다음 버튼 -->
|
||||
<c:if test="${pageMaker.next}">
|
||||
<li class="pageMaker_btn next">
|
||||
<a href="${pageMaker.pageEnd + 1 }">다음</a>
|
||||
</li>
|
||||
</c:if>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<form id="moveForm" action="/admin/goodsManage" method="get" >
|
||||
<input type="hidden" name="pageNum" value="${pageMaker.cri.pageNum}">
|
||||
<input type="hidden" name="amount" value="${pageMaker.cri.amount}">
|
||||
<input type="hidden" name="keyword" value="${pageMaker.cri.keyword}">
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<%@include file="../includes/admin/footer.jsp" %>
|
||||
@@ -42,6 +122,40 @@ $(document).ready(function(){
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
let searchForm = $('#searchForm');
|
||||
let moveForm = $('#moveForm');
|
||||
|
||||
/* 작거 검색 버튼 동작 */
|
||||
$("#searchForm button").on("click", function(e){
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
/* 검색 키워드 유효성 검사 */
|
||||
if(!searchForm.find("input[name='keyword']").val()){
|
||||
alert("키워드를 입력하십시오");
|
||||
return false;
|
||||
}
|
||||
|
||||
searchForm.find("input[name='pageNum']").val("1");
|
||||
|
||||
searchForm.submit();
|
||||
|
||||
});
|
||||
|
||||
|
||||
/* 페이지 이동 버튼 */
|
||||
$(".pageMaker_btn a").on("click", function(e){
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
moveForm.find("input[name='pageNum']").val($(this).attr("href"));
|
||||
|
||||
moveForm.submit();
|
||||
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
@@ -95,9 +95,9 @@ ul{
|
||||
.admin_content_wrap{
|
||||
width: 80%;
|
||||
float:left;
|
||||
min-height:700px;
|
||||
min-height: 700px;
|
||||
}
|
||||
.admin_content_subject{ /* 관리자 컨텐츠 제목 영역 */
|
||||
.admin_content_subject{ /* 관리자 컨텐츠 제목 영역 */
|
||||
font-size: 40px;
|
||||
font-weight: bolder;
|
||||
padding-left: 15px;
|
||||
@@ -107,6 +107,108 @@ ul{
|
||||
color: white;
|
||||
}
|
||||
|
||||
/* 상품 목록 영역 */
|
||||
.goods_table_wrap{
|
||||
padding: 20px 35px
|
||||
}
|
||||
.goods_table{
|
||||
width: 100%;
|
||||
border: 1px solid #d3d8e1;
|
||||
text-align: center;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
.goods_table td{
|
||||
padding: 10px 5px;
|
||||
border : 1px solid #e9ebf0;
|
||||
}
|
||||
.goods_table thead{
|
||||
background-color: #f8f9fd;
|
||||
font-weight: 600;
|
||||
}
|
||||
.goods_table a{
|
||||
color:#1088ed;
|
||||
font-weight: 500;
|
||||
}
|
||||
.th_column_1{
|
||||
width:11%;
|
||||
}
|
||||
.th_column_3{
|
||||
width:14%;
|
||||
}
|
||||
.th_column_4{
|
||||
width:15%;
|
||||
}
|
||||
.th_column_5{
|
||||
width:10%;
|
||||
}
|
||||
.table_empty{
|
||||
height: 50px;
|
||||
text-align: center;
|
||||
margin: 200px 0 215px 0px;
|
||||
font-size: 25px;
|
||||
}
|
||||
|
||||
/* 검색 영역 */
|
||||
.search_wrap{
|
||||
margin-top:15px;
|
||||
}
|
||||
.search_input{
|
||||
position: relative;
|
||||
text-align:center;
|
||||
}
|
||||
.search_input input[name='keyword']{
|
||||
padding: 4px 10px;
|
||||
font-size: 15px;
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
}
|
||||
.search_btn{
|
||||
height: 32px;
|
||||
width: 80px;
|
||||
font-weight: 600;
|
||||
font-size: 18px;
|
||||
line-height: 20px;
|
||||
position: absolute;
|
||||
margin-left: 15px;
|
||||
background-color: #c3daf7;
|
||||
}
|
||||
|
||||
|
||||
/* 페이지 버튼 인터페이스 */
|
||||
.pageMaker_wrap{
|
||||
text-align: center;
|
||||
margin-top: 30px;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
.pageMaker{
|
||||
list-style: none;
|
||||
display: inline-block;
|
||||
}
|
||||
.pageMaker_btn {
|
||||
float: left;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
margin-left: 20px;
|
||||
}
|
||||
.active{
|
||||
border : 2px solid black;
|
||||
font-weight:400;
|
||||
}
|
||||
.next, .prev {
|
||||
border: 1px solid #ccc;
|
||||
padding: 0 10px;
|
||||
}
|
||||
.pageMaker_btn a:link {color: black;}
|
||||
.pageMaker_btn a:visited {color: black;}
|
||||
.pageMaker_btn a:active {color: black;}
|
||||
.pageMaker_btn a:hover {color: black;}
|
||||
.next a, .prev a {
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* footer navai 영역 */
|
||||
.footer_nav{
|
||||
width:100%;
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
package com.vam.mapper;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
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)
|
||||
@@ -40,11 +42,37 @@ public class AdminMapperTests {
|
||||
*/
|
||||
|
||||
/* 카테고리 리스트 */
|
||||
/*
|
||||
@Test
|
||||
public void cateListTest() throws Exception{
|
||||
|
||||
System.out.println("cateList()..........." + mapper.cateList());
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
/* 상품 리스트 & 상품 총 개수*/
|
||||
/**/
|
||||
@Test
|
||||
public void goodsGetListTests() {
|
||||
|
||||
Criteria cri = new Criteria();
|
||||
|
||||
cri.setKeyword("test");
|
||||
|
||||
/* 상품 리스트 */
|
||||
List list = mapper.goodsGetList(cri);
|
||||
for(int i = 0; i < 10; i++) {
|
||||
System.out.println("result..........." +i + " : " + list.get(i) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* 상품 총 개수 */
|
||||
//int result = mapper.goodsGetTotal(cri);
|
||||
//System.out.println("resout........." + result);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -18,5 +18,43 @@
|
||||
select * from vam_bcate order by catecode
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 상품 리스트 -->
|
||||
<select id="goodsGetList" resultType="com.vam.model.BookVO">
|
||||
|
||||
<![CDATA[
|
||||
select * from(
|
||||
select /*+INDEX_DESC(vam_book SYS_C007551)*/ rownum as rn, bookId, bookName,
|
||||
(select authorName from vam_author where vam_book.authorId = vam_author.authorId) authorName,
|
||||
(select cateName from vam_bcate where vam_book.cateCode = vam_bcate.cateCode) cateName,bookStock,regDate
|
||||
from vam_book
|
||||
where
|
||||
]]>
|
||||
|
||||
<if test="keyword != null">
|
||||
|
||||
bookName like '%' || #{keyword} || '%' and
|
||||
|
||||
</if>
|
||||
|
||||
<![CDATA[
|
||||
rownum <= #{pageNum} * #{amount}
|
||||
)
|
||||
where rn > (#{pageNum} -1) * #{amount}
|
||||
]]>
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 상품 총 개수 -->
|
||||
<select id="goodsGetTotal" resultType="int">
|
||||
|
||||
select count(*) from vam_book
|
||||
|
||||
<if test="keyword != null">
|
||||
|
||||
where bookName like '%' || #{keyword} || '%'
|
||||
</if>
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -1,5 +1,5 @@
|
||||
#Generated by Maven Integration for Eclipse
|
||||
#Wed Mar 31 15:59:23 KST 2021
|
||||
#Tue Apr 13 13:59:44 KST 2021
|
||||
m2e.projectLocation=C\:\\Users\\sjinj\\git\\Blog_Project\\VamPa
|
||||
m2e.projectName=VamPa
|
||||
groupId=com.vam
|
||||
|
||||
@@ -41,10 +41,25 @@ public class AdminController {
|
||||
|
||||
}
|
||||
|
||||
/* 상품 등록 페이지 접속 */
|
||||
/* 상품 관리(상품목록) 페이지 접속 */
|
||||
@RequestMapping(value = "goodsManage", method = RequestMethod.GET)
|
||||
public void goodsManageGET() throws Exception{
|
||||
logger.info("상품 등록 페이지 접속");
|
||||
public void goodsManageGET(Criteria cri, Model model) throws Exception{
|
||||
|
||||
logger.info("상품 관리(상품목록) 페이지 접속");
|
||||
|
||||
/* 상품 리스트 데이터 */
|
||||
List list = adminService.goodsGetList(cri);
|
||||
|
||||
if(!list.isEmpty()) {
|
||||
model.addAttribute("list", list);
|
||||
} else {
|
||||
model.addAttribute("listCheck", "empty");
|
||||
return;
|
||||
}
|
||||
|
||||
/* 페이지 인터페이스 데이터 */
|
||||
model.addAttribute("pageMaker", new PageDTO(cri, adminService.goodsGetTotal(cri)));
|
||||
|
||||
}
|
||||
|
||||
/* 상품 등록 페이지 접속 */
|
||||
|
||||
@@ -4,6 +4,8 @@ import java.util.List;
|
||||
|
||||
import com.vam.model.BookVO;
|
||||
import com.vam.model.CateVO;
|
||||
import com.vam.model.Criteria;
|
||||
import com.vam.model.Criteria;
|
||||
|
||||
public interface AdminMapper {
|
||||
|
||||
@@ -13,4 +15,10 @@ public interface AdminMapper {
|
||||
/* 카테고리 리스트 */
|
||||
public List<CateVO> cateList();
|
||||
|
||||
/* 상품 리스트 */
|
||||
public List<BookVO> goodsGetList(Criteria cri);
|
||||
|
||||
/* 상품 총 개수 */
|
||||
public int goodsGetTotal(Criteria cri);
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.List;
|
||||
|
||||
import com.vam.model.BookVO;
|
||||
import com.vam.model.CateVO;
|
||||
import com.vam.model.Criteria;
|
||||
|
||||
public interface AdminService {
|
||||
|
||||
@@ -13,4 +14,10 @@ public interface AdminService {
|
||||
/* 카테고리 리스트 */
|
||||
public List<CateVO> cateList();
|
||||
|
||||
/* 상품 리스트 */
|
||||
public List<BookVO> goodsGetList(Criteria cri);
|
||||
|
||||
/* 상품 총 개수 */
|
||||
public int goodsGetTotal(Criteria cri);
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import org.springframework.stereotype.Service;
|
||||
import com.vam.mapper.AdminMapper;
|
||||
import com.vam.model.BookVO;
|
||||
import com.vam.model.CateVO;
|
||||
import com.vam.model.Criteria;
|
||||
|
||||
import lombok.extern.log4j.Log4j;
|
||||
|
||||
@@ -37,4 +38,17 @@ public class AdminServiceImpl implements AdminService {
|
||||
return adminMapper.cateList();
|
||||
}
|
||||
|
||||
/* 상품 리스트 */
|
||||
@Override
|
||||
public List<BookVO> goodsGetList(Criteria cri) {
|
||||
log.info("goodsGetTotalList()..........");
|
||||
return adminMapper.goodsGetList(cri);
|
||||
}
|
||||
|
||||
/* 상품 총 갯수 */
|
||||
public int goodsGetTotal(Criteria cri) {
|
||||
log.info("goodsGetTotal().........");
|
||||
return adminMapper.goodsGetTotal(cri);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,5 +18,35 @@
|
||||
select * from vam_bcate order by catecode
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 상품 리스트 -->
|
||||
<select id="goodsGetList" resultType="com.vam.model.BookVO">
|
||||
|
||||
select bookId, bookName, b.authorName, c.cateName, bookStock, a.regDate
|
||||
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
|
||||
<if test="keyword != null">
|
||||
where (bookName like concat ('%', #{keyword}, '%'))
|
||||
</if>
|
||||
order by bookId desc
|
||||
limit #{skip}, #{amount}
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 상품 총 갯수 -->
|
||||
<select id="goodsGetTotal" resultType="int">
|
||||
|
||||
select count(*) from vam_book
|
||||
|
||||
<if test="keyword != null">
|
||||
|
||||
where bookName like concat('%' , #{keyword}, '%')
|
||||
|
||||
</if>
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -21,6 +21,86 @@
|
||||
|
||||
<div class="admin_content_wrap">
|
||||
<div class="admin_content_subject"><span>상품 관리</span></div>
|
||||
<div class="goods_table_wrap">
|
||||
<!-- 상품 리스트 O -->
|
||||
<c:if test="${listcheck != 'empty'}">
|
||||
<table class="goods_table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="th_column_1">상품 번호</td>
|
||||
<td class="th_column_2">상품 이름</td>
|
||||
<td class="th_column_3">작가 이름</td>
|
||||
<td class="th_column_4">카테고리</td>
|
||||
<td class="th_column_5">재고</td>
|
||||
<td class="th_column_6">등록날짜</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<c:forEach items="${list}" var="list">
|
||||
<tr>
|
||||
<td><c:out value="${list.bookId}"></c:out></td>
|
||||
<td><c:out value="${list.bookName}"></c:out></td>
|
||||
<td><c:out value="${list.authorName}"></c:out></td>
|
||||
<td><c:out value="${list.cateName}"></c:out></td>
|
||||
<td><c:out value="${list.bookStock}"></c:out></td>
|
||||
<td><fmt:formatDate value="${list.regDate}" pattern="yyyy-MM-dd"/></td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</table>
|
||||
</c:if>
|
||||
<!-- 상품 리스트 X -->
|
||||
<c:if test="${listCheck == 'empty'}">
|
||||
<div class="table_empty">
|
||||
등록된 작가가 없습니다.
|
||||
</div>
|
||||
</c:if>
|
||||
</div>
|
||||
|
||||
<!-- 검색 영역 -->
|
||||
<div class="search_wrap">
|
||||
<form id="searchForm" action="/admin/goodsManage" method="get">
|
||||
<div class="search_input">
|
||||
<input type="text" name="keyword" value='<c:out value="${pageMaker.cri.keyword}"></c:out>'>
|
||||
<input type="hidden" name="pageNum" value='<c:out value="${pageMaker.cri.pageNum }"></c:out>'>
|
||||
<input type="hidden" name="amount" value='${pageMaker.cri.amount}'>
|
||||
<input type="hidden" name="type" value="G">
|
||||
<button class='btn search_btn'>검 색</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- 페이지 이름 인터페이스 영역 -->
|
||||
<div class="pageMaker_wrap">
|
||||
<ul class="pageMaker">
|
||||
|
||||
<!-- 이전 버튼 -->
|
||||
<c:if test="${pageMaker.prev }">
|
||||
<li class="pageMaker_btn prev">
|
||||
<a href="${pageMaker.pageStart -1}">이전</a>
|
||||
</li>
|
||||
</c:if>
|
||||
|
||||
<!-- 페이지 번호 -->
|
||||
<c:forEach begin="${pageMaker.pageStart }" end="${pageMaker.pageEnd }" var="num">
|
||||
<li class="pageMaker_btn ${pageMaker.cri.pageNum == num ? 'active':''}">
|
||||
<a href="${num}">${num}</a>
|
||||
</li>
|
||||
</c:forEach>
|
||||
|
||||
<!-- 다음 버튼 -->
|
||||
<c:if test="${pageMaker.next}">
|
||||
<li class="pageMaker_btn next">
|
||||
<a href="${pageMaker.pageEnd + 1 }">다음</a>
|
||||
</li>
|
||||
</c:if>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<form id="moveForm" action="/admin/goodsManage" method="get" >
|
||||
<input type="hidden" name="pageNum" value="${pageMaker.cri.pageNum}">
|
||||
<input type="hidden" name="amount" value="${pageMaker.cri.amount}">
|
||||
<input type="hidden" name="keyword" value="${pageMaker.cri.keyword}">
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<%@include file="../includes/admin/footer.jsp" %>
|
||||
@@ -42,6 +122,40 @@ $(document).ready(function(){
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
let searchForm = $('#searchForm');
|
||||
let moveForm = $('#moveForm');
|
||||
|
||||
/* 작거 검색 버튼 동작 */
|
||||
$("#searchForm button").on("click", function(e){
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
/* 검색 키워드 유효성 검사 */
|
||||
if(!searchForm.find("input[name='keyword']").val()){
|
||||
alert("키워드를 입력하십시오");
|
||||
return false;
|
||||
}
|
||||
|
||||
searchForm.find("input[name='pageNum']").val("1");
|
||||
|
||||
searchForm.submit();
|
||||
|
||||
});
|
||||
|
||||
|
||||
/* 페이지 이동 버튼 */
|
||||
$(".pageMaker_btn a").on("click", function(e){
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
moveForm.find("input[name='pageNum']").val($(this).attr("href"));
|
||||
|
||||
moveForm.submit();
|
||||
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
@@ -95,9 +95,9 @@ ul{
|
||||
.admin_content_wrap{
|
||||
width: 80%;
|
||||
float:left;
|
||||
min-height:700px;
|
||||
min-height: 700px;
|
||||
}
|
||||
.admin_content_subject{ /* 관리자 컨텐츠 제목 영역 */
|
||||
.admin_content_subject{ /* 관리자 컨텐츠 제목 영역 */
|
||||
font-size: 40px;
|
||||
font-weight: bolder;
|
||||
padding-left: 15px;
|
||||
@@ -107,6 +107,108 @@ ul{
|
||||
color: white;
|
||||
}
|
||||
|
||||
/* 상품 목록 영역 */
|
||||
.goods_table_wrap{
|
||||
padding: 20px 35px
|
||||
}
|
||||
.goods_table{
|
||||
width: 100%;
|
||||
border: 1px solid #d3d8e1;
|
||||
text-align: center;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
.goods_table td{
|
||||
padding: 10px 5px;
|
||||
border : 1px solid #e9ebf0;
|
||||
}
|
||||
.goods_table thead{
|
||||
background-color: #f8f9fd;
|
||||
font-weight: 600;
|
||||
}
|
||||
.goods_table a{
|
||||
color:#1088ed;
|
||||
font-weight: 500;
|
||||
}
|
||||
.th_column_1{
|
||||
width:11%;
|
||||
}
|
||||
.th_column_3{
|
||||
width:14%;
|
||||
}
|
||||
.th_column_4{
|
||||
width:15%;
|
||||
}
|
||||
.th_column_5{
|
||||
width:10%;
|
||||
}
|
||||
.table_empty{
|
||||
height: 50px;
|
||||
text-align: center;
|
||||
margin: 200px 0 215px 0px;
|
||||
font-size: 25px;
|
||||
}
|
||||
|
||||
/* 검색 영역 */
|
||||
.search_wrap{
|
||||
margin-top:15px;
|
||||
}
|
||||
.search_input{
|
||||
position: relative;
|
||||
text-align:center;
|
||||
}
|
||||
.search_input input[name='keyword']{
|
||||
padding: 4px 10px;
|
||||
font-size: 15px;
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
}
|
||||
.search_btn{
|
||||
height: 32px;
|
||||
width: 80px;
|
||||
font-weight: 600;
|
||||
font-size: 18px;
|
||||
line-height: 20px;
|
||||
position: absolute;
|
||||
margin-left: 15px;
|
||||
background-color: #c3daf7;
|
||||
}
|
||||
|
||||
|
||||
/* 페이지 버튼 인터페이스 */
|
||||
.pageMaker_wrap{
|
||||
text-align: center;
|
||||
margin-top: 30px;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
.pageMaker{
|
||||
list-style: none;
|
||||
display: inline-block;
|
||||
}
|
||||
.pageMaker_btn {
|
||||
float: left;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
margin-left: 20px;
|
||||
}
|
||||
.active{
|
||||
border : 2px solid black;
|
||||
font-weight:400;
|
||||
}
|
||||
.next, .prev {
|
||||
border: 1px solid #ccc;
|
||||
padding: 0 10px;
|
||||
}
|
||||
.pageMaker_btn a:link {color: black;}
|
||||
.pageMaker_btn a:visited {color: black;}
|
||||
.pageMaker_btn a:active {color: black;}
|
||||
.pageMaker_btn a:hover {color: black;}
|
||||
.next a, .prev a {
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* footer navai 영역 */
|
||||
.footer_nav{
|
||||
width:100%;
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
package com.vam.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
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)
|
||||
@ContextConfiguration("file:src/main/webapp/WEB-INF/spring/root-context.xml")
|
||||
@@ -38,11 +40,36 @@ public class AdminMapperTests {
|
||||
*/
|
||||
|
||||
/* 카테고리 리스트 */
|
||||
/*
|
||||
@Test
|
||||
public void cateListTest() throws Exception{
|
||||
|
||||
System.out.println("cateList()..........." + mapper.cateList());
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/* 상품 리스트 & 상품 총 갯수 */
|
||||
@Test
|
||||
public void goodsGetListTest() {
|
||||
|
||||
Criteria cri = new Criteria();
|
||||
|
||||
/* 검색조건 */
|
||||
//cri.setKeyword("테스트");
|
||||
|
||||
/* 검색 리스트 */
|
||||
/*List list = mapper.goodsGetList(cri);
|
||||
for(int i = 0; i < list.size(); i++) {
|
||||
System.out.println("result......." + i + " : " + list.get(i));
|
||||
}*/
|
||||
|
||||
/* 상품 총 갯수 */
|
||||
int result = mapper.goodsGetTotal(cri);
|
||||
System.out.println("resutl.........." + result);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,5 +18,35 @@
|
||||
select * from vam_bcate order by catecode
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 상품 리스트 -->
|
||||
<select id="goodsGetList" resultType="com.vam.model.BookVO">
|
||||
|
||||
select bookId, bookName, b.authorName, c.cateName, bookStock, a.regDate
|
||||
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
|
||||
<if test="keyword != null">
|
||||
where (bookName like concat ('%', #{keyword}, '%'))
|
||||
</if>
|
||||
order by bookId desc
|
||||
limit #{skip}, #{amount}
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 상품 총 갯수 -->
|
||||
<select id="goodsGetTotal" resultType="int">
|
||||
|
||||
select count(*) from vam_book
|
||||
|
||||
<if test="keyword != null">
|
||||
|
||||
where bookName like concat('%' , #{keyword}, '%')
|
||||
|
||||
</if>
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -1,5 +1,5 @@
|
||||
#Generated by Maven Integration for Eclipse
|
||||
#Wed Mar 31 15:59:24 KST 2021
|
||||
#Tue Apr 13 14:07:29 KST 2021
|
||||
m2e.projectLocation=C\:\\Users\\sjinj\\git\\Blog_Project\\VamPa_MySQL
|
||||
m2e.projectName=VamPa_MySQL
|
||||
groupId=com.vam
|
||||
|
||||
Reference in New Issue
Block a user