Add count where condition 'deleted' at 'is null

This commit is contained in:
zhangwenjian
2020-05-14 22:38:22 +08:00
parent 68d3ce0a22
commit 1bb0eb150d
7 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -104,7 +104,7 @@ func (e *Post) GetPage(pageSize int, pageIndex int) ([]Post, int, error) {
if err := table.Order("sort").Offset((pageIndex - 1) * pageSize).Limit(pageSize).Find(&doc).Error; err != nil {
return nil, 0, err
}
table.Count(&count)
table.Where("`deleted_at` IS NULL").Count(&count)
return doc, count, nil
}