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