コード例 #1
0
ファイル: CommentServiceImpl.java プロジェクト: RainyZou/Shop
  @Override
  public ReturnStatus delete(int id) {
    Comment comment = getById(id);
    if (comment.getCommentId() == null) {
      List<Comment> list = getSubComments(id);
      for (Comment c : list) {
        commentMapper.deleteByPrimaryKey(c.getId());
      }
    }
    int result = commentMapper.deleteByPrimaryKey(id);

    if (result > 0) {
      return new ReturnStatus(result, "ɾ³ýÆÀÂ۳ɹ¦!");
    } else {
      return new ReturnStatus(result, "ɾ³ýÆÀÂÛʧ°Ü");
    }
  }