优化仓储、Service
This commit is contained in:
@@ -11,16 +11,6 @@ namespace ZR.Repository.System
|
||||
[AppService(ServiceLifetime = LifeTime.Transient)]
|
||||
public class SysUserRoleRepository : BaseRepository<SysUserRole>
|
||||
{
|
||||
/// <summary>
|
||||
/// 删除用户角色
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
public int DeleteUserRoleByUserId(int userId)
|
||||
{
|
||||
return Context.Deleteable<SysUserRole>().Where(it => it.UserId == userId).ExecuteCommand();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量删除角色对应用户
|
||||
/// </summary>
|
||||
@@ -33,36 +23,6 @@ namespace ZR.Repository.System
|
||||
.ExecuteCommand();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加用户角色
|
||||
/// </summary>
|
||||
/// <param name="sysUsers"></param>
|
||||
/// <returns></returns>
|
||||
public int AddUserRole(List<SysUserRole> sysUsers)
|
||||
{
|
||||
return Context.Insertable(sysUsers).ExecuteCommand();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除角色关联的用户
|
||||
/// </summary>
|
||||
/// <param name="roleId"></param>
|
||||
/// <returns></returns>
|
||||
public int DeleteUserRoleByRoleId(int roleId)
|
||||
{
|
||||
return Context.Deleteable<SysUserRole>().In(roleId).ExecuteCommand();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取角色分配个数
|
||||
/// </summary>
|
||||
/// <param name="roleId"></param>
|
||||
/// <returns></returns>
|
||||
public int CountUserRoleByRoleId(long roleId)
|
||||
{
|
||||
return Context.Queryable<SysUserRole>().Where(it => it.RoleId == roleId).Count();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户数据根据角色id
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user