fix: 内部 SKU 拉入选择器防抖并去掉 focus 重复请求

This commit is contained in:
2026-09-14 16:58:40 +08:00
parent 327ecbf7eb
commit 618e052807
5 changed files with 49 additions and 10 deletions
@@ -3,7 +3,6 @@ package top.xyquan.ecomdmbbackend.modules.channel.pdd.goods.publishdesk.model.vo
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
/**
* 发布草稿 VO。
@@ -237,7 +237,7 @@ public class PddGoodsPublishDeskServiceImpl implements PddGoodsPublishDeskServic
Long companyId = currentUserContext.getCurrentCompanyId();
Long userId = currentUserContext.getCurrentUserId();
List<Long> ids = dto.getDraftIds().stream().distinct().toList();
List<PddGoodsPublishDraftPO> drafts = draftMapper.selectBatchIds(ids);
List<PddGoodsPublishDraftPO> drafts = draftMapper.selectByIds(ids);
if (drafts.size() != ids.size()) {
throw new BusinessException("部分草稿不存在");
}
@@ -19,5 +19,6 @@ public class ProductSkuFilterDTO {
private String skuCode;
/** 模糊匹配:SKU 名称、SKU 编码、所属商品名称、商品编码 */
private String keywords;
}
@@ -231,10 +231,23 @@ public class ProductSkuServiceImpl extends ServiceImpl<ProductSkuMapper, Product
}
if (filter.getKeywords() != null && !filter.getKeywords().trim().isEmpty()) {
String keywords = filter.getKeywords().trim();
wrapper.and(w -> w
.like(ProductSkuPO::getName, keywords)
.or()
.like(ProductSkuPO::getSkuCode, keywords));
LambdaQueryWrapper<ProductPO> productKw = new LambdaQueryWrapper<>();
productKw.select(ProductPO::getId)
.eq(ProductPO::getCompanyId, companyId)
.and(p -> p.like(ProductPO::getName, keywords)
.or()
.like(ProductPO::getProductCode, keywords));
List<Long> matchedProductIds = productService.list(productKw).stream()
.map(ProductPO::getId)
.toList();
wrapper.and(w -> {
w.like(ProductSkuPO::getName, keywords)
.or()
.like(ProductSkuPO::getSkuCode, keywords);
if (!matchedProductIds.isEmpty()) {
w.or().in(ProductSkuPO::getProductId, matchedProductIds);
}
});
} else {
if (filter.getName() != null && !filter.getName().trim().isEmpty()) {
wrapper.like(ProductSkuPO::getName, filter.getName());