优化mongo,封装count逻辑,处理objectId

This commit is contained in:
2026-01-06 17:01:10 +08:00
parent a43da6e06e
commit 213ad95791
8 changed files with 123 additions and 91 deletions

View File

@@ -10,11 +10,22 @@ type ResponseEmpty struct {
}
type Page struct {
PageNum int `p:"pageNum"` //当前页码
PageSize int `p:"pageSize"` //每页数
Total int //总页数
PageNum int64 `p:"pageNum"` //当前页码
PageSize int64 `p:"pageSize"` //每页数
Total int64 //总页数
}
type OrderEnum string
const (
Asc OrderEnum = "asc" // 正序
Desc OrderEnum = "desc" // 倒序
)
type OrderBy struct {
Field string `p:"field"` //排序字段
Order OrderEnum `p:"order"` //排序方式
}
type MongoBaseDO struct {
Id bson.ObjectID `bson:"_id,omitempty" json:"id"` // MongoDB 默认 ID
Creator interface{} `bson:"creator,omitempty" json:"creator"`