diff --git a/src/main/java/com/no1/wms/stock/StockDto.java b/src/main/java/com/no1/wms/stock/StockDto.java index f62552d..7fb44bf 100644 --- a/src/main/java/com/no1/wms/stock/StockDto.java +++ b/src/main/java/com/no1/wms/stock/StockDto.java @@ -6,8 +6,8 @@ import lombok.Data; public class StockDto { private String id; - private int warehouse_id; - private int product_id; + private int warehouseId; + private int productId; private int quantity; private boolean activation; } diff --git a/src/main/java/com/no1/wms/warehouse/WarehouseController.java b/src/main/java/com/no1/wms/warehouse/WarehouseController.java index 1206de6..653621c 100644 --- a/src/main/java/com/no1/wms/warehouse/WarehouseController.java +++ b/src/main/java/com/no1/wms/warehouse/WarehouseController.java @@ -7,6 +7,7 @@ import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; import java.util.List; +import java.util.Map; @Controller @Slf4j @@ -20,6 +21,7 @@ public class WarehouseController { public String list(@RequestParam(name = "searchn", defaultValue = "0") int searchn, @RequestParam(name = "search", defaultValue = "") String search, @RequestParam(name = "p", defaultValue = "1") int page, Model m) { + int count = service.count(searchn, search); int perPage = 5; // 한 페이지에 보일 글의 갯수 @@ -27,6 +29,8 @@ public class WarehouseController { //스톡서비스로 재고 리스트 출력 메서트 작성 List dto = service.list(searchn, search, startRow ,perPage); + + m.addAttribute("wlist", dto); m.addAttribute("start", startRow + 1); @@ -50,19 +54,53 @@ public class WarehouseController { // 재고 상세페이지 @PostMapping("warehouse/read") - public String read(String id, Model m) { + public String read(@RequestParam(name = "searchn", defaultValue = "0") int searchn, + @RequestParam(name = "search", defaultValue = "") String search, + @RequestParam(name = "p", defaultValue = "1") int page, String id, Model m) { //스톡서비스로 재고 상세페이지 출력 메서드 작성 - WarehouseDto dto = service.warehouseOne(id); - m.addAttribute("dto", dto); - return "warehouse/read/"; + + WarehouseDto One = service.One(id); + System.out.println("one :: " + One); + log.debug("Osne테스트 :: " + One); + + m.addAttribute("One", One); + + int warehouseOneCount = service.warehouseOneCount(searchn, search, id); + + log.debug("warehouseOneCount테스트 :: " + warehouseOneCount); + + int perPage = 5; // 한 페이지에 보일 글의 갯수 + int startRow = (page - 1) * perPage; + m.addAttribute("start", startRow + 1); + + List> dto = service.warehouseOne(searchn, search, id, startRow, perPage); + m.addAttribute("wlist", dto); + System.out.println("list ::" + dto); + + log.debug("dto테스트 :: " + dto); + + int pageNum = 5;//보여질 페이지 번호 수 + int totalPages = warehouseOneCount / perPage + (warehouseOneCount % perPage > 0 ? 1 : 0); // 전체 페이지 수 + int begin = (page - 1) / pageNum * pageNum + 1; + int end = begin + pageNum - 1; + if (end > totalPages) { + end = totalPages; + } + m.addAttribute("begin", begin); + m.addAttribute("end", end); + m.addAttribute("pageNum", pageNum); + m.addAttribute("totalPages", totalPages); + m.addAttribute("p" , page); + + return "warehouse/read"; } // 수정 - 폼 @GetMapping("/warehouse/update/{id}") public String update(@PathVariable String id, Model m) { - WarehouseDto dto = service.warehouseOne(id); - m.addAttribute("dto", dto); + WarehouseDto dto = service.One(id); + m.addAttribute("One", dto); return "warehouse/update"; } diff --git a/src/main/java/com/no1/wms/warehouse/WarehouseDto.java b/src/main/java/com/no1/wms/warehouse/WarehouseDto.java index c261634..8f3df49 100644 --- a/src/main/java/com/no1/wms/warehouse/WarehouseDto.java +++ b/src/main/java/com/no1/wms/warehouse/WarehouseDto.java @@ -1,15 +1,26 @@ package com.no1.wms.warehouse; +import com.no1.wms.product.ProductDto; +import com.no1.wms.stock.StockDto; +import lombok.AllArgsConstructor; import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; @Data +@NoArgsConstructor +@AllArgsConstructor public class WarehouseDto { private String id; private String name; private int capacity; - private int current_capacity; - private String manager_id; + private int currentCapacity; + private String managerId; private String address; private boolean activation; + + private List productDto; + private List stockDto; } diff --git a/src/main/java/com/no1/wms/warehouse/WarehouseMapper.java b/src/main/java/com/no1/wms/warehouse/WarehouseMapper.java index 4244fd2..255d3e1 100644 --- a/src/main/java/com/no1/wms/warehouse/WarehouseMapper.java +++ b/src/main/java/com/no1/wms/warehouse/WarehouseMapper.java @@ -8,19 +8,22 @@ import java.util.Map; @Mapper public interface WarehouseMapper { - - int count(Map m);//검색 글 갯수 - + List list(Map m); + int count(Map m);//검색 글 갯수 + + List> warehouseOne(Map m); + + int warehouseOneCount(Map m);//검색 글 갯수 + + WarehouseDto One(String id); + int updateWarehouse(WarehouseDto dto); int createWarehouse(WarehouseDto dto); - - WarehouseDto warehouseOne(String id); int deleteWarehouse(String id); - } diff --git a/src/main/java/com/no1/wms/warehouse/WarehouseService.java b/src/main/java/com/no1/wms/warehouse/WarehouseService.java index 03734cc..876f771 100644 --- a/src/main/java/com/no1/wms/warehouse/WarehouseService.java +++ b/src/main/java/com/no1/wms/warehouse/WarehouseService.java @@ -1,19 +1,21 @@ package com.no1.wms.warehouse; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.awt.color.ICC_ColorSpace; import java.util.HashMap; import java.util.List; import java.util.Map; @Service +@Slf4j public class WarehouseService { @Autowired WarehouseMapper mapper; public int count(int searchn, String search) { - Map m = new HashMap(); m.put("searchn",searchn); @@ -37,11 +39,37 @@ public class WarehouseService { } - public WarehouseDto warehouseOne(String id) { - return mapper.warehouseOne(id); + public List> warehouseOne(int searchn, String search, String id, int start, int perPage) { + + Map m = new HashMap(); + m.put("searchn",searchn); + m.put("search", search); + m.put("start", start); + m.put("perPage", perPage); + m.put("id" , id); + System.out.println(m); + + List> result = mapper.warehouseOne(m); + log.debug("warehouseOne테스트 :: " + result); + return result; } - - + + public int warehouseOneCount(int searchn, String search, String id){ + + Map m = new HashMap(); + m.put("searchn",searchn); + m.put("search", search); + m.put("id", id); + + log.debug("warehouseOneCount테스트 :: " + m); + + return mapper.warehouseOneCount(m); + } + + public WarehouseDto One(String id){ + return mapper.One(id); + } + public int createWarehouse(WarehouseDto dto) { return mapper.createWarehouse(dto); } diff --git a/src/main/resources/mappers/WarehouseMapper.xml b/src/main/resources/mappers/WarehouseMapper.xml index 934d0e1..d120d74 100644 --- a/src/main/resources/mappers/WarehouseMapper.xml +++ b/src/main/resources/mappers/WarehouseMapper.xml @@ -4,33 +4,76 @@ - + - + select p.name, s.quantity, w.id + from warehouse w + LEFT JOIN stock s ON w.id = s.warehouse_id + LEFT JOIN product p ON s.product_id = p.id + + + + w.id = #{id} and w.activation = 1 and p.name like concat('%',#{search},'%') + w.id = #{id} and w.activation = 1 and s.quantity like concat('%',#{search},'%') + + + + + + + + + + @@ -52,7 +95,7 @@ - delete from warehouse where no = #{id} + delete from warehouse where id = #{id} \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/warehouse/list.jsp b/src/main/webapp/WEB-INF/views/warehouse/list.jsp index bfe82b2..347e77c 100644 --- a/src/main/webapp/WEB-INF/views/warehouse/list.jsp +++ b/src/main/webapp/WEB-INF/views/warehouse/list.jsp @@ -1,15 +1,21 @@ -<%@ page contentType="text/html; charset=UTF-8"%> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> -<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> +<%@ page contentType="text/html; charset=UTF-8" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> 창고 리스트 + -
-
+
+

창고 리스트

@@ -29,7 +35,8 @@
- +
@@ -49,14 +56,14 @@ - - - ${start} - ${dto.name } - ${dto.capacity } - ${dto.current_capacity } - - + + + ${start} + ${dto.name } + ${dto.capacity } + ${dto.currentCapacity } + +
@@ -69,47 +76,49 @@
-
    - -
  • - < -
  • -
    - -
  • active "> - ${i } -
  • -
    - -
  • - > -
  • -
    -
+
    + +
  • + < +
  • +
    + +
  • active "> + ${i } +
  • +
    + +
  • + > +
  • +
    +
-
+ - - - + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/warehouse/read.jsp b/src/main/webapp/WEB-INF/views/warehouse/read.jsp index 2c1d4eb..5ff4559 100644 --- a/src/main/webapp/WEB-INF/views/warehouse/read.jsp +++ b/src/main/webapp/WEB-INF/views/warehouse/read.jsp @@ -1,5 +1,5 @@ -<%@ page contentType="text/html; charset=UTF-8"%> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@ page contentType="text/html; charset=UTF-8" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> @@ -13,28 +13,131 @@ -
-
-
-
-

제품 카테고리 상세페이지

-
-
- +
+ +
+

창고 상세페이지

+
+
- +
+
+
+
+
+
+
+ 창고명 + +
+
+ 용적 + +
+
+ 적재량 + +
+ +
+
+
+
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + +
번호제품명재고수
${start} ${dto.name }${dto.quantity }
+
+
+
+
+
+
+ +
+
+ +
    + +
  • + < +
  • +
    + +
  • active "> + ${i } +
  • +
    + +
  • + > +
  • +
    +
+
+
+
+
+ + +
+
+
+
+ +
+ diff --git a/src/main/webapp/WEB-INF/views/warehouse/update.jsp b/src/main/webapp/WEB-INF/views/warehouse/update.jsp new file mode 100644 index 0000000..b4b48cd --- /dev/null +++ b/src/main/webapp/WEB-INF/views/warehouse/update.jsp @@ -0,0 +1,154 @@ +<%@ page contentType="text/html; charset=UTF-8"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> + + + + + + 제품 카테고리 수정페이지 + + +
+

제품 카테고리 수정페이지

+
+
+
+
+<%--
--%> +<%--
--%> +<%--
--%> +<%--
--%> +<%-- 대분류 +<%-- type="text" class="form-control" placeholder="대분류" id="cls_nm_1"--%> +<%-- aria-label="대분류" value="${dto.cls_nm_1 }">--%> +<%--
--%> + +<%--
--%> +<%-- 중분류 +<%-- type="text" class="form-control" placeholder="중분류" id="cls_nm_2"--%> +<%-- aria-label="중분류" value="${dto.cls_nm_2 }">--%> +<%--
--%> + +<%--
--%> +<%-- 소분류 +<%-- type="text" class="form-control" placeholder="소분류" id="cls_nm_3"--%> +<%-- aria-label="소분류" value="${dto.cls_nm_3 }">--%> +<%--
--%> + +<%--
--%> +<%-- 세분류 +<%-- type="text" class="form-control" placeholder="세분류" id="cls_nm_4"--%> +<%-- aria-label="세분류" value="${dto.cls_nm_4 }">--%> +<%--
--%> + +<%--
--%> +<%-- KAN 코드 +<%-- type="text" class="form-control" placeholder="KAN 코드"--%> +<%-- aria-label="KAN 코드" value="${dto.kan_code }" id="kan_code" readonly>--%> +<%--
--%> +<%--
--%> +<%--
--%> +<%--
--%> + +<%--
--%> +<%--
--%> +<%--
--%> +<%-- --%> +<%-- --%> +<%--
--%> +<%--
--%> +<%--
--%> +
+
+ + +