示例#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;
  }
示例#2
0
 /**
  * 菜单列表
  *
  * @param page
  * @param rows
  * @return
  */
 @Login()
 @RequestMapping("/listData")
 @ResponseBody
 public BaseListResponse<Menu> listData(
     @RequestParam(value = "page", defaultValue = "1") int page,
     @RequestParam(value = "rows", defaultValue = "10") int rows,
     Menu menu) {
   BaseListResponse<Menu> response = new BaseListResponse<Menu>();
   if (!Str.isNull(menu.getName())) {
     response.setTotal(this.mMenuService.queryMenuContionCount(menu.getName()));
     response.setRows(this.mMenuService.queryContionMenus(page, rows, menu.getName()));
   } else {
     response.setTotal(this.mMenuService.queryMenuCount());
     response.setRows(this.mMenuService.queryMenus(page, rows));
   }
   return response;
 }