コード例 #1
0
  @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());
  }
コード例 #2
0
 // 메뉴 추가
 @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";
 }
コード例 #3
0
  @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());
  }
コード例 #4
0
  @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());
  }