Commit 61b1528d by huluobin

update

parent 6b566d73
......@@ -914,13 +914,22 @@ public class ScheduleManageServiceImpl extends ServiceImpl<ScheduleManageMapper,
List<ScheduleServe> scheduleServeList = scheduleManage.getScheduleServeList();
scheduleServeList.forEach(scheduleServe -> scheduleServe.setSchId(scheduleManage.getId()));
scheduleServeList.forEach(scheduleServe -> {
if (scheduleServe.getId() != null) {
scheduleServeMapper.updateById(scheduleServe);
} else {
scheduleServeMapper.insert(scheduleServe);
}
});
scheduleServeList.stream()
.filter(scheduleServe -> scheduleServe.getId() == null)
.forEach(scheduleServeMapper::insert);
scheduleServeList.stream()
.filter(scheduleServe -> scheduleServe.getId() != null)
.forEach(scheduleServeMapper::updateById);
// //数据库死锁
// scheduleServeList.forEach(scheduleServe -> {
// if (scheduleServe.getId() != null) {
// scheduleServeMapper.updateById(scheduleServe);
// } else {
// scheduleServeMapper.insert(scheduleServe);
// }
// });
List<Integer> removeIds = oldScheduleServeIds.stream().filter(id -> !scheduleServeList.stream().map(ScheduleServe::getId).collect(Collectors.toList()).contains(id)).collect(Collectors.toList());
if (ListUtil.isNotEmpty(removeIds)) {
scheduleServeMapper.deleteBatchIds(removeIds);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment