mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-07 02:10:23 +00:00
perf: 接口sql优化 /api/v1/perms/asset-permissions/<uuid:pk>/assets/all/
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
from functools import lru_cache
|
||||
|
||||
from rest_framework import generics
|
||||
from django.db.models import F
|
||||
from django.shortcuts import get_object_or_404
|
||||
@@ -93,6 +95,7 @@ class AssetPermissionAllAssetListApi(generics.ListAPIView):
|
||||
filterset_fields = ("name", "address")
|
||||
search_fields = filterset_fields
|
||||
|
||||
@lru_cache(maxsize=2)
|
||||
def get_queryset(self):
|
||||
pk = self.kwargs.get("pk")
|
||||
assets = AssetPermissionPermAssetUtil(perm_ids=[pk]).get_all_assets()
|
||||
|
Reference in New Issue
Block a user