😎修复租户从库处理错误
This commit is contained in:
parent
943b776fa2
commit
f7e01cf58f
@ -80,6 +80,7 @@ public class SysTenantService : IDynamicApiController, ITransient
|
|||||||
DbType = u.DbType,
|
DbType = u.DbType,
|
||||||
Connection = u.Connection,
|
Connection = u.Connection,
|
||||||
ConfigId = u.ConfigId,
|
ConfigId = u.ConfigId,
|
||||||
|
SlaveConnections = u.SlaveConnections,
|
||||||
OrderNo = u.OrderNo,
|
OrderNo = u.OrderNo,
|
||||||
Remark = u.Remark,
|
Remark = u.Remark,
|
||||||
Status = u.Status,
|
Status = u.Status,
|
||||||
@ -118,7 +119,7 @@ public class SysTenantService : IDynamicApiController, ITransient
|
|||||||
if (isExist) throw Oops.Oh(ErrorCodeEnum.D1301);
|
if (isExist) throw Oops.Oh(ErrorCodeEnum.D1301);
|
||||||
|
|
||||||
// 从库配置判断
|
// 从库配置判断
|
||||||
if (!string.IsNullOrWhiteSpace(input.SlaveConnections) && !JSON.IsValid(input.SlaveConnections))
|
if (input.TenantType == TenantTypeEnum.Db && (string.IsNullOrWhiteSpace(input.SlaveConnections) || !JSON.IsValid(input.SlaveConnections, true)))
|
||||||
throw Oops.Oh(ErrorCodeEnum.D1302);
|
throw Oops.Oh(ErrorCodeEnum.D1302);
|
||||||
|
|
||||||
switch (input.TenantType)
|
switch (input.TenantType)
|
||||||
@ -329,7 +330,7 @@ public class SysTenantService : IDynamicApiController, ITransient
|
|||||||
throw Oops.Oh(ErrorCodeEnum.D3004);
|
throw Oops.Oh(ErrorCodeEnum.D3004);
|
||||||
}
|
}
|
||||||
// 从库配置判断
|
// 从库配置判断
|
||||||
if (!string.IsNullOrWhiteSpace(input.SlaveConnections) && !JSON.IsValid(input.SlaveConnections))
|
if (input.TenantType == TenantTypeEnum.Db && (string.IsNullOrWhiteSpace(input.SlaveConnections) || !JSON.IsValid(input.SlaveConnections, true)))
|
||||||
throw Oops.Oh(ErrorCodeEnum.D1302);
|
throw Oops.Oh(ErrorCodeEnum.D1302);
|
||||||
|
|
||||||
await _sysTenantRep.AsUpdateable(input.Adapt<TenantOutput>()).IgnoreColumns(true).ExecuteCommandAsync();
|
await _sysTenantRep.AsUpdateable(input.Adapt<TenantOutput>()).IgnoreColumns(true).ExecuteCommandAsync();
|
||||||
|
|||||||
@ -97,9 +97,17 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
||||||
<el-form-item label="从库连接串">
|
<el-form-item label="从库连接串">
|
||||||
|
<template v-slot:label>
|
||||||
|
<div>
|
||||||
|
从库连接串
|
||||||
|
<el-tooltip raw-content content='格式:[{"HitRate":10, "ConnectionString":"xxx"},{"HitRate":10, "ConnectionString":"xxx"}]' placement="top">
|
||||||
|
<SvgIcon name="fa fa-question-circle-o" :size="16" style="vertical-align: middle" />
|
||||||
|
</el-tooltip>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
<el-input
|
<el-input
|
||||||
v-model="state.ruleForm.slaveConnections"
|
v-model="state.ruleForm.slaveConnections"
|
||||||
placeholder="格式:[{'HitRate':10, 'ConnectionString':'xxx'},{'HitRate':10, 'ConnectionString':'xxx'}]"
|
placeholder='格式:[{"HitRate":10, "ConnectionString":"xxx"},{"HitRate":10, "ConnectionString":"xxx"}]'
|
||||||
clearable
|
clearable
|
||||||
type="textarea"
|
type="textarea"
|
||||||
:disabled="state.ruleForm.tenantType == 0 && state.ruleForm.tenantType != undefined"
|
:disabled="state.ruleForm.tenantType == 0 && state.ruleForm.tenantType != undefined"
|
||||||
|
|||||||
@ -152,10 +152,10 @@ const options = useVxeTable<TenantOutput>(
|
|||||||
{ field: 'dbType', title: '数据库类型', minWidth: 120, showOverflow: 'tooltip', slots: { default: 'row_dbType' } },
|
{ field: 'dbType', title: '数据库类型', minWidth: 120, showOverflow: 'tooltip', slots: { default: 'row_dbType' } },
|
||||||
{ field: 'configId', title: '数据库标识', minWidth: 150, showOverflow: 'tooltip' },
|
{ field: 'configId', title: '数据库标识', minWidth: 150, showOverflow: 'tooltip' },
|
||||||
{ field: 'connection', title: '数据库连接', minWidth: 300, showOverflow: 'tooltip' },
|
{ field: 'connection', title: '数据库连接', minWidth: 300, showOverflow: 'tooltip' },
|
||||||
{ field: 'slaveConnections', title: '从库连接', showOverflow: 'tooltip' },
|
{ field: 'slaveConnections', title: '从库连接', minWidth: 300, showOverflow: 'tooltip' },
|
||||||
{ field: 'orderNo', title: '排序', width: 80, showOverflow: 'tooltip' },
|
{ field: 'orderNo', title: '排序', width: 80, showOverflow: 'tooltip' },
|
||||||
{ field: '', title: '修改记录', width: 100, showOverflow: 'tooltip', slots: { default: 'row_record' } },
|
{ field: '', title: '修改记录', width: 100, showOverflow: 'tooltip', slots: { default: 'row_record' } },
|
||||||
{ title: '操作', fixed: 'right', width: 430, showOverflow: true, slots: { default: 'row_buttons' } },
|
{ title: '操作', fixed: 'right', width: 400, showOverflow: true, slots: { default: 'row_buttons' } },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
// vxeGrid配置参数(此处可覆写任何参数),参考vxe-table官方文档
|
// vxeGrid配置参数(此处可覆写任何参数),参考vxe-table官方文档
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user