[Update] 优化sql, or方式改为union (#3682)

* [Update] 优化sql, or方式改为union

* [Update] 优化union操作,直接union后,queryset 的一些参数不能使用,如annoate, 如filter assets__isnull=True
This commit is contained in:
老广
2020-02-05 15:56:28 +08:00
committed by GitHub
parent aa2255a87e
commit 3c69860b24
7 changed files with 53 additions and 34 deletions

View File

@@ -93,7 +93,7 @@ class AssetPermission(BasePermission):
models.Prefetch('nodes', queryset=Node.objects.all().only('key')),
models.Prefetch('assets', queryset=Asset.objects.all().only('id')),
models.Prefetch('system_users', queryset=SystemUser.objects.all().only('id'))
)
).order_by()
def get_all_assets(self):
from assets.models import Node