fix(jd): 京东数据库摘除公司 tab(2026-11-16 用户定案「删除掉公司 tab 参考品牌数据库」=品牌库 2026-10-06 先例同形:摘的不只是 tab)——前端 admin_jd_database 退出 COMPANY_SCOPED_PAGES 注册表(定案注释+「公司维度不得回流」SHARED 清单钉住)+routes companyScoped:false+页面卸 companyTab watch 与两处 companyId 发送口(列表 params/类目下拉 fetchJdProductCategories 无参化,JdProductAssignPane 取数同形);后端读侧同窗摘:XML productConds 与 selectProductCategories 的公司维谓词删除(行 company_id 列保留=同步来源标记,JdSchemaContractTest 契约不动)、JdProductMapper.countProducts/selectProductPage 8 参、selectProductCategories() 无参、JdProductQueryService.page 10 参+Filter 去 companyId、AdminJdProductController.page 10 参数+categories(request) 去 superAdminScopedCompanyId 与 DataReadScope 注入、JdCollectController.categories() 调用方同步。判据:vue-tsc rc=0;node --test 9 文件 56/56(wiring SEND_POINTS 27→25、分组 21→19、watch 分母 12→11;menu-route 钉 companyScoped=false;jd-page 钉退出注册表);vitest mount 28/28(删「切公司 Tab 重取」用例,companyId 发送口全改 not.toHaveProperty);mvn -o test-compile rc=0;mvn -o test jd 模块全绿(AdminJdProductControllerTest 20/20:结构判据改「读侧零公司维度_公司tab口径整批摘除」反向钉 company_id/superAdminScopedCompanyId/DataReadScope 不得回潜,行为样本改 requireJdAccess 正门装 200 信封)
This commit is contained in:
+63
-70
@@ -5,7 +5,6 @@ import com.nanri.aiimage.common.api.PageDefaults;
|
||||
import com.nanri.aiimage.common.exception.BusinessException;
|
||||
import com.nanri.aiimage.common.model.entity.AdminUserEntity;
|
||||
import com.nanri.aiimage.common.security.AdminAuthSupport;
|
||||
import com.nanri.aiimage.common.service.DataReadScope;
|
||||
import com.nanri.aiimage.modules.jd.mapper.JdProductImageMapper;
|
||||
import com.nanri.aiimage.modules.jd.mapper.JdProductMapper;
|
||||
import com.nanri.aiimage.modules.jd.model.dto.JdProductBatchDeleteRequest;
|
||||
@@ -48,16 +47,16 @@ import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyNoInteractions;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
/**
|
||||
* v1.4 Phase 5:后管「京东数据库」只读接口(列表/详情)与分组管理入口。
|
||||
*
|
||||
* <p>结构判据(照 {@code AdminAppearancePatentCleanItemsControllerTest} 双形态):
|
||||
* 端点只读、鉴权 seam、公司口径(读侧只剩超管筛选 superAdminScopedCompanyId,公共库不走
|
||||
* readCompanyIdOrOwn)、snake 参数带默认值、SQL 只落 XML;
|
||||
* 行为样本:mock HttpServletRequest 把 company 参数交给 superAdminScopedCompanyId 并装进 200 信封、
|
||||
* 端点只读、鉴权 seam、公司口径(2026-11-16 用户定案「删除掉公司 tab,参考品牌数据库」=
|
||||
* 品牌库 2026-10-06 先例同形:company_id 请求参数与 superAdminScopedCompanyId 谓词整批摘除,
|
||||
* 读侧零公司维度、反向钉住防回潜)、snake 参数带默认值、SQL 只落 XML;
|
||||
* 行为样本:mock HttpServletRequest 走 requireJdAccess 鉴权正门并把结果装进 200 信封、
|
||||
* 分页钳制 offset/limit(page=Long.MAX_VALUE 不得负,铁律 15)、详情 attr_json
|
||||
* tabs→attrGroups 解析与非法形状兜底(AC-7)。
|
||||
* 导出端点与 sale_status 筛选参数已随 2026-11-15 客户口径整段下线(反向钉住防回潜)。</p>
|
||||
@@ -114,23 +113,30 @@ class AdminJdProductControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void 公司口径只剩超管筛选_公共库不走readCompanyIdOrOwn() throws IOException {
|
||||
void 读侧零公司维度_公司tab口径整批摘除() throws IOException {
|
||||
String source = stripComments(Files.readString(CONTROLLER));
|
||||
assertTrue(source.contains("DataReadScope"), "公司维度唯一出口是 DataReadScope");
|
||||
assertTrue(source.contains("superAdminScopedCompanyId"),
|
||||
"读侧(列表/类目)必须走 superAdminScopedCompanyId:只有站点超管显式传 company_id 才收窄"
|
||||
+ "(公司 tab 筛选管理员),其余请求全量(2026-11-15 用户定案「京东数据库不区分公司、属于公共的」)");
|
||||
// 2026-11-16 用户定案「删除掉公司 tab,参考品牌数据库」=品牌库 2026-10-06 先例同形:
|
||||
// 摘的不只是 tab——company_id 参数与 superAdminScopedCompanyId 谓词一起撤,
|
||||
// 数据全平台公共(行 company_id 列仍是同步来源标记,不构成可见性边界)。
|
||||
assertFalse(source.contains("company_id"),
|
||||
"company_id 请求参数必须已删除,不得回潜(2026-11-16 随公司 tab 整批摘除)");
|
||||
assertFalse(source.contains("superAdminScopedCompanyId"),
|
||||
"superAdminScopedCompanyId 谓词必须已删除:第五道门(超管显式收窄)对京东只读面不再生效");
|
||||
assertFalse(source.contains("readCompanyIdOrOwn"),
|
||||
"不得走 readCompanyIdOrOwn:它对非超管强制本公司,公共库对每一家管理员都是同一份全量");
|
||||
"不得走 readCompanyIdOrOwn:全平台公共数据对每一家管理员都是同一份全量,无公司可见性边界");
|
||||
assertFalse(source.contains("DataReadScope"),
|
||||
"DataReadScope 不得再注入京东只读控制器(公司收口已随 2026-11-16 摘除)");
|
||||
}
|
||||
|
||||
@Test
|
||||
void 分页参数snake且带默认值() throws IOException {
|
||||
String source = stripComments(Files.readString(CONTROLLER));
|
||||
for (String param : List.of("page_size", "product_code", "title_keyword",
|
||||
"group_id", "ungrouped", "grouped", "synced_from", "synced_to", "company_id")) {
|
||||
"group_id", "ungrouped", "grouped", "synced_from", "synced_to")) {
|
||||
assertTrue(source.contains(param), "查询参数必须 snake_case:" + param);
|
||||
}
|
||||
// company_id 参数已随 2026-11-16「删除掉公司 tab」整批摘除(读侧零公司维度支另有反向钉)。
|
||||
assertFalse(source.contains("company_id"), "company_id 请求参数必须已删除,不得回潜");
|
||||
// 商品状态筛选框已随 2026-11-15 客户口径从前端下线 ⇒ 服务端同名参数一起撤(反向钉住防回潜)。
|
||||
assertFalse(source.contains("\"sale_status\""), "sale_status 筛选参数必须已删除,不得回潜");
|
||||
// 店铺筛选同日客户口径「店铺不需要」下线 ⇒ shop_name 参数同窗撤(反向钉住防回潜)。
|
||||
@@ -177,64 +183,58 @@ class AdminJdProductControllerTest {
|
||||
// ===================== 行为样本 =====================
|
||||
|
||||
@Test
|
||||
void 控制器把公司参数交给superAdminScopedCompanyId并把结果装进200信封() {
|
||||
void 控制器列表走requireJdAccess正门并把查询结果装进200信封() {
|
||||
JdProductQueryService queryService = mock(JdProductQueryService.class);
|
||||
AdminAuthSupport authSupport = mock(AdminAuthSupport.class);
|
||||
PermissionMenuService permissionMenuService = mock(PermissionMenuService.class);
|
||||
DataReadScope dataReadScope = mock(DataReadScope.class);
|
||||
AdminJdProductController controller = new AdminJdProductController(
|
||||
queryService, mock(JdProductDeleteService.class), mock(JdProductUpdateService.class), authSupport,
|
||||
permissionMenuService, dataReadScope);
|
||||
permissionMenuService);
|
||||
|
||||
AdminUserEntity operator = new AdminUserEntity();
|
||||
operator.setId(7L);
|
||||
HttpServletRequest request = mock(HttpServletRequest.class);
|
||||
when(authSupport.requireUser(request)).thenReturn(operator);
|
||||
when(authSupport.currentRole(operator)).thenReturn("super_admin");
|
||||
// 超管显式传 company_id=5 ⇒ 超管筛选把 5 交出来(不传时给 null=全量,同一行为样本家族)。
|
||||
when(dataReadScope.superAdminScopedCompanyId(operator, 5L)).thenReturn(5L);
|
||||
JdProductPageVo pageVo = new JdProductPageVo();
|
||||
pageVo.setItems(List.of());
|
||||
pageVo.setTotal(0L);
|
||||
pageVo.setPage(1L);
|
||||
pageVo.setPageSize((long) PageDefaults.JD_PRODUCTS_PAGE_SIZE_INT);
|
||||
when(queryService.page(1L, 20L, 5L, null, null, null, null, null, null, null, null)).thenReturn(pageVo);
|
||||
when(queryService.page(1L, 20L, null, null, null, null, null, null, null, null)).thenReturn(pageVo);
|
||||
|
||||
// 2026-11-16 起请求面没有 company_id:任何授权身份看到的都是同一份全量。
|
||||
ApiResponse<JdProductPageVo> response = controller.page(1L, 20L, null, null, null, null, null,
|
||||
null, null, null, 5L, request);
|
||||
null, null, null, request);
|
||||
|
||||
verify(dataReadScope).superAdminScopedCompanyId(operator, 5L);
|
||||
verify(queryService).page(1L, 20L, 5L, null, null, null, null, null, null, null, null);
|
||||
verify(queryService).page(1L, 20L, null, null, null, null, null, null, null, null);
|
||||
assertEquals(Boolean.TRUE, response.isSuccess(), "拒绝走 403 业务码,放行必须是 success 信封(B80-03)");
|
||||
assertEquals(pageVo, response.getData());
|
||||
}
|
||||
|
||||
@Test
|
||||
void 类目下拉端点走同一超管筛选口径并回选项集() {
|
||||
void 类目下拉端点走同一鉴权正门并回全平台选项集() {
|
||||
JdProductQueryService queryService = mock(JdProductQueryService.class);
|
||||
AdminAuthSupport authSupport = mock(AdminAuthSupport.class);
|
||||
DataReadScope dataReadScope = mock(DataReadScope.class);
|
||||
AdminJdProductController controller = new AdminJdProductController(
|
||||
queryService, mock(JdProductDeleteService.class), mock(JdProductUpdateService.class), authSupport,
|
||||
mock(PermissionMenuService.class), dataReadScope);
|
||||
mock(PermissionMenuService.class));
|
||||
|
||||
AdminUserEntity operator = new AdminUserEntity();
|
||||
operator.setId(7L);
|
||||
HttpServletRequest request = mock(HttpServletRequest.class);
|
||||
when(authSupport.requireUser(request)).thenReturn(operator);
|
||||
when(authSupport.currentRole(operator)).thenReturn("super_admin");
|
||||
when(dataReadScope.superAdminScopedCompanyId(operator, 5L)).thenReturn(5L);
|
||||
JdProductCategoryVo row = new JdProductCategoryVo();
|
||||
row.setName("艺考形体服");
|
||||
row.setProductCount(85L);
|
||||
when(queryService.categories(5L)).thenReturn(List.of(row));
|
||||
when(queryService.categories()).thenReturn(List.of(row));
|
||||
|
||||
ApiResponse<List<JdProductCategoryVo>> response = controller.categories(5L, request);
|
||||
ApiResponse<List<JdProductCategoryVo>> response = controller.categories(request);
|
||||
|
||||
verify(dataReadScope).superAdminScopedCompanyId(operator, 5L);
|
||||
verify(queryService).categories(5L);
|
||||
verify(queryService).categories();
|
||||
assertEquals(Boolean.TRUE, response.isSuccess(), "类目下拉与列表同一鉴权正门(200 信封)");
|
||||
assertEquals("艺考形体服", response.getData().get(0).getName(), "选项=已落库行的末级类目名");
|
||||
assertEquals("艺考形体服", response.getData().get(0).getName(), "选项=已落库行的末级类目名(全平台去重)");
|
||||
assertEquals(85L, response.getData().get(0).getProductCount());
|
||||
}
|
||||
|
||||
@@ -242,10 +242,9 @@ class AdminJdProductControllerTest {
|
||||
void 控制器详情走同一鉴权正门并回详情且不问公司() {
|
||||
JdProductQueryService queryService = mock(JdProductQueryService.class);
|
||||
AdminAuthSupport authSupport = mock(AdminAuthSupport.class);
|
||||
DataReadScope dataReadScope = mock(DataReadScope.class);
|
||||
AdminJdProductController controller = new AdminJdProductController(
|
||||
queryService, mock(JdProductDeleteService.class), mock(JdProductUpdateService.class), authSupport,
|
||||
mock(PermissionMenuService.class), dataReadScope);
|
||||
mock(PermissionMenuService.class));
|
||||
|
||||
AdminUserEntity operator = new AdminUserEntity();
|
||||
operator.setId(7L);
|
||||
@@ -258,8 +257,7 @@ class AdminJdProductControllerTest {
|
||||
|
||||
ApiResponse<JdProductDetailVo> response = controller.detail(11L, request);
|
||||
|
||||
// 公共库详情没有公司维度:DataReadScope 不参与(防有人把公司收口接回来)。
|
||||
verifyNoInteractions(dataReadScope);
|
||||
// 公共库详情没有公司维度(DataReadScope 反向钉在结构判据支,2026-11-16 已整批摘除)。
|
||||
verify(queryService).detail(11L);
|
||||
assertEquals(Boolean.TRUE, response.isSuccess());
|
||||
assertEquals(detailVo, response.getData());
|
||||
@@ -270,10 +268,9 @@ class AdminJdProductControllerTest {
|
||||
JdProductQueryService queryService = mock(JdProductQueryService.class);
|
||||
JdProductDeleteService deleteService = mock(JdProductDeleteService.class);
|
||||
AdminAuthSupport authSupport = mock(AdminAuthSupport.class);
|
||||
DataReadScope dataReadScope = mock(DataReadScope.class);
|
||||
AdminJdProductController controller = new AdminJdProductController(
|
||||
queryService, deleteService, mock(JdProductUpdateService.class), authSupport,
|
||||
mock(PermissionMenuService.class), dataReadScope);
|
||||
mock(PermissionMenuService.class));
|
||||
|
||||
AdminUserEntity operator = new AdminUserEntity();
|
||||
operator.setId(7L);
|
||||
@@ -288,8 +285,7 @@ class AdminJdProductControllerTest {
|
||||
|
||||
ApiResponse<JdProductDeleteVo> response = controller.delete(11L, request);
|
||||
|
||||
// 公共库写侧没有公司维度:不收 company_id、DataReadScope 不参与。
|
||||
verifyNoInteractions(dataReadScope);
|
||||
// 公共库写侧没有公司维度(结构判据支反向钉 company_id/DataReadScope 不得回流)。
|
||||
verify(deleteService).delete(List.of(11L));
|
||||
assertEquals(Boolean.TRUE, response.isSuccess());
|
||||
assertEquals(9, response.getData().getObjectsDeleted());
|
||||
@@ -300,10 +296,9 @@ class AdminJdProductControllerTest {
|
||||
JdProductQueryService queryService = mock(JdProductQueryService.class);
|
||||
JdProductDeleteService deleteService = mock(JdProductDeleteService.class);
|
||||
AdminAuthSupport authSupport = mock(AdminAuthSupport.class);
|
||||
DataReadScope dataReadScope = mock(DataReadScope.class);
|
||||
AdminJdProductController controller = new AdminJdProductController(
|
||||
queryService, deleteService, mock(JdProductUpdateService.class), authSupport,
|
||||
mock(PermissionMenuService.class), dataReadScope);
|
||||
mock(PermissionMenuService.class));
|
||||
|
||||
AdminUserEntity operator = new AdminUserEntity();
|
||||
operator.setId(7L);
|
||||
@@ -326,23 +321,23 @@ class AdminJdProductControllerTest {
|
||||
JdProductQueryService service = new JdProductQueryService(mapper, mock(JdProductImageMapper.class),
|
||||
mock(com.nanri.aiimage.modules.jd.mapper.JdProductSkuMapper.class),
|
||||
mock(com.nanri.aiimage.modules.jd.mapper.JdProductGroupMapper.class));
|
||||
when(mapper.countProducts(any(), any(), any(), any(), any(), any(), any(), any(), any())).thenReturn(1L);
|
||||
when(mapper.countProducts(any(), any(), any(), any(), any(), any(), any(), any())).thenReturn(1L);
|
||||
|
||||
// page=0 / size=null ⇒ 归一为第 1 页、默认 20 条;offset = 0。
|
||||
service.page(0L, null, null, null, null, null, null, null, null, null, null);
|
||||
service.page(0L, null, null, null, null, null, null, null, null, null);
|
||||
ArgumentCaptor<Long> offset = ArgumentCaptor.forClass(Long.class);
|
||||
ArgumentCaptor<Integer> limit = ArgumentCaptor.forClass(Integer.class);
|
||||
verify(mapper).selectProductPage(isNull(), isNull(), isNull(), isNull(), isNull(), isNull(),
|
||||
isNull(), isNull(), isNull(), offset.capture(), limit.capture());
|
||||
isNull(), isNull(), offset.capture(), limit.capture());
|
||||
assertEquals(0L, offset.getValue());
|
||||
assertEquals(PageDefaults.JD_PRODUCTS_PAGE_SIZE_INT, limit.getValue());
|
||||
|
||||
// page=Long.MAX_VALUE / size=500 ⇒ 钳到 10_000 页、100 条;乘积 999_900 不得变负(铁律 15)。
|
||||
service.page(Long.MAX_VALUE, 500L, null, null, null, null, null, null, null, null, null);
|
||||
service.page(Long.MAX_VALUE, 500L, null, null, null, null, null, null, null, null);
|
||||
ArgumentCaptor<Long> offsetMax = ArgumentCaptor.forClass(Long.class);
|
||||
ArgumentCaptor<Integer> limitMax = ArgumentCaptor.forClass(Integer.class);
|
||||
verify(mapper, times(2)).selectProductPage(any(), any(), any(), any(), any(), any(),
|
||||
any(), any(), any(), offsetMax.capture(), limitMax.capture());
|
||||
any(), any(), offsetMax.capture(), limitMax.capture());
|
||||
assertEquals(999_900L, offsetMax.getValue(), "(page-1)*page_size 最大 999_900,钳制后不得溢出变负");
|
||||
assertEquals(100, limitMax.getValue());
|
||||
}
|
||||
@@ -356,9 +351,9 @@ class AdminJdProductControllerTest {
|
||||
LocalDateTime from = LocalDateTime.of(2026, 11, 14, 12, 0);
|
||||
LocalDateTime to = LocalDateTime.of(2026, 11, 14, 8, 0);
|
||||
BusinessException ex = assertThrows(BusinessException.class,
|
||||
() -> service.page(1L, 20L, null, null, null, null, null, null, null, from, to));
|
||||
() -> service.page(1L, 20L, null, null, null, null, null, null, from, to));
|
||||
assertTrue(ex.getMessage().contains("开始时间不能晚于结束时间"), "倒挂时间按业务异常拒绝");
|
||||
verify(mapper, never()).countProducts(any(), any(), any(), any(), any(), any(), any(), any(), any());
|
||||
verify(mapper, never()).countProducts(any(), any(), any(), any(), any(), any(), any(), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -367,37 +362,37 @@ class AdminJdProductControllerTest {
|
||||
JdProductQueryService service = new JdProductQueryService(mapper, mock(JdProductImageMapper.class),
|
||||
mock(com.nanri.aiimage.modules.jd.mapper.JdProductSkuMapper.class),
|
||||
mock(com.nanri.aiimage.modules.jd.mapper.JdProductGroupMapper.class));
|
||||
when(mapper.countProducts(any(), any(), any(), any(), any(), any(), any(), any(), any())).thenReturn(0L);
|
||||
when(mapper.countProducts(any(), any(), any(), any(), any(), any(), any(), any())).thenReturn(0L);
|
||||
|
||||
// 超管显式传 5 ⇒ 按公司 5 筛(收窄);groupId ≤0 按没选分组处理;文本两侧空白剥掉。
|
||||
// groupId ≤0 按没选分组处理;文本两侧空白剥掉。
|
||||
// 类目(京麦末级类目名)走同一过滤面:传值原样直传、空白归 null。
|
||||
service.page(1L, 20L, 5L, " SKU-1 ", " 连衣裙 ", " 艺考形体服 ", 0L, null, null, null, null);
|
||||
verify(mapper).countProducts(eq(5L), eq("SKU-1"), eq("连衣裙"),
|
||||
service.page(1L, 20L, " SKU-1 ", " 连衣裙 ", " 艺考形体服 ", 0L, null, null, null, null);
|
||||
verify(mapper).countProducts(eq("SKU-1"), eq("连衣裙"),
|
||||
eq("艺考形体服"), isNull(), isNull(), isNull(), isNull(), isNull());
|
||||
// 全量(scopedCompanyId=null)⇒ companyId 不过滤。
|
||||
service.page(1L, 20L, null, null, null, null, null, null, null, null, null);
|
||||
// 全量口径(2026-11-16 起读侧无公司维)⇒ 过滤面全 null。
|
||||
service.page(1L, 20L, null, null, null, null, null, null, null, null);
|
||||
verify(mapper).countProducts(isNull(), isNull(), isNull(), isNull(), isNull(),
|
||||
isNull(), isNull(), isNull(), isNull());
|
||||
isNull(), isNull(), isNull());
|
||||
|
||||
// 未分类范围(店铺分类弹窗「未分类」页签):ungrouped=true 原样下推到 SQL 侧。
|
||||
service.page(1L, 20L, null, null, null, null, null, Boolean.TRUE, null, null, null);
|
||||
verify(mapper).countProducts(isNull(), isNull(), isNull(), isNull(), isNull(),
|
||||
eq(Boolean.TRUE), isNull(), isNull(), isNull());
|
||||
service.page(1L, 20L, null, null, null, null, Boolean.TRUE, null, null, null);
|
||||
verify(mapper).countProducts(isNull(), isNull(), isNull(), isNull(), eq(Boolean.TRUE),
|
||||
isNull(), isNull(), isNull());
|
||||
// ungrouped=false / 缺省按不过滤处理(Filter 归一成 null,不进 IS NULL 分支);
|
||||
// 与②「全量」那发同形状,累计 2 次。
|
||||
service.page(1L, 20L, null, null, null, null, null, Boolean.FALSE, null, null, null);
|
||||
service.page(1L, 20L, null, null, null, null, Boolean.FALSE, null, null, null);
|
||||
verify(mapper, times(2)).countProducts(isNull(), isNull(), isNull(), isNull(), isNull(),
|
||||
isNull(), isNull(), isNull(), isNull());
|
||||
isNull(), isNull(), isNull());
|
||||
|
||||
// 已分类档(页面筛选行「分类状态」=已分类,2026-11-15 客户口径「分类好的可以不显示」反选):
|
||||
// grouped=true 原样下推到 SQL 侧(group_id IS NOT NULL),ungrouped 不动。
|
||||
service.page(1L, 20L, null, null, null, null, null, null, Boolean.TRUE, null, null);
|
||||
service.page(1L, 20L, null, null, null, null, null, Boolean.TRUE, null, null);
|
||||
verify(mapper).countProducts(isNull(), isNull(), isNull(), isNull(), isNull(),
|
||||
isNull(), eq(Boolean.TRUE), isNull(), isNull());
|
||||
eq(Boolean.TRUE), isNull(), isNull());
|
||||
// grouped=false / 缺省同口径归一成 null(不进 IS NOT NULL 分支);与②「全量」累计 3 次。
|
||||
service.page(1L, 20L, null, null, null, null, null, null, Boolean.FALSE, null, null);
|
||||
service.page(1L, 20L, null, null, null, null, null, Boolean.FALSE, null, null);
|
||||
verify(mapper, times(3)).countProducts(isNull(), isNull(), isNull(), isNull(), isNull(),
|
||||
isNull(), isNull(), isNull(), isNull());
|
||||
isNull(), isNull(), isNull());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -405,10 +400,9 @@ class AdminJdProductControllerTest {
|
||||
JdProductQueryService queryService = mock(JdProductQueryService.class);
|
||||
JdProductUpdateService updateService = mock(JdProductUpdateService.class);
|
||||
AdminAuthSupport authSupport = mock(AdminAuthSupport.class);
|
||||
DataReadScope dataReadScope = mock(DataReadScope.class);
|
||||
AdminJdProductController controller = new AdminJdProductController(
|
||||
queryService, mock(JdProductDeleteService.class), updateService, authSupport,
|
||||
mock(PermissionMenuService.class), dataReadScope);
|
||||
mock(PermissionMenuService.class));
|
||||
|
||||
AdminUserEntity operator = new AdminUserEntity();
|
||||
operator.setId(7L);
|
||||
@@ -423,8 +417,7 @@ class AdminJdProductControllerTest {
|
||||
body.setGroupId(3L);
|
||||
ApiResponse<Integer> response = controller.batchAssignGroup(body, request);
|
||||
|
||||
// 公共库写侧没有公司维度:不收 company_id、DataReadScope 不参与。
|
||||
verifyNoInteractions(dataReadScope);
|
||||
// 公共库写侧没有公司维度(结构判据支反向钉 company_id/DataReadScope 不得回流)。
|
||||
verify(updateService).assignGroup(List.of(11L, 12L), 3L);
|
||||
assertEquals(Boolean.TRUE, response.isSuccess(), "放行必须是 success 信封(B80-03)");
|
||||
assertEquals(2, response.getData(), "回执=实际更新的行数");
|
||||
@@ -598,8 +591,8 @@ class AdminJdProductControllerTest {
|
||||
grouped.setGroupId(3L);
|
||||
JdProductEntity missing = productEntity(2L);
|
||||
missing.setGroupId(99L);
|
||||
when(mapper.countProducts(any(), any(), any(), any(), any(), any(), any(), any(), any())).thenReturn(2L);
|
||||
when(mapper.selectProductPage(any(), any(), any(), any(), any(), any(), any(), any(), any(),
|
||||
when(mapper.countProducts(any(), any(), any(), any(), any(), any(), any(), any())).thenReturn(2L);
|
||||
when(mapper.selectProductPage(any(), any(), any(), any(), any(), any(), any(), any(),
|
||||
anyLong(), anyInt())).thenReturn(List.of(grouped, missing));
|
||||
com.nanri.aiimage.modules.jd.model.entity.JdProductGroupEntity group =
|
||||
new com.nanri.aiimage.modules.jd.model.entity.JdProductGroupEntity();
|
||||
@@ -607,7 +600,7 @@ class AdminJdProductControllerTest {
|
||||
group.setName("秋冬款");
|
||||
when(groupMapper.selectBatchIds(any())).thenReturn(List.of(group));
|
||||
|
||||
JdProductPageVo vo = service.page(1L, 20L, 5L, null, null, null, null, null, null, null, null);
|
||||
JdProductPageVo vo = service.page(1L, 20L, null, null, null, null, null, null, null, null);
|
||||
|
||||
assertEquals("秋冬款", vo.getItems().get(0).getGroupName(), "行集 group_id 一次取齐分组名(无逐行查询)");
|
||||
assertNull(vo.getItems().get(1).getGroupName(), "分组已删=不猜名字(铁律 30),前端展示 -");
|
||||
|
||||
Reference in New Issue
Block a user