mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-11-08 02:14:44 +08:00
添加角色处理
This commit is contained in:
@@ -20,7 +20,11 @@ namespace OpenAuth.Repository.Models.Mapping
|
||||
.IsRequired()
|
||||
.HasMaxLength(64);
|
||||
|
||||
this.Property(t => t.CreateOrgCascadeId)
|
||||
this.Property(t => t.OrgCascadeId)
|
||||
.IsRequired()
|
||||
.HasMaxLength(255);
|
||||
|
||||
this.Property(t => t.OrgName)
|
||||
.IsRequired()
|
||||
.HasMaxLength(255);
|
||||
|
||||
@@ -32,8 +36,9 @@ namespace OpenAuth.Repository.Models.Mapping
|
||||
this.Property(t => t.Type).HasColumnName("Type");
|
||||
this.Property(t => t.CreateTime).HasColumnName("CreateTime");
|
||||
this.Property(t => t.CreateId).HasColumnName("CreateId");
|
||||
this.Property(t => t.CreateOrgId).HasColumnName("CreateOrgId");
|
||||
this.Property(t => t.CreateOrgCascadeId).HasColumnName("CreateOrgCascadeId");
|
||||
this.Property(t => t.OrgId).HasColumnName("OrgId");
|
||||
this.Property(t => t.OrgCascadeId).HasColumnName("OrgCascadeId");
|
||||
this.Property(t => t.OrgName).HasColumnName("OrgName");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
<Compile Include="Models\OpenAuthDBContext.cs" />
|
||||
<Compile Include="OrgRepository.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="RoleRepository.cs" />
|
||||
<Compile Include="UserRepository.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
41
OpenAuth.Repository/RoleRepository.cs
Normal file
41
OpenAuth.Repository/RoleRepository.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using OpenAuth.Domain;
|
||||
using OpenAuth.Domain.Interface;
|
||||
|
||||
namespace OpenAuth.Repository
|
||||
{
|
||||
public class RoleRepository :BaseRepository<Role>, IRoleRepository
|
||||
{
|
||||
public IEnumerable<Role> LoadRoles(int pageindex, int pagesize)
|
||||
{
|
||||
return Context.Roles.OrderBy(u => u.Name).Skip((pageindex - 1) * pagesize).Take(pagesize);
|
||||
}
|
||||
|
||||
public int GetRoleCntInOrgs(params int[] orgIds)
|
||||
{
|
||||
return LoadInOrgs(orgIds).Count();
|
||||
}
|
||||
|
||||
public IEnumerable<Role> LoadInOrgs(int pageindex, int pagesize, params int[] orgIds)
|
||||
{
|
||||
return LoadInOrgs(orgIds).OrderBy(u => u.Name).Skip((pageindex - 1) * pagesize).Take(pagesize);
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
Delete(u =>u.Id == id);
|
||||
}
|
||||
|
||||
public IEnumerable<Role> LoadInOrgs(params int[] orgId)
|
||||
{
|
||||
var result = from role in Context.Roles.Where(u => orgId.Contains(u.OrgId)) select role;
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user