diff --git a/src/main/java/com/no1/wms/category/CategoryController.java b/src/main/java/com/no1/wms/category/CategoryController.java index 1764ba2..58cff6d 100644 --- a/src/main/java/com/no1/wms/category/CategoryController.java +++ b/src/main/java/com/no1/wms/category/CategoryController.java @@ -49,8 +49,8 @@ public class CategoryController { } // 상세페이지 - @PostMapping("/category/read/{kan_code}") - public String read(@PathVariable String kan_code, Model m) { + @PostMapping("/category/read") + public String read(String kan_code, Model m) { // 선택한 kan_code를 바탕으로 원하는 상세정보 출력하는 메서드 작성 CategoryDto dto = categoryService.selectByKanCode(kan_code); m.addAttribute("dto", dto); @@ -58,28 +58,27 @@ public class CategoryController { } // 생성 - 폼 - @GetMapping("/category/create") + @PostMapping("/category/create") public String create() { return "category/create"; } - + + // 생성 - Ajax @PostMapping("/category/create_process") @ResponseBody - public boolean createProcess(CategoryDto dto, Model m) { + public boolean createProcess(CategoryDto dto) { int i = categoryService.createProcess(dto); if (i == 1) { return true; } else { - // ajax테스트후 결정 - m.addAttribute("dto", dto); return false; } } // 수정 - 폼 - @GetMapping("/category/update/{kan_code}") - public String update(@PathVariable String kan_code, Model m) { + @PostMapping("/category/update") + public String update(String kan_code, Model m) { CategoryDto dto = categoryService.selectByKanCode(kan_code); m.addAttribute("dto", dto); return "category/update"; @@ -88,15 +87,13 @@ public class CategoryController { @PutMapping("/category/update_process") @ResponseBody - public int updateProcess(CategoryDto dto, Model m) { + public boolean updateProcess(CategoryDto dto) { int i = categoryService.updateByKanCode(dto); if (i == 1) { - return i; + return true; } else { - // ajax테스트후 결정 - // m.addAttribute("dto", dto); - return 0; + return false; } } diff --git a/src/main/resources/mappers/CategoryMapper.xml b/src/main/resources/mappers/CategoryMapper.xml index 86268b2..3d47c79 100644 --- a/src/main/resources/mappers/CategoryMapper.xml +++ b/src/main/resources/mappers/CategoryMapper.xml @@ -14,8 +14,8 @@ UPDATE product_category - SET cls_nm_1 = #{dto.cls_nm_1}, cls_nm_2 = #{dto.cls_nm_2},cls_nm_3 = #{dto.cls_nm_3}, cls_nm_4 = #{dto.cls_nm_4} - WHERE kan_code = #{dto.kan_code} + SET cls_nm_1 = #{cls_nm_1}, cls_nm_2 = #{cls_nm_2},cls_nm_3 = #{cls_nm_3}, cls_nm_4 = #{cls_nm_4} + WHERE kan_code = #{kan_code} diff --git a/src/main/webapp/WEB-INF/views/category/create.jsp b/src/main/webapp/WEB-INF/views/category/create.jsp index cb0d4b9..c851f5e 100644 --- a/src/main/webapp/WEB-INF/views/category/create.jsp +++ b/src/main/webapp/WEB-INF/views/category/create.jsp @@ -5,12 +5,6 @@ 카테고리 생성 -
-

제품 카테고리 생성

+
+

제품 카테고리 생성


-
+
@@ -44,19 +38,19 @@
- 중분류 + 중분류
- 소분류 + 소분류
- 세분류 + 세분류 @@ -68,6 +62,7 @@ +
@@ -75,8 +70,9 @@
- - + + +
@@ -108,11 +104,12 @@ if (data == "") { $("#checkKan").css("background-color", "#4CAF50"); // 파란색 배경으로 변경 $("#checkKan").text("사용가능"); // 버튼 텍스트 변경 - $("#checkKan").append(""); + $("#kan_chack").val('1'); } else { $("#checkKan").css("background-color", "#FF5E5E"); // 원래의 빨간색 배경으로 변경 $("#checkKan").text("사용불가"); // 버튼 텍스트 변경 $("#kan_chack").val('0'); + $("#kan_code").focus(); //여기 } }).fail(function() { @@ -124,8 +121,16 @@ });//kan중복체크 기능 + $("#kan_code").on("change", function() { + $("#kan_chack").val('0'); + $("#checkKan").css("background-color", "#FF5E5E"); // 원래의 빨간색 배경으로 변경 + $("#checkKan").text("중복확인"); + $("#kan_code").focus(); + })//kan_code값이 바뀔때마다 초기화 스크립트 - $("#submit").on("click", function(){ + + + $("#submitBtn").on("click", function(){ var clsnm1 = $("#cls_nm_1").val(); var clsnm2 = $("#cls_nm_2").val(); var clsnm3 = $("#cls_nm_3").val(); @@ -133,22 +138,27 @@ var kanCode = $("#kan_code").val(); if(!clsnm1){ alert("대분류를 입력해야 합니다."); + $("#cls_nm_1").focus(); return false; } if(!clsnm2){ alert("중분류를 입력해야 합니다."); + $("#cls_nm_2").focus(); return false; } if(!clsnm3){ alert("소분류를 입력해야 합니다."); + $("#cls_nm_3").focus(); return false; } if(!clsnm4){ alert("세분류를 입력해야 합니다."); + $("#cls_nm_4").focus(); return false; } if( $("#kan_chack").val() != 1){ alert("KAN코드를 입력후 중복체크를 해야합니다."); + $("#kan_code").focus(); return false; } @@ -167,19 +177,34 @@ }).done(function(data) { if (data == true) { alert("카테고리가 생성되었습니다."); - $(location).attr("href", "/category/list") + + var form = document.createElement("form"); + form.action = "/category/read"; + form.method = "POST"; + document.body.appendChild(form); + + var input = document.createElement("input"); + input.type = "hidden"; + input.name = "kan_code"; + input.value = kanCode; + form.appendChild(input); + + form.submit(); } else { alert("카테고리 생성에 실패하였습니다."); } }).fail(function() { alert("오류가 발생했습니다."); }).always(function() { - // Ajax 요청 완료 후 버튼 다시 활성화 - + // }); }) + $("#cancelBtn").on("click", function(){ + $(location).attr("href", "/category/list"); + + }) diff --git a/src/main/webapp/WEB-INF/views/category/list.jsp b/src/main/webapp/WEB-INF/views/category/list.jsp index 05251b9..80e53ac 100644 --- a/src/main/webapp/WEB-INF/views/category/list.jsp +++ b/src/main/webapp/WEB-INF/views/category/list.jsp @@ -5,80 +5,137 @@ 제품 카테고리 - - - -
-

제품 카테고리 관리

+
+

제품 카테고리 관리


-
- -
-
- +
+
+ +
+
+ +
+ +
- - + +
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
대분류중분류소분류세분류KAN코드
${dto.cls_nm_1 }${dto.cls_nm_2 }${dto.cls_nm_3 }${dto.cls_nm_4 }${dto.kan_code }
+
- +
-
- - - - - - - - - - - - - - - - - - -
KAN코드대분류중분류소분류세분류
${dto.kan_code }${dto.cls_nm_1 }${dto.cls_nm_2 }${dto.cls_nm_3 }${dto.cls_nm_4 }
+
+
+
+ 엑셀이미지 + +
+
+ +
+
+ +
+
-
-
- 엑셀다운로드 이미지 - -
-
- -
-
- -
- -
\ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/category/read.jsp b/src/main/webapp/WEB-INF/views/category/read.jsp new file mode 100644 index 0000000..864c84e --- /dev/null +++ b/src/main/webapp/WEB-INF/views/category/read.jsp @@ -0,0 +1,95 @@ +<%@ page contentType="text/html; charset=UTF-8"%> + + + + + +제품 카테고리 상세페이지 + + +
+

제품 카테고리 상세페이지

+
+
+ +
+
+
+
+
+
+ 대분류 +
+ +
+ 중분류 +
+ +
+ 소분류 +
+ +
+ 세분류 +
+ +
+ KAN 코드 +
+
+
+
+ +
+
+
+ + +
+
+
+
+
+ + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/category/update.jsp b/src/main/webapp/WEB-INF/views/category/update.jsp new file mode 100644 index 0000000..cab307a --- /dev/null +++ b/src/main/webapp/WEB-INF/views/category/update.jsp @@ -0,0 +1,155 @@ +<%@ page contentType="text/html; charset=UTF-8"%> + + + + +제품 카테고리 수정페이지 + + +
+

제품 카테고리 수정페이지

+
+
+
+
+
+
+
+
+ 대분류 +
+ +
+ 중분류 +
+ +
+ 소분류 +
+ +
+ 세분류 +
+ +
+ KAN 코드 +
+
+
+
+ +
+
+
+ + +
+
+
+
+
+ + + + + + \ No newline at end of file