package com.dbnt.kcgfilemanager.controller; import com.dbnt.kcgfilemanager.model.CommonCode; import com.dbnt.kcgfilemanager.service.CommonCodeService; import lombok.RequiredArgsConstructor; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @RestController @RequiredArgsConstructor @RequestMapping("/admin") public class adminController { private final CommonCodeService commonCodeService; @GetMapping("/main") public ModelAndView goAdmin() { ModelAndView mav = new ModelAndView("admin/main"); return mav; } @GetMapping("/userMgt") public ModelAndView userMgt() { ModelAndView mav = new ModelAndView("admin/userMgt"); 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)); return mav; } @PostMapping("/insertCode") public CommonCode insertCommonCode(CommonCode commonCode){ commonCodeService.insertCommonCode(commonCode); return commonCode; } @PutMapping(value = "/deleteCode") @ResponseBody public int deleteCommonCode(@RequestBody List codeList) { commonCodeService.updateCommonCode(codeList); return codeList.size(); } }