1.修改basedo字段类型

2、提供获取authen中用户信息的方法
This commit is contained in:
2025-12-02 09:07:21 +08:00
parent 8ed282877e
commit cd3571554f
3 changed files with 34 additions and 4 deletions

View File

@@ -1,16 +1,21 @@
package do
import (
"go.mongodb.org/mongo-driver/v2/bson"
"time"
"go.mongodb.org/mongo-driver/v2/bson"
)
type MongoBaseDO struct {
Id bson.ObjectID `bson:"_id,omitempty" json:"id"` // MongoDB 默认 ID
Creator bson.ObjectID `bson:"creator,omitempty" json:"creator"`
Creator interface{} `bson:"creator,omitempty" json:"creator"`
CreatedAt time.Time `bson:"createdAt,omitempty" json:"createdAt"`
Updater bson.ObjectID `bson:"updater,omitempty" json:"updater"`
Updater interface{} `bson:"updater,omitempty" json:"updater"`
UpdatedAt time.Time `bson:"updatedAt,omitempty" json:"updatedAt"`
TenantId bson.ObjectID `bson:"tenantId" json:"tenantId" default:"1"` // 租户ID
TenantId interface{} `bson:"tenantId" json:"tenantId" default:"1"` // 租户ID
IsDeleted bool `bson:"isDeleted" json:"isDeleted" default:"false"`
}
type User struct {
Id interface{} `bson:"_id,omitempty" json:"id"` // MongoDB 默认 ID
TenantId interface{} `bson:"tenantId" json:"tenantId" default:"1"` // 租户ID
}