|
|
|
@ -1,7 +1,10 @@ |
|
|
|
|
using System.Data; |
|
|
|
|
using System.Dynamic; |
|
|
|
|
using System.Linq.Expressions; |
|
|
|
|
using AgileObjects.AgileMapper; |
|
|
|
|
using Microsoft.AspNetCore.Http; |
|
|
|
|
using Newtonsoft.Json.Linq; |
|
|
|
|
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; |
|
|
|
|
using SqlSugar; |
|
|
|
|
using Tiobon.Core.Common; |
|
|
|
|
using Tiobon.Core.Common.Caches; |
|
|
|
@ -124,6 +127,172 @@ public class BaseServices<TEntity, TEntityDto, TInsertDto, TEditDto> : IBaseServ |
|
|
|
|
return Mapper.Map(data).ToANew<List<TEntityDto>>(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public async Task<ServiceFormResult> QueryForm(QueryForm body) |
|
|
|
|
{ |
|
|
|
|
var result = new ServiceFormResult(); |
|
|
|
|
var data = await BaseDal.QueryById(body.id); |
|
|
|
|
var dto = Mapper.Map(data).ToANew<TEntityDto>(); |
|
|
|
|
string sql = string.Empty; |
|
|
|
|
var dt = new DataTable(); |
|
|
|
|
|
|
|
|
|
Type entityType = typeof(TEntity); |
|
|
|
|
sql = @$"DECLARE @langId INT = '{body.langId}',@ID BIGINT = '{body.id}';
|
|
|
|
|
|
|
|
|
|
SELECT *, |
|
|
|
|
isnull |
|
|
|
|
((SELECT CASE WHEN @langId = 1 THEN UserName ELSE UserEname END |
|
|
|
|
FROM Ghrs_User kk |
|
|
|
|
WHERE kk.UserId = a.CreateBy), |
|
|
|
|
'') |
|
|
|
|
+ ' ' |
|
|
|
|
+ [dbo].[FLangKeyToValue] ('GHR_Common_000078', @langId, '于 ') |
|
|
|
|
+ ' ' |
|
|
|
|
+ CONVERT (NVARCHAR (16), CreateTime, 121) |
|
|
|
|
+ ' ' |
|
|
|
|
+ [dbo].[FLangKeyToValue] ('GHR_Common_000079', @langId, ' 创建') |
|
|
|
|
CreateDataInfo, |
|
|
|
|
isnull |
|
|
|
|
((SELECT CASE WHEN @langId = 1 THEN UserName ELSE UserEname END |
|
|
|
|
FROM Ghrs_User kk |
|
|
|
|
WHERE kk.UserId = a.UpdateBy), |
|
|
|
|
'') |
|
|
|
|
+ ' ' |
|
|
|
|
+ [dbo].[FLangKeyToValue] ('GHR_Common_000078', @langId, '于') |
|
|
|
|
+ ' ' |
|
|
|
|
+ CONVERT (NVARCHAR (16), UpdateTime, 121) |
|
|
|
|
+ ' ' |
|
|
|
|
+ [dbo].[FLangKeyToValue] |
|
|
|
|
('GHR_Common_000080', @langId, ' 最后修改') |
|
|
|
|
UpdateDataInfo |
|
|
|
|
FROM {entityType.GetEntityTableName()} a |
|
|
|
|
WHERE a.Id = @ID";
|
|
|
|
|
|
|
|
|
|
result.result.DT_TableDataT1 = Db.Ado.SqlQuery<TEntityDto>(sql); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region JM_PageFormActionsT1 |
|
|
|
|
dynamic JM_PageFormActionsT1 = new ExpandoObject(); |
|
|
|
|
|
|
|
|
|
var toolbars = new JArray(); |
|
|
|
|
|
|
|
|
|
sql = @$"SELECT field fnKey, [dbo].[FLangKeyToValue] (mkey, {body.langId}, label) fnTitle, icon
|
|
|
|
|
FROM Ghrs_PageSettingEdit |
|
|
|
|
WHERE IsEnable = 1 AND pageNo = '{body.menuName}' AND elementType = 'FnKey'";
|
|
|
|
|
dt = await Db.Ado.GetDataTableAsync(sql); |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < dt.Rows.Count; i++) |
|
|
|
|
{ |
|
|
|
|
JObject item = |
|
|
|
|
[ |
|
|
|
|
new JProperty("fnKey", dt.Rows[i]["fnKey"].ToString()), |
|
|
|
|
new JProperty("fnTitle", dt.Rows[i]["fnTitle"].ToString()), |
|
|
|
|
new JProperty("icon", dt.Rows[i]["icon"].ToString()), |
|
|
|
|
new JProperty("display", true) |
|
|
|
|
]; |
|
|
|
|
toolbars.Add(item); |
|
|
|
|
} |
|
|
|
|
JM_PageFormActionsT1.Toolbar = toolbars; |
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
#region JM_TableColumnT1 |
|
|
|
|
dynamic JM_TableColumnT1 = new ExpandoObject(); |
|
|
|
|
var tableColumn = new JArray(); |
|
|
|
|
sql = @$"SELECT field,
|
|
|
|
|
[dbo].[FLangKeyToValue] (mkey, {body.langId}, label) |
|
|
|
|
label, |
|
|
|
|
required, |
|
|
|
|
editable, |
|
|
|
|
rowNum, |
|
|
|
|
colNum, |
|
|
|
|
elementType, |
|
|
|
|
dbo.FS_GetdataSourceBySet |
|
|
|
|
(dataSource, APIDataSourceType, Ghrs_PageSettingEdit.APIDataSourceID) |
|
|
|
|
dataSource, |
|
|
|
|
defaultHidden, |
|
|
|
|
isPrimaryKey, |
|
|
|
|
isSingleColumn |
|
|
|
|
FROM Ghrs_PageSettingEdit |
|
|
|
|
WHERE IsEnable = 1 |
|
|
|
|
AND pageNo = '{body.menuName}' |
|
|
|
|
AND elementType NOT IN ('FnKey', 'PageGroup');";
|
|
|
|
|
dt = await Db.Ado.GetDataTableAsync(sql); |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < dt.Rows.Count; i++) |
|
|
|
|
{ |
|
|
|
|
JObject item = |
|
|
|
|
[ |
|
|
|
|
new JProperty("field", dt.Rows[i]["field"].ToString()), |
|
|
|
|
new JProperty("label", dt.Rows[i]["label"].ToString()), |
|
|
|
|
new JProperty("required",!string.IsNullOrWhiteSpace(dt.Rows[i]["required"].ToString())? Convert.ToBoolean(dt.Rows[i]["required"]):null), |
|
|
|
|
new JProperty("editable",!string.IsNullOrWhiteSpace(dt.Rows[i]["editable"].ToString())? Convert.ToBoolean(dt.Rows[i]["editable"]):null), |
|
|
|
|
new JProperty("rowNum",!string.IsNullOrWhiteSpace(dt.Rows[i]["rowNum"].ToString())? Convert.ToInt32(dt.Rows[i]["rowNum"]):null), |
|
|
|
|
new JProperty("colNum",!string.IsNullOrWhiteSpace(dt.Rows[i]["colNum"].ToString())? Convert.ToInt32(dt.Rows[i]["colNum"]):null), |
|
|
|
|
new JProperty("elementType", dt.Rows[i]["elementType"].ToString()), |
|
|
|
|
new JProperty("dataSource", dt.Rows[i]["dataSource"].ToString()), |
|
|
|
|
new JProperty("defaultHidden", dt.Rows[i]["defaultHidden"].ToString()), |
|
|
|
|
new JProperty("isPrimaryKey", dt.Rows[i]["isPrimaryKey"].ToString()), |
|
|
|
|
new JProperty("isSingleColumn",!string.IsNullOrWhiteSpace(dt.Rows[i]["isSingleColumn"].ToString())? Convert.ToInt32(dt.Rows[i]["isSingleColumn"]):null), |
|
|
|
|
]; |
|
|
|
|
tableColumn.Add(item); |
|
|
|
|
} |
|
|
|
|
JM_TableColumnT1.TableColumn = tableColumn; |
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
#region JM_PageFormT1 |
|
|
|
|
dynamic JM_PageFormT1 = new ExpandoObject(); |
|
|
|
|
var pageForm = new JArray(); |
|
|
|
|
JObject pageFormItem = |
|
|
|
|
[ |
|
|
|
|
new JProperty("disabled", false), |
|
|
|
|
new JProperty("labelAlign", "right"), |
|
|
|
|
new JProperty("labelCol", "{span: 6}"), |
|
|
|
|
new JProperty("labelWidth",120), |
|
|
|
|
new JProperty("layout", "horizontal") |
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
sql = $@"SELECT [dbo].[FLangKeyToValue] (MKey, {body.langId}, MenuName) pageTitle,
|
|
|
|
|
IUDProcedure apiName |
|
|
|
|
FROM Ghrs_Menu |
|
|
|
|
WHERE MenuNo = '{body.menuName}' AND IsEnable = 1";
|
|
|
|
|
dt = await Db.Ado.GetDataTableAsync(sql); |
|
|
|
|
if (dt.Rows.Count > 0) |
|
|
|
|
{ |
|
|
|
|
pageFormItem.Add(new JProperty("pageTitle", dt.Rows[0]["pageTitle"].ToString())); |
|
|
|
|
pageFormItem.Add(new JProperty("apiName", dt.Rows[0]["apiName"].ToString())); |
|
|
|
|
} |
|
|
|
|
pageForm.Add(pageFormItem); |
|
|
|
|
JM_PageFormT1.PageForm = pageForm; |
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
#region DT_PageMutiMsg |
|
|
|
|
var DT_PageMutiMsg = new List<DT_PageMutiMsg>(); |
|
|
|
|
sql = $@"SELECT Langkey field,
|
|
|
|
|
CASE {body.langId} |
|
|
|
|
WHEN 1 THEN isnull (Value01, LangValue) |
|
|
|
|
WHEN 2 THEN isnull (Value02, LangValue) |
|
|
|
|
WHEN 3 THEN isnull (Value03, LangValue) |
|
|
|
|
WHEN 4 THEN isnull (Value04, LangValue) |
|
|
|
|
WHEN 5 THEN isnull (Value05, LangValue) |
|
|
|
|
WHEN 6 THEN isnull (Value06, LangValue) |
|
|
|
|
WHEN 7 THEN isnull (Value07, LangValue) |
|
|
|
|
WHEN 8 THEN isnull (Value08, LangValue) |
|
|
|
|
WHEN 9 THEN isnull (Value09, LangValue) |
|
|
|
|
WHEN 10 THEN isnull (Value10, LangValue) |
|
|
|
|
END label |
|
|
|
|
FROM Ghrs_LangKey |
|
|
|
|
WHERE (LangKey LIKE 'GHR_Page%' OR LangKey LIKE 'GHR_Common%') |
|
|
|
|
AND IsEnable = 1";
|
|
|
|
|
DT_PageMutiMsg = Db.Ado.SqlQuery<DT_PageMutiMsg>(sql); |
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
result.result.JM_PageFormActionsT1 = JM_PageFormActionsT1; |
|
|
|
|
result.result.JM_TableColumnT1 = JM_TableColumnT1; |
|
|
|
|
result.result.JM_PageFormT1 = JM_PageFormT1; |
|
|
|
|
result.result.DT_PageMutiMsg = DT_PageMutiMsg; |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#region 新增 |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
@ -806,7 +975,7 @@ public class BaseServices<TEntity, TEntityDto, TInsertDto, TEditDto> : IBaseServ |
|
|
|
|
if (list == null || (list != null && !list.Any())) |
|
|
|
|
{ |
|
|
|
|
string sql = $"SELECT * FROM Ghrs_ParaDetail WHERE ParaMasterNo ='{key}' ORDER BY SortNo ASC"; |
|
|
|
|
list = DbAccess.QueryList<Ghrs_ParaDetail>(sql); |
|
|
|
|
list = DbAccess.QueryList<Ghrs_ParaDetail>(sql); |
|
|
|
|
if (list.Any()) |
|
|
|
|
await _caching.SetAsync(key, list); |
|
|
|
|
} |
|
|
|
|