You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sonic/service/impl/comment_sheet.go

29 lines
760 B
Go

package impl
import (
"context"
"github.com/go-sonic/sonic/consts"
"github.com/go-sonic/sonic/dal"
"github.com/go-sonic/sonic/service"
)
type sheetCommentServiceImpl struct {
service.BaseCommentService
}
func NewSheetCommentService(baseCommentService service.BaseCommentService) service.SheetCommentService {
return &sheetCommentServiceImpl{
BaseCommentService: baseCommentService,
}
}
func (s sheetCommentServiceImpl) CountByStatus(ctx context.Context, status consts.CommentStatus) (int64, error) {
commentDAL := dal.GetQueryByCtx(ctx).Comment
count, err := commentDAL.WithContext(ctx).Where(commentDAL.Type.Eq(consts.CommentTypeSheet), commentDAL.Status.Eq(status)).Count()
if err != nil {
return 0, WrapDBErr(err)
}
return count, nil
}