//----------SysUserRole开始----------
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Admin.Core.Common;
using Admin.Core.IRepository;
using Admin.Core.IService.ISys;
using Admin.Core.Model.Sys;
using SqlSugar;
namespace Admin.Core.Service.Sys
{
///
/// 用户和角色关联表Service
///
public partial class SysUserRoleService : BaseServices, ISysUserRoleService
{
IBaseRepository dal;
public SysUserRoleService(IBaseRepository dal)
{
this.dal = dal;
BaseDal = dal;
}
///
/// 根据角色Key获取用户列表
///
///
///
public async Task> GetAllUser(string roleKey)
{
var sql = @" select distinct a.*,d.DeptName from SysUser a,SysUserRole b,SysRole c,SysDept d
where c.RoleKey=@roleKey
and c.RoleID=b.RoleID
and b.UserID=a.UserID
and d.DeptID=a.DeptID
and a.DelFlag=0
and a.[Status]=0";
SugarParameter[] parameters = new SugarParameter[]
{
new SugarParameter("@roleKey",roleKey),
};
var dt = await dal.QueryTableAsync(sql, parameters);
var list = dt.ToDataList();
return list;
}
}
}
//----------SysUserRole结束----------