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 contentAssetQuery struct {
contentAssetQueryDo contentAssetQueryDo
ALL field.Asterisk
ID field.Int64
TenantID field.Int64
UserID field.Int64
ContentID field.Int64
AssetID field.Int64
Role field.Field
Sort field.Int32
CreatedAt field.Time
UpdatedAt field.Time
ID field.Int64 // 主键ID自增
TenantID field.Int64 // 租户ID多租户隔离必须与 content_id、asset_id 所属租户一致
UserID field.Int64 // 用户ID操作人/绑定人;用于审计(通常为租户管理员或作者)
ContentID field.Int64 // 内容ID关联 contents.id用于查询内容下资源列表
AssetID field.Int64 // 资源ID关联 media_assets.id用于查询资源归属内容
Role field.Field // 资源角色main/cover/previewpreview 必须为独立资源以满足禁下载与防绕过
Sort field.Int32 // 排序:同一 role 下的展示顺序,数值越小越靠前
CreatedAt field.Time // 创建时间:默认 now();用于审计
UpdatedAt field.Time // 更新时间:默认 now();更新 sort/role 时写入
fieldMap map[string]field.Expr
}