mirror of https://github.com/jumpserver/jumpserver
perf: 优化工单推荐资产的数量
parent
1116d1d353
commit
8f3fb60332
|
@ -146,7 +146,7 @@ class ApplyApplicationSerializer(ApplySerializer, ApproveSerializer):
|
||||||
queries &= Q(type=apply_type)
|
queries &= Q(type=apply_type)
|
||||||
|
|
||||||
with tmp_to_org(self.root.instance.org_id):
|
with tmp_to_org(self.root.instance.org_id):
|
||||||
application_ids = Application.objects.filter(queries).values_list('id', flat=True)[:5]
|
application_ids = Application.objects.filter(queries).values_list('id', flat=True)[:15]
|
||||||
application_ids = [str(application_id) for application_id in application_ids]
|
application_ids = [str(application_id) for application_id in application_ids]
|
||||||
return application_ids
|
return application_ids
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,7 @@ class ApplyAssetSerializer(ApplySerializer, ApproveSerializer):
|
||||||
if not queries:
|
if not queries:
|
||||||
return []
|
return []
|
||||||
with tmp_to_org(self.root.instance.org_id):
|
with tmp_to_org(self.root.instance.org_id):
|
||||||
asset_ids = Asset.objects.filter(queries).values_list('id', flat=True)[:5]
|
asset_ids = Asset.objects.filter(queries).values_list('id', flat=True)[:100]
|
||||||
asset_ids = [str(asset_id) for asset_id in asset_ids]
|
asset_ids = [str(asset_id) for asset_id in asset_ids]
|
||||||
return asset_ids
|
return asset_ids
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue