diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/AccountController.cs b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/AccountController.cs
index 3891129c..06c7d7cf 100644
--- a/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/AccountController.cs
+++ b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/AccountController.cs
@@ -4,6 +4,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
+using Yi.Framework.Common;
using Yi.Framework.Common.Helper;
using Yi.Framework.Common.Models;
using Yi.Framework.Core;
diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/RoleController.cs b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/RoleController.cs
index 0858911a..a62cc81e 100644
--- a/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/RoleController.cs
+++ b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/RoleController.cs
@@ -70,7 +70,12 @@ namespace Yi.Framework.ApiMicroservice.Controllers
///
[HttpPost]
public async Task SetMenuByRole(IdsListDto idsListDto)
- {
+ {
+ foreach(var id in idsListDto.ids1)
+ {
+ await _roleService.SetMenusByRolesId(idsListDto.ids2, id);
+ }
+ return Result.Success();
}
}
}
diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/UserController.cs b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/UserController.cs
index 22930893..73e0951c 100644
--- a/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/UserController.cs
+++ b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/UserController.cs
@@ -85,13 +85,16 @@ namespace Yi.Framework.ApiMicroservice.Controllers
}
///
- /// 给单个用户设置多个角色,ids有用户id与 角列表色ids,1对多
+ /// 给单个用户设置多个角色,ids有用户id与 角色列表ids,1对多
///
///
///
[HttpPost]
public async Task SetRoleByUser(IdsDto idsDto)
- {
+ {
+ var _user = this.HttpContext.GetCurrentUserInfo();
+ await _userService.SetRolesByUserId(idsDto.ids, _user.id);
+ return Result.Success();
}
}
}
diff --git a/Yi.Framework/Yi.Framework.Core/Yi.Framework.Core.csproj b/Yi.Framework/Yi.Framework.Core/Yi.Framework.Core.csproj
index 5af9d499..e441d22a 100644
--- a/Yi.Framework/Yi.Framework.Core/Yi.Framework.Core.csproj
+++ b/Yi.Framework/Yi.Framework.Core/Yi.Framework.Core.csproj
@@ -15,6 +15,7 @@
+
diff --git a/Yi.Framework/Yi.Framework.Interface/T4IService.tt b/Yi.Framework/Yi.Framework.Interface/T4IService.tt
index 2570a5f1..0956330b 100644
--- a/Yi.Framework/Yi.Framework.Interface/T4IService.tt
+++ b/Yi.Framework/Yi.Framework.Interface/T4IService.tt
@@ -13,3 +13,22 @@
Type[] ts = assembly.GetTypes();
#>
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Yi.Framework.Model.Models;
+
+namespace Yi.Framework.Interface
+{
+ public partial class BaseContext :DbContext
+ {
+<# foreach(string item in ts){
+ #>
+ public partial interface I<#=item #>Dal:IBaseDal<<#=item #>>
+ {
+ }
+<# } #>
+ }
+}
\ No newline at end of file
diff --git a/Yi.Framework/Yi.Framework.Model/DataContext.cs b/Yi.Framework/Yi.Framework.Model/DataContext.cs
index 6c3f0195..439c7e98 100644
--- a/Yi.Framework/Yi.Framework.Model/DataContext.cs
+++ b/Yi.Framework/Yi.Framework.Model/DataContext.cs
@@ -12,7 +12,7 @@ namespace Yi.Framework.Model
{
//Add-Migration yi-1
//Update-Database yi-1
- public class DataContext : DbContext
+ public partial class DataContext : DbContext
{
private readonly IOptionsMonitor _optionsMonitor;
private readonly string _connStr;
diff --git a/Yi.Framework/Yi.Framework.Model/T4DaraContext.tt b/Yi.Framework/Yi.Framework.Model/T4DaraContext.tt
index 2570a5f1..32c6bc39 100644
--- a/Yi.Framework/Yi.Framework.Model/T4DaraContext.tt
+++ b/Yi.Framework/Yi.Framework.Model/T4DaraContext.tt
@@ -11,5 +11,24 @@
string solutionsPath = Host.ResolveAssemblyReference("$(SolutionDir)");//获取解决方案路径
Assembly assembly = Assembly.LoadFrom(System.IO.Path.Combine(solutionsPath, @"Yi.Framework.ApiMicroservice\bin\Debug\net5.0\Yi.Framework.Model.dll"));
Type[] ts = assembly.GetTypes();
+
#>
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Yi.Framework.Model
+{
+ public partial class BaseContext :DbContext
+ {
+<# foreach(var item in ts){
+
+ #>
+ public DbSet<<#=item#>> <#=item#> { get; set; }
+<# } #>
+ }
+}
\ No newline at end of file
diff --git a/Yi.Framework/Yi.Framework.Model/Yi.Framework.Model.csproj b/Yi.Framework/Yi.Framework.Model/Yi.Framework.Model.csproj
index abe851b9..92106451 100644
--- a/Yi.Framework/Yi.Framework.Model/Yi.Framework.Model.csproj
+++ b/Yi.Framework/Yi.Framework.Model/Yi.Framework.Model.csproj
@@ -8,14 +8,6 @@
-
-
- True
- True
- T4DaraContext.tt
-
-
-
diff --git a/Yi.Framework/Yi.Framework.Service/UserService.cs b/Yi.Framework/Yi.Framework.Service/UserService.cs
index 35567401..abcc455c 100644
--- a/Yi.Framework/Yi.Framework.Service/UserService.cs
+++ b/Yi.Framework/Yi.Framework.Service/UserService.cs
@@ -41,9 +41,9 @@ namespace Yi.Framework.Service
public async Task> GetMenusByUser(user _user)
{
- var user_data= await _Db.Set().Include(u => u.roles).ThenInclude(u => u.menus)
+ var user_data= await _Db.Set().Include(u => u.roles).ThenInclude(u=>u.menus).ThenInclude(u=>u.mould)
.Where(u=>u.id==_user.id&& u.is_delete == (short)Common.Enum.DelFlagEnum.Normal).FirstOrDefaultAsync();
- var menuList= user_data.roles.Select(u => u.menus);
+ var menuList= user_data.roles.Select(u=>u.menus);
return (List