forked from wangziqi/gongxue-base
54 lines
1.3 KiB
TypeScript
54 lines
1.3 KiB
TypeScript
import {
|
|
Entity,
|
|
PrimaryGeneratedColumn,
|
|
Column,
|
|
CreateDateColumn,
|
|
ManyToOne,
|
|
JoinColumn,
|
|
} from 'typeorm';
|
|
import { Student } from './student.entity';
|
|
|
|
@Entity('deposits')
|
|
export class Deposit {
|
|
@PrimaryGeneratedColumn()
|
|
id: number;
|
|
|
|
@Column({ name: 'student_id' })
|
|
studentId: number;
|
|
|
|
@Column({ type: 'decimal', precision: 10, scale: 2, default: 500 })
|
|
amount: number;
|
|
|
|
// paid: 已缴 | refunded: 已退 | deducted: 已扣除(部分或全部)
|
|
@Column({ type: 'varchar', length: 20, default: 'paid' })
|
|
status: string;
|
|
|
|
@Column({ name: 'paid_date', type: 'date' })
|
|
paidDate: string;
|
|
|
|
@Column({ name: 'refund_date', type: 'date', nullable: true })
|
|
refundDate: string;
|
|
|
|
@Column({ name: 'refund_amount', type: 'decimal', precision: 10, scale: 2, nullable: true })
|
|
refundAmount: number;
|
|
|
|
@Column({ name: 'deduction_amount', type: 'decimal', precision: 10, scale: 2, default: 0 })
|
|
deductionAmount: number;
|
|
|
|
@Column({ name: 'deduction_reason', type: 'text', nullable: true })
|
|
deductionReason: string;
|
|
|
|
@Column({ type: 'text', nullable: true })
|
|
notes: string;
|
|
|
|
@Column({ name: 'recorded_by', nullable: true })
|
|
recordedBy: number;
|
|
|
|
@CreateDateColumn({ name: 'created_at' })
|
|
createdAt: Date;
|
|
|
|
@ManyToOne(() => Student, { eager: true })
|
|
@JoinColumn({ name: 'student_id' })
|
|
student: Student;
|
|
}
|