/** * 添加保存操作日志 * * @param op * @param shareHref * @param opResult * @param memo */ private void addSaveLog(String op, ShareHref shareHref, String opResult, String memo) { if (op.equals("add")) { sysLogService.addLog( request, getLoginUser(), "分享链接维护", OpType.add + "", opResult, memo, shareHref.getId() + "", BusinessTableName.shareHref.name); } else { sysLogService.addLog( request, getLoginUser(), "分享链接维护", OpType.modify + "", opResult, memo, shareHref.getId() + "", BusinessTableName.shareHref.name); } }
/** * 删除 * * @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); }
/** * 编辑页面初始化 * * @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; }