@RequestMapping(params = "method=delete")
  @ResponseBody
  public JsonResult delete(HttpServletRequest request, String ids) {
    JsonResult result = new JsonResult();

    try {
      String[] array = ids.split(",");

      for (String id : array) {
        MobileAppConfig mobileAppConfig = mobileAppConfigService.get(id);

        if (mobileAppConfig != null) {
          String appCodeName = mobileAppConfig.getCodeName();

          mobileAppService.deleteMobileAppItemByAppCodeName(appCodeName);

          mobileAppConfigService.delete(id);
        }
      }

      result.setMessage(AbstractController.AJAX_SUCCESS_CODE);
    } catch (Exception e) {
      result.setMessage(null);
      log.error("delete MobileAppConfig exception reason:" + e.getMessage());
    }
    return result;
  }
  @RequestMapping(params = "method=clearmobileappconfigcache")
  @ResponseBody
  public JsonResult clearMobileAppConfigCache() {
    JsonResult result = new JsonResult();

    try {
      mobileAppConfigService.clearMobileAppConfigCache();
      mobileAppConfigService.getMobileAppConfigCache();
      result.setMessage(AbstractController.AJAX_SUCCESS_CODE);
    } catch (Exception e) {
      // TODO: handle exception
      System.out.print(e.getMessage());
      result.setMessage(null);
    }

    return result;
  }
  @RequestMapping(params = "method=add")
  @ResponseBody
  public JsonResult create(HttpServletRequest request, MobileAppConfig entity) {
    JsonResult result = new JsonResult();

    try {
      String sessionUserName = ((UserInfo) request.getSession().getAttribute("user")).getUserName();

      entity.setId(UUID.randomUUID().toString());
      entity.setCreator(sessionUserName);

      mobileAppConfigService.create(entity);
      result.setMessage(AbstractController.AJAX_SUCCESS_CODE);
    } catch (Exception e) {
      result.setMessage(null);
      log.error("create MobileAppConfig exception reason:" + e.getMessage());
    }
    return result;
  }
  @RequestMapping(params = "method=update")
  @ResponseBody
  public JsonResult update(HttpServletRequest request, MobileAppConfig entity) {
    JsonResult result = new JsonResult();

    try {
      String sessionUserName = ((UserInfo) request.getSession().getAttribute("user")).getUserName();

      MobileAppConfig model = mobileAppConfigService.get(entity.getId());

      model.setDescription(entity.getDescription());
      model.setPackageName(entity.getPackageName());
      model.setFileUrl(entity.getFileUrl() == null ? "" : entity.getFileUrl());
      model.setStatus(entity.getStatus());
      model.setUpdator(sessionUserName);

      mobileAppConfigService.update(model);
      result.setMessage(AbstractController.AJAX_SUCCESS_CODE);
    } catch (Exception e) {
      result.setMessage(null);
      log.error("update MobileAppConfig exception reason:" + e.getMessage());
    }
    return result;
  }