mirror of https://github.com/go-sonic/sonic.git
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.
29 lines
760 B
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
|
|
}
|