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