perf: 修改 risk filter

pull/14774/head^2
ibuler 2025-01-06 19:11:45 +08:00
parent 738465c02d
commit 197c309f44
3 changed files with 2823 additions and 2831 deletions

View File

@ -71,20 +71,10 @@ class AccountFilterSet(BaseFilterSet):
if not value:
return queryset
asset_usernames = AccountRisk.objects.filter(risk=value). \
values_list(
Concat(
F('asset_id'), Value('-'), F('username'),
output_field=CharField()
), flat=True
)
queryset = queryset.annotate(
asset_username=Concat(
F('asset_id'), Value('-'), F('username'),
output_field=CharField()
)
).filter(asset_username__in=asset_usernames)
risks = AccountRisk.objects.filter(risk=value)
usernames = risks.values_list('username', flat=True)
assets = risks.values_list('asset', flat=True)
queryset = queryset.filter(username__in=usernames, asset__in=assets)
return queryset
@staticmethod

View File

@ -920,7 +920,7 @@
"Push": "Push",
"PushAccount": "Push accounts",
"PushAccountsHelpText": "Pushing the account to the target asset allows for configuring different push methods for assets on different platforms.",
"PushParams": "Push parameters",
"PushParams": "Push params",
"Qcloud": "Tencent cloud",
"QcloudLighthouse": "Tencent cloud (Lighthouse)",
"QingYunPrivateCloud": "Qingyun private cloud",
@ -1066,6 +1066,7 @@
"Secret": "Password",
"SecretKey": "Key",
"SecretKeyStrategy": "Password policy",
"SecretReset": "Allow secret reset",
"Secure": "Security",
"Security": "Security",
"Select": "Select",

View File

@ -1063,6 +1063,7 @@
"Secret": "密码",
"SecretKey": "密钥",
"SecretKeyStrategy": "密码策略",
"SecretReset": "允许改密",
"Secure": "安全",
"Security": "安全设置",
"Select": "选择",