Commit 404d8dcc by fudahua

批量处理关联关系优化

parent a8775cef
...@@ -172,9 +172,11 @@ public class StoreRangeServiceImpl implements StoreRangeService { ...@@ -172,9 +172,11 @@ public class StoreRangeServiceImpl implements StoreRangeService {
private void dealStoreRelation(List<TabStoreRelation> storeRelations, String enterpriseId, Set<String> delStoreIds, Set<String> addStoreIds) { private void dealStoreRelation(List<TabStoreRelation> storeRelations, String enterpriseId, Set<String> delStoreIds, Set<String> addStoreIds) {
//先删除 后新增 //先删除 后新增
if (CollectionUtils.isNotEmpty(delStoreIds)) { if (CollectionUtils.isNotEmpty(delStoreIds)) {
logger.info("批量删除门店:{}", JSONObject.toJSONString(delStoreIds));
tabHaobanStoreRelationMapper.deleteStoreRalationByStoreIds(enterpriseId, delStoreIds); tabHaobanStoreRelationMapper.deleteStoreRalationByStoreIds(enterpriseId, delStoreIds);
} }
if (CollectionUtils.isNotEmpty(addStoreIds)) { if (CollectionUtils.isNotEmpty(addStoreIds)) {
logger.info("批量新增门店:{}", JSONObject.toJSONString(addStoreIds));
List<TabStoreRelation> adds = storeRelations.stream().filter(dto -> addStoreIds.contains(dto.getStoreId())).collect(Collectors.toList()); List<TabStoreRelation> adds = storeRelations.stream().filter(dto -> addStoreIds.contains(dto.getStoreId())).collect(Collectors.toList());
//批量插入 //批量插入
insertStoreRelationBatch(adds); insertStoreRelationBatch(adds);
......
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