[Spring][쇼핑몰 프로젝트][31] 검색 구현(기본 기능 구현)
https://kimvampa.tistory.com/244
This commit is contained in:
@@ -13,13 +13,18 @@ import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
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.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
import com.vam.mapper.AttachMapper;
|
||||
import com.vam.model.AttachImageVO;
|
||||
import com.vam.model.BookVO;
|
||||
import com.vam.model.Criteria;
|
||||
import com.vam.model.PageDTO;
|
||||
import com.vam.service.AttachService;
|
||||
import com.vam.service.BookService;
|
||||
|
||||
@Controller
|
||||
public class BookController {
|
||||
@@ -27,7 +32,10 @@ public class BookController {
|
||||
private static final Logger logger = LoggerFactory.getLogger(BookController.class);
|
||||
|
||||
@Autowired
|
||||
private AttachMapper attachMapper;
|
||||
private AttachService attachService;
|
||||
|
||||
@Autowired
|
||||
private BookService bookService;
|
||||
|
||||
//메인 페이지 이동
|
||||
@RequestMapping(value="/main", method = RequestMethod.GET)
|
||||
@@ -69,10 +77,34 @@ public class BookController {
|
||||
|
||||
logger.info("getAttachList.........." + bookId);
|
||||
|
||||
return new ResponseEntity<List<AttachImageVO>>(attachMapper.getAttachList(bookId), HttpStatus.OK);
|
||||
return new ResponseEntity<List<AttachImageVO>>(attachService.getAttachList(bookId), HttpStatus.OK);
|
||||
|
||||
}
|
||||
|
||||
/* 상품 검색 */
|
||||
@GetMapping("search")
|
||||
public String searchGoodsGET(Criteria cri, Model model) {
|
||||
|
||||
logger.info("cri : " + cri);
|
||||
|
||||
List<BookVO> list = bookService.getGoodsList(cri);
|
||||
logger.info("pre list : " + list);
|
||||
if(!list.isEmpty()) {
|
||||
model.addAttribute("list", list);
|
||||
logger.info("list : " + list);
|
||||
} else {
|
||||
model.addAttribute("listcheck", "empty");
|
||||
|
||||
return "search";
|
||||
}
|
||||
|
||||
model.addAttribute("pageMaker", new PageDTO(cri, bookService.goodsGetTotal(cri)));
|
||||
|
||||
|
||||
return "search";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user