代码清理

This commit is contained in:
2025-03-24 19:24:16 +08:00
parent fb1ae0bb08
commit fabc7606e7
14 changed files with 425 additions and 547 deletions

View File

@ -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();
}
}
}
}