新增客户用电回路表及相关数据库迁移、后端服务、控制器、DTO、实体类和权限配置;新增前端API封装,同时调整路由名称以匹配新业务模块,复用现有菜单权限避免403错误。
45 lines
2.5 KiB
TypeScript
45 lines
2.5 KiB
TypeScript
import { IsNotEmpty, IsOptional, IsString, IsInt, IsNumber, Matches, Min, Max, MaxLength } from "class-validator";
|
|
|
|
export class CustomerCircuitQueryDTO {
|
|
@IsOptional() @IsInt() @Min(1) page?: number = 1;
|
|
@IsOptional() @IsInt() @Min(1) @Max(500) pageSize?: number = 10;
|
|
@IsOptional() @IsString() @MaxLength(64) keyword?: string;
|
|
@IsOptional() @IsInt() customerId?: number;
|
|
@IsOptional() @IsInt() buildingId?: number;
|
|
@IsOptional() @IsInt() roomId?: number;
|
|
@IsOptional() @IsString() @MaxLength(16) floorNo?: string;
|
|
}
|
|
|
|
export class CustomerCircuitCreateDTO {
|
|
@IsNotEmpty({ message: '回路编号不能为空' }) @IsString() @MaxLength(64) @Matches(/^[^<>]*$/) circuitCode!: string;
|
|
@IsNotEmpty({ message: '所属客户不能为空' }) @IsInt() customerId!: number;
|
|
@IsNotEmpty({ message: '所属建筑不能为空' }) @IsInt() buildingId!: number;
|
|
@IsNotEmpty({ message: '回路名称不能为空' }) @IsString() @MaxLength(128) @Matches(/^[^<>]*$/) circuitName!: string;
|
|
@IsOptional() @IsInt() roomId?: number;
|
|
@IsOptional() @IsString() @MaxLength(16) @Matches(/^[^<>]*$/) floorNo?: string;
|
|
@IsOptional() @IsString() @MaxLength(128) @Matches(/^[^<>]*$/) loopSpec?: string;
|
|
@IsOptional() @IsString() @MaxLength(32) @Matches(/^[^<>]*$/) loadType?: string;
|
|
@IsOptional() @IsString() @MaxLength(32) @Matches(/^[^<>]*$/) ratedVoltage?: string;
|
|
@IsOptional() @IsString() @MaxLength(32) @Matches(/^[^<>]*$/) ratedCurrent?: string;
|
|
@IsOptional() @IsNumber() @Min(0) ratedPower?: number;
|
|
@IsOptional() @IsInt() status?: number;
|
|
@IsOptional() @IsString() @MaxLength(2000) remark?: string;
|
|
@IsOptional() @IsInt() sortOrder?: number;
|
|
}
|
|
|
|
export class CustomerCircuitUpdateDTO {
|
|
@IsOptional() @IsString() @MaxLength(64) @Matches(/^[^<>]*$/) circuitCode?: string;
|
|
@IsOptional() @IsInt() customerId?: number;
|
|
@IsOptional() @IsInt() buildingId?: number;
|
|
@IsOptional() @IsString() @MaxLength(128) @Matches(/^[^<>]*$/) circuitName?: string;
|
|
@IsOptional() @IsInt() roomId?: number;
|
|
@IsOptional() @IsString() @MaxLength(16) @Matches(/^[^<>]*$/) floorNo?: string;
|
|
@IsOptional() @IsString() @MaxLength(128) @Matches(/^[^<>]*$/) loopSpec?: string;
|
|
@IsOptional() @IsString() @MaxLength(32) @Matches(/^[^<>]*$/) loadType?: string;
|
|
@IsOptional() @IsString() @MaxLength(32) @Matches(/^[^<>]*$/) ratedVoltage?: string;
|
|
@IsOptional() @IsString() @MaxLength(32) @Matches(/^[^<>]*$/) ratedCurrent?: string;
|
|
@IsOptional() @IsNumber() @Min(0) ratedPower?: number;
|
|
@IsOptional() @IsInt() status?: number;
|
|
@IsOptional() @IsString() @MaxLength(2000) remark?: string;
|
|
@IsOptional() @IsInt() sortOrder?: number;
|
|
} |