mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-28 14:52:58 +00:00
refactor: improve SQL queries to include user nicknames and enhance readability
This commit is contained in:
parent
13c5833d42
commit
b9304f0fda
|
|
@ -1,28 +1,30 @@
|
|||
select *
|
||||
from (select "id"::text,
|
||||
"name",
|
||||
"desc",
|
||||
"is_publish",
|
||||
"type",
|
||||
from (select application."id"::text,
|
||||
application."name",
|
||||
application. "desc",
|
||||
application. "is_publish",
|
||||
application."type",
|
||||
'application' as "resource_type",
|
||||
"workspace_id",
|
||||
"folder_id",
|
||||
"user_id",
|
||||
"create_time",
|
||||
"update_time"
|
||||
from application
|
||||
application."workspace_id",
|
||||
application. "folder_id",
|
||||
application."user_id",
|
||||
"user"."nick_name" as "nick_name",
|
||||
application."create_time",
|
||||
application."update_time"
|
||||
from application left join "user" on user_id = "user".id
|
||||
${application_custom_sql}
|
||||
UNION
|
||||
select "id",
|
||||
"name",
|
||||
"desc",
|
||||
true as "is_publish",
|
||||
select application_folder."id",
|
||||
application_folder."name",
|
||||
application_folder."desc",
|
||||
true as "is_publish",
|
||||
'folder' as "type",
|
||||
'folder' as "resource_type",
|
||||
"workspace_id",
|
||||
"parent_id" as "folder_id",
|
||||
"user_id",
|
||||
"create_time",
|
||||
"update_time"
|
||||
from application_folder ${folder_query_set}) temp
|
||||
application_folder."workspace_id",
|
||||
application_folder."parent_id" as "folder_id",
|
||||
application_folder."user_id",
|
||||
"user"."nick_name" as "nick_name",
|
||||
application_folder."create_time",
|
||||
application_folder."update_time"
|
||||
from application_folder left join "user" on user_id = "user".id ${folder_query_set}) temp
|
||||
${application_query_set}
|
||||
|
|
@ -1,31 +1,33 @@
|
|||
select *
|
||||
from (select "id"::text,
|
||||
"name",
|
||||
"desc",
|
||||
"is_publish",
|
||||
"type",
|
||||
from (select application."id"::text,
|
||||
application."name",
|
||||
application. "desc",
|
||||
application. "is_publish",
|
||||
application."type",
|
||||
'application' as "resource_type",
|
||||
"workspace_id",
|
||||
"folder_id",
|
||||
"user_id",
|
||||
"create_time",
|
||||
"update_time"
|
||||
from application
|
||||
application."workspace_id",
|
||||
application. "folder_id",
|
||||
application."user_id",
|
||||
"user"."nick_name" as "nick_name",
|
||||
application."create_time",
|
||||
application."update_time"
|
||||
from application left join "user" on user_id = "user".id
|
||||
where id in (select target
|
||||
from workspace_user_resource_permission
|
||||
where auth_target_type = 'APPLICATION'
|
||||
and 'VIEW' = any (permission_list))
|
||||
UNION
|
||||
select "id",
|
||||
"name",
|
||||
"desc",
|
||||
true as "is_publish",
|
||||
select application_folder."id",
|
||||
application_folder."name",
|
||||
application_folder."desc",
|
||||
true as "is_publish",
|
||||
'folder' as "type",
|
||||
'folder' as "resource_type",
|
||||
"workspace_id",
|
||||
"parent_id" as "folder_id",
|
||||
"user_id",
|
||||
"create_time",
|
||||
"update_time"
|
||||
from application_folder ${folder_query_set}) temp
|
||||
application_folder."workspace_id",
|
||||
application_folder."parent_id" as "folder_id",
|
||||
application_folder."user_id",
|
||||
"user"."nick_name" as "nick_name",
|
||||
application_folder."create_time",
|
||||
application_folder."update_time"
|
||||
from application_folder left join "user" on user_id = "user".id ${folder_query_set}) temp
|
||||
${application_query_set}
|
||||
|
|
@ -1,16 +1,17 @@
|
|||
select *
|
||||
from (select "id"::text,
|
||||
"name",
|
||||
"desc",
|
||||
"is_publish",
|
||||
"type",
|
||||
from (select application."id"::text,
|
||||
application."name",
|
||||
application. "desc",
|
||||
application. "is_publish",
|
||||
application."type",
|
||||
'application' as "resource_type",
|
||||
"workspace_id",
|
||||
"folder_id",
|
||||
"user_id",
|
||||
"create_time",
|
||||
"update_time"
|
||||
from application
|
||||
application."workspace_id",
|
||||
application. "folder_id",
|
||||
application."user_id",
|
||||
"user"."nick_name" as "nick_name",
|
||||
application."create_time",
|
||||
application."update_time"
|
||||
from application left join "user" on user_id = "user".id
|
||||
where id in (select target
|
||||
from workspace_user_resource_permission
|
||||
where auth_target_type = 'APPLICATION'
|
||||
|
|
@ -24,16 +25,17 @@ from (select "id"::text,
|
|||
'VIEW' = any (permission_list)
|
||||
end)
|
||||
UNION
|
||||
select "id",
|
||||
"name",
|
||||
"desc",
|
||||
true as "is_publish",
|
||||
select application_folder."id",
|
||||
application_folder."name",
|
||||
application_folder."desc",
|
||||
true as "is_publish",
|
||||
'folder' as "type",
|
||||
'folder' as "resource_type",
|
||||
"workspace_id",
|
||||
"parent_id" as "folder_id",
|
||||
"user_id",
|
||||
"create_time",
|
||||
"update_time"
|
||||
from application_folder ${folder_query_set}) temp
|
||||
application_folder."workspace_id",
|
||||
application_folder."parent_id" as "folder_id",
|
||||
application_folder."user_id",
|
||||
"user"."nick_name" as "nick_name",
|
||||
application_folder."create_time",
|
||||
application_folder."update_time"
|
||||
from application_folder left join "user" on user_id = "user".id ${folder_query_set}) temp
|
||||
${application_query_set}
|
||||
|
|
@ -153,7 +153,7 @@
|
|||
</template>
|
||||
<template #subTitle>
|
||||
<el-text class="color-secondary lighter" size="small">
|
||||
{{ $t('common.creator') }}: {{ item.username }}
|
||||
{{ $t('common.creator') }}: {{ item.nick_name }}
|
||||
</el-text>
|
||||
</template>
|
||||
</CardBox>
|
||||
|
|
@ -171,7 +171,7 @@
|
|||
<template #subTitle>
|
||||
<el-text class="color-secondary" size="small">
|
||||
<auto-tooltip :content="item.username">
|
||||
{{ $t('common.creator') }}: {{ item.username }}
|
||||
{{ $t('common.creator') }}: {{ item.nick_name }}
|
||||
</auto-tooltip>
|
||||
</el-text>
|
||||
</template>
|
||||
|
|
|
|||
Loading…
Reference in New Issue