28 lines
824 B
C#
28 lines
824 B
C#
|
|
using SqlSugar;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
|
|||
|
|
namespace YY.Admin.Services.Service.User
|
|||
|
|
{
|
|||
|
|
public class SysUserRoleService : ISysUserRoleService, ISingletonDependency
|
|||
|
|
{
|
|||
|
|
private readonly ISqlSugarClient _dbContext;
|
|||
|
|
public SysUserRoleService(ISqlSugarClient context) {
|
|||
|
|
_dbContext=context;
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
///根据用户Id获取角色Id集合
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="userId"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public async Task<List<long>> GetUserRoleIdList(long userId)
|
|||
|
|
{
|
|||
|
|
return await _dbContext.Queryable<SysUserRole>()
|
|||
|
|
.Where(u => u.UserId == userId).Select(u => u.RoleId).ToListAsync();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|