feat(卡列表): 新增 has_active_package 查询条件筛选生效中套餐

- DTO ListStandaloneIotCardRequest 增加 HasActivePackage *bool 字段,
  query/json 名 has_active_package,description 中文
- Service ListStandalone 将 HasActivePackage 映射为 filters["has_active_package"]
- Store applyStandaloneFilters 新增 EXISTS/NOT EXISTS 子查询,
  使用 constants.PackageUsageStatusActive,限制 master_usage_id IS NULL
  且 deleted_at IS NULL,所有查询路径(默认/两阶段/并行)均复用此函数

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-19 12:06:33 +08:00
parent 5e7e68cce7
commit 9f5c5c3680
3 changed files with 15 additions and 1 deletions

View File

@@ -203,6 +203,9 @@ func (s *Service) ListStandalone(ctx context.Context, req *dto.ListStandaloneIot
if req.CarrierName != "" {
filters["carrier_name"] = req.CarrierName
}
if req.HasActivePackage != nil {
filters["has_active_package"] = *req.HasActivePackage
}
// 代理用户注入 subordinate_shop_ids让 Store 层走并行查询路径
// 避免 PG 对 shop_id IN (...) + ORDER BY 选择全表扫描