mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-11-08 18:34:44 +08:00
同步openauth.Core:
采用代码生成器的表结构控制前端显示,删除以前按照dbset获取数据库结构 优化注释 升级EF及所有三方的版本
This commit is contained in:
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using OpenAuth.App.Interface;
|
||||
using OpenAuth.App.Request;
|
||||
using OpenAuth.App.Response;
|
||||
@@ -25,15 +26,13 @@ namespace OpenAuth.App
|
||||
{
|
||||
throw new CommonException("登录已过期", Define.INVALID_TOKEN);
|
||||
}
|
||||
|
||||
var properties = loginContext.GetProperties("DataPrivilegeRule");
|
||||
|
||||
if (properties == null || properties.Count == 0)
|
||||
|
||||
var columnFields = loginContext.GetTableColumns("DataPrivilegeRule");
|
||||
if (columnFields == null || columnFields.Count == 0)
|
||||
{
|
||||
throw new Exception("当前登录用户没有访问该模块字段的权限,请联系管理员配置");
|
||||
throw new Exception("请在代码生成界面配置DataPrivilegeRule表的字段属性");
|
||||
}
|
||||
|
||||
|
||||
var result = new TableData();
|
||||
var objs = UnitWork.Find<DataPrivilegeRule>(null);
|
||||
if (!string.IsNullOrEmpty(request.key))
|
||||
@@ -41,13 +40,12 @@ namespace OpenAuth.App
|
||||
objs = objs.Where(u => u.Id.Contains(request.key) || u.SourceCode.Contains(request.key) || u.Description.Contains(request.key));
|
||||
}
|
||||
|
||||
|
||||
var propertyStr = string.Join(',', properties.Select(u => u.Key));
|
||||
result.columnHeaders = properties;
|
||||
var propertyStr = string.Join(',', columnFields.Select(u => u.ColumnName));
|
||||
result.columnFields = columnFields;
|
||||
result.data = objs.OrderBy(u => u.Id)
|
||||
.Skip((request.page - 1) * request.limit)
|
||||
.Take(request.limit).Select($"new ({propertyStr})");
|
||||
result.count = objs.Count();
|
||||
result.count = await objs.CountAsync();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user