示例#1
0
  /**
   * 更新运维文章 根据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);
  }
示例#2
0
 /**
  * 根据主键批量删除运维文章 非物理删除 修改删除标识
  *
  * @param id Primary key
  */
 @Override
 public void deleteMntArticleByIds(String ids) {
   SysUser currentUser = userRealm.getCurrentUser();
   MntArticle mntArticle = new MntArticle();
   mntArticle.setDeleteFlag("1");
   mntArticle.setModifier(currentUser.getUserName());
   mntArticle.setModifyDate(new Date());
   String[] idAry = ids.split(",");
   for (String id : idAry) {
     mntArticle.setId(Integer.parseInt(id));
     mntArticleMapper.updateByPrimaryKey(mntArticle);
   }
 }