Пример #1
0
  /**
   * 编辑页面初始化
   *
   * @param shareHref
   * @param op 操作类型,添加、修改
   * @return
   */
  @RequestMapping(value = "/add")
  public ModelAndView add(@ModelAttribute ShareHref shareHref, @RequestParam String op) {

    ModelAndView view = new ModelAndView();

    if (op.equals("modify")) {
      shareHref = shareHrefService.get(shareHref.getId());
    }

    view.addObject("shareHref", shareHref);
    view.addObject("op", op);
    view.setViewName("business/sharehref/add");
    view.addObject(
        "validationRules", sysValidationService.getValidationByCode("sharehref_validate"));
    return view;
  }
Пример #2
0
  /**
   * 删除
   *
   * @return
   */
  @RequestMapping(value = "/delete")
  public void delete(@ModelAttribute ShareHref shareHref) {
    Map<String, Object> map = new HashMap<String, Object>();

    try {
      map.put("code", "1");
      map.put("msg", "删除成功!");

      ShareHref shareHref2 = shareHrefService.get(shareHref.getId());
      shareHref2.setHrefStatus(-1);
      shareHrefService.update(shareHref2);

      sysLogService.addLog(
          request,
          getLoginUser(),
          "分享链接",
          OpType.delete + "",
          OpRresult.success + "",
          "分享链接删除成功!",
          shareHref.getId() + "",
          BusinessTableName.shareHref.name);

    } catch (Exception e) {
      logger.error(e.getMessage(), e);
      map.put("code", "0");
      map.put("msg", "删除失败!");
      sysLogService.addLog(
          request,
          getLoginUser(),
          "分享链接",
          OpType.delete + "",
          OpRresult.fail + "",
          "分享链接删除失败!",
          shareHref.getId() + "",
          BusinessTableName.shareHref.name);
    }

    outJson(map);
  }