Commit b7964e09 authored by yangyang's avatar yangyang

refactor(amos-boot-module-tcm): 优化企业信息更新逻辑- 新增 newTzsUserInfos 列表用于存储需要更新的用户信息

- 遍历 tzsUserInfos 列表,将需要更新的用户信息添加到 newTzsUserInfos 列表中 - 如果 newTzsUserInfos 不为空,使用 userInfoService.saveOrUpdateBatch 方法进行批量更新 - 通过这种方式提高数据处理效率,减少数据库操作次数
parent 373e3aa0
...@@ -858,6 +858,7 @@ public class TzBaseEnterpriseInfoServiceImpl ...@@ -858,6 +858,7 @@ public class TzBaseEnterpriseInfoServiceImpl
LambdaQueryWrapper<TzsUserInfo> lambda = new QueryWrapper<TzsUserInfo>().lambda(); LambdaQueryWrapper<TzsUserInfo> lambda = new QueryWrapper<TzsUserInfo>().lambda();
lambda.eq(TzsUserInfo::getUnitCode, creditCode); lambda.eq(TzsUserInfo::getUnitCode, creditCode);
List<TzsUserInfo> tzsUserInfos = tzsUserInfoMapper.selectList(lambda); List<TzsUserInfo> tzsUserInfos = tzsUserInfoMapper.selectList(lambda);
List<TzsUserInfo> newTzsUserInfos = new ArrayList<>();
tzsUserInfos.forEach(item -> { tzsUserInfos.forEach(item -> {
boolean update = false; boolean update = false;
if (!ObjectUtils.isEmpty(item.getEquipType())) { if (!ObjectUtils.isEmpty(item.getEquipType())) {
...@@ -878,10 +879,13 @@ public class TzBaseEnterpriseInfoServiceImpl ...@@ -878,10 +879,13 @@ public class TzBaseEnterpriseInfoServiceImpl
} else { } else {
item.setEquipType(null); item.setEquipType(null);
} }
tzsUserInfoMapper.updateById(item); newTzsUserInfos.add(item);
} }
} }
}); });
if (!ValidationUtil.isEmpty(newTzsUserInfos)) {
userInfoService.saveOrUpdateBatch(newTzsUserInfos, 1000);
}
} }
@Override @Override
......
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