From b774c35c6d99a5a8344789865c83250c45c3363f Mon Sep 17 00:00:00 2001 From: liangkun Date: Mon, 26 Sep 2022 17:17:19 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=89=8B=E6=9C=BA=E7=AB=AF?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=A4=9A=E8=A1=A8=E8=A1=A8=E5=8D=95=E5=87=BA?= =?UTF-8?q?=E7=8E=B0from=E9=99=84=E8=BF=91=E8=AF=AD=E6=B3=95=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Scheme/FormSchemeBLL.cs | 93 ++++++++++++++++++- 1 file changed, 92 insertions(+), 1 deletion(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Form/Scheme/FormSchemeBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Form/Scheme/FormSchemeBLL.cs index 1948b9075..e63e83d59 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Form/Scheme/FormSchemeBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Form/Scheme/FormSchemeBLL.cs @@ -551,7 +551,98 @@ namespace Learun.Application.Form } } } - + + public Dictionary GetFolderKey(string schemeInfoId, string processIdName, string keyValue) + { + Dictionary res = new Dictionary(); + + try + { + FormSchemeInfoEntity formSchemeInfoEntity = GetSchemeInfoEntity(schemeInfoId); + FormSchemeEntity formSchemeEntity = GetSchemeEntity(formSchemeInfoEntity.F_SchemeId); + FormSchemeModel formSchemeModel = formSchemeEntity.F_Scheme.ToObject(); + + // 确定主从表之间的关系 + List> TableTree = new List>();// 从表 + foreach (var table in formSchemeModel.dbTable) + { + TreeModelEx treeone = new TreeModelEx(); + treeone.data = table; + treeone.id = table.name; + treeone.parentId = table.relationName; + if (string.IsNullOrEmpty(table.relationName)) + { + treeone.parentId = "0"; + } + TableTree.Add(treeone); + } + TableTree = TableTree.ToTree(); + bool hasupload = false; + + // 确定表与组件之间的关系 + Dictionary> tableComponts = new Dictionary>(); + foreach (var tab in formSchemeModel.data) + { + foreach (var compont in tab.componts) + { + if (!string.IsNullOrEmpty(compont.table)) + { + if (!tableComponts.ContainsKey(compont.table)) + { + tableComponts[compont.table] = new List(); + } + if (compont.type == "upload") + { + hasupload = true; + tableComponts[compont.table].Add(compont); + } + if (compont.type == "guid") + { + tableComponts[compont.table].Add(compont); + } + + } + } + } + Dictionary uploadfieldkeyvalue = new Dictionary(); + + if (!hasupload) + { + return uploadfieldkeyvalue; + } + GetInstanceTableData(TableTree, tableComponts, formSchemeModel.dbId, keyValue, processIdName, null, res); + foreach (var itemCompont in tableComponts) + { + foreach (FormCompontModel formitem in itemCompont.Value) + { + if (formitem.type=="upload") + { + foreach (var resitem in res) + { + if (resitem.Value.Rows.Count>0) + { + if (resitem.Value.Rows[0][formitem.field] != null) + uploadfieldkeyvalue.Add(formitem.id, resitem.Value.Rows[0][formitem.field].ToString()); + } + } + } + } + } + return uploadfieldkeyvalue; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + /// /// 保存自定义表单数据 ///