批量插入
This commit is contained in:
@@ -25,7 +25,7 @@ public class BkContactListServiceImpl extends ServiceImpl<BkContactListMapper, B
|
|||||||
@Override
|
@Override
|
||||||
public List<BkContactList> getUserList(Long shopId, Set<String> phones) {
|
public List<BkContactList> getUserList(Long shopId, Set<String> phones) {
|
||||||
remove(QueryWrapper.create().eq(BkContactList::getShopId, shopId));
|
remove(QueryWrapper.create().eq(BkContactList::getShopId, shopId));
|
||||||
saveBatch(phones.stream()
|
List<BkContactList> collect = phones.stream()
|
||||||
.filter(StrUtil::isNotEmpty)
|
.filter(StrUtil::isNotEmpty)
|
||||||
.map(phone -> {
|
.map(phone -> {
|
||||||
BkContactList bkContact = new BkContactList();
|
BkContactList bkContact = new BkContactList();
|
||||||
@@ -33,7 +33,8 @@ public class BkContactListServiceImpl extends ServiceImpl<BkContactListMapper, B
|
|||||||
bkContact.setPhone(phone.trim());
|
bkContact.setPhone(phone.trim());
|
||||||
return bkContact;
|
return bkContact;
|
||||||
})
|
})
|
||||||
.collect(Collectors.toList()));
|
.collect(Collectors.toList());
|
||||||
|
mapper.insertBatch(collect);
|
||||||
return mapper.getUserList(shopId);
|
return mapper.getUserList(shopId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user