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; }