2021-11-30 10:05:43 +00:00
|
|
|
package com.dbnt.kcgfilemanager.controller;
|
2021-11-29 09:38:48 +00:00
|
|
|
|
2021-12-07 10:08:49 +00:00
|
|
|
import com.dbnt.kcgfilemanager.model.BoardCategory;
|
2021-12-08 09:50:38 +00:00
|
|
|
import com.dbnt.kcgfilemanager.model.CategoryRole;
|
2021-11-30 10:05:43 +00:00
|
|
|
import com.dbnt.kcgfilemanager.model.CommonCode;
|
2021-12-03 09:07:14 +00:00
|
|
|
import com.dbnt.kcgfilemanager.model.UserInfo;
|
2021-12-07 10:08:49 +00:00
|
|
|
import com.dbnt.kcgfilemanager.service.BoardCategoryService;
|
2021-12-08 09:50:38 +00:00
|
|
|
import com.dbnt.kcgfilemanager.service.CategoryRoleService;
|
2021-11-30 10:05:43 +00:00
|
|
|
import com.dbnt.kcgfilemanager.service.CommonCodeService;
|
2021-12-03 09:07:14 +00:00
|
|
|
import com.dbnt.kcgfilemanager.service.UserInfoService;
|
2021-11-29 09:38:48 +00:00
|
|
|
import lombok.RequiredArgsConstructor;
|
2021-12-01 09:54:01 +00:00
|
|
|
import org.springframework.web.bind.annotation.*;
|
2021-11-30 10:05:43 +00:00
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
2021-12-08 09:50:38 +00:00
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.LinkedHashMap;
|
2021-11-30 10:05:43 +00:00
|
|
|
import java.util.List;
|
2021-11-29 09:38:48 +00:00
|
|
|
|
2021-12-02 09:10:30 +00:00
|
|
|
@RestController
|
2021-11-29 09:38:48 +00:00
|
|
|
@RequiredArgsConstructor
|
|
|
|
|
@RequestMapping("/admin")
|
|
|
|
|
public class adminController {
|
|
|
|
|
|
2021-11-30 10:05:43 +00:00
|
|
|
private final CommonCodeService commonCodeService;
|
2021-12-07 10:08:49 +00:00
|
|
|
private final BoardCategoryService boardCategoryService;
|
2021-12-03 09:07:14 +00:00
|
|
|
private final UserInfoService userInfoService;
|
2021-12-08 09:50:38 +00:00
|
|
|
private final CategoryRoleService categoryRoleService;
|
2021-11-29 09:38:48 +00:00
|
|
|
|
|
|
|
|
@GetMapping("/main")
|
2021-12-02 09:10:30 +00:00
|
|
|
public ModelAndView goAdmin() {
|
|
|
|
|
ModelAndView mav = new ModelAndView("admin/main");
|
|
|
|
|
return mav;
|
2021-11-29 09:38:48 +00:00
|
|
|
}
|
2021-12-06 09:46:00 +00:00
|
|
|
@GetMapping("/categoryMgt")
|
|
|
|
|
public ModelAndView categoryMgt(){
|
|
|
|
|
ModelAndView mav = new ModelAndView("admin/categoryMgt");
|
2021-12-07 10:08:49 +00:00
|
|
|
mav.addObject("categoryList", boardCategoryService.selectBoardCategory(null,1));
|
|
|
|
|
return mav;
|
|
|
|
|
}
|
2021-11-29 09:38:48 +00:00
|
|
|
|
2021-12-07 10:08:49 +00:00
|
|
|
@GetMapping("/getChildCategoryTable")
|
|
|
|
|
public ModelAndView getChildCategoryTable(Integer parentCategory, Integer depth){
|
|
|
|
|
ModelAndView mav = new ModelAndView("admin/boardCategoryTable");
|
|
|
|
|
mav.addObject("categoryList", boardCategoryService.selectBoardCategory(parentCategory, depth));
|
|
|
|
|
mav.addObject("depth", depth);
|
2021-12-06 09:46:00 +00:00
|
|
|
return mav;
|
|
|
|
|
}
|
2021-12-07 10:08:49 +00:00
|
|
|
|
|
|
|
|
@PostMapping("/insertCategory")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public int insertBoardCategory(@RequestBody List<BoardCategory> categoryList) {
|
|
|
|
|
boardCategoryService.insertBoardCategory(categoryList);
|
|
|
|
|
return categoryList.get(0).getDepth();
|
|
|
|
|
}
|
|
|
|
|
@DeleteMapping("/deleteCategory")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public int deleteBoardCategory(Integer categorySeq, Integer depth) {
|
|
|
|
|
boardCategoryService.deleteBoardCategory(categorySeq, depth);
|
|
|
|
|
return categorySeq;
|
|
|
|
|
}
|
2021-11-29 09:38:48 +00:00
|
|
|
@GetMapping("/userMgt")
|
2021-12-03 09:07:14 +00:00
|
|
|
public ModelAndView userMgt(UserInfo userInfo) {
|
|
|
|
|
userInfo.setQueryInfo();
|
2021-12-02 09:10:30 +00:00
|
|
|
ModelAndView mav = new ModelAndView("admin/userMgt");
|
2021-12-03 09:07:14 +00:00
|
|
|
mav.addObject("userInfoList", userInfoService.selectUserInfoList(userInfo));
|
|
|
|
|
userInfo.setContentCnt(userInfoService.selectUserInfoListCnt(userInfo));
|
|
|
|
|
userInfo.setPaginationInfo();
|
|
|
|
|
mav.addObject("searchParams", userInfo);
|
2021-12-02 09:10:30 +00:00
|
|
|
return mav;
|
2021-11-29 09:38:48 +00:00
|
|
|
}
|
|
|
|
|
|
2021-12-03 09:07:14 +00:00
|
|
|
@PostMapping("/insertUserInfo")
|
|
|
|
|
public String insertUserInfo(UserInfo userInfo){
|
|
|
|
|
return userInfoService.insertUserInfo(userInfo);
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-06 08:12:41 +00:00
|
|
|
@PostMapping("/updateUserInfo")
|
|
|
|
|
public String updateUserInfo(UserInfo userInfo){
|
|
|
|
|
return userInfoService.updateUserInfo(userInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("/selectUserInfo")
|
|
|
|
|
public ModelAndView selectUserInfo(UserInfo userInfo){
|
|
|
|
|
ModelAndView mav = new ModelAndView("admin/userInfo");
|
|
|
|
|
mav.addObject("userInfo", userInfoService.selectUserInfo(userInfo));
|
|
|
|
|
return mav;
|
|
|
|
|
}
|
2021-12-08 09:50:38 +00:00
|
|
|
@PostMapping("/insertCategoryRole")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public Integer insertCategoryRole(@RequestBody HashMap<String, Object> map){
|
|
|
|
|
List<LinkedHashMap> mapList = (List<LinkedHashMap>)map.get("categoryRoleList");
|
|
|
|
|
Integer userSeq = (int)map.get("userSeq");
|
|
|
|
|
categoryRoleService.insertCategoryRole(userSeq, mapList);
|
|
|
|
|
return map.size();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("/selectCategoryRole")
|
2021-12-09 09:23:19 +00:00
|
|
|
public ModelAndView selectCategorySeqListToUser(CategoryRole categoryRole){
|
2021-12-08 09:50:38 +00:00
|
|
|
ModelAndView mav = new ModelAndView("admin/userCategoryRole");
|
2021-12-09 09:23:19 +00:00
|
|
|
mav.addObject("categorySeqList", categoryRoleService.selectCategorySeqListToUser(categoryRole));
|
2021-12-08 09:50:38 +00:00
|
|
|
return mav;
|
|
|
|
|
}
|
2021-12-06 09:46:00 +00:00
|
|
|
|
2021-11-29 09:38:48 +00:00
|
|
|
@GetMapping("/modifyRequest")
|
2021-12-02 09:10:30 +00:00
|
|
|
public ModelAndView modifyRequest() {
|
|
|
|
|
ModelAndView mav = new ModelAndView("admin/modifyRequest");
|
|
|
|
|
return mav;
|
2021-11-29 09:38:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("/codeMgt")
|
2021-11-30 10:05:43 +00:00
|
|
|
public ModelAndView codeMgt(CommonCode commonCode) {
|
|
|
|
|
ModelAndView mav = new ModelAndView("admin/codeMgt");
|
2021-12-01 09:54:01 +00:00
|
|
|
mav.addObject("categoryList", commonCodeService.selectCommonCodeCategory(commonCode));
|
2021-11-30 10:05:43 +00:00
|
|
|
return mav;
|
2021-11-29 09:38:48 +00:00
|
|
|
}
|
2021-12-01 09:54:01 +00:00
|
|
|
|
|
|
|
|
@GetMapping("/codeValue")
|
|
|
|
|
public ModelAndView codeValue(CommonCode commonCode) {
|
|
|
|
|
ModelAndView mav = new ModelAndView("admin/codeValue");
|
2021-12-03 09:07:14 +00:00
|
|
|
mav.addObject("valueList", commonCodeService.selectCommonCodeValue(commonCode.getCategory()));
|
2021-12-01 09:54:01 +00:00
|
|
|
return mav;
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-03 01:08:44 +00:00
|
|
|
@PostMapping("/insertCode")
|
2021-12-02 09:10:30 +00:00
|
|
|
public CommonCode insertCommonCode(CommonCode commonCode){
|
2021-12-01 09:54:01 +00:00
|
|
|
commonCodeService.insertCommonCode(commonCode);
|
2021-12-02 09:10:30 +00:00
|
|
|
return commonCode;
|
2021-12-01 09:54:01 +00:00
|
|
|
}
|
2021-12-02 09:10:30 +00:00
|
|
|
|
2021-12-03 01:08:44 +00:00
|
|
|
@PutMapping(value = "/deleteCode")
|
2021-12-02 09:10:30 +00:00
|
|
|
@ResponseBody
|
2021-12-03 01:08:44 +00:00
|
|
|
public int deleteCommonCode(@RequestBody List<CommonCode> codeList) {
|
2021-12-02 09:10:30 +00:00
|
|
|
commonCodeService.updateCommonCode(codeList);
|
|
|
|
|
return codeList.size();
|
2021-12-01 09:54:01 +00:00
|
|
|
}
|
2021-12-02 09:10:30 +00:00
|
|
|
|
2021-11-29 09:38:48 +00:00
|
|
|
}
|