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:
@@ -47,18 +47,18 @@ type contentPriceQuery struct {
|
||||
contentPriceQueryDo contentPriceQueryDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Int64
|
||||
TenantID field.Int64
|
||||
UserID field.Int64
|
||||
ContentID field.Int64
|
||||
Currency field.Field
|
||||
PriceAmount field.Int64
|
||||
DiscountType field.Field
|
||||
DiscountValue field.Int64
|
||||
DiscountStartAt field.Time
|
||||
DiscountEndAt field.Time
|
||||
CreatedAt field.Time
|
||||
UpdatedAt field.Time
|
||||
ID field.Int64 // 主键ID:自增
|
||||
TenantID field.Int64 // 租户ID:多租户隔离;与内容归属一致
|
||||
UserID field.Int64 // 用户ID:设置/更新价格的操作人(通常为 tenant_admin);用于审计
|
||||
ContentID field.Int64 // 内容ID:唯一约束 (tenant_id, content_id);一个内容在一个租户内仅一份定价
|
||||
Currency field.Field // 币种:当前固定 CNY;金额单位为分
|
||||
PriceAmount field.Int64 // 基础价格:分;0 表示免费(可直接访问正片资源)
|
||||
DiscountType field.Field // 折扣类型:none/percent/amount;仅影响下单时成交价,需写入订单快照
|
||||
DiscountValue field.Int64 // 折扣值:percent=0-100(按业务校验);amount=分;none 时忽略
|
||||
DiscountStartAt field.Time // 折扣开始时间:可为空;为空表示立即生效(由业务逻辑解释)
|
||||
DiscountEndAt field.Time // 折扣结束时间:可为空;为空表示长期有效(由业务逻辑解释)
|
||||
CreatedAt field.Time // 创建时间:默认 now();用于审计
|
||||
UpdatedAt field.Time // 更新时间:默认 now();更新价格/折扣时写入
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user