| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, ManyToOne, JoinColumn } from 'typeorm';
- import { WechatCouponStock } from './wechat-coupon-stock.entity';
- @Entity('wechat_coupons')
- export class WechatCoupon {
- @PrimaryGeneratedColumn({ unsigned: true })
- id!: number;
- @Column({ name: 'coupon_id', type: 'varchar', length: 32, unique: true, comment: '微信支付代金券ID' })
- couponId!: string;
- @Column({ name: 'stock_id', type: 'varchar', length: 32, comment: '批次号' })
- stockId!: string;
- @Column({ name: 'openid', type: 'varchar', length: 64, comment: '用户openid' })
- openid!: string;
- @Column({ name: 'out_request_no', type: 'varchar', length: 64, comment: '商户请求单号' })
- outRequestNo!: string;
- @Column({ name: 'coupon_status', type: 'varchar', length: 20, default: 'SENDED', comment: '代金券状态:SENDED-已发放,USED-已使用,EXPIRED-已过期' })
- couponStatus!: string;
- @Column({ name: 'amount', type: 'int', comment: '代金券面额(分)' })
- amount!: number;
- @Column({ name: 'available_start_time', type: 'datetime', comment: '可用开始时间' })
- availableStartTime!: Date;
- @Column({ name: 'available_end_time', type: 'datetime', comment: '可用结束时间' })
- availableEndTime!: Date;
- @Column({ name: 'used_time', type: 'datetime', nullable: true, comment: '使用时间' })
- usedTime!: Date | null;
- @Column({ name: 'transaction_id', type: 'varchar', length: 64, nullable: true, comment: '微信支付订单号' })
- transactionId!: string | null;
- @Column({ name: 'stock_id_ref', type: 'int', unsigned: true, comment: '批次ID' })
- stockIdRef!: number;
- @ManyToOne(() => WechatCouponStock)
- @JoinColumn({ name: 'stock_id_ref' })
- stock!: WechatCouponStock;
- @Column({ name: 'created_by', type: 'int', nullable: true, comment: '创建用户ID' })
- createdBy!: number | null;
- @Column({ name: 'updated_by', type: 'int', nullable: true, comment: '更新用户ID' })
- updatedBy!: number | null;
- @CreateDateColumn({ name: 'created_at' })
- createdAt!: Date;
- @UpdateDateColumn({ name: 'updated_at' })
- updatedAt!: Date;
- }
|