1、新增根据ORGID获取Telnet
2、后端 处理 跨库数据查找 PF/PFApprove/FullGet string tenant = OPTenantDBConnService.GetTenantByORGID(对应ORG_ID); filter.IgnoreOrgRule = true; filter.OrgId = null; filter.IsSpecifyDb = true; filter.SpecifyTenant = tenant; ilter.IgnoreDataRule = true;
This commit is contained in:
parent
ef2976955c
commit
2d0ef5be61
@ -305,5 +305,10 @@
|
|||||||
/// 所有数据库链接
|
/// 所有数据库链接
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string ConnAll = "OPConn";
|
public const string ConnAll = "OPConn";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 所有Tenant
|
||||||
|
/// </summary>
|
||||||
|
public const string TenantAll = "OPTenant";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,5 +22,13 @@ namespace APT.BaseData.Domain.IServices.OP
|
|||||||
/// <param name="ORG_ID">过滤值</param>
|
/// <param name="ORG_ID">过滤值</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
string GetConnByORGID(Guid ORG_ID);
|
string GetConnByORGID(Guid ORG_ID);
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据ORGID 获取 Tenant
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ORG_ID"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
string GetTenantByORGID(Guid ORG_ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -164,5 +164,56 @@ namespace APT.BaseData.Services.Services.OP
|
|||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据ORGID 获取 Tenant
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ORG_ID"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string GetTenantByORGID(Guid ORG_ID)
|
||||||
|
{
|
||||||
|
|
||||||
|
Dictionary<Guid, string> dicORGCONN = new Dictionary<Guid, string>();
|
||||||
|
//从Redis中获取所有数据库链接值
|
||||||
|
|
||||||
|
bool isRedisConfig = true;
|
||||||
|
var redisConfig = APT.Infrastructure.Api.ConfigurationManager.AppSettings["RedisFormConfig"];
|
||||||
|
if (!string.IsNullOrEmpty(redisConfig))
|
||||||
|
isRedisConfig = bool.Parse(redisConfig);
|
||||||
|
if (isRedisConfig)
|
||||||
|
{
|
||||||
|
if (CsRedisManager.KeyExists(RedisCacheKey.TenantAll))
|
||||||
|
dicORGCONN = CsRedisManager.StringGet<Dictionary<Guid, string>>(RedisCacheKey.TenantAll);
|
||||||
|
}
|
||||||
|
#region Redis没找到 去数据库查找
|
||||||
|
|
||||||
|
if (dicORGCONN == null || dicORGCONN.Count < 1)
|
||||||
|
{
|
||||||
|
string conn = string.Empty;
|
||||||
|
IEnumerable<T_OP_TENANT> listTent = null;
|
||||||
|
using (var context = new MigrationContext())
|
||||||
|
{
|
||||||
|
Expression<Func<T_OP_TENANT, bool>> expression = e => e.DB_CONN_ID.HasValue;
|
||||||
|
listTent = context.GetEntities(expression, null, null);
|
||||||
|
if (listTent != null && listTent.Count() > 0)
|
||||||
|
{
|
||||||
|
foreach (var item in listTent)
|
||||||
|
{
|
||||||
|
if (!dicORGCONN.ContainsKey(item.ID))
|
||||||
|
{
|
||||||
|
dicORGCONN.Add(item.ID, item.CODE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
if (dicORGCONN != null && dicORGCONN.Count > 0 && dicORGCONN.ContainsKey(ORG_ID))
|
||||||
|
{
|
||||||
|
return dicORGCONN[ORG_ID];
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -653,22 +653,21 @@
|
|||||||
T_PF_APPROVE result = null;
|
T_PF_APPROVE result = null;
|
||||||
if (!string.IsNullOrEmpty(filter.Parameter1) && filter.OrgId.HasValue && filter.Parameter1 != filter.OrgId.Value.ToString())
|
if (!string.IsNullOrEmpty(filter.Parameter1) && filter.OrgId.HasValue && filter.Parameter1 != filter.OrgId.Value.ToString())
|
||||||
{
|
{
|
||||||
//集团人员 通过 首页点击 获取对应的数据库链接 返回结果
|
//集团人员 通过 首页点击 获取对应的数据库链接 返回结果
|
||||||
//这边怎么调用 原生的 GetEntity 方法
|
|
||||||
|
|
||||||
|
////后端直接处理
|
||||||
|
//string tenant = OPTenantDBConnService.GetTenantByORGID(new Guid(filter.Parameter1));
|
||||||
|
//filter.IgnoreOrgRule = true;
|
||||||
|
//filter.OrgId = null;
|
||||||
|
//filter.IsSpecifyDb = true;
|
||||||
|
//filter.SpecifyTenant = tenant;
|
||||||
|
//filter.IgnoreDataRule = true;
|
||||||
|
//result = GetEntity<T_PF_APPROVE>(e => !e.IS_DELETED, filter, null);
|
||||||
|
|
||||||
//string conn = OPTenantDBConnService.GetConnByORGID(new Guid(filter.Parameter1));
|
//前端处理Tenant
|
||||||
//var service = APT.Infrastructure.Api.ServiceLocator.Instance.GetService<IFMNotificatoinService>();
|
|
||||||
filter.IgnoreOrgRule = true;
|
filter.IgnoreOrgRule = true;
|
||||||
filter.OrgId = null;
|
filter.OrgId = null;
|
||||||
//filter.SpecifyDbConn = conn;
|
result = GetEntity<T_PF_APPROVE>(e => !e.IS_DELETED, filter, null);
|
||||||
filter.IsSpecifyDb = true;
|
|
||||||
filter.SpecifyTenant = "0005";
|
|
||||||
filter.IgnoreDataRule = true;
|
|
||||||
//var ccc = service.GetEntities<T_PF_APPROVE>(e => !e.IS_DELETED, filter, null);
|
|
||||||
|
|
||||||
|
|
||||||
var aaa = GetEntities<T_PF_APPROVE>(e => !e.IS_DELETED, filter, null);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user