소스 검색

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

- 在 GetGatewayipOnlyIpByHostIdAll 方法中添加了 Model 指定
-确保查询正确关联到 Gatewayip 模型
fusu 3 주 전
부모
커밋
51f0f94550
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  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
 }