You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.7 KiB
C#
57 lines
1.7 KiB
C#
|
|
|
|
//----------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
|
|
{
|
|
/// <summary>
|
|
/// 用户和角色关联表Service
|
|
/// </summary>
|
|
public partial class SysUserRoleService : BaseServices<SysUserRole>, ISysUserRoleService
|
|
{
|
|
IBaseRepository<SysUserRole> dal;
|
|
public SysUserRoleService(IBaseRepository<SysUserRole> dal)
|
|
{
|
|
this.dal = dal;
|
|
BaseDal = dal;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据角色Key获取用户列表
|
|
/// </summary>
|
|
/// <param name="roleKey"></param>
|
|
/// <returns></returns>
|
|
public async Task<List<SysUser>> 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<SysUser>();
|
|
return list;
|
|
}
|
|
}
|
|
}
|
|
|
|
//----------SysUserRole结束----------
|
|
|