feat: 新增店铺联级查询接口
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m3s
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:
@@ -69,3 +69,16 @@ type UpdateShopParams struct {
|
||||
IDReq
|
||||
UpdateShopRequest
|
||||
}
|
||||
|
||||
// ShopCascadeRequest 店铺联级查询请求
|
||||
type ShopCascadeRequest struct {
|
||||
ShopName string `json:"shop_name" query:"shop_name" validate:"omitempty,max=100" maxLength:"100" description:"店铺名称(模糊查询)"`
|
||||
ParentID *uint `json:"parent_id" query:"parent_id" validate:"omitempty,min=1" minimum:"1" description:"上级店铺ID(不传则查询顶级店铺)"`
|
||||
}
|
||||
|
||||
// ShopCascadeItem 联级查询结果项
|
||||
type ShopCascadeItem struct {
|
||||
ID uint `json:"id" description:"店铺ID"`
|
||||
ShopName string `json:"shop_name" description:"店铺名称"`
|
||||
HasChildren bool `json:"has_children" description:"是否有下级店铺"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user