diff --git a/src/main/java/com/dbnt/kcgfilemanager/controller/adminController.java b/src/main/java/com/dbnt/kcgfilemanager/controller/adminController.java index 632fab1..d1d60d7 100644 --- a/src/main/java/com/dbnt/kcgfilemanager/controller/adminController.java +++ b/src/main/java/com/dbnt/kcgfilemanager/controller/adminController.java @@ -63,6 +63,18 @@ public class adminController { boardCategoryService.deleteBoardCategory(categorySeq, depth); return categorySeq; } + + /*게시판 분류관리 개선*/ + @GetMapping("/categoryMgt2") + public ModelAndView categoryMgt2(){ + ModelAndView mav = new ModelAndView("admin/categoryMgt2"); + return mav; + } + @GetMapping("/getCategoryList") + public List getCategoryList(){ + return boardCategoryService.selectBoardCategoryListToFindAll(); + } + @GetMapping("/userMgt") public ModelAndView userMgt(UserInfo userInfo) { ModelAndView mav = new ModelAndView("admin/userMgt"); diff --git a/src/main/java/com/dbnt/kcgfilemanager/model/BoardCategory.java b/src/main/java/com/dbnt/kcgfilemanager/model/BoardCategory.java index 2051ce5..db54a6d 100644 --- a/src/main/java/com/dbnt/kcgfilemanager/model/BoardCategory.java +++ b/src/main/java/com/dbnt/kcgfilemanager/model/BoardCategory.java @@ -30,4 +30,8 @@ public class BoardCategory { private String categoryName; @Transient private List childCategoryList; + @Transient + private String status; + @Transient + private Integer tempSeq; } diff --git a/src/main/java/com/dbnt/kcgfilemanager/service/BoardCategoryService.java b/src/main/java/com/dbnt/kcgfilemanager/service/BoardCategoryService.java index 47bb066..f7d0c3b 100644 --- a/src/main/java/com/dbnt/kcgfilemanager/service/BoardCategoryService.java +++ b/src/main/java/com/dbnt/kcgfilemanager/service/BoardCategoryService.java @@ -25,6 +25,7 @@ public class BoardCategoryService { public List selectBoardCategory(Integer parentSeq, Integer depth) { return boardCategoryRepository.findByParentSeqAndDepth(parentSeq, depth); } + public List selectBoardCategoryAll(Integer parentSeq, Integer depth){ List categoryList = boardCategoryRepository.findByParentSeqAndDepth(parentSeq, depth); for(BoardCategory category: categoryList){ @@ -32,6 +33,11 @@ public class BoardCategoryService { } return categoryList; } + + public List selectBoardCategoryListToFindAll(){ + return boardCategoryRepository.findAll(); + } + @Transactional public void insertBoardCategory(List categoryList){ boardCategoryRepository.saveAll(categoryList); diff --git a/src/main/resources/static/js/admin/categoryMgt2.js b/src/main/resources/static/js/admin/categoryMgt2.js new file mode 100644 index 0000000..490f7a1 --- /dev/null +++ b/src/main/resources/static/js/admin/categoryMgt2.js @@ -0,0 +1,70 @@ +const categoryList = [] +let maxSeq = 0; +$(function (){ + getCategoryList(); +}) +$(document).on('click', '.categoryTr', function (){ + const chooseTr = $(this) + setCategoryTable(Number(chooseTr.attr("data-depth"))+1, Number(chooseTr.attr("data-categoryseq"))); +}) +function getCategoryList(){ + $.ajax({ + url: '/admin/getCategoryList', + type: 'GET', + success: function(data){ + data.forEach(function (category){ + categoryList.push({ + categorySeq: category.categorySeq, + parentSeq: category.parentSeq, + categoryName: category.categoryName, + depth: category.depth, + status: "saved", + }) + if(maxSeq"; + tbody += "" + tbody += ""+data.categoryName+"" + tbody += ""; + }) + clearChildTable(depth); + $("#depth"+depth+"Tbody").append(tbody); + +} + +function getTableData(categoryList, depth, parentSeq){ + let targetList = []; + categoryList.forEach(function (category){ + if(category.depth===depth && category.parentSeq===parentSeq){ + targetList.push({ + categorySeq: category.categorySeq, + categoryName: category.categoryName, + parentSeq: category.parentSeq, + depth: category.depth, + status: category.status + }) + } + }); + return targetList; +} + +function clearChildTable(depth){ + for(let i=depth; i<=4; i++){ + $("#depth"+i+"Tbody").empty(); + } +} \ No newline at end of file diff --git a/src/main/resources/templates/admin/categoryMgt2.html b/src/main/resources/templates/admin/categoryMgt2.html new file mode 100644 index 0000000..8f3e8d4 --- /dev/null +++ b/src/main/resources/templates/admin/categoryMgt2.html @@ -0,0 +1,131 @@ + + + + + +
+
+ + +

게시판 분류 관리

+
+
+
+
+ +
+
+
+
+ + + + + + + + + +
대분류
+
+
+
+ +
+
+ +
+
+
+
+
+ + + + + + + + + +
연도
+
+
+
+ +
+
+ +
+
+
+
+
+ + + + + + + + + +
중분류
+
+
+
+ +
+
+ +
+
+
+
+
+ + + + + + + + + +
소분류
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+
+
+ + + + + + + +
+ + + + + + +
+
+
+ \ No newline at end of file diff --git a/src/main/resources/templates/fragments/leftMenu.html b/src/main/resources/templates/fragments/leftMenu.html index 2710b91..599d601 100644 --- a/src/main/resources/templates/fragments/leftMenu.html +++ b/src/main/resources/templates/fragments/leftMenu.html @@ -6,6 +6,7 @@