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:
2025-12-18 13:12:26 +08:00
parent f93caefcb2
commit 1da84f2af3
42 changed files with 6468 additions and 265 deletions

View File

@@ -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/expiredrevoked 表示立即失效(例如退款/违规)
RevokedAt field.Time // 撤销时间:当 status=revoked 时写入;用于审计与追责
CreatedAt field.Time // 创建时间:默认 now();用于审计
UpdatedAt field.Time // 更新时间:默认 now();更新 status 时写入
fieldMap map[string]field.Expr
}