批量插入
This commit is contained in:
@@ -20,12 +20,12 @@ import java.util.stream.Collectors;
|
|||||||
* @since 2025-11-27
|
* @since 2025-11-27
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class BkContactListServiceImpl extends ServiceImpl<BkContactListMapper, BkContactList> implements BkContactListService{
|
public class BkContactListServiceImpl extends ServiceImpl<BkContactListMapper, BkContactList> implements BkContactListService {
|
||||||
|
|
||||||
@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