diff --git a/es/entities/OauthUser.js b/es/entities/OauthUser.js index fc30b826d..47d738039 100644 --- a/es/entities/OauthUser.js +++ b/es/entities/OauthUser.js @@ -44,5 +44,18 @@ export const entityDesc = { loaded: '#008000', } } - } + }, + indexes: [ + { + // 业务上可能涉及的间接授权查询,建立索引以避免全表扫描 + name: 'idx_oauthUser_composite', + attributes: [{ + name: 'user', + }, { + name: 'providerUserId', + }, { + name: 'providerConfig', + }] + } + ] }; diff --git a/es/oak-app-domain/OauthUser/Storage.js b/es/oak-app-domain/OauthUser/Storage.js index 152f7e611..7dccabacd 100644 --- a/es/oak-app-domain/OauthUser/Storage.js +++ b/es/oak-app-domain/OauthUser/Storage.js @@ -58,5 +58,18 @@ export const desc = { } }, actionType: "crud", - actions + actions, + indexes: [ + { + // 业务上可能涉及的间接授权查询,建立索引以避免全表扫描 + name: 'idx_oauthUser_composite', + attributes: [{ + name: "userId", + }, { + name: 'providerUserId', + }, { + name: "providerConfigId", + }] + } + ] }; diff --git a/lib/entities/OauthUser.js b/lib/entities/OauthUser.js index fe6da46f3..feb8bbcbd 100644 --- a/lib/entities/OauthUser.js +++ b/lib/entities/OauthUser.js @@ -47,5 +47,18 @@ exports.entityDesc = { loaded: '#008000', } } - } + }, + indexes: [ + { + // 业务上可能涉及的间接授权查询,建立索引以避免全表扫描 + name: 'idx_oauthUser_composite', + attributes: [{ + name: 'user', + }, { + name: 'providerUserId', + }, { + name: 'providerConfig', + }] + } + ] }; diff --git a/lib/oak-app-domain/OauthUser/Storage.js b/lib/oak-app-domain/OauthUser/Storage.js index d1f03431a..2654c6254 100644 --- a/lib/oak-app-domain/OauthUser/Storage.js +++ b/lib/oak-app-domain/OauthUser/Storage.js @@ -61,5 +61,18 @@ exports.desc = { } }, actionType: "crud", - actions: Action_1.actions + actions: Action_1.actions, + indexes: [ + { + // 业务上可能涉及的间接授权查询,建立索引以避免全表扫描 + name: 'idx_oauthUser_composite', + attributes: [{ + name: "userId", + }, { + name: 'providerUserId', + }, { + name: "providerConfigId", + }] + } + ] }; diff --git a/src/entities/OauthUser.ts b/src/entities/OauthUser.ts index 7feedfeac..b90d8af9d 100644 --- a/src/entities/OauthUser.ts +++ b/src/entities/OauthUser.ts @@ -47,7 +47,7 @@ export const LoadActionDef: ActionDef = { export const entityDesc: EntityDesc = { +}> = { locales: { zh_CN: { name: '用户登录连接', @@ -87,6 +87,19 @@ export const entityDesc: EntityDesc