|
|
@@ -151,11 +151,12 @@ public class CourseStudentRelateController {
|
|
|
param.put("courseId", courseStudentRelateAddParam.getCourseId());
|
|
|
List<CourseStudentRelate> alreadyRelateList=courseStudentRelateService.listWrapper(param);
|
|
|
List<String> alreadyRelateIdList=CollStreamUtil.toList(alreadyRelateList, CourseStudentRelate::getUserId);
|
|
|
- for(String willUserId:willUserIdList)
|
|
|
+ for (int i = willUserIdList.size() - 1; i >= 0; i--)
|
|
|
{
|
|
|
+ String willUserId = willUserIdList.get(i);
|
|
|
if(alreadyRelateIdList.contains(willUserId))
|
|
|
{
|
|
|
- willUserIdList.remove(willUserId);
|
|
|
+ willUserIdList.remove(i);
|
|
|
}
|
|
|
}
|
|
|
if(willUserIdList.size()>0)
|
|
|
@@ -166,9 +167,9 @@ public class CourseStudentRelateController {
|
|
|
courseStudentRelate.setUserId(willUserId);
|
|
|
willAddList.add(courseStudentRelate);
|
|
|
}
|
|
|
+ courseStudentRelateService.addBatch(willAddList);
|
|
|
}
|
|
|
|
|
|
- courseStudentRelateService.addBatch(willAddList);
|
|
|
return CommonResult.ok();
|
|
|
}
|
|
|
|