feat(jd-admin): 2026-11-18 客户三条反馈闭环——公司超管收窄到名下+京东类目一级/二级可选中(IN 下推)+级联触发框 34px 对齐
【一、用户管理:公司超管「各自看各自名下」(backend-java AdminUserService)】
客户口径(11-18 截图:阿华66 公司超管看到了 admin 直建的 ssss):平台超管看所有,
其余公司超管只看自己名下。读侧 listUsers 公司超管分支由「本公司全部(role≠super_admin)」
改为 company_id=本公司 AND (id=本人 OR created_by_id=本人)——与组长档同一形状;
自己那行永远可见(保证能改自己密码/额度)。写侧 updateUser/deleteUser 公司超管分支
在「同公司」闸之外加同形「目标 created_by_id=本人」谓词,不留「列表看不见、API 照样改」
的洞(停用/改密/额度全走这条闸)。createUser 不动(新建天然落本人名下)。
口径为直接下级:组长再建的普通号归组长看,不在公司超管列表(如需整棵下级树另拍板)。
判据:AdminUserServiceCompanySuperAdminTest 改 1 增 5(名下可见谓词/超管档反向不收窄/
写侧越权 403 两支+本人建的可编辑);其余 admin 测试类夹具全用超管/组长档,核过不受影响。
【二、京东类目一级/二级可选中(前端展开+后端 IN,零表结构变更,用户拍板路线)】
后端:AdminJdProductController.page 的 category 参数改 List<String>(重复 query key 绑定,
参数名不变、单值形状照常);JdProductQueryService.Filter 逐项 trim/去空白/去重、空集合归
null=不过滤;JdProductMapper.xml productConds 类目谓词 eq→IN+foreach(仍 SQL 侧下推,
铁律 20 同形)。落库仍只有末级类目名,无 schema/迁移改动。
前端:jd-category-tree.ts 新增 jdCategoryAllNodes/jdCategorySearchNodes(搜索铺全层级)
+jdCategoryNamesUnder(path)(选中节点→自身+全部后代类目名集合,含自身因实际末级可能
就在这一级;路径失效回 null 兜单名)。JdCategoryCascader.vue:非末级行圆点点击=选中
(emit change 带名称路径)、行体/箭头仍下钻;选中态按路径比对(同名跨支不串);搜索
结果含一级/二级行。JdDatabasePage/jd-product-filter/jd-product-api:categoryPath 入筛选态,
序列化按子树展开集合,axios paramsSerializer indexes:false 出重复 category= 参数。
已知代价(路线自带、用户已选):不同父级下同名末级会随展开集合一起命中(B112-05 同口径)。
【三、样式(JdCategoryCascader.vue)】
触发框 min-height 42→34px+padding 5x10:main.css:245-248 全局密度收口把相邻 input/
el-select/.btn 压到 34,自绘 button 不在收口清单里才显高;非末级圆点不再永远空心。
【台账】source-pin-ledger.json 重录(UPDATE_SOURCE_PIN_BASELINE=1 官方口):本笔
jd-category-tree.test.ts 用例 6→8;同时把 2a8bdd7d 已提交未记账的
user-menu-tree-platform-filter.test.ts(8 例 0 钉 0 读点)一并登记——基线在该窗陈旧,
此处为台账记账、非卷码。
【验证】mvn -o test-compile rc=0;定向 mvn -o test(AdminUserService* 七类+
AdminJdProductControllerTest)rc=0;admin vue-tsc rc=0;node --test jd-category-tree/
jd-database-page/jd-product-group/cascader-position 全绿;vitest mount jd-database-page
44/44(含本笔新增一级/二级选中用例);ops _push_gate.py --fast overall=pass 四面绿
(首轮后管 readSource 格红=本笔用例数,重录基线后复跑绿)。
发版未做:jar+后管随下一窗口走既有流程;full 闸门未跑(模式 D 口径)。
This commit is contained in:
+17
-2
@@ -112,9 +112,15 @@ public class AdminUserService {
|
||||
query.eq(AdminUserEntity::getCompanyId, companyIdFilter);
|
||||
}
|
||||
} else if (isCompanySuperAdmin) {
|
||||
// 公司超管看本公司全部账号(站点超管账号除外——那是平台自己的身份)
|
||||
// 2026-11-18 客户口径「admin 看所有,其余公司超管各自看各自名下的」:
|
||||
// 公司超管只看本人那行+自己直接创建(created_by_id=本人)的账号,
|
||||
// 本公司内由站点超管或其他组长建的行不再可见——与下面组长档同一形状。
|
||||
// 站点超管行本来就不可能落进这个谓词(ne 只是对脏数据的保险,保留)。
|
||||
Long selfId = currentUser.getId();
|
||||
query.eq(AdminUserEntity::getCompanyId, currentUser.getCompanyId())
|
||||
.ne(AdminUserEntity::getRole, "super_admin");
|
||||
.ne(AdminUserEntity::getRole, "super_admin")
|
||||
.and(w -> w.eq(AdminUserEntity::getId, selfId)
|
||||
.or(inner -> inner.eq(AdminUserEntity::getCreatedById, selfId)));
|
||||
if (!kw.isEmpty()) {
|
||||
query.like(AdminUserEntity::getUsername, kw);
|
||||
}
|
||||
@@ -441,6 +447,11 @@ public class AdminUserService {
|
||||
if (!currentUser.getCompanyId().equals(target.getCompanyId())) {
|
||||
throw new BusinessException(403, "只能编辑本公司名下的账号");
|
||||
}
|
||||
// 2026-11-18 与读侧「各自看各自名下」同口径:目标必须是自己直接创建的,
|
||||
// 否则就是「列表看不见、API 照样改」的洞(停用/改密/额度全走这条闸)。
|
||||
if (!currentUser.getId().equals(target.getCreatedById())) {
|
||||
throw new BusinessException(403, "只能编辑自己名下创建的账号");
|
||||
}
|
||||
}
|
||||
if ("super_admin".equals(wantRole)) {
|
||||
throw new BusinessException("不能将用户设为超级管理员");
|
||||
@@ -610,6 +621,10 @@ public class AdminUserService {
|
||||
if (!currentUser.getCompanyId().equals(target.getCompanyId())) {
|
||||
throw new BusinessException(403, "只能删除本公司名下的账号");
|
||||
}
|
||||
// 2026-11-18 与读侧/updateUser 同口径:只清退自己直接创建的账号
|
||||
if (!currentUser.getId().equals(target.getCreatedById())) {
|
||||
throw new BusinessException(403, "只能删除自己名下创建的账号");
|
||||
}
|
||||
}
|
||||
int affected = adminUserMapper.deleteById(uid);
|
||||
if (affected == 0) {
|
||||
|
||||
+4
-2
@@ -114,7 +114,9 @@ public class AdminJdProductController {
|
||||
@Parameter(description = "每页数量") @RequestParam(name = "page_size", defaultValue = PageDefaults.JD_PRODUCTS_PAGE_SIZE) Long pageSize,
|
||||
@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,
|
||||
@Parameter(description = "类目(京麦类目名,多值 IN;2026-11-18 支持选一级/二级类目——"
|
||||
+ "前端把选中节点展开为其子树全部类目名,用重复 category 参数下发,单值形状照常工作)")
|
||||
@RequestParam(name = "category", required = false) List<String> categories,
|
||||
@Parameter(description = "自定义分类 id(类目面板「自定义分类」选中驱动)") @RequestParam(name = "group_id", required = false) Long groupId,
|
||||
@Parameter(description = "当前数据权限分组 id(分类列/分类筛选按它取;缺省=作用域默认分组)")
|
||||
@RequestParam(name = "owner_group_id", required = false) Long ownerGroupId,
|
||||
@@ -136,7 +138,7 @@ public class AdminJdProductController {
|
||||
requireVisibleCategory(scope, groupId);
|
||||
}
|
||||
return ApiResponse.success(jdProductQueryService.page(page, pageSize,
|
||||
productCode, titleKeyword, category, groupId, syncedFrom, syncedTo, classified,
|
||||
productCode, titleKeyword, categories, groupId, syncedFrom, syncedTo, classified,
|
||||
scopedOwnerGroupId));
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,8 @@ public interface JdProductMapper extends BaseMapper<JdProductEntity> {
|
||||
/**
|
||||
* 后管只读页总数(Phase 5,v1.4):与 {@link #selectProductPage} 同一过滤面
|
||||
* (商品编码/标题关键词/类目/自定义分类/同步起止,全部 SQL 侧下推,铁律 20)。
|
||||
* {@code categories}(2026-11-18 一级/二级类目可选):类目名集合 IN,空/ null=不过滤;
|
||||
* 选父级时由前端展开为子树类目名集合下发,单值=原 eq 形状。
|
||||
* 公司维过滤已随 2026-11-16「删除掉公司 tab,参考品牌数据库」撤掉
|
||||
* (数据全平台公共);{@code groupId} 为空或 ≤0=不过滤该面;
|
||||
* {@code ungrouped}/{@code grouped} 两档(未分类/已分类)已随同日口径
|
||||
@@ -55,7 +57,7 @@ public interface JdProductMapper extends BaseMapper<JdProductEntity> {
|
||||
*/
|
||||
long countProducts(@Param("productCode") String productCode,
|
||||
@Param("titleKeyword") String titleKeyword,
|
||||
@Param("category") String category,
|
||||
@Param("categories") List<String> categories,
|
||||
@Param("groupId") Long groupId,
|
||||
@Param("syncedFrom") LocalDateTime syncedFrom,
|
||||
@Param("syncedTo") LocalDateTime syncedTo,
|
||||
@@ -96,7 +98,7 @@ public interface JdProductMapper extends BaseMapper<JdProductEntity> {
|
||||
*/
|
||||
List<JdProductEntity> selectProductPage(@Param("productCode") String productCode,
|
||||
@Param("titleKeyword") String titleKeyword,
|
||||
@Param("category") String category,
|
||||
@Param("categories") List<String> categories,
|
||||
@Param("groupId") Long groupId,
|
||||
@Param("syncedFrom") LocalDateTime syncedFrom,
|
||||
@Param("syncedTo") LocalDateTime syncedTo,
|
||||
|
||||
+18
-9
@@ -78,7 +78,9 @@ public class JdProductQueryService {
|
||||
/**
|
||||
* 分页查询商品行({@code synced_at} 倒序)。
|
||||
*
|
||||
* <p>过滤面:商品编码 contains、标题关键词 contains、类目 eq、分组 eq(2026-11-16 起
|
||||
* <p>过滤面:商品编码 contains、标题关键词 contains、类目 IN(2026-11-18 起多值:
|
||||
* 选一级/二级类目由前端展开为子树类目名集合下发,单值=原 eq 形状;空集合=不过滤该面)、
|
||||
* 分组 eq(2026-11-16 起
|
||||
* 由类目面板「自定义分类」选中驱动)、同步起止(datetime 闭区间)、分类状态档
|
||||
* {@code classified}(2026-11-17 用户口径「加个已分类和未分类的筛选」:true=当前分组下
|
||||
* 有分类、false=没有、null=全部;按 V203 归属表 EXISTS/NOT EXISTS 在 SQL 侧下推,
|
||||
@@ -89,7 +91,7 @@ public class JdProductQueryService {
|
||||
* 公司维过滤已随 2026-11-16 摘公司 tab 整批撤掉(全平台公共)。</p>
|
||||
*/
|
||||
public JdProductPageVo page(Long page, Long pageSize,
|
||||
String productCode, String titleKeyword, String category, Long groupId,
|
||||
String productCode, String titleKeyword, List<String> categories, Long groupId,
|
||||
LocalDateTime syncedFrom, LocalDateTime syncedTo, Boolean classified, Long ownerGroupId) {
|
||||
if (syncedFrom != null && syncedTo != null && syncedFrom.isAfter(syncedTo)) {
|
||||
throw new BusinessException("开始时间不能晚于结束时间");
|
||||
@@ -97,14 +99,14 @@ 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(productCode, titleKeyword, category,
|
||||
Filter filter = filter(productCode, titleKeyword, categories,
|
||||
groupId, syncedFrom, syncedTo, classified);
|
||||
long total = jdProductMapper.countProducts(filter.productCode(),
|
||||
filter.titleKeyword(), filter.category(), filter.groupId(),
|
||||
filter.titleKeyword(), filter.categories(), filter.groupId(),
|
||||
filter.syncedFrom(), filter.syncedTo(), filter.classified(), ownerGroupId);
|
||||
List<JdProductEntity> rows = total <= 0 ? List.of()
|
||||
: jdProductMapper.selectProductPage(filter.productCode(),
|
||||
filter.titleKeyword(), filter.category(), filter.groupId(),
|
||||
filter.titleKeyword(), filter.categories(), filter.groupId(),
|
||||
filter.syncedFrom(), filter.syncedTo(), filter.classified(), ownerGroupId,
|
||||
(safePage - 1) * safeSize, (int) safeSize);
|
||||
List<JdProductListItemVo> items = rows.stream().map(this::toListItem).toList();
|
||||
@@ -228,18 +230,25 @@ public class JdProductQueryService {
|
||||
// ---------------------------------------------------------------- 过滤面
|
||||
|
||||
/** 服务侧过滤面归一:groupId ≤0 按没选处理,文本 trim 后空串归 null(无公司维,2026-11-16 摘);
|
||||
* classified 原样直传(null=不过滤该面,2026-11-17 分类状态快筛)。 */
|
||||
* classified 原样直传(null=不过滤该面,2026-11-17 分类状态快筛);
|
||||
* categories 逐项 trim、去空白、去重,空集合归 null=不过滤该面(2026-11-18 一级/二级类目展开)。 */
|
||||
private record Filter(String productCode, String titleKeyword,
|
||||
String category, Long groupId,
|
||||
List<String> categories, Long groupId,
|
||||
LocalDateTime syncedFrom, LocalDateTime syncedTo, Boolean classified) {
|
||||
}
|
||||
|
||||
private static Filter filter(String productCode, String titleKeyword,
|
||||
String category, Long groupId,
|
||||
List<String> categories, Long groupId,
|
||||
LocalDateTime syncedFrom, LocalDateTime syncedTo, Boolean classified) {
|
||||
Long safeGroupId = groupId != null && groupId > 0 ? groupId : null;
|
||||
List<String> safeCategories = categories == null ? null : categories.stream()
|
||||
.map(JdProductQueryService::trimToNull)
|
||||
.filter(java.util.Objects::nonNull)
|
||||
.distinct()
|
||||
.toList();
|
||||
return new Filter(trimToNull(productCode), trimToNull(titleKeyword),
|
||||
trimToNull(category), safeGroupId, syncedFrom, syncedTo, classified);
|
||||
safeCategories == null || safeCategories.isEmpty() ? null : safeCategories,
|
||||
safeGroupId, syncedFrom, syncedTo, classified);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- 列表/详情搬运
|
||||
|
||||
@@ -115,7 +115,13 @@
|
||||
<sql id="productConds">
|
||||
<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>
|
||||
<!-- 类目过滤(2026-11-18 一级/二级类目可选):单值=原 eq 形状;父级选中由前端展开为
|
||||
子树类目名集合,这里 IN 下推(铁律 20:谓词必须在 SQL 侧,不得 Java 侧对已取页 filter)。
|
||||
服务侧已逐项 trim/去空白/去重,空集合归 null 不进本分支。 -->
|
||||
<if test="categories != null and categories.size() > 0">
|
||||
AND p.category_path IN
|
||||
<foreach collection="categories" item="cat" open="(" separator="," close=")">#{cat}</foreach>
|
||||
</if>
|
||||
<if test="groupId != null and groupId > 0">
|
||||
AND EXISTS (
|
||||
SELECT 1 FROM biz_jd_product_group_assign a
|
||||
|
||||
+70
-3
@@ -172,7 +172,9 @@ class AdminUserServiceCompanySuperAdminTest {
|
||||
// ---------- 列表 ----------
|
||||
|
||||
@Test
|
||||
void companySuperAdminListsOwnCompanyWithoutSiteSuperAdmin() {
|
||||
void companySuperAdminOnlyListsOwnSubordinates() {
|
||||
// 2026-11-18 客户口径:公司超管只看「本人那行+自己直接创建的」,不再看本公司全部。
|
||||
// 判据形状:谓词必须同时出现 company_id、created_by_id 与 id=本人(读侧与组长档同形)。
|
||||
AdminUserEntity operator = user(9L, "company_super_admin", 2L, null);
|
||||
when(authSupport.currentRole(operator)).thenReturn("company_super_admin");
|
||||
when(userMapper.selectCount(any())).thenReturn(0L);
|
||||
@@ -184,8 +186,27 @@ class AdminUserServiceCompanySuperAdminTest {
|
||||
ArgumentCaptor.forClass(LambdaQueryWrapper.class);
|
||||
verify(userMapper).selectCount(captor.capture());
|
||||
// 先碰一次 SqlSegment 才会铺出参数(MP 惯例)
|
||||
captor.getValue().getSqlSegment();
|
||||
assertThat(captor.getValue().getParamNameValuePairs().values()).contains(2L);
|
||||
String sql = captor.getValue().getSqlSegment();
|
||||
assertThat(sql).contains("company_id").contains("created_by_id");
|
||||
assertThat(captor.getValue().getParamNameValuePairs().values())
|
||||
.contains(2L) // 本公司
|
||||
.contains(9L); // 本人(id=本人 OR created_by_id=本人,两处同一值)
|
||||
}
|
||||
|
||||
@Test
|
||||
void siteSuperAdminListStillUnscopedBySubordinates() {
|
||||
// 反向保险:收窄只落在公司超管档——平台超管「看所有」,谓词里不得出现 created_by_id 强制项
|
||||
AdminUserEntity operator = user(1L, "super_admin", 1L, null);
|
||||
when(authSupport.currentRole(operator)).thenReturn("super_admin");
|
||||
when(userMapper.selectCount(any())).thenReturn(0L);
|
||||
when(userMapper.selectList(any())).thenReturn(List.of());
|
||||
|
||||
service.listUsers(operator, 1, 15, null, null, null, null);
|
||||
|
||||
ArgumentCaptor<LambdaQueryWrapper<AdminUserEntity>> captor =
|
||||
ArgumentCaptor.forClass(LambdaQueryWrapper.class);
|
||||
verify(userMapper).selectCount(captor.capture());
|
||||
assertThat(captor.getValue().getSqlSegment()).doesNotContain("created_by_id");
|
||||
}
|
||||
|
||||
// ---------- 编辑 ----------
|
||||
@@ -244,6 +265,52 @@ class AdminUserServiceCompanySuperAdminTest {
|
||||
.hasMessageContaining("只有超级管理员可以修改公司超级管理员");
|
||||
}
|
||||
|
||||
@Test
|
||||
void companySuperAdminCannotEditAccountCreatedByOthers() {
|
||||
// 2026-11-18 写侧与读侧同口径:本公司但由别人(组长8/站点超管)创建的账号,
|
||||
// 列表已不可见,API 也必须 403——不留「看不见但改得动」的洞。
|
||||
AdminUserEntity operator = user(9L, "company_super_admin", 1L, 2L);
|
||||
AdminUserEntity target = user(12L, "admin", 1L, 8L);
|
||||
when(authSupport.currentRole(operator)).thenReturn("company_super_admin");
|
||||
when(userMapper.selectById(12L)).thenReturn(target);
|
||||
|
||||
AdminUserUpdateRequest request = new AdminUserUpdateRequest();
|
||||
request.setPassword("secret1");
|
||||
|
||||
assertThatThrownBy(() -> service.updateUser(operator, 12L, request))
|
||||
.isInstanceOf(BusinessException.class)
|
||||
.hasMessageContaining("只能编辑自己名下创建的账号");
|
||||
verify(userMapper, never()).update(any(), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
void companySuperAdminCanEditOwnCreatedAdmin() {
|
||||
AdminUserEntity operator = user(9L, "company_super_admin", 1L, 2L);
|
||||
AdminUserEntity target = user(12L, "admin", 1L, 9L);
|
||||
when(authSupport.currentRole(operator)).thenReturn("company_super_admin");
|
||||
when(userMapper.selectById(12L)).thenReturn(target);
|
||||
|
||||
AdminUserUpdateRequest request = new AdminUserUpdateRequest();
|
||||
request.setPassword("secret1");
|
||||
|
||||
service.updateUser(operator, 12L, request);
|
||||
|
||||
verify(userMapper).update(any(), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
void companySuperAdminCannotDeleteAccountCreatedByOthers() {
|
||||
AdminUserEntity operator = user(9L, "company_super_admin", 1L, 2L);
|
||||
AdminUserEntity target = user(12L, "normal", 1L, 8L);
|
||||
when(authSupport.currentRole(operator)).thenReturn("company_super_admin");
|
||||
when(userMapper.selectById(12L)).thenReturn(target);
|
||||
|
||||
assertThatThrownBy(() -> service.deleteUser(operator, 12L))
|
||||
.isInstanceOf(BusinessException.class)
|
||||
.hasMessageContaining("只能删除自己名下创建的账号");
|
||||
verify(userMapper, never()).deleteById(12L);
|
||||
}
|
||||
|
||||
@Test
|
||||
void companySuperAdminCannotDeleteCompanySuperAdminTarget() {
|
||||
AdminUserEntity operator = user(9L, "company_super_admin", 1L, 2L);
|
||||
|
||||
+36
-3
@@ -726,15 +726,48 @@ class AdminJdProductControllerTest {
|
||||
JdProductMapper mapper = mock(JdProductMapper.class);
|
||||
JdProductQueryService service = queryService(mapper);
|
||||
when(mapper.countProducts(any(), any(), any(), any(), any(), any(), any(), any())).thenReturn(1L);
|
||||
service.page(1L, 20L, " SKU-1 ", " 连衣裙 ", " 艺考形体服 ", 7L, null, null, null, null);
|
||||
verify(mapper).countProducts("SKU-1", "连衣裙", "艺考形体服", 7L, null, null, null, null);
|
||||
verify(mapper).selectProductPage("SKU-1", "连衣裙", "艺考形体服", 7L, null, null, null, null, 0L, 20);
|
||||
service.page(1L, 20L, " SKU-1 ", " 连衣裙 ", List.of(" 艺考形体服 "), 7L, null, null, null, null);
|
||||
verify(mapper).countProducts("SKU-1", "连衣裙", List.of("艺考形体服"), 7L, null, null, null, null);
|
||||
verify(mapper).selectProductPage("SKU-1", "连衣裙", List.of("艺考形体服"), 7L, null, null, null, null, 0L, 20);
|
||||
|
||||
service.page(1L, 20L, " ", null, null, 0L, null, null, null, null);
|
||||
verify(mapper).countProducts(null, null, null, null, null, null, null, null);
|
||||
verify(mapper).selectProductPage(null, null, null, null, null, null, null, null, 0L, 20);
|
||||
}
|
||||
|
||||
/**
|
||||
* 2026-11-18 一级/二级类目可选(前端展开子树类目名集合下发):
|
||||
* ① 服务侧逐项 trim、去空白、去重后进 mapper;全空白集合归 null=不过滤该面;
|
||||
* ② XML 绊线:类目谓词必须是 IN+foreach 下推(改回单值 eq 即红,铁律 20 同形)。
|
||||
*/
|
||||
@Test
|
||||
void 类目多值必须逐项归一并IN下推() throws IOException {
|
||||
JdProductMapper mapper = mock(JdProductMapper.class);
|
||||
JdProductQueryService service = queryService(mapper);
|
||||
when(mapper.countProducts(any(), any(), any(), any(), any(), any(), any(), any())).thenReturn(1L);
|
||||
|
||||
service.page(1L, 20L, null, null,
|
||||
java.util.Arrays.asList(" 女装 ", "女装", "", null, " 汉服/旗袍 "),
|
||||
null, null, null, null, null);
|
||||
verify(mapper).countProducts(null, null, List.of("女装", "汉服/旗袍"),
|
||||
null, null, null, null, null);
|
||||
verify(mapper).selectProductPage(null, null, List.of("女装", "汉服/旗袍"),
|
||||
null, null, null, null, null, 0L, 20);
|
||||
|
||||
// 全空白/空集合=不过滤该面(与「全部类目」清选同口径,不得下发空 IN)
|
||||
service.page(1L, 20L, null, null, java.util.Arrays.asList(" ", ""), null, null, null, null, null);
|
||||
verify(mapper).countProducts(null, null, null, null, null, null, null, null);
|
||||
|
||||
Path xml = findJdProductMapperXml();
|
||||
String xmlText = stripComments(Files.readString(xml)).replaceAll("(?s)<!--.*?-->", "");
|
||||
assertTrue(xmlText.contains("p.category_path IN"),
|
||||
"类目谓词必须是 IN 下推(2026-11-18 父级类目展开集合)");
|
||||
assertTrue(xmlText.contains("<foreach collection=\"categories\""),
|
||||
"IN 集合必须由 foreach 展开(拼串即红)");
|
||||
assertFalse(xmlText.contains("p.category_path = #{category}"),
|
||||
"改回单值 eq 即红——一级/二级类目展开会整体失效");
|
||||
}
|
||||
|
||||
/**
|
||||
* 分类状态快筛(2026-11-17 用户口径「加个已分类和未分类的筛选」):
|
||||
* ① classified+ownerGroupId 必须原样下传给 mapper(谓词在 XML 的 EXISTS/NOT EXISTS 段,
|
||||
|
||||
Reference in New Issue
Block a user