feat: 新增店铺联级查询接口
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m3s

- 新增 GET /api/admin/shops/cascade 接口,支持按店铺名模糊查询和上级ID过滤
- Store 层新增 ListForCascade(支持数据权限过滤)和 GetParentIDsWithChildren 方法
- Service 层新增 ListCascade,批量判断 has_children 避免 N+1 查询
- 返回格式:[{id, shop_name, has_children}]

💘 Generated with Crush

Assisted-by: Claude Sonnet 4.6 via Crush <crush@charm.land>
This commit is contained in:
2026-04-09 11:43:37 +08:00
parent 384a54164b
commit 81ba84cf05
6 changed files with 201 additions and 0 deletions

View File

@@ -78,3 +78,19 @@ func (h *ShopHandler) Delete(c *fiber.Ctx) error {
return response.Success(c, nil)
}
// Cascade 店铺联级查询
// GET /api/admin/shops/cascade
func (h *ShopHandler) Cascade(c *fiber.Ctx) error {
var req dto.ShopCascadeRequest
if err := c.QueryParser(&req); err != nil {
return errors.New(errors.CodeInvalidParam, "请求参数解析失败")
}
items, err := h.service.ListCascade(c.UserContext(), &req)
if err != nil {
return err
}
return response.Success(c, items)
}