|
@@ -16,7 +16,7 @@ type GatewayGroupRepository interface {
|
|
|
AddGatewayGroup(ctx context.Context, req *model.GatewayGroup) error
|
|
|
EditGatewayGroup(ctx context.Context, req *model.GatewayGroup) error
|
|
|
DeleteGatewayGroup(ctx context.Context, id int) error
|
|
|
- GetGatewayGroupWhereHostIdNull(ctx context.Context,operator int, count int) (int, error)
|
|
|
+ GetGatewayGroupWhereHostIdNull(ctx context.Context, req v1.GlobalLimitRequireResponse) (int, error)
|
|
|
GetGatewayGroupByHostId(ctx context.Context, hostId int64) (*model.GatewayGroup, error)
|
|
|
GetGatewayGroupList(ctx context.Context,req v1.SearchGatewayGroupParams) (*v1.PaginatedResponse[model.GatewayGroup], error)
|
|
|
EditGatewayGroupById(ctx context.Context, req *model.GatewayGroup) error
|
|
@@ -61,15 +61,17 @@ func (r *gatewayGroupRepository) DeleteGatewayGroup(ctx context.Context, id int)
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-func (r *gatewayGroupRepository) GetGatewayGroupWhereHostIdNull(ctx context.Context,operator int, count int) (int, error) {
|
|
|
+func (r *gatewayGroupRepository) GetGatewayGroupWhereHostIdNull(ctx context.Context,req v1.GlobalLimitRequireResponse) (int, error) {
|
|
|
var id int
|
|
|
subQuery := r.DB(ctx).Model(&model.GateWayGroupIp{}).
|
|
|
Select("gateway_group_id").
|
|
|
Group("gateway_group_id").
|
|
|
- Having("COUNT(*) = ?", count)
|
|
|
+ Having("COUNT(*) = ?", req.IpCount)
|
|
|
|
|
|
err := r.DB(ctx).Model(&model.GatewayGroup{}).
|
|
|
- Where("operator = ?", operator).
|
|
|
+ Where("operator = ?", req.Operator).
|
|
|
+ Where("ban_udp", req.IsBanUdp).
|
|
|
+ Where("ban_overseas", req.IsBanOverseas).
|
|
|
Where("id IN (?)", subQuery).
|
|
|
Where("host_id = ?", 0).
|
|
|
Select("id").First(&id).Error
|