| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn } from 'typeorm';
- import { PaymentStatus } from './payment.types.js';
- @Entity('payments')
- export class PaymentEntity {
- @PrimaryGeneratedColumn({ comment: '支付记录ID' })
- id!: number;
- @Column({ type: 'int', unsigned: true, name: 'external_order_id', comment: '外部订单ID(用于与业务系统集成)' })
- externalOrderId!: number;
- @Column({ type: 'int', unsigned: true, name: 'user_id', comment: '用户ID' })
- userId!: number;
- @Column({ type: 'int', unsigned: true, name: 'total_amount', comment: '支付金额(分)' })
- totalAmount!: number;
- @Column({ type: 'varchar', length: 128, name: 'description', comment: '支付描述' })
- description!: string;
- @Column({
- type: 'enum',
- enum: PaymentStatus,
- default: PaymentStatus.PENDING,
- name: 'payment_status',
- comment: '支付状态'
- })
- paymentStatus!: PaymentStatus;
- @Column({ type: 'varchar', length: 64, nullable: true, name: 'wechat_transaction_id', comment: '微信支付交易ID' })
- wechatTransactionId?: string;
- @Column({ type: 'varchar', length: 64, nullable: true, name: 'out_trade_no', comment: '商户订单号' })
- outTradeNo?: string;
- @Column({ type: 'varchar', length: 64, name: 'openid', comment: '用户OpenID' })
- openid!: string;
- @CreateDateColumn({ name: 'created_at', comment: '创建时间' })
- createdAt!: Date;
- @UpdateDateColumn({ name: 'updated_at', comment: '更新时间' })
- updatedAt!: Date;
- }
|