localhost_oa_based/src/modules/vehicle_usage/vehicle_usage.entity.ts

104 lines
3.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 { ApiHideProperty, ApiProperty } from '@nestjs/swagger';
import { Column, Entity, JoinColumn, JoinTable, ManyToMany, ManyToOne, Relation } from 'typeorm';
import { CommonEntity } from '~/common/entity/common.entity';
import { DictItemEntity } from '../system/dict-item/dict-item.entity';
import { Storage } from '../tools/storage/storage.entity';
@Entity({ name: 'vehicle_usage' })
export class VehicleUsageEntity extends CommonEntity {
@Column({ type: 'int', comment: '年度' })
@ApiProperty({ description: '年度' })
year: number;
@Column({ name: 'vehicle_id', type: 'int', comment: '外出使用的车辆名称(字典)' })
@ApiProperty({ description: '外出使用的车辆名称(字典)' })
vehicleId: number;
@Column({
name: 'applicant',
type: 'varchar',
length: 50,
comment: '申请人'
})
@ApiProperty({ description: '申请人' })
applicant: string;
@Column({
name: 'driver',
type: 'varchar',
length: 50,
comment: '出行司机',
nullable: true
})
@ApiProperty({ description: '出行司机' })
driver: string;
@Column({
name: 'partner',
type: 'varchar',
length: 50,
comment: '随行人员',
nullable: true
})
@ApiProperty({ description: '随行人员' })
partner: string;
@Column({ name: 'current_mileage', type: 'int', comment: '当前车辆里程数(KM)', nullable: true })
@ApiProperty({ description: '当前车辆里程数(KM)' })
currentMileage: number;
@Column({
name: 'expected_start_date',
type: 'date',
nullable: true,
comment: '预计出行开始时间'
})
@ApiProperty({ description: '预计出行开始时间' })
expectedStartDate: Date;
@Column({ name: 'expected_end_date', type: 'date', nullable: true, comment: '预计出行结束时间' })
@ApiProperty({ description: '预计出行结束时间' })
expectedEndDate: Date;
@Column({ name: 'purpose', type: 'varchar', length: 255, comment: '使用事由', nullable: true })
@ApiProperty({ description: '使用事由' })
purpose: string;
@Column({
name: 'actual_return_time',
type: 'date',
nullable: true,
comment: '实际回司时间'
})
@ApiProperty({ description: '实际回司时间' })
actualReturnTime: Date;
@Column({ name: 'return_mileage', type: 'int', comment: '回城车辆里程数(KM)', nullable: true })
@ApiProperty({ description: '回城车辆里程数(KM)' })
returnMileage: number;
@Column({ name: 'reviewer', type: 'varchar', length: 50, comment: '审核人', nullable: true })
@ApiProperty({ description: '审核人' })
reviewer: string;
@Column({ name: 'status', type: 'tinyint', default: 0, comment: '审核状态(字典)' })
@ApiProperty({ description: '审核状态0待审核1同意2.不同意(字典)' })
status: number;
@Column({ name: 'remark', type: 'varchar', length: 255, comment: '备注', nullable: true })
@ApiProperty({ description: '备注' })
remark: string;
@ManyToOne(() => DictItemEntity)
@JoinColumn({ name: 'vehicle_id' })
vehicle: DictItemEntity;
@ManyToMany(() => Storage, storage => storage.vehicleUsage)
@JoinTable({
name: 'vehicle_usage_storage',
joinColumn: { name: 'vehicle_id', referencedColumnName: 'id' },
inverseJoinColumn: { name: 'file_id', referencedColumnName: 'id' }
})
files: Relation<Storage[]>;
}