test(公司tab): 补分组 wrapper 用例,反向钉改绑到参数绑定本身

评审两处咬不住的地方:分组侧 list() 那条 created_by_id=? OR user_id=? 被公司条件
平铺时,MySQL 的 AND 优先会让前半个 OR 整块逃出筛选(多放行、接口照样 200),而这
一Shape 全仓没有用例捕;读入口的反向钉只断 contains("company_id"),而 @Operation
的描述里就写着这个词,删掉绑定也不会红。

顺带删掉没人调的 list(Long) 重载,并把"空成员集"两支落到 id=-1 哨兵上(IN () 是
MySQL 语法错,退化成不加条件则是把全量放出来)。
This commit is contained in:
2026-10-05 16:57:32 +08:00
parent 41dbcad1ac
commit 4c7d21eb52
6 changed files with 141 additions and 13 deletions
@@ -48,10 +48,6 @@ public class ShopManageGroupService {
return list(null, null);
}
public List<ShopManageGroupItemVo> list(Long createdById) {
return list(createdById, null);
}
public List<ShopManageGroupItemVo> list(Long createdById, List<Long> companyMemberIds) {
LambdaQueryWrapper<ShopManageGroupEntity> qw = new LambdaQueryWrapper<ShopManageGroupEntity>()
.orderByAsc(ShopManageGroupEntity::getId);
@@ -65,7 +61,7 @@ public class ShopManageGroupService {
if (companyMemberIds.isEmpty()) {
qw.eq(ShopManageGroupEntity::getId, -1L);
} else {
// 公司条件同样自成一组(G2 护栏钉的是 AND (…) 这个形状;平铺 IN 与它在语义上等价)。
// 同样自成一组:上面那支 and() 里已经混着 OR,这条若平铺下去,AND 优先只会作用在 OR 的右半边。
qw.and(w -> w.in(ShopManageGroupEntity::getCreatedById, companyMemberIds));
}
}