作者 tangxvhui

Merge branch 'dev' into test

... ... @@ -29,7 +29,7 @@ func (l *SystemListAticleCommentLogic) SystemListAticleComment(req *types.System
var conn = l.svcCtx.DefaultDBConn()
cnt, commentList, err := l.svcCtx.ArticleCommentRepository.CustomSearchBy(l.ctx, conn, req.CompanyId, req.Page, req.Size,
req.TopId, req.ArticleTitle, req.Content, req.FromUser, req.Show,
req.TopId, req.ArticleTitle, req.Content, req.FromUser, req.Show, [2]int64{req.BeginTime, req.EndTime},
)
if err != nil {
return nil, xerr.NewErrMsgErr("获取评论列表失败", err)
... ...
... ... @@ -330,7 +330,7 @@ func (repository *ArticleCommentRepository) Top5Comment(ctx context.Context, con
}
func (repository *ArticleCommentRepository) CustomSearchBy(ctx context.Context, conn transaction.Conn, companyId int64, page int, size int,
topId int64, articleTitle string, contentLike string, fromUserName string, show int) (int, []*domain.ArticleCommentShow, error) {
topId int64, articleTitle string, contentLike string, fromUserName string, show int, createdAtRange [2]int64) (int, []*domain.ArticleCommentShow, error) {
if size <= 0 {
size = 20
... ... @@ -364,6 +364,17 @@ func (repository *ArticleCommentRepository) CustomSearchBy(ctx context.Context,
where += ` and article_comment."top_id"= ? `
condition = append(condition, topId)
}
if createdAtRange[0] > 0 {
where += ` and article_comment.created_at >=? `
condition = append(condition, createdAtRange[0])
}
if createdAtRange[1] > 0 {
where += ` and article_comment.created_at <=? `
condition = append(condition, createdAtRange[1])
}
countSql := `select
count(*)
from article_comment
... ...
... ... @@ -77,5 +77,5 @@ type ArticleCommentRepository interface {
Top5Comment(ctx context.Context, conn transaction.Conn, companyId int64, articleId int64) ([]*ArticleComment, error)
// 特定的查询
CustomSearchBy(ctx context.Context, conn transaction.Conn, companyId int64, page int, size int,
topId int64, articleTitle string, contentLike string, fromUserName string, show int) (int, []*ArticleCommentShow, error)
topId int64, articleTitle string, contentLike string, fromUserName string, show int, createdAtRange [2]int64) (int, []*ArticleCommentShow, error)
}
... ...