diff --git a/Directory.Build.Volo.targets b/Directory.Build.Volo.targets
index c40b1cc..b1b5f23 100644
--- a/Directory.Build.Volo.targets
+++ b/Directory.Build.Volo.targets
@@ -19,7 +19,7 @@
-
+
diff --git a/Directory.Build.targets b/Directory.Build.targets
index 065b380..6eddc80 100644
--- a/Directory.Build.targets
+++ b/Directory.Build.targets
@@ -102,8 +102,13 @@
-
-
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/JiShe.ServicePro b/JiShe.ServicePro
index 323492e..c3d3ced 160000
--- a/JiShe.ServicePro
+++ b/JiShe.ServicePro
@@ -1 +1 @@
-Subproject commit 323492e10b2937a063c9e60b26bc40c6954503c7
+Subproject commit c3d3ced4b1a82967373e389877632349afee0de0
diff --git a/NuGet.Config b/NuGet.Config
index 23a7f7f..abdb807 100644
--- a/NuGet.Config
+++ b/NuGet.Config
@@ -1,8 +1,8 @@
-
+
-
-
+
+
diff --git a/host/JiShe.IoT.HttpApi.Host/JiShe.IoT.HttpApi.Host.csproj b/host/JiShe.IoT.HttpApi.Host/JiShe.IoT.HttpApi.Host.csproj
index e8ee68d..b901aee 100644
--- a/host/JiShe.IoT.HttpApi.Host/JiShe.IoT.HttpApi.Host.csproj
+++ b/host/JiShe.IoT.HttpApi.Host/JiShe.IoT.HttpApi.Host.csproj
@@ -33,7 +33,6 @@
-
diff --git a/src/JiShe.IoT.DbMigrator/appsettings.json b/src/JiShe.IoT.DbMigrator/appsettings.json
index 5cb5a3c..459df4f 100644
--- a/src/JiShe.IoT.DbMigrator/appsettings.json
+++ b/src/JiShe.IoT.DbMigrator/appsettings.json
@@ -1,14 +1,14 @@
{
"ConnectionStrings": {
- "Default": "Data Source=192.168.111.174;Port=13306;Database=JiSheIoTProDB;uid=root;pwd=JiShe!aqG#5kGgh&0;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true;TreatTinyAsBoolean=false;SslMode=None;Pooling=true;"
+ "Default": "Data Source=localhost;Port=33306;Database=JiSheIoTProDB3;uid=root;pwd=123456789;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true;TreatTinyAsBoolean=false;SslMode=Preferred;Pooling=true;"
},
"IoTDBOptions": {
"UserName": "root",
"Password": "Lixiao@1980",
//"TreeModelClusterList": [ "47.110.53.196:6667", "47.110.60.222:6667", "47.110.62.104:6667" ],
//"TableModelClusterList": [ "47.110.53.196:6667", "47.110.60.222:6667", "47.110.62.104:6667" ],
- "TreeModelClusterList": [ "192.168.111.174:30710" ],
- "TableModelClusterList": [ "192.168.111.174:30710" ],
+ "TreeModelClusterList": [ "47.110.53.196:30710" ],
+ "TableModelClusterList": [ "47.110.53.196:30710" ],
"PoolSize": 32,
"DataBaseName": "jisheiotdata",
"OpenDebugMode": false,
diff --git a/src/JiShe.IoT.EntityFrameworkCore/EntityFrameworkCore/IoTEntityFrameworkCoreModule.cs b/src/JiShe.IoT.EntityFrameworkCore/EntityFrameworkCore/IoTEntityFrameworkCoreModule.cs
index da78f5c..3ddb0c0 100644
--- a/src/JiShe.IoT.EntityFrameworkCore/EntityFrameworkCore/IoTEntityFrameworkCoreModule.cs
+++ b/src/JiShe.IoT.EntityFrameworkCore/EntityFrameworkCore/IoTEntityFrameworkCoreModule.cs
@@ -4,13 +4,14 @@ using JiShe.ServicePro.DynamicMenuManagement.EntityFrameworkCore;
using JiShe.ServicePro.FileManagement.EntityFrameworkCore;
using JiShe.ServicePro.OneNETManagement.EntityFrameworkCore;
using JiShe.ServicePro.TemplateManagement.EntityFrameworkCore;
+using Volo.Abp.EntityFrameworkCore.MySQL;
using Volo.Abp.Guids;
namespace JiShe.IoT.EntityFrameworkCore
{
[DependsOn(
typeof(IoTDomainModule),
- typeof(AbpEntityFrameworkCoreMySQLModule),
+ typeof(AbpEntityFrameworkCoreMySQLPomeloModule),
typeof(BasicManagementEntityFrameworkCoreModule),
typeof(DataDictionaryManagementEntityFrameworkCoreModule),
typeof(NotificationManagementEntityFrameworkCoreModule),
@@ -37,6 +38,10 @@ namespace JiShe.IoT.EntityFrameworkCore
* default repositories only for aggregate roots */
options.AddDefaultRepositories(includeAllEntities: true);
});
+
+ //// 注册自定义的IdentityUserRepository以修复ABP 10.0.1与MySQL的兼容性问题
+ //context.Services.AddTransient();
+
Configure(options =>
{
options.DefaultSequentialGuidType = SequentialGuidType.SequentialAsString;
diff --git a/src/JiShe.IoT.EntityFrameworkCore/EntityFrameworkCore/IoTIdentityUserRepository.cs b/src/JiShe.IoT.EntityFrameworkCore/EntityFrameworkCore/IoTIdentityUserRepository.cs
new file mode 100644
index 0000000..bc46c85
--- /dev/null
+++ b/src/JiShe.IoT.EntityFrameworkCore/EntityFrameworkCore/IoTIdentityUserRepository.cs
@@ -0,0 +1,38 @@
+using Microsoft.EntityFrameworkCore;
+using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
+using Volo.Abp.EntityFrameworkCore;
+using Volo.Abp.Identity;
+
+namespace JiShe.IoT.EntityFrameworkCore
+{
+ ///
+ /// 自定义IdentityUserRepository,修复ABP 10.0.1与MySQL提供程序的兼容性问题
+ /// 解决 "Expression '@organizationUnitIds' in the SQL tree does not have a type mapping assigned" 错误
+ ///
+ public class IoTIdentityUserRepository : Volo.Abp.Identity.EntityFrameworkCore.EfCoreIdentityUserRepository
+ {
+ public IoTIdentityUserRepository(
+ IDbContextProvider dbContextProvider)
+ : base((IDbContextProvider)dbContextProvider)
+ {
+ }
+
+ public override async Task> GetRoleNamesAsync(Guid id, CancellationToken cancellationToken = default)
+ {
+ var dbContext = await GetDbContextAsync();
+
+ // 使用Join查询来避免参数化集合查询的问题
+ // 这样可以避免EF Core将集合参数转换为SQL参数时出现的类型映射问题
+ var roleNames = await (from user in dbContext.Users
+ join userRole in dbContext.Set() on user.Id equals userRole.UserId
+ join role in dbContext.Roles on userRole.RoleId equals role.Id
+ where user.Id == id
+ select role.Name)
+ .Distinct()
+ .ToListAsync(GetCancellationToken(cancellationToken));
+
+ return roleNames ?? new List();
+ }
+ }
+}
+
diff --git a/src/JiShe.IoT.EntityFrameworkCore/EntityFrameworkCore/IoTMigrationsDbContextFactory.cs b/src/JiShe.IoT.EntityFrameworkCore/EntityFrameworkCore/IoTMigrationsDbContextFactory.cs
index d1d1565..9e310b5 100644
--- a/src/JiShe.IoT.EntityFrameworkCore/EntityFrameworkCore/IoTMigrationsDbContextFactory.cs
+++ b/src/JiShe.IoT.EntityFrameworkCore/EntityFrameworkCore/IoTMigrationsDbContextFactory.cs
@@ -9,9 +9,10 @@ namespace JiShe.IoT.EntityFrameworkCore
IoTEfCoreEntityExtensionMappings.Configure();
var configuration = BuildConfiguration();
+ var serverVersion = new MySqlServerVersion(new Version(8, 4, 6));
var builder = new DbContextOptionsBuilder()
- .UseMySQL(configuration.GetConnectionString("Default"));
+ .UseMySql(configuration.GetConnectionString("Default"), serverVersion);
return new IoTDbContext(builder.Options);
}
diff --git a/src/JiShe.IoT.EntityFrameworkCore/JiShe.IoT.EntityFrameworkCore.csproj b/src/JiShe.IoT.EntityFrameworkCore/JiShe.IoT.EntityFrameworkCore.csproj
index 859cbd3..d0e9c9e 100644
--- a/src/JiShe.IoT.EntityFrameworkCore/JiShe.IoT.EntityFrameworkCore.csproj
+++ b/src/JiShe.IoT.EntityFrameworkCore/JiShe.IoT.EntityFrameworkCore.csproj
@@ -3,11 +3,16 @@
$(DotnetTargetFrameworkVersion)
JiShe.IoT
+
+
+
-
-
+
+
+
+