mirror of https://github.com/jumpserver/jumpserver
Merge pull request #10761 from jumpserver/pr@dev@perf_assets_label
perf: 接口 /api/v1/assets/label/ sql优化pull/10770/head
commit
618ee0b2f9
|
@ -38,5 +38,6 @@ class LabelViewSet(OrgBulkModelViewSet):
|
|||
return super().list(request, *args, **kwargs)
|
||||
|
||||
def get_queryset(self):
|
||||
self.queryset = Label.objects.annotate(asset_count=Count("assets"))
|
||||
self.queryset = Label.objects.prefetch_related(
|
||||
'assets').annotate(asset_count=Count("assets"))
|
||||
return self.queryset
|
||||
|
|
Loading…
Reference in New Issue