Browse Source

fix(internal/repository): 修复获取网关 IP 列表的 SQL 查询

- 在 GetGatewayipOnlyIpByHostIdAll 方法中添加了 Model 指定
-确保查询正确关联到 Gatewayip 模型
fusu 3 tuần trước cách đây
mục cha
commit
51f0f94550
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      internal/repository/gatewayip.go

+ 1 - 1
internal/repository/gatewayip.go

@@ -128,5 +128,5 @@ func (r *gatewayipRepository) CleanIPByHostId(ctx context.Context, hostId []int6
 
 func (r *gatewayipRepository) GetGatewayipOnlyIpByHostIdAll(ctx context.Context, hostId int64) ([]string, error) {
 	var req []string
-	return req, r.DB(ctx).Where("host_id = ?", hostId).Pluck("ip", &req).Error
+	return req, r.DB(ctx).Model(&model.Gatewayip{}).Where("host_id = ?", hostId).Pluck("ip", &req).Error
 }