|
@@ -44,7 +44,8 @@ class StudentService extends CrudService {
|
|
|
if (!data) return { filter, body };
|
|
|
// 不允许操作,因为目前设计的是:一个学员信息对应一个学生.而不是一个学校.
|
|
|
// 所以学员信息只允许1个用户有1个数据
|
|
|
- // 且还需要删除掉这条数据,因为这条数据属于重复的数据,之前已经存在了绑定的学员数据
|
|
|
+ // 且还需要 更新关系 并 删除掉这条数据,因为这条数据属于重复的数据,之前已经存在了绑定的学员数据
|
|
|
+ await this.model.updateOne({ student_id: id }, { student_id: data._id });
|
|
|
await this.model.deleteOne({ _id: ObjectId(id) });
|
|
|
throw new BusinessError(ErrorCode.DATA_EXISTED, '该用户已存在学员数据,不可以重复绑定');
|
|
|
}
|