@RequestMapping(value = "/ajaxAddMenuCancel.do") public void ajaxAddMenuCancel( HttpServletRequest request, HttpServletResponse response, MenuDTO menuDto) throws IOException { System.out.println("/ajaxAddMenuCancel.do"); System.out.println("menuDto::" + menuDto); String restntId = menuDto.getRestntId(); String menuId = menuDto.getMenuId(); System.out.println("run Cancel Query"); menuService.addMenuCancel(menuId); System.out.println(restntId); System.out.println("run menuList Query"); menus = menuService.getMenuListByRestntId(restntId); System.out.println(menus); // 제이슨으로 변환 JSONArray jsonArray = JSONArray.fromObject(menus); System.out.println("menus - " + jsonArray); Map<String, Object> map = new HashMap<String, Object>(); map.put("menus", jsonArray); JSONObject jsonObject = JSONObject.fromObject(map); System.out.println("json - " + jsonObject); response.setContentType("text/html; charset=utf-8"); PrintWriter out = response.getWriter(); out.print(jsonObject.toString()); }
// 메뉴 추가 @RequestMapping(value = "/menuInfoInsert.do", method = RequestMethod.POST) String menuInfoInsert(Model model, MenuDTO menuDto) { menuService.putMenu(menuDto); menu = menuService.getMenuInfoByMenuId(menuDto.getMenuId()); model.addAttribute("menu", menu); return "admin/menuManant"; }
@RequestMapping(value = "/ajaxMenuList.do") public void ajaxMenuList( HttpServletRequest request, HttpServletResponse response, SettingDTO settingDto) throws IOException { System.out.println("/ajaxMenuList.do"); String restntId = request.getParameter("restntId"); System.out.println(restntId); menus = menuService.getMenuListByRestntId(restntId); System.out.println(menus); // 제이슨으로 변환 JSONArray jsonArray = JSONArray.fromObject(menus); System.out.println("menus - " + jsonArray); Map<String, Object> map = new HashMap<String, Object>(); map.put("menus", jsonArray); JSONObject jsonObject = JSONObject.fromObject(map); System.out.println("json - " + jsonObject); response.setContentType("text/html; charset=utf-8"); PrintWriter out = response.getWriter(); out.print(jsonObject.toString()); }
@RequestMapping(value = "/ajaxDelMenu.do") public void delMenu( HttpServletRequest request, HttpServletResponse response, SettingDTO settingDto, MenuDTO menuDto) throws IOException { System.out.println("/ajaxDelMenu.do"); System.out.println("menuDto::" + menuDto); String restntId = menuDto.getRestntId(); String menuId = menuDto.getMenuId(); System.out.println("소속 식당 아이디::" + restntId); System.out.println("입력 정보 반영 쿼리 실행"); menuService.dropMenuByMenuId(menuId); System.out.println("메뉴 리스트 가져오는 쿼리 실행"); menus = menuService.getMenuListByRestntId(restntId); System.out.println(menus); // 제이슨으로 변환 JSONArray jsonArray = JSONArray.fromObject(menus); System.out.println("menus - " + jsonArray); Map<String, Object> map = new HashMap<String, Object>(); map.put("menus", jsonArray); JSONObject jsonObject = JSONObject.fromObject(map); System.out.println("json - " + jsonObject); response.setContentType("text/html; charset=utf-8"); PrintWriter out = response.getWriter(); out.print(jsonObject.toString()); }
@RequestMapping(value = "/ajaxAddMenuForm.do") public void ajaxAddMenuForm( HttpServletRequest request, HttpServletResponse response, String restntId, MenuDTO menuDto) throws IOException { System.out.println("/ajaxAddMenuForm.do"); System.out.println(restntId); String lastMenuId = menuService.getLastMenuId(restntId); String newMenuId = menuIdGen(lastMenuId, restntId); menuDto.setMenuId(newMenuId); menuDto.setRestntId(restntId); menuService.addMenuForm(menuDto); // 제이슨으로 변환 JSONObject jsonObject = JSONObject.fromObject(menuDto); System.out.println("json - " + jsonObject); response.setContentType("text/html; charset=utf-8"); PrintWriter out = response.getWriter(); out.print(jsonObject.toString()); }
// 메뉴 삭제 @RequestMapping(value = "/menuInfoDelete.do", method = RequestMethod.POST) String menuInfoDelete(Model model, String menuId) { menuService.dropMenuByMenuId(menuId); return "admin/menuManant"; }