代码清理
This commit is contained in:
@ -1,15 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using DHSoftware.Models;
|
||||
using DHSoftware.Models;
|
||||
using DHSoftware.Utils;
|
||||
using SqlSugar;
|
||||
|
||||
namespace DHSoftware.Services
|
||||
{
|
||||
|
||||
public static class AuthService
|
||||
{
|
||||
public static User CurrentUser { get; private set; }
|
||||
@ -37,11 +31,11 @@ namespace DHSoftware.Services
|
||||
|
||||
using (var db = DatabaseUtil.GetDatabase())
|
||||
{
|
||||
return db.Queryable<UserRole>()
|
||||
.InnerJoin<RolePermission>((ur, rp) => ur.RoleId == rp.RoleId)
|
||||
.Where((ur, rp) => ur.UserId == CurrentUser.Id)
|
||||
.Where((ur, rp) => rp.PermissionCode == permissionCode)
|
||||
.Any();
|
||||
return db.Queryable<UserRole>()
|
||||
.InnerJoin<RolePermission>((ur, rp) => ur.RoleId == rp.RoleId)
|
||||
.Where((ur, rp) => ur.UserId == CurrentUser.Id)
|
||||
.Where((ur, rp) => rp.PermissionCode == permissionCode)
|
||||
.Any();
|
||||
}
|
||||
}
|
||||
|
||||
@ -67,4 +61,4 @@ namespace DHSoftware.Services
|
||||
.ExecuteCommand();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user