😎1、优化开放接口可以获取默认租户 2、修复租户更新时账号名称修改无效问题
This commit is contained in:
parent
1660b1aae9
commit
8c108fe80b
@ -25,6 +25,11 @@ public class PageTenantInput : BasePageInput
|
|||||||
/// 电话
|
/// 电话
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual string Phone { get; set; }
|
public virtual string Phone { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否包括默认
|
||||||
|
/// </summary>
|
||||||
|
public bool IncludeDefault { get; set; } = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AddTenantInput : TenantOutput
|
public class AddTenantInput : TenantOutput
|
||||||
|
|||||||
@ -74,7 +74,7 @@ public class SysTenantService : IDynamicApiController, ITransient
|
|||||||
.LeftJoin<SysOrg>((u, a, b) => u.OrgId == b.Id)
|
.LeftJoin<SysOrg>((u, a, b) => u.OrgId == b.Id)
|
||||||
.WhereIF(!string.IsNullOrWhiteSpace(input.Phone), (u, a) => a.Phone.Contains(input.Phone.Trim()))
|
.WhereIF(!string.IsNullOrWhiteSpace(input.Phone), (u, a) => a.Phone.Contains(input.Phone.Trim()))
|
||||||
.WhereIF(!string.IsNullOrWhiteSpace(input.Name), (u, a, b) => b.Name.Contains(input.Name.Trim()))
|
.WhereIF(!string.IsNullOrWhiteSpace(input.Name), (u, a, b) => b.Name.Contains(input.Name.Trim()))
|
||||||
.Where(u => u.Id.ToString() != SqlSugarConst.MainConfigId) // 排除默认主库/主租户
|
.WhereIF(!input.IncludeDefault, u => u.Id.ToString() != SqlSugarConst.MainConfigId) // 排除默认主库/主租户
|
||||||
.OrderBy(u => new { u.OrderNo, u.Id })
|
.OrderBy(u => new { u.OrderNo, u.Id })
|
||||||
.Select((u, a, b) => new TenantOutput
|
.Select((u, a, b) => new TenantOutput
|
||||||
{
|
{
|
||||||
@ -358,7 +358,7 @@ public class SysTenantService : IDynamicApiController, ITransient
|
|||||||
await _sysOrgRep.UpdateAsync(u => new SysOrg() { Name = input.Name, Pid = input.OrgPid }, u => u.Id == input.OrgId);
|
await _sysOrgRep.UpdateAsync(u => new SysOrg() { Name = input.Name, Pid = input.OrgPid }, u => u.Id == input.OrgId);
|
||||||
|
|
||||||
// 更新系统用户
|
// 更新系统用户
|
||||||
await _sysUserRep.UpdateAsync(u => new SysUser() { Account = input.AdminAccount, Phone = input.Phone, Email = input.Email }, u => u.Id == input.UserId);
|
await _sysUserRep.UpdateAsync(u => new SysUser() { Account = input.AdminAccount, RealName = input.RealName, Phone = input.Phone, Email = input.Email }, u => u.Id == input.UserId);
|
||||||
|
|
||||||
await CacheTenant(input.Id);
|
await CacheTenant(input.Id);
|
||||||
|
|
||||||
|
|||||||
@ -325,6 +325,61 @@ export const SysCommonApiAxiosParamCreator = function (configuration?: Configura
|
|||||||
options: localVarRequestOptions,
|
options: localVarRequestOptions,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary 从 china.sqlite 中获取区划数据
|
||||||
|
* @param {string} code 区划编码
|
||||||
|
* @param {number} level 级数(从当前code所在级别往下级数)
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
*/
|
||||||
|
apiSysCommonRegionTreeCodeLevelGet: async (code: string, level: number, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||||
|
// verify required parameter 'code' is not null or undefined
|
||||||
|
if (code === null || code === undefined) {
|
||||||
|
throw new RequiredError('code','Required parameter code was null or undefined when calling apiSysCommonRegionTreeCodeLevelGet.');
|
||||||
|
}
|
||||||
|
// 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 apiSysCommonRegionTreeCodeLevelGet.');
|
||||||
|
}
|
||||||
|
const localVarPath = `/api/sysCommon/regionTree/{code}/{level}`
|
||||||
|
.replace(`{${"code"}}`, encodeURIComponent(String(code)))
|
||||||
|
.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,
|
||||||
|
};
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @summary 国密SM2解密字符串 🔖
|
* @summary 国密SM2解密字符串 🔖
|
||||||
@ -608,6 +663,21 @@ export const SysCommonApiFp = function(configuration?: Configuration) {
|
|||||||
return axios.request(axiosRequestArgs);
|
return axios.request(axiosRequestArgs);
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary 从 china.sqlite 中获取区划数据
|
||||||
|
* @param {string} code 区划编码
|
||||||
|
* @param {number} level 级数(从当前code所在级别往下级数)
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
*/
|
||||||
|
async apiSysCommonRegionTreeCodeLevelGet(code: string, level: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> {
|
||||||
|
const localVarAxiosArgs = await SysCommonApiAxiosParamCreator(configuration).apiSysCommonRegionTreeCodeLevelGet(code, level, options);
|
||||||
|
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||||
|
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
|
||||||
|
return axios.request(axiosRequestArgs);
|
||||||
|
};
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @summary 国密SM2解密字符串 🔖
|
* @summary 国密SM2解密字符串 🔖
|
||||||
@ -733,6 +803,17 @@ export const SysCommonApiFactory = function (configuration?: Configuration, base
|
|||||||
async apiSysCommonMachineSerialKeyGet(options?: AxiosRequestConfig): Promise<AxiosResponse<AdminNETResultString>> {
|
async apiSysCommonMachineSerialKeyGet(options?: AxiosRequestConfig): Promise<AxiosResponse<AdminNETResultString>> {
|
||||||
return SysCommonApiFp(configuration).apiSysCommonMachineSerialKeyGet(options).then((request) => request(axios, basePath));
|
return SysCommonApiFp(configuration).apiSysCommonMachineSerialKeyGet(options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary 从 china.sqlite 中获取区划数据
|
||||||
|
* @param {string} code 区划编码
|
||||||
|
* @param {number} level 级数(从当前code所在级别往下级数)
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
*/
|
||||||
|
async apiSysCommonRegionTreeCodeLevelGet(code: string, level: number, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
|
||||||
|
return SysCommonApiFp(configuration).apiSysCommonRegionTreeCodeLevelGet(code, level, options).then((request) => request(axios, basePath));
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @summary 国密SM2解密字符串 🔖
|
* @summary 国密SM2解密字符串 🔖
|
||||||
@ -849,6 +930,18 @@ export class SysCommonApi extends BaseAPI {
|
|||||||
public async apiSysCommonMachineSerialKeyGet(options?: AxiosRequestConfig) : Promise<AxiosResponse<AdminNETResultString>> {
|
public async apiSysCommonMachineSerialKeyGet(options?: AxiosRequestConfig) : Promise<AxiosResponse<AdminNETResultString>> {
|
||||||
return SysCommonApiFp(this.configuration).apiSysCommonMachineSerialKeyGet(options).then((request) => request(this.axios, this.basePath));
|
return SysCommonApiFp(this.configuration).apiSysCommonMachineSerialKeyGet(options).then((request) => request(this.axios, this.basePath));
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary 从 china.sqlite 中获取区划数据
|
||||||
|
* @param {string} code 区划编码
|
||||||
|
* @param {number} level 级数(从当前code所在级别往下级数)
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @memberof SysCommonApi
|
||||||
|
*/
|
||||||
|
public async apiSysCommonRegionTreeCodeLevelGet(code: string, level: number, options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
|
||||||
|
return SysCommonApiFp(this.configuration).apiSysCommonRegionTreeCodeLevelGet(code, level, options).then((request) => request(this.axios, this.basePath));
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @summary 国密SM2解密字符串 🔖
|
* @summary 国密SM2解密字符串 🔖
|
||||||
|
|||||||
@ -97,4 +97,12 @@ export interface PageTenantInput {
|
|||||||
* @memberof PageTenantInput
|
* @memberof PageTenantInput
|
||||||
*/
|
*/
|
||||||
phone?: string | null;
|
phone?: string | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否包括默认
|
||||||
|
*
|
||||||
|
* @type {boolean}
|
||||||
|
* @memberof PageTenantInput
|
||||||
|
*/
|
||||||
|
includeDefault?: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,7 +33,12 @@
|
|||||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||||
<el-form-item label="绑定用户" prop="bindUserId" :rules="[{ required: true, message: '绑定用户不能为空', trigger: 'blur' }]">
|
<el-form-item label="绑定用户" prop="bindUserId" :rules="[{ required: true, message: '绑定用户不能为空', trigger: 'blur' }]">
|
||||||
<el-select v-model="state.ruleForm.bindUserId" placeholder="绑定用户" filterable default-first-option style="width: 100%">
|
<el-select v-model="state.ruleForm.bindUserId" placeholder="绑定用户" filterable default-first-option style="width: 100%">
|
||||||
<el-option v-for="item in state.userData" :key="item.id" :label="`${item.account}(${item.realName})`" :value="item.id" />
|
<el-option v-for="item in state.userData" :key="item.id" :label="`${item.account}【${item.realName}】`" :value="item.id">
|
||||||
|
<span style="float: left">{{ item.account }}</span>
|
||||||
|
<span style="float: right; color: var(--el-text-color-secondary)">
|
||||||
|
{{ item.realName }}
|
||||||
|
</span>
|
||||||
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -69,7 +74,7 @@ const state = reactive({
|
|||||||
});
|
});
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
let res = await getAPI(SysTenantApi).apiSysTenantPagePost({ page: 1, pageSize: 10000 });
|
let res = await getAPI(SysTenantApi).apiSysTenantPagePost({ page: 1, pageSize: 10000, includeDefault: true });
|
||||||
state.tenantData = res.data.result?.items ?? [];
|
state.tenantData = res.data.result?.items ?? [];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user