mirror of https://github.com/jumpserver/jumpserver
perf: 接口sql优化 /api/v1/assets/assets/
parent
b2bff22387
commit
d7d554daf5
|
@ -121,6 +121,10 @@ class AssetViewSet(SuggestionMixin, NodeFilterMixin, OrgBulkModelViewSet):
|
|||
NodeFilterBackend, AttrRulesFilterBackend
|
||||
]
|
||||
|
||||
def get_queryset(self):
|
||||
return super().get_queryset().prefetch_related('nodes', 'protocols')\
|
||||
.select_related('platform', 'domain', 'host')
|
||||
|
||||
def get_serializer_class(self):
|
||||
cls = super().get_serializer_class()
|
||||
if self.action == "retrieve":
|
||||
|
|
Loading…
Reference in New Issue