Beispiel #1
0
  /**
   * 保存菜单
   *
   * @param menu
   * @return
   */
  @Login()
  @RequestMapping("/save")
  @ResponseBody
  public BaseResponse save(Menu menu) {
    logger.info("save menu :" + menu);

    BaseResponse response = new BaseResponse();
    Integer result = 0;
    try {
      menu.setOrder_by("0");
      if (menu.getId() == null) {
        result = this.mMenuService.addMenu(menu);
      } else {
        result = this.mMenuService.updateMenu(menu);
      }
    } catch (Exception e) {
      e.printStackTrace();
      logger.error("save menu error :" + e.getMessage());
      response.setResultCode(ResultCode.SYSTEM_CONFIG_SAVE_ERROR.getCode());
      response.setResultDesc(
          ResultCode.SYSTEM_CONFIG_SAVE_ERROR.getDesc() + ",error:" + e.getMessage());
      return response;
    }
    response.setResultCode(ResultCode.SUCCESS.getCode());
    response.setResultDesc(ResultCode.SUCCESS.getDesc());
    if (result < 0) {
      response.setResultCode(ResultCode.SYSTEM_CONFIG_SAVE_ERROR.getCode());
      response.setResultDesc(ResultCode.SYSTEM_CONFIG_SAVE_ERROR.getDesc());
    }
    return response;
  }
Beispiel #2
0
  /**
   * 复制菜单
   *
   * @param ids
   * @return
   */
  @Login()
  @RequestMapping("/copy")
  @ResponseBody
  public BaseResponse copy(@RequestParam("ids[]") List<Integer> ids) {
    logger.info("copy sysconf ids :" + ids);
    BaseResponse response = new BaseResponse();
    response.setResultCode(ResultCode.SUCCESS.getCode());
    response.setResultDesc(ResultCode.SUCCESS.getDesc());

    try {
      Integer result = this.mMenuService.copyMenu(ids);
      if (result <= 0) {
        response.setResultCode(ResultCode.SYSTEM_CONFIG_COPY_ERROR.getCode());
        response.setResultDesc(ResultCode.SYSTEM_CONFIG_COPY_ERROR.getDesc());
      }
    } catch (Exception e) {
      logger.error("cope menu error :" + e.getMessage());
      response.setResultCode(ResultCode.SYSTEM_CONFIG_COPY_ERROR.getCode());
      response.setResultDesc(
          ResultCode.SYSTEM_CONFIG_COPY_ERROR.getDesc() + ",error :" + e.getMessage());
    }
    return response;
  }