/**
   * 更新运维文章 根据MntArticle的主键更新主键以外的其他字段
   *
   * @param MntArticle
   */
  @Override
  public void updateMntArticleById(MntArticle mntArticle) {

    // 文章分类
    if (mntArticle.getTypeId() == -99) {
      MntArticleType mntArticleType = new MntArticleType();
      mntArticleType.setTypeCn(mntArticle.getTypeCn());
      mntArticleType.setParentTypeId(-1);
      mntArticleTypeMapper.save(mntArticleType);
      mntArticle.setTypeId(mntArticleType.getTypeId());

      addArticleTypeCache(mntArticleType);
    }

    SysUser currentUser = userRealm.getCurrentUser();

    // getAuthor
    if (StringUtils.isEmpty(mntArticle.getAuthor())) {
      mntArticle.setAuthor(currentUser.getUserName());
    }

    mntArticle.setModifier(currentUser.getUserName());
    mntArticle.setModifyDate(new Date());

    mntArticleMapper.updateByPrimaryKey(mntArticle);
  }
  /**
   * 添加运维文章
   *
   * @param MntArticle
   */
  @Override
  public void saveMntArticle(MntArticle mntArticle) {
    SysUser currentUser = userRealm.getCurrentUser();

    // getSummary
    //        if(StringUtils.isEmpty(mntArticle.getSummary())) {
    //            if(!StringUtils.isEmpty(mntArticle.getContent())) {
    //                if(mntArticle.getContent().length() > 100) {
    //                    mntArticle.setSummary(mntArticle.getContent().substring(0, 100));
    //                }else {
    //                    mntArticle.setSummary(mntArticle.getContent());
    //                }
    //            }
    //        }

    // 文章分类
    if (mntArticle.getTypeId() == -99) {
      MntArticleType mntArticleType = new MntArticleType();
      mntArticleType.setTypeCn(mntArticle.getTypeCn());
      mntArticleType.setParentTypeId(-1);
      mntArticleTypeMapper.save(mntArticleType);
      mntArticle.setTypeId(mntArticleType.getTypeId());

      addArticleTypeCache(mntArticleType);
    }

    // getAuthor
    if (StringUtils.isEmpty(mntArticle.getAuthor())) {
      mntArticle.setAuthor(currentUser.getUserName());
    }
    mntArticle.setReadCount(0);
    mntArticle.setIsTop("0");
    mntArticle.setDeleteFlag("0");
    mntArticle.setCreator(currentUser.getUserName());
    mntArticle.setModifier(currentUser.getUserName());
    mntArticle.setCreateDate(new Date());
    mntArticle.setModifyDate(new Date());
    mntArticleMapper.save(mntArticle);
  }