/** * @Title: edit @Description: TODO(编辑页面) * * @param @param id * @param @return * @param @throws BussinessException 设定文件 * @return ModelAndView 返回类型 * @throws */ @RequestMapping(value = "/{id}", method = RequestMethod.GET) public ModelAndView edit(@PathVariable(value = "id") String id) throws BussinessException { ModelAndView mv = new ModelAndView("syrkgl/ryRyjlSave"); RyRyjlxxb entity = ryRyjlxxbService.queryById(id); if (entity == null) { throw new BussinessException("查询无数据!"); } mv.addObject("entity", entity); return mv; }
/** * @Title: update @Description: TODO(修改保存) * * @param @param entity * @param @param sessionBean * @param @return 设定文件 * @return ModelAndView 返回类型 * @throws */ @RequestMapping(value = "/update", method = RequestMethod.POST) public ModelAndView update(RyRyjlxxb entity, SessionBean sessionBean) { ModelAndView mv = new ModelAndView(getViewName(sessionBean)); Map<String, Object> map = new HashMap<String, Object>(); sessionBean = getSessionBean(sessionBean); try { ryRyjlxxbService.update(entity, sessionBean); map.put(AppConst.STATUS, AppConst.SUCCESS); map.put(AppConst.MESSAGES, getUpdateSuccess()); } catch (Exception e) { e.printStackTrace(); logger.error(e.getMessage(), e); map.put(AppConst.STATUS, AppConst.FAIL); map.put(AppConst.MESSAGES, getUpdateFail()); } mv.addObject(AppConst.MESSAGES, new Gson().toJson(map)); return mv; }