chore: commit oxfmt formatting changes and verify artifacts

This commit is contained in:
2026-07-02 15:55:09 +08:00
parent 34726cc46d
commit 4f4cee157a
77 changed files with 5576 additions and 1400 deletions

View File

@@ -54,25 +54,47 @@ export class ClassroomsService {
return { message: '已恢复' };
}
async batchImport(rows: { name: string; building?: string; floor?: number; capacity?: number; roomType?: string; courseType?: string; supervisor?: string }[]) {
async batchImport(
rows: {
name: string;
building?: string;
floor?: number;
capacity?: number;
roomType?: string;
courseType?: string;
supervisor?: string;
}[],
) {
let imported = 0;
let skipped = 0;
for (const row of rows) {
if (!row.name || !row.name.trim()) { skipped++; continue; }
if (!row.name || !row.name.trim()) {
skipped++;
continue;
}
const name = row.name.trim();
const exists = await this.repo.findOne({ where: { name } });
if (exists) { skipped++; continue; }
await this.repo.save(this.repo.create({
name,
building: row.building?.trim() || undefined,
floor: row.floor || undefined,
capacity: row.capacity || 30,
roomType: row.roomType?.trim() || '大',
courseType: row.courseType?.trim() || undefined,
supervisor: row.supervisor?.trim() || undefined,
}));
if (exists) {
skipped++;
continue;
}
await this.repo.save(
this.repo.create({
name,
building: row.building?.trim() || undefined,
floor: row.floor || undefined,
capacity: row.capacity || 30,
roomType: row.roomType?.trim() || '大',
courseType: row.courseType?.trim() || undefined,
supervisor: row.supervisor?.trim() || undefined,
}),
);
imported++;
}
return { message: `成功导入 ${imported} 间教室,跳过 ${skipped} 条(重复或空行)`, imported, skipped };
return {
message: `成功导入 ${imported} 间教室,跳过 ${skipped} 条(重复或空行)`,
imported,
skipped,
};
}
}