fix(sync): remove unused classStudentRepo injection, use transactional manager for class lookup

This commit is contained in:
2026-07-09 12:37:49 +08:00
parent 00de6cbd3a
commit 0f3fec6b44
2 changed files with 1 additions and 5 deletions

View File

@@ -14,7 +14,6 @@ import {
Student,
Role,
Class,
ClassStudent,
} from '../entities';
import { SyncService } from './sync.service';
import { SyncController } from './sync.controller';
@@ -34,7 +33,6 @@ import { ScheduleSyncService } from './schedule-sync.service';
Student,
Role,
Class,
ClassStudent,
]),
IntegrationModule,
AttendanceModule,

View File

@@ -40,8 +40,6 @@ export class SyncService {
private readonly roleRepo: Repository<Role>,
@InjectRepository(ClassEntity)
private readonly classRepo: Repository<ClassEntity>,
@InjectRepository(ClassStudent)
private readonly classStudentRepo: Repository<ClassStudent>,
private readonly dingTalkService: DingTalkService,
private readonly weComService: WeComService,
private readonly attendanceImportService: AttendanceImportService,
@@ -255,7 +253,7 @@ export class SyncService {
const tc = await manager.count(ClassTeacher, { where: { classId } });
const sc = await manager.count(ClassStudent, { where: { classId } });
if (tc === 0 && sc === 0) {
const cls = await this.classRepo.findOne({ where: { id: classId } });
const cls = await manager.findOne(ClassEntity, { where: { id: classId } });
warnings.push(`班级 "${cls?.name}" (deptId=${deptId}) 无任何师生`);
}
}