Exemplo n.º 1
0
  /** 进入保存新增系统类型组 */
  @RequestMapping(value = "/savegroup")
  public ModelAndView savegroup(
      HttpServletRequest request, HttpServletResponse response, MisTypeInfo mistype)
      throws Exception {
    String msg = "";
    ModelAndView mav = new ModelAndView();
    mav.setViewName(SUCCESS_ACTION);
    if (mistype == null) {
      this.logger.warn("保存系统类型组时传递的MisTypeInfo为null");
      msg = "failed";

    } else {
      MisTypeInfo checkMisType = mistypeService.getMisTypeInfo(mistype.getTypeId());
      if (checkMisType == null) {
        try {
          mistypeService.saveGroup(mistype);
          this.insertLog(request, "新增系统类型组");
        } catch (Exception e) {

          msg = "failed";
          e.printStackTrace();
          this.logger.error("新增系统类型组失败:" + e.getMessage(), e);
        }

      } else {
        msg = "该系统类型组Id已存在!";
      }
    }

    mav.addObject("mistype", mistype);
    mav.addObject("msg", msg);
    return mav;
  }
Exemplo n.º 2
0
  /** 保存新增系统类型 */
  @RequestMapping(value = "/saveAddType", method = RequestMethod.POST)
  public ModelAndView saveExample(
      HttpServletRequest request, HttpServletResponse response, MisTypeInfo mistype) {
    String msg = "";
    ModelAndView mv = new ModelAndView();
    if (mistype == null) {
      this.logger.warn("保存时传递的misType为null");
      msg = "failed";
    } else {
      MisTypeInfo mistype1 = mistypeService.getMisTypeInfo(mistype.getTypeId());
      if (mistype1 == null) {
        try {

          mistypeService.save(mistype);
          msg = "success";
          this.insertLog(request, "新增系统类型");
        } catch (Exception e) {

          e.printStackTrace();
          this.logger.error("新增系统类型失败:" + e.getMessage(), e);
          msg = "failed";
        }

      } else {
        msg = "该系统类型Id已存在";
      }
    }
    mv.addObject("msg", msg);
    mv.setViewName(SUCCESS_ACTION);
    return mv;
  }