diff --git a/Tiobon.Core.Api/Tiobon.Core.Model.xml b/Tiobon.Core.Api/Tiobon.Core.Model.xml
index 99769651..036fd617 100644
--- a/Tiobon.Core.Api/Tiobon.Core.Model.xml
+++ b/Tiobon.Core.Api/Tiobon.Core.Model.xml
@@ -576,12 +576,12 @@
- GradeNo
+ 编号
- GradeName
+ 名称
@@ -1722,6 +1722,11 @@
表中文名
+
+
+ 是否校验唯一性
+
+
以下model 来自ids4项目,多库模式,为了调取ids4数据
diff --git a/Tiobon.Core.Api/Tiobon.Core.xml b/Tiobon.Core.Api/Tiobon.Core.xml
index eff44bd1..e2fb8b95 100644
--- a/Tiobon.Core.Api/Tiobon.Core.xml
+++ b/Tiobon.Core.Api/Tiobon.Core.xml
@@ -278,11 +278,11 @@
登录管理【无权限】
-
+
构造函数注入
-
+
diff --git a/Tiobon.Core.Api/appsettings.json b/Tiobon.Core.Api/appsettings.json
index 38158ebc..c58bbf2f 100644
--- a/Tiobon.Core.Api/appsettings.json
+++ b/Tiobon.Core.Api/appsettings.json
@@ -107,8 +107,8 @@
"ConnId": "WMTiobon_MSSQL_Main",
"DBType": 1,
"Enabled": true,
- //"Connection": "Data Source=47.99.54.186;User ID=GHR;Password=Tiobon20190101;Database=GHR30;Encrypt=True;TrustServerCertificate=True;",
- "Connection": "Data Source=116.204.98.209;User ID=Tiobon;Password=&($!4UGUyU#$2sp9O;Database=Tiobon;Encrypt=True;TrustServerCertificate=True;",
+ "Connection": "Data Source=47.99.54.186;User ID=GHR;Password=Tiobon20190101;Database=GHR30;Encrypt=True;TrustServerCertificate=True;",
+ //"Connection": "Data Source=116.204.98.209;User ID=Tiobon;Password=&($!4UGUyU#$2sp9O;Database=Tiobon;Encrypt=True;TrustServerCertificate=True;",
"ProviderName": "System.Data.SqlClient"
},
{
diff --git a/Tiobon.Core.Common/DB/Dapper/Entity/EntityAttribute.cs b/Tiobon.Core.Common/DB/Dapper/Entity/EntityAttribute.cs
index af753017..5e24cdcd 100644
--- a/Tiobon.Core.Common/DB/Dapper/Entity/EntityAttribute.cs
+++ b/Tiobon.Core.Common/DB/Dapper/Entity/EntityAttribute.cs
@@ -1,38 +1,31 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+namespace Tiobon.Core.Common.DB.Dapper.Entity;
-namespace Tiobon.Core.Common.DB.Dapper.Entity
+public class EntityAttribute : Attribute
{
- public class EntityAttribute : Attribute
- {
- ///
- /// 真实表名(数据库表名,若没有填写默认实体为表名)
- ///
- public string TableName { get; set; }
- ///
- /// 表中文名
- ///
- public string TableCnName { get; set; }
- ///
- /// 子表
- ///
- public Type[] DetailTable { get; set; }
- ///
- /// 子表中文名
- ///
- public string DetailTableCnName { get; set; }
- ///
- /// 数据库
- ///
- public string DBServer { get; set; }
+ ///
+ /// 真实表名(数据库表名,若没有填写默认实体为表名)
+ ///
+ public string TableName { get; set; }
+ ///
+ /// 表中文名
+ ///
+ public string TableCnName { get; set; }
+ ///
+ /// 子表
+ ///
+ public Type[] DetailTable { get; set; }
+ ///
+ /// 子表中文名
+ ///
+ public string DetailTableCnName { get; set; }
+ ///
+ /// 数据库
+ ///
+ public string DBServer { get; set; }
- //是否开启用户数据权限,true=用户只能操作自己(及下级角色)创建的数据,如:查询、删除、修改等操作
- public bool CurrentUserPermission { get; set; }
+ //是否开启用户数据权限,true=用户只能操作自己(及下级角色)创建的数据,如:查询、删除、修改等操作
+ public bool CurrentUserPermission { get; set; }
- public Type ApiInput { get; set; }
- public Type ApiOutput { get; set; }
- }
+ public Type ApiInput { get; set; }
+ public Type ApiOutput { get; set; }
}
diff --git a/Tiobon.Core.Common/DB/Dapper/Extensions/EntityProperties.cs b/Tiobon.Core.Common/DB/Dapper/Extensions/EntityProperties.cs
index a2ed785e..4455b6f6 100644
--- a/Tiobon.Core.Common/DB/Dapper/Extensions/EntityProperties.cs
+++ b/Tiobon.Core.Common/DB/Dapper/Extensions/EntityProperties.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data;
@@ -8,6 +9,10 @@ using System.Linq.Expressions;
using System.Reflection;
using System.Text;
using Tiobon.Core.Common.DB.Dapper.Entity;
+using static Dapper.SqlMapper;
+using Tiobon.Core.Model.Models;
+using Tiobon.Core.Model;
+using AutoMapper.Execution;
namespace Tiobon.Core.Common.DB.Dapper.Extensions;
@@ -124,7 +129,7 @@ public static class EntityProperties
}
return new KeyValuePair(property.Name, colType);
}
-
+
///
///要执行的sql语句如:通过EntityToSqlTempName.Temp_Insert0.ToString()字符串占位,生成的的sql语句会把EntityToSqlTempName.Temp_Insert0.ToString()替换成生成的sql临时表数据
/// string sql = " ;DELETE FROM " + typeEntity.Name + " where " + typeEntity.GetKeyName() +
@@ -144,7 +149,7 @@ public static class EntityProperties
string columnType = string.Empty;
List arrrayEntityList = array.Select(x => new ArrayEntity { column1 = x.ToString() }).ToList();
return arrrayEntityList.GetEntitySql(false, sql, null, null, fieldType);
- }
+ }
///
/// 根据实体获取key的类型,用于update或del操作
///
@@ -301,7 +306,7 @@ public static class EntityProperties
declareTable.AppendLine("; drop table " + tempTablbe);
}
return declareTable.ToString();
- }
+ }
public static string GetKeyName(this Type typeinfo)
{
return typeinfo.GetProperties().GetKeyName();
@@ -524,7 +529,43 @@ public static class EntityProperties
}
return displayName;
}
-
+
+ public static string GetDescription(this PropertyInfo type)
+ {
+ Attribute attribute = type.GetCustomAttribute(typeof(DescriptionAttribute));
+ if (attribute != null && attribute is DescriptionAttribute)
+ {
+ return (attribute as DescriptionAttribute).Description ?? type.Name;
+ }
+ return type.Name;
+ }
+ public static void GetOnlyList(this T entity, out List names, out List