Completed
As a 商品管理员和普通用户 I want 商品API能正确处理父子商品关系,提供优化的查询性能和清晰的父子关系展示 so that 管理员能有效管理父子商品,用户能获得正确的商品信息,系统性能良好
spuId=0过滤只显示父商品packages/goods-module-mt/ - 多租户商品管理模块packages/goods-management-ui-mt/ - 多租户商品管理界面packages/goods-module-mt/src/routes/packages/goods-module-mt/src/entities/goods.entity.mt.tspackages/goods-module-mt/src/schemas/packages/goods-management-ui-mt/src/components/GoodsManagement.tsxspuId: number - 主商品ID,0表示父商品或单规格商品,>0表示子商品spuName: string | null - 主商品名称tenantId: number - 租户ID,用于多租户数据隔离state: number - 状态(1可用,2不可用)publicGoodsRoutesMt - 默认只返回父商品(spuId=0)[Source: packages/goods-module-mt/src/routes/public-goods-routes.mt.ts:34]adminGoodsRoutesMt - 无默认过滤,显示所有商品 [Source: packages/goods-module-mt/src/routes/admin-goods-routes.mt.ts]GET /api/v1/goods/{id}/children - 已实现 [Source: packages/goods-module-mt/src/routes/public-goods-children.mt.ts]admin-goods-aggregated.mt.ts聚合基础CRUD和父子商品管理路由GoodsManagement.tsx当前状态:
GoodsParentChildPanel)publicGoodsRoutesMt当前状态:
defaultFilters: { state: 1, spuId: 0 }adminGoodsRoutesMt当前状态:
packages/goods-module-mt/src/routes/public-goods-routes.mt.ts - 公共商品路由packages/goods-module-mt/src/routes/admin-goods-routes.mt.ts - 管理员商品路由packages/goods-module-mt/src/routes/admin-goods-aggregated.mt.ts - 聚合路由packages/goods-module-mt/src/routes/public-goods-children.mt.ts - 获取子商品列表路由packages/goods-management-ui-mt/src/components/GoodsManagement.tsx - 商品管理主组件packages/goods-module-mt/src/entities/goods.entity.mt.ts - 商品实体定义packages/goods-module-mt/src/schemas/public-goods.schema.mt.ts - 公共商品Schemapackages/goods-module-mt/src/schemas/admin-goods.schema.mt.ts - 管理员商品Schematests文件夹与源码并列(例如:packages/goods-module-mt/tests/ 与 packages/goods-module-mt/src/ 并列)clientManager.get().api.$method调用packages/goods-module-mt/tests/integration/packages/goods-management-ui-mt/tests/unit/vi.mock() mock API客户端| Date | Version | Description | Author |
|---|---|---|---|
| 2025-12-12 | 1.1 | 更新测试目录描述,从 __tests__ 修正为 tests |
Bob (Scrum Master) |
| 2025-12-12 | 1.0 | 初始故事创建 | Bob (Scrum Master) |
James (Developer Agent)
商品详情API已支持父子商品信息返回(已完成)
管理员商品API查询功能已增强(已完成)
商品列表查询性能已优化(已完成)
@Index()和@Index(['tenantId', 'spuId'])管理员商品管理列表页面已增强(已完成)
单元测试和集成测试已添加(已完成)