mirror of
https://gitee.com/ccnetcore/Yi
synced 2026-04-04 16:16:35 +08:00
更新控制器接口
This commit is contained in:
@@ -1 +0,0 @@
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
<#@ template debug="false" hostspecific="true" language="C#" #>
|
||||
<#@ assembly name="System.Core" #>
|
||||
<#@ import namespace="System.Linq" #>
|
||||
<#@ import namespace="System.Text" #>
|
||||
<#@ import namespace="System.Collections.Generic" #>
|
||||
<#@ import namespace="System.Reflection" #>
|
||||
<#@ import namespace="System.IO" #>
|
||||
<#@ output extension=".cs" #>
|
||||
|
||||
<#
|
||||
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();
|
||||
|
||||
#>
|
||||
@@ -85,17 +85,20 @@ namespace Yi.Framework.Service
|
||||
return await AddAsync(_user);
|
||||
}
|
||||
|
||||
public async Task<bool> SetRolesByUserId(List<int> roleIds, int userId)
|
||||
public async Task<bool> SetRolesByUser(List<int> roleIds, List<int> userIds)
|
||||
{
|
||||
var user_data =await GetEntity(u => u.id ==userId &&u.is_delete == (short)Common.Enum.DelFlagEnum.Normal);
|
||||
var user_data =await _Db.Set<user>().Include(u=>u.roles).Where(u =>userIds.Contains(u.id) &&u.is_delete == (short)Common.Enum.DelFlagEnum.Normal).ToListAsync();
|
||||
if (user_data == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var roleList = _Db.Set<role>().Where(u => roleIds.Contains(u.id)).ToList();
|
||||
foreach(var item in user_data)
|
||||
{
|
||||
item.roles = roleList;
|
||||
}
|
||||
|
||||
user_data.roles = roleList;
|
||||
return await AddAsync(user_data);
|
||||
return await UpdateListAsync(user_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,36 +8,13 @@
|
||||
<Compile Remove="T4DaraContext.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="T4Service.cs">
|
||||
<DependentUpon>T4Service.tt</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Yi.Framework.Interface\Yi.Framework.Interface.csproj" />
|
||||
<ProjectReference Include="..\Yi.Framework.Model\Yi.Framework.Model.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="T4Service.tt">
|
||||
<LastGenOutput>T4Service.cs</LastGenOutput>
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="T4Service.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>T4Service.tt</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user