feat(jd): 店铺分类弹窗新建收成+图标/排序输入下线;京东数据库下线店铺筛选与列(后端 shop_name 参数同窗撤)

This commit is contained in:
2026-11-15 23:58:52 +08:00
parent 6818f9777b
commit 4506253989
12 changed files with 135 additions and 131 deletions
@@ -67,8 +67,9 @@ import java.util.List;
* 请求里的 company_id 传参已随公共化从写侧端点摘除。</p>
*
* <p>导出端点已随 2026-11-15 客户口径「导出也不用」整段下线(控制器/服务/mapper 参数一起删);
* {@code sale_status} 查询参数同窗撤掉(商品状态筛选框已从前端下线)。DB 列
* {@code biz_jd_product.sale_status} 与详情/回传链不动。</p>
* {@code sale_status} 查询参数同窗撤掉(商品状态筛选框已从前端下线)。店铺筛选参数
* {@code shop_name} 同日客户口径「店铺不需要」同窗撤掉(前端筛选框与列下线;DB 列
* {@code biz_jd_product.shop_name} 与详情/回传链不动)。</p>
*/
@RestController
@RequiredArgsConstructor
@@ -96,7 +97,6 @@ public class AdminJdProductController {
public ApiResponse<JdProductPageVo> page(
@Parameter(description = "页码") @RequestParam(name = "page", defaultValue = PageDefaults.FIRST_PAGE) Long page,
@Parameter(description = "每页数量") @RequestParam(name = "page_size", defaultValue = PageDefaults.JD_PRODUCTS_PAGE_SIZE) Long pageSize,
@Parameter(description = "店铺名(包含匹配)") @RequestParam(name = "shop_name", required = false) String shopName,
@Parameter(description = "商品编码(包含匹配)") @RequestParam(name = "product_code", required = false) String productCode,
@Parameter(description = "标题关键词(包含匹配)") @RequestParam(name = "title_keyword", required = false) String titleKeyword,
@Parameter(description = "类目(京麦末级类目名,eq)") @RequestParam(name = "category", required = false) String category,
@@ -116,7 +116,7 @@ public class AdminJdProductController {
// 公司维度只剩超管的公司 tab 筛选(superAdminScopedCompanyId):超管显式传才收窄,
// 非超管传什么都不收——公共库对每一家管理员都是同一份全量。
Long scopedCompanyId = dataReadScope.superAdminScopedCompanyId(user, companyId);
return ApiResponse.success(jdProductQueryService.page(page, pageSize, scopedCompanyId, shopName,
return ApiResponse.success(jdProductQueryService.page(page, pageSize, scopedCompanyId,
productCode, titleKeyword, category, groupId, ungrouped, grouped, syncedFrom, syncedTo));
}
@@ -42,13 +42,13 @@ public interface JdProductMapper extends BaseMapper<JdProductEntity> {
/**
* 后管只读页总数(Phase 5,v1.4):与 {@link #selectProductPage} 同一过滤面
* (公司/店铺名/商品编码/标题关键词/类目/分组/未分类/已分类/同步起止,全部 SQL 侧下推,
* (公司/商品编码/标题关键词/类目/分组/未分类/已分类/同步起止,全部 SQL 侧下推,
* 铁律 20)。{@code companyId}/{@code groupId} 为空或 ≤0=不过滤该面;
* {@code ungrouped=true}=只看未分类行(group_id IS NULL,店铺分类弹窗「未分类」范围);
* {@code grouped=true}=只看已分类行(group_id IS NOT NULL,页面筛选行「分类状态」档)。
* 店铺名过滤参数已随 2026-11-15 客户口径「店铺不需要」同窗撤掉(DB 列与详情/回传链不动)。
*/
long countProducts(@Param("companyId") Long companyId,
@Param("shopName") String shopName,
@Param("productCode") String productCode,
@Param("titleKeyword") String titleKeyword,
@Param("category") String category,
@@ -91,7 +91,6 @@ public interface JdProductMapper extends BaseMapper<JdProductEntity> {
* {@code (page-1)*page_size} 溢出(铁律 15),mapper 不做第二次换算,避免两处各算各的。</p>
*/
List<JdProductEntity> selectProductPage(@Param("companyId") Long companyId,
@Param("shopName") String shopName,
@Param("productCode") String productCode,
@Param("titleKeyword") String titleKeyword,
@Param("category") String category,
@@ -47,7 +47,8 @@ import java.util.Map;
* 主表高频列直接从 entity 映射,不走 JSON。</p>
*
* <p>导出(byte[] xlsx)已随 2026-11-15 客户口径「导出也不用」整段下线,控制器端点同窗删;
* {@code sale_status} 过滤参数同窗撤掉(前端筛选框下线),DB 列与详情/回传链不动。</p>
* {@code sale_status} 过滤参数同窗撤掉(前端筛选框下线);店铺筛选参数同日客户口径
* 「店铺不需要」同窗撤掉(DB 列与详情/回传链不动)。</p>
*/
@Slf4j
@Service
@@ -74,12 +75,12 @@ public class JdProductQueryService {
/**
* 分页查询商品行({@code synced_at} 倒序)。
*
* <p>过滤面:公司(物化列 eq)、店铺名 contains、商品编码 contains、标题关键词 contains、
* <p>过滤面:公司(物化列 eq)、商品编码 contains、标题关键词 contains、
* 类目 eq、分组 eq、未分类(group_id IS NULL,店铺分类弹窗「未分类」范围)、
* 已分类(group_id IS NOT NULL,页面筛选行「分类状态」档,2026-11-15 客户口径
* 「查询已分类的跟未分类,分类好的可以不显示」)、同步起止(datetime 闭区间)。</p>
*/
public JdProductPageVo page(Long page, Long pageSize, Long scopedCompanyId, String shopName,
public JdProductPageVo page(Long page, Long pageSize, Long scopedCompanyId,
String productCode, String titleKeyword, String category, Long groupId, Boolean ungrouped,
Boolean grouped, LocalDateTime syncedFrom, LocalDateTime syncedTo) {
if (syncedFrom != null && syncedTo != null && syncedFrom.isAfter(syncedTo)) {
@@ -88,13 +89,13 @@ public class JdProductQueryService {
long safePage = page == null || page < 1 ? 1 : Math.min(page, MAX_PAGE);
long safeSize = pageSize == null ? PageDefaults.JD_PRODUCTS_PAGE_SIZE_INT
: Math.min(Math.max(pageSize, 1), MAX_PAGE_SIZE);
Filter filter = filter(scopedCompanyId, shopName, productCode, titleKeyword, category,
Filter filter = filter(scopedCompanyId, productCode, titleKeyword, category,
groupId, ungrouped, grouped, syncedFrom, syncedTo);
long total = jdProductMapper.countProducts(filter.companyId(), filter.shopName(), filter.productCode(),
long total = jdProductMapper.countProducts(filter.companyId(), filter.productCode(),
filter.titleKeyword(), filter.category(), filter.groupId(), filter.ungrouped(),
filter.grouped(), filter.syncedFrom(), filter.syncedTo());
List<JdProductEntity> rows = total <= 0 ? List.of()
: jdProductMapper.selectProductPage(filter.companyId(), filter.shopName(), filter.productCode(),
: jdProductMapper.selectProductPage(filter.companyId(), filter.productCode(),
filter.titleKeyword(), filter.category(), filter.groupId(), filter.ungrouped(),
filter.grouped(), filter.syncedFrom(), filter.syncedTo(),
(safePage - 1) * safeSize, (int) safeSize);
@@ -173,12 +174,12 @@ public class JdProductQueryService {
// ---------------------------------------------------------------- 过滤面
/** 服务侧过滤面归一:companyId/groupId ≤0 按没选处理,文本 trim 后空串归 null。 */
private record Filter(Long companyId, String shopName, String productCode, String titleKeyword,
private record Filter(Long companyId, String productCode, String titleKeyword,
String category, Long groupId, Boolean ungrouped, Boolean grouped,
LocalDateTime syncedFrom, LocalDateTime syncedTo) {
}
private static Filter filter(Long scopedCompanyId, String shopName, String productCode, String titleKeyword,
private static Filter filter(Long scopedCompanyId, String productCode, String titleKeyword,
String category, Long groupId, Boolean ungrouped, Boolean grouped,
LocalDateTime syncedFrom, LocalDateTime syncedTo) {
Long companyId = scopedCompanyId != null && scopedCompanyId > 0 ? scopedCompanyId : null;
@@ -188,7 +189,7 @@ public class JdProductQueryService {
// 已分类同口径:true=只看 group_id IS NOT NULL 的行;与未分类同选时 SQL 侧两谓词相与=空集
// (前端下拉是单选,正常到不了这个组合)。
Boolean safeGrouped = Boolean.TRUE.equals(grouped) ? Boolean.TRUE : null;
return new Filter(companyId, trimToNull(shopName), trimToNull(productCode), trimToNull(titleKeyword),
return new Filter(companyId, trimToNull(productCode), trimToNull(titleKeyword),
trimToNull(category), safeGroupId, safeUngrouped, safeGrouped, syncedFrom, syncedTo);
}
@@ -100,16 +100,16 @@
)
</select>
<!-- 后管只读页(Phase 5,v1.4)过滤面:公司(物化列 eq)、店铺名/商品编码/标题关键词
<!-- 后管只读页(Phase 5,v1.4)过滤面:公司(物化列 eq)、商品编码/标题关键词
(contains LIKE)、类目 eq、分组 eq、未分类(group_id IS NULL,店铺分类弹窗
「未分类」范围)、已分类(group_id IS NOT NULL,页面筛选行「分类状态」档,
2026-11-15 客户口径「查询已分类的跟未分类,分类好的可以不显示」)、
同步起止(datetime 闭区间)。
sale_status 筛选随 2026-11-15 客户口径撤掉(前端筛选框下线;列本身与详情/回传链不动)。
sale_status 筛选随 2026-11-15 客户口径撤掉;店铺名过滤同日客户口径「店铺不需要」
同窗撤掉(前端筛选框与列下线;DB 列本身与详情/回传链不动)。
全部走 #{} 占位符;offset/limit 必须是服务侧钳制后的值(铁律 15),mapper 不做第二次换算。 -->
<sql id="productConds">
<if test="companyId != null and companyId &gt; 0">AND p.company_id = #{companyId}</if>
<if test="shopName != null and shopName != ''">AND p.shop_name LIKE CONCAT('%', #{shopName}, '%')</if>
<if test="productCode != null and productCode != ''">AND p.product_code LIKE CONCAT('%', #{productCode}, '%')</if>
<if test="titleKeyword != null and titleKeyword != ''">AND p.title LIKE CONCAT('%', #{titleKeyword}, '%')</if>
<if test="category != null and category != ''">AND p.category_path = #{category}</if>