fix(comment): fix comment query param when select

pull/35/head
doper 2 years ago committed by 1379Monitor
parent e4fe69ac91
commit 2a82f7a328

@ -6,9 +6,9 @@ type CommentQuery struct {
Page
*Sort
ContentID *int32
Keyword *string `json:"keyword"`
CommentStatus *consts.CommentStatus `json:"status"`
ParentID *int32 `json:"parentID"`
Keyword *string `json:"keyword" form:"keyword"`
CommentStatus *consts.CommentStatus `json:"status" form:"status"`
ParentID *int32 `json:"parentID" form:"parentID"`
}
type Comment struct {

@ -43,8 +43,8 @@ func (b baseCommentServiceImpl) Page(ctx context.Context, commentQuery param.Com
if err != nil {
return nil, 0, err
}
if commentQuery.Keyword != nil {
commentDO.Where(commentDAL.Content.Like(*commentQuery.Keyword))
if commentQuery.Keyword != nil && *commentQuery.Keyword != "" {
commentDO.Where(commentDAL.Content.Like("%" + *commentQuery.Keyword + "%"))
}
if commentQuery.CommentStatus != nil {
commentDO.Where(commentDAL.Status.Eq(*commentQuery.CommentStatus))

Loading…
Cancel
Save