feat: add TenantLedger model and query generation
- Introduced TenantLedger model with fields for managing tenant transactions, including ID, TenantID, UserID, OrderID, transaction Type, Amount, and balance details. - Implemented CRUD operations for TenantLedger with methods for Create, Update, Delete, and Reload. - Generated query methods for TenantLedger to facilitate database interactions, including filtering, pagination, and aggregation functions. - Established relationships with Order model for foreign key references.
This commit is contained in:
@@ -44,15 +44,15 @@ type contentAccessQuery struct {
|
||||
contentAccessQueryDo contentAccessQueryDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Int64
|
||||
TenantID field.Int64
|
||||
UserID field.Int64
|
||||
ContentID field.Int64
|
||||
OrderID field.Int64
|
||||
Status field.Field
|
||||
RevokedAt field.Time
|
||||
CreatedAt field.Time
|
||||
UpdatedAt field.Time
|
||||
ID field.Int64 // 主键ID:自增
|
||||
TenantID field.Int64 // 租户ID:多租户隔离;与内容、用户归属一致
|
||||
UserID field.Int64 // 用户ID:权益所属用户;用于访问校验
|
||||
ContentID field.Int64 // 内容ID:权益对应内容;唯一约束 (tenant_id, user_id, content_id)
|
||||
OrderID field.Int64 // 订单ID:产生该权益的订单;可为空(例如后台补发/迁移)
|
||||
Status field.Field // 权益状态:active/revoked/expired;revoked 表示立即失效(例如退款/违规)
|
||||
RevokedAt field.Time // 撤销时间:当 status=revoked 时写入;用于审计与追责
|
||||
CreatedAt field.Time // 创建时间:默认 now();用于审计
|
||||
UpdatedAt field.Time // 更新时间:默认 now();更新 status 时写入
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user