新增运营商名称模糊搜索
This commit is contained in:
@@ -18,6 +18,7 @@ type ListStandaloneIotCardRequest struct {
|
||||
IsReplaced *bool `json:"is_replaced" query:"is_replaced" description:"是否有换卡记录 (true:有换卡记录, false:无换卡记录)"`
|
||||
ICCIDStart string `json:"iccid_start" query:"iccid_start" validate:"omitempty,max=20" maxLength:"20" description:"ICCID起始号"`
|
||||
ICCIDEnd string `json:"iccid_end" query:"iccid_end" validate:"omitempty,max=20" maxLength:"20" description:"ICCID结束号"`
|
||||
CarrierName string `json:"carrier_name" query:"carrier_name" validate:"omitempty,max=100" maxLength:"100" description:"运营商名称(模糊查询)"`
|
||||
}
|
||||
|
||||
type StandaloneIotCardResponse struct {
|
||||
|
||||
@@ -148,6 +148,9 @@ func (s *Service) ListStandalone(ctx context.Context, req *dto.ListStandaloneIot
|
||||
if req.SeriesID != nil {
|
||||
filters["series_id"] = *req.SeriesID
|
||||
}
|
||||
if req.CarrierName != "" {
|
||||
filters["carrier_name"] = req.CarrierName
|
||||
}
|
||||
|
||||
// 代理用户注入 subordinate_shop_ids,让 Store 层走并行查询路径
|
||||
// 避免 PG 对 shop_id IN (...) + ORDER BY 选择全表扫描
|
||||
|
||||
@@ -736,6 +736,9 @@ func (s *IotCardStore) applyStandaloneFilters(ctx context.Context, query *gorm.D
|
||||
if seriesID, ok := filters["series_id"].(uint); ok && seriesID > 0 {
|
||||
query = query.Where("series_id = ?", seriesID)
|
||||
}
|
||||
if carrierName, ok := filters["carrier_name"].(string); ok && carrierName != "" {
|
||||
query = query.Where("carrier_name LIKE ?", "%"+carrierName+"%")
|
||||
}
|
||||
|
||||
return query
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user