|
@@ -202,5 +202,23 @@ class TrainplanService extends CrudService {
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
+ async updateclass({ trainplanid, classid, rightHeader }) {
|
|
|
+ assert(trainplanid && classid && rightHeader, '缺少参数项');
|
|
|
+ // 根据全年计划表id查出对应的全年计划详细信息
|
|
|
+ const trainplan = await this.model.findById(trainplanid);
|
|
|
+ if (!trainplan) {
|
|
|
+ throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '全年计划信息不存在');
|
|
|
+ }
|
|
|
+ for (const term of trainplan.termnum) {
|
|
|
+ for (const batch of term.batchnum) {
|
|
|
+ const class_ = await batch.class.id(classid);
|
|
|
+ if (class_) {
|
|
|
+ class_.headteacherid = rightHeader;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return await trainplan.save();
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
module.exports = TrainplanService;
|