feat: 合同管理及车辆使用管理初始化
This commit is contained in:
parent
88a97ee162
commit
f402438a5a
|
@ -1,12 +0,0 @@
|
||||||
CREATE TABLE contracts (
|
|
||||||
id INT AUTO_INCREMENT PRIMARY KEY ,
|
|
||||||
contract_number VARCHAR(255) COMMENT '合同编号',
|
|
||||||
title VARCHAR(255) COMMENT '合同标题',
|
|
||||||
type VARCHAR(255) COMMENT '合同类型',
|
|
||||||
party_a VARCHAR(255) COMMENT '甲方',
|
|
||||||
party_b VARCHAR(255) COMMENT '乙方',
|
|
||||||
signing_date DATE COMMENT '签订日期',
|
|
||||||
delivery_deadline DATE COMMENT '交付期限',
|
|
||||||
review_result VARCHAR(255) COMMENT '审核结果',
|
|
||||||
attachment_url VARCHAR(255) COMMENT '下载附件'
|
|
||||||
);
|
|
|
@ -1,8 +1,8 @@
|
||||||
CREATE TABLE vehicle_usage (
|
CREATE TABLE vehicle_usage (
|
||||||
id INT AUTO_INCREMENT PRIMARY KEY COMMENT '主键,用于唯一标识每条记录',
|
id INT AUTO_INCREMENT PRIMARY KEY COMMENT '主键,用于唯一标识每条记录',
|
||||||
`year` INT COMMENT '年度',
|
`year` INT COMMENT '年度',
|
||||||
vehicle_name VARCHAR(255) COMMENT '外出使用的车辆名称',
|
vehicle_license VARCHAR(255) COMMENT '车牌号',
|
||||||
license_plate VARCHAR(255) COMMENT '车牌号',
|
VARCHAR(255) COMMENT '外出使用的车辆名称',
|
||||||
applicant VARCHAR(255) COMMENT '申请人',
|
applicant VARCHAR(255) COMMENT '申请人',
|
||||||
driver VARCHAR(255) COMMENT '出行司机',
|
driver VARCHAR(255) COMMENT '出行司机',
|
||||||
current_mileage FLOAT COMMENT '当前车辆里程数(KM)',
|
current_mileage FLOAT COMMENT '当前车辆里程数(KM)',
|
||||||
|
|
|
@ -25,6 +25,9 @@ import { DatabaseModule } from './shared/database/database.module';
|
||||||
|
|
||||||
import { SocketModule } from './socket/socket.module';
|
import { SocketModule } from './socket/socket.module';
|
||||||
import { ContractModule } from './modules/contract/contract.module';
|
import { ContractModule } from './modules/contract/contract.module';
|
||||||
|
import { VehicleUsageModule } from './modules/vehicle-usage/vehicle-usage.module';
|
||||||
|
import { VehicleUsageController } from './modules/vehicle-usage/vehicle-usage.controller';
|
||||||
|
import { VehicleUsageService } from './modules/vehicle-usage/vehicle-usage.service';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
|
@ -53,7 +56,9 @@ import { ContractModule } from './modules/contract/contract.module';
|
||||||
|
|
||||||
TodoModule,
|
TodoModule,
|
||||||
|
|
||||||
ContractModule
|
ContractModule,
|
||||||
|
|
||||||
|
VehicleUsageModule
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: APP_FILTER, useClass: AllExceptionsFilter },
|
{ provide: APP_FILTER, useClass: AllExceptionsFilter },
|
||||||
|
@ -64,7 +69,9 @@ import { ContractModule } from './modules/contract/contract.module';
|
||||||
{ provide: APP_INTERCEPTOR, useClass: IdempotenceInterceptor },
|
{ provide: APP_INTERCEPTOR, useClass: IdempotenceInterceptor },
|
||||||
|
|
||||||
{ provide: APP_GUARD, useClass: JwtAuthGuard },
|
{ provide: APP_GUARD, useClass: JwtAuthGuard },
|
||||||
{ provide: APP_GUARD, useClass: RbacGuard }
|
{ provide: APP_GUARD, useClass: RbacGuard },
|
||||||
]
|
VehicleUsageService
|
||||||
|
],
|
||||||
|
controllers: [VehicleUsageController]
|
||||||
})
|
})
|
||||||
export class AppModule {}
|
export class AppModule {}
|
||||||
|
|
|
@ -3,37 +3,42 @@ import { Column, Entity, JoinTable, ManyToMany, Relation } from 'typeorm';
|
||||||
import { CommonEntity } from '~/common/entity/common.entity';
|
import { CommonEntity } from '~/common/entity/common.entity';
|
||||||
|
|
||||||
@Entity({ name: 'contract' })
|
@Entity({ name: 'contract' })
|
||||||
export class RoleEntity extends CommonEntity {
|
export class ContractEntity extends CommonEntity {
|
||||||
@Column({ length: 100, unique: true, name: 'contract_number' })
|
@Column({
|
||||||
|
name: 'contract_number',
|
||||||
|
type: 'varchar',
|
||||||
|
length: 255,
|
||||||
|
unique: true,
|
||||||
|
comment: '合同编号'
|
||||||
|
})
|
||||||
@ApiProperty({ description: '合同编号' })
|
@ApiProperty({ description: '合同编号' })
|
||||||
contractNumber: string;
|
contractNumber: string;
|
||||||
|
|
||||||
@Column({ length: 255, name: 'title', type: 'varchar' })
|
@Column({ name: 'title', type: 'varchar', length: 255, comment: '合同标题' })
|
||||||
@ApiProperty({ description: '合同标题' })
|
@ApiProperty({ description: '合同标题' })
|
||||||
title: string;
|
title: string;
|
||||||
|
|
||||||
@Column()
|
@Column({ type: 'int', comment: '合同类型' })
|
||||||
@ApiProperty({ description: '合同类型', type: 'varchar' })
|
@ApiProperty({ description: '合同类型' })
|
||||||
type: number;
|
type: number;
|
||||||
|
|
||||||
@Column({ name: 'partyA', length: 255, type: 'varchar' })
|
@Column({ name: 'party_a', length: 255, type: 'varchar', comment: '甲方' })
|
||||||
@ApiProperty({ description: '甲方' })
|
@ApiProperty({ description: '甲方' })
|
||||||
partyA: string;
|
partyA: string;
|
||||||
|
|
||||||
// @Column({ type: 'tinyint', nullable: true, default: 1 })
|
@Column({ name: 'party_b', length: 255, type: 'varchar', comment: '乙方' })
|
||||||
// @ApiProperty({ description: '状态:1启用,0禁用' })
|
@ApiProperty({ description: '乙方' })
|
||||||
// status: number
|
partyB: string;
|
||||||
|
|
||||||
// @Column({ nullable: true })
|
@Column({ name: 'signing_date', type: 'date', nullable: true })
|
||||||
// @ApiProperty({ description: '是否默认用户' })
|
@ApiProperty({ description: '签订日期' })
|
||||||
// default: boolean
|
signingDate: Date;
|
||||||
|
|
||||||
// @ApiHideProperty()
|
@Column({ name: 'delivery_deadline', type: 'date', nullable: true })
|
||||||
// @ManyToMany(() => MenuEntity, menu => menu.roles, {})
|
@ApiProperty({ description: '交付期限' })
|
||||||
// @JoinTable({
|
deliveryDeadline: Date;
|
||||||
// name: 'sys_role_menus',
|
|
||||||
// joinColumn: { name: 'role_id', referencedColumnName: 'id' },
|
@Column({ name: 'status', type: 'tinyint', default: 0, comment: '审核状态' })
|
||||||
// inverseJoinColumn: { name: 'menu_id', referencedColumnName: 'id' },
|
@ApiProperty({ description: '审核状态:0待审核,1同意,2.不同意' })
|
||||||
// })
|
status: number;
|
||||||
// menus: Relation<MenuEntity[]>
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { ContractController } from './contract.controller';
|
import { ContractController } from './contract.controller';
|
||||||
import { ContractService } from './contract.service';
|
import { ContractService } from './contract.service';
|
||||||
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||||
|
import { ContractEntity } from './contract.entity';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
|
imports: [TypeOrmModule.forFeature([ContractEntity])],
|
||||||
controllers: [ContractController],
|
controllers: [ContractController],
|
||||||
providers: [ContractService]
|
providers: [ContractService]
|
||||||
})
|
})
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
import { Controller } from '@nestjs/common';
|
||||||
|
|
||||||
|
@Controller('vehicle-usage')
|
||||||
|
export class VehicleUsageController {}
|
|
@ -0,0 +1,78 @@
|
||||||
|
import { ApiHideProperty, ApiProperty } from '@nestjs/swagger';
|
||||||
|
import { Column, Entity, JoinTable, ManyToMany, Relation } from 'typeorm';
|
||||||
|
import { CommonEntity } from '~/common/entity/common.entity';
|
||||||
|
|
||||||
|
@Entity({ name: 'vehicle_usage' })
|
||||||
|
export class VehicleUsageEntity extends CommonEntity {
|
||||||
|
@Column({ type: 'int', comment: '年度' })
|
||||||
|
@ApiProperty({ description: '年度' })
|
||||||
|
year: number;
|
||||||
|
|
||||||
|
@Column({ name: 'vehicle_license', type: 'int', comment: '外出使用的车辆名称' })
|
||||||
|
@ApiProperty({ description: '外出使用的车辆名称' })
|
||||||
|
vehicleLicense: number;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
name: 'applicant',
|
||||||
|
type: 'varchar',
|
||||||
|
length: 50,
|
||||||
|
comment: '申请人'
|
||||||
|
})
|
||||||
|
@ApiProperty({ description: '申请人' })
|
||||||
|
applicant: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
name: 'driver',
|
||||||
|
type: 'varchar',
|
||||||
|
length: 50,
|
||||||
|
comment: '出行司机'
|
||||||
|
})
|
||||||
|
@ApiProperty({ description: '出行司机', nullable: true })
|
||||||
|
driver: 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: 'remarks', type: 'varchar', length: 255, comment: '备注', nullable: true })
|
||||||
|
@ApiProperty({ description: '备注' })
|
||||||
|
remarks: string;
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
import { Module } from '@nestjs/common';
|
||||||
|
import { VehicleUsageService } from './vehicle-usage.service';
|
||||||
|
import { VehicleUsageController } from './vehicle-usage.controller';
|
||||||
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||||
|
import { VehicleUsageEntity } from './vehicle-usage.entity';
|
||||||
|
|
||||||
|
@Module({
|
||||||
|
imports: [TypeOrmModule.forFeature([VehicleUsageEntity])],
|
||||||
|
providers: [VehicleUsageService],
|
||||||
|
controllers: [VehicleUsageController]
|
||||||
|
})
|
||||||
|
export class VehicleUsageModule {}
|
|
@ -0,0 +1,4 @@
|
||||||
|
import { Injectable } from '@nestjs/common';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class VehicleUsageService {}
|
Loading…
Reference in New Issue