|
|
@@ -70,64 +70,6 @@ public class InternshipPlanManageServiceImpl extends MPJBaseServiceImpl<Internsh
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Boolean update(InternshipPlanManage internshipPlanManage) {
|
|
|
internshipPlanManageMapper.updateById(internshipPlanManage);
|
|
|
- //********************************* InternshipPlanTeacher 增删改 开始 *******************************************/
|
|
|
- {
|
|
|
- // 查出所有子级的id
|
|
|
- List<InternshipPlanTeacher> internshipPlanTeacherList = internshipPlanTeacherMapper.selectList(Wrappers.lambdaQuery(InternshipPlanTeacher.class).eq(InternshipPlanTeacher::getInternshipPlanManageId, internshipPlanManage.getId()).select(InternshipPlanTeacher::getId));
|
|
|
- List<Long> internshipPlanTeacherIds = internshipPlanTeacherList.stream().map(InternshipPlanTeacher::getId).collect(Collectors.toList());
|
|
|
- //原有子表单 没有被删除的主键
|
|
|
- List<Long> internshipPlanTeacherOldIds = internshipPlanManage.getInternshipPlanTeacherList().stream().map(InternshipPlanTeacher::getId).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
- //找到需要删除的id
|
|
|
- List<Long> internshipPlanTeacherRemoveIds = internshipPlanTeacherIds.stream().filter(item -> !internshipPlanTeacherOldIds.contains(item)).collect(Collectors.toList());
|
|
|
-
|
|
|
- for (InternshipPlanTeacher internshipPlanTeacher : internshipPlanManage.getInternshipPlanTeacherList()) {
|
|
|
- //如果不等于空则修改
|
|
|
- if (internshipPlanTeacher.getId() != null) {
|
|
|
- internshipPlanTeacherMapper.updateById(internshipPlanTeacher);
|
|
|
- }
|
|
|
- //如果等于空 则新增
|
|
|
- else {
|
|
|
- //已经不存在的id 删除
|
|
|
- internshipPlanTeacher.setInternshipPlanManageId(internshipPlanManage.getId());
|
|
|
- internshipPlanTeacherMapper.insert(internshipPlanTeacher);
|
|
|
- }
|
|
|
- }
|
|
|
- //已经不存在的id 删除
|
|
|
- if(internshipPlanTeacherRemoveIds.size() > 0){
|
|
|
- internshipPlanTeacherMapper.deleteBatchIds(internshipPlanTeacherRemoveIds);
|
|
|
- }
|
|
|
- }
|
|
|
- //********************************* InternshipPlanTeacher 增删改 结束 *******************************************/
|
|
|
-
|
|
|
- //********************************* InternshipPlanClass 增删改 开始 *******************************************/
|
|
|
- {
|
|
|
- // 查出所有子级的id
|
|
|
- List<InternshipPlanClass> internshipPlanClassList = internshipPlanClassMapper.selectList(Wrappers.lambdaQuery(InternshipPlanClass.class).eq(InternshipPlanClass::getInternshipPlanManageId, internshipPlanManage.getId()).select(InternshipPlanClass::getId));
|
|
|
- List<Long> internshipPlanClassIds = internshipPlanClassList.stream().map(InternshipPlanClass::getId).collect(Collectors.toList());
|
|
|
- //原有子表单 没有被删除的主键
|
|
|
- List<Long> internshipPlanClassOldIds = internshipPlanManage.getInternshipPlanClassList().stream().map(InternshipPlanClass::getId).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
- //找到需要删除的id
|
|
|
- List<Long> internshipPlanClassRemoveIds = internshipPlanClassIds.stream().filter(item -> !internshipPlanClassOldIds.contains(item)).collect(Collectors.toList());
|
|
|
-
|
|
|
- for (InternshipPlanClass internshipPlanClass : internshipPlanManage.getInternshipPlanClassList()) {
|
|
|
- //如果不等于空则修改
|
|
|
- if (internshipPlanClass.getId() != null) {
|
|
|
- internshipPlanClassMapper.updateById(internshipPlanClass);
|
|
|
- }
|
|
|
- //如果等于空 则新增
|
|
|
- else {
|
|
|
- //已经不存在的id 删除
|
|
|
- internshipPlanClass.setInternshipPlanManageId(internshipPlanManage.getId());
|
|
|
- internshipPlanClassMapper.insert(internshipPlanClass);
|
|
|
- }
|
|
|
- }
|
|
|
- //已经不存在的id 删除
|
|
|
- if(internshipPlanClassRemoveIds.size() > 0){
|
|
|
- internshipPlanClassMapper.deleteBatchIds(internshipPlanClassRemoveIds);
|
|
|
- }
|
|
|
- }
|
|
|
- //********************************* InternshipPlanClass 增删改 结束 *******************************************/
|
|
|
-
|
|
|
return true;
|
|
|
}
|
|
|
|