😎增加获取当前用户机构子树接口

This commit is contained in:
zuohuaijun 2025-10-13 11:37:14 +08:00
parent ea173ac5b1
commit d519edca45
2 changed files with 95 additions and 0 deletions

View File

@ -107,6 +107,17 @@ public class SysOrgService : IDynamicApiController, ITransient
return await iSugarQueryable.Where(u => u.Level < level).ToTreeAsync(u => u.Children, u => u.Pid, pid);
}
/// <summary>
/// 获取当前用户机构子树 🔖
/// </summary>
/// <param name="level"></param>
/// <returns></returns>
[DisplayName("获取当前用户机构子树")]
public async Task<List<SysOrg>> GetUserChildTree(int level = 100)
{
return await GetChildTree(_userManager.OrgId, level);
}
/// <summary>
/// 增加机构 🔖
/// </summary>

View File

@ -289,6 +289,55 @@ export const SysOrgApiAxiosParamCreator = function (configuration?: Configuratio
const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || "");
return {
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
options: localVarRequestOptions,
};
},
/**
*
* @summary 🔖
* @param {number} level
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
apiSysOrgUserChildTreeLevelGet: async (level: number, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'level' is not null or undefined
if (level === null || level === undefined) {
throw new RequiredError('level','Required parameter level was null or undefined when calling apiSysOrgUserChildTreeLevelGet.');
}
const localVarPath = `/api/sysOrg/userChildTree/{level}`
.replace(`{${"level"}}`, encodeURIComponent(String(level)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication Bearer required
// http bearer authentication required
if (configuration && configuration.accessToken) {
const accessToken = typeof configuration.accessToken === 'function'
? await configuration.accessToken()
: await configuration.accessToken;
localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
}
const query = new URLSearchParams(localVarUrlObj.search);
for (const key in localVarQueryParameter) {
query.set(key, localVarQueryParameter[key]);
}
for (const key in options.params) {
query.set(key, options.params[key]);
}
localVarUrlObj.search = (new URLSearchParams(query)).toString();
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
options: localVarRequestOptions,
@ -377,6 +426,20 @@ export const SysOrgApiFp = function(configuration?: Configuration) {
return axios.request(axiosRequestArgs);
};
},
/**
*
* @summary 🔖
* @param {number} level
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async apiSysOrgUserChildTreeLevelGet(level: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<AdminNETResultListSysOrg>>> {
const localVarAxiosArgs = await SysOrgApiAxiosParamCreator(configuration).apiSysOrgUserChildTreeLevelGet(level, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
}
};
@ -440,6 +503,16 @@ export const SysOrgApiFactory = function (configuration?: Configuration, basePat
async apiSysOrgUpdatePost(body?: UpdateOrgInput, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
return SysOrgApiFp(configuration).apiSysOrgUpdatePost(body, options).then((request) => request(axios, basePath));
},
/**
*
* @summary 🔖
* @param {number} level
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async apiSysOrgUserChildTreeLevelGet(level: number, options?: AxiosRequestConfig): Promise<AxiosResponse<AdminNETResultListSysOrg>> {
return SysOrgApiFp(configuration).apiSysOrgUserChildTreeLevelGet(level, options).then((request) => request(axios, basePath));
},
};
};
@ -509,4 +582,15 @@ export class SysOrgApi extends BaseAPI {
public async apiSysOrgUpdatePost(body?: UpdateOrgInput, options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
return SysOrgApiFp(this.configuration).apiSysOrgUpdatePost(body, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary 🔖
* @param {number} level
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof SysOrgApi
*/
public async apiSysOrgUserChildTreeLevelGet(level: number, options?: AxiosRequestConfig) : Promise<AxiosResponse<AdminNETResultListSysOrg>> {
return SysOrgApiFp(this.configuration).apiSysOrgUserChildTreeLevelGet(level, options).then((request) => request(this.axios, this.basePath));
}
}