143 lines
4.9 KiB
Java
143 lines
4.9 KiB
Java
package com.dbnt.kcgfilemanager.controller;
|
|
|
|
import com.dbnt.kcgfilemanager.config.LogStatus;
|
|
import com.dbnt.kcgfilemanager.model.*;
|
|
import com.dbnt.kcgfilemanager.service.*;
|
|
import lombok.RequiredArgsConstructor;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
import java.io.File;
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.LinkedHashMap;
|
|
import java.util.List;
|
|
|
|
@RestController
|
|
@RequiredArgsConstructor
|
|
@RequestMapping("/admin")
|
|
public class adminController {
|
|
|
|
private final CommonCodeService commonCodeService;
|
|
private final BoardCategoryService boardCategoryService;
|
|
private final UserInfoService userInfoService;
|
|
private final CategoryRoleService categoryRoleService;
|
|
private final BoardService boardService;
|
|
|
|
@GetMapping("/main")
|
|
public ModelAndView goAdmin(BoardLog boardLog) {
|
|
ModelAndView mav = new ModelAndView("admin/main");
|
|
boardLog.setQueryInfo();
|
|
mav.addObject("statusMap", LogStatus.getStatusMap());
|
|
mav.addObject("boardLogList", boardService.selectBoardLogList(boardLog));
|
|
boardLog.setContentCnt(boardService.selectBoardLogListCnt(boardLog));
|
|
boardLog.setPaginationInfo();
|
|
mav.addObject("searchParams", boardLog);
|
|
mav.addObject("diskInfoList", boardService.getDiskInfoList());
|
|
return mav;
|
|
}
|
|
@GetMapping("/categoryMgt")
|
|
public ModelAndView categoryMgt(){
|
|
ModelAndView mav = new ModelAndView("admin/categoryMgt");
|
|
mav.addObject("categoryList", boardCategoryService.selectBoardCategory(null,1));
|
|
return mav;
|
|
}
|
|
|
|
@GetMapping("/getChildCategoryTable")
|
|
public ModelAndView getChildCategoryTable(Integer parentSeq, Integer depth){
|
|
ModelAndView mav = new ModelAndView("admin/boardCategoryTable");
|
|
mav.addObject("categoryList", boardCategoryService.selectBoardCategory(parentSeq, depth));
|
|
mav.addObject("depth", depth);
|
|
return mav;
|
|
}
|
|
|
|
@PostMapping("/insertCategory")
|
|
@ResponseBody
|
|
public int insertBoardCategory(@RequestBody List<BoardCategory> categoryList) {
|
|
boardCategoryService.insertBoardCategory(categoryList);
|
|
return categoryList.get(0).getDepth();
|
|
}
|
|
@PostMapping("/deleteCategory")
|
|
@ResponseBody
|
|
public int deleteBoardCategory(Integer categorySeq, Integer depth) {
|
|
boardCategoryService.deleteBoardCategory(categorySeq, depth);
|
|
return categorySeq;
|
|
}
|
|
@GetMapping("/userMgt")
|
|
public ModelAndView userMgt(UserInfo userInfo) {
|
|
ModelAndView mav = new ModelAndView("admin/userMgt");
|
|
userInfo.setQueryInfo();
|
|
mav.addObject("userInfoList", userInfoService.selectUserInfoList(userInfo));
|
|
userInfo.setContentCnt(userInfoService.selectUserInfoListCnt(userInfo));
|
|
userInfo.setPaginationInfo();
|
|
mav.addObject("searchParams", userInfo);
|
|
return mav;
|
|
}
|
|
|
|
@PostMapping("/insertUserInfo")
|
|
public String insertUserInfo(UserInfo userInfo){
|
|
return userInfoService.insertUserInfo(userInfo);
|
|
}
|
|
|
|
@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.selectUserInfoByUserSeq(userInfo));
|
|
return mav;
|
|
}
|
|
@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")
|
|
public ModelAndView selectCategorySeqListToUser(CategoryRole categoryRole){
|
|
ModelAndView mav = new ModelAndView("admin/userCategoryRole");
|
|
mav.addObject("categorySeqList", categoryRoleService.selectCategorySeqListToUser(categoryRole));
|
|
return mav;
|
|
}
|
|
|
|
@GetMapping("/modifyRequest")
|
|
public ModelAndView modifyRequest() {
|
|
ModelAndView mav = new ModelAndView("admin/modifyRequest");
|
|
return mav;
|
|
}
|
|
|
|
@GetMapping("/codeMgt")
|
|
public ModelAndView codeMgt(CommonCode commonCode) {
|
|
ModelAndView mav = new ModelAndView("admin/codeMgt");
|
|
mav.addObject("categoryList", commonCodeService.selectCommonCodeCategory(commonCode));
|
|
return mav;
|
|
}
|
|
|
|
@GetMapping("/codeValue")
|
|
public ModelAndView codeValue(CommonCode commonCode) {
|
|
ModelAndView mav = new ModelAndView("admin/codeValue");
|
|
mav.addObject("valueList", commonCodeService.selectCommonCodeValue(commonCode.getCategory()));
|
|
return mav;
|
|
}
|
|
|
|
@PostMapping("/insertCode")
|
|
public CommonCode insertCommonCode(CommonCode commonCode){
|
|
commonCodeService.insertCommonCode(commonCode);
|
|
return commonCode;
|
|
}
|
|
|
|
@PutMapping(value = "/deleteCode")
|
|
@ResponseBody
|
|
public int deleteCommonCode(@RequestBody List<CommonCode> codeList) {
|
|
commonCodeService.updateCommonCode(codeList);
|
|
return codeList.size();
|
|
}
|
|
|
|
}
|