Files
rent/apps/server/src/entities/platform-account.entity.ts
T
2026-05-22 18:54:30 +08:00

41 lines
1.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, Index, VersionColumn } from 'typeorm';
@Entity('platform_accounts')
export class PlatformAccount {
@PrimaryGeneratedColumn({ type: 'bigint', unsigned: true })
id: number;
@Column({ type: 'varchar', length: 50, comment: '账户名称(如:主账户、备用账户)' })
account_name: string;
@Column({ type: 'decimal', precision: 12, scale: 2, default: 0, comment: '可用余额(平台净收益 = total_income - total_expense' })
balance: number;
@Column({ type: 'decimal', precision: 12, scale: 2, default: 0, comment: '冻结余额(提现中)' })
frozen_balance: number;
@Column({ type: 'decimal', precision: 12, scale: 2, default: 0, comment: '累计收入(服务费收入)' })
total_income: number;
@Column({ type: 'decimal', precision: 12, scale: 2, default: 0, comment: '累计支出(邀请返现支出)' })
total_expense: number;
@VersionColumn({ comment: '乐观锁版本号' })
version: number;
@Column({
type: 'enum',
enum: ['active', 'frozen', 'closed'],
default: 'active',
comment: '状态'
})
@Index()
status: 'active' | 'frozen' | 'closed';
@CreateDateColumn({ comment: '创建时间' })
created_at: Date;
@UpdateDateColumn({ comment: '更新时间' })
updated_at: Date;
}