紧急修复CodeSmith模版

This commit is contained in:
yubaolee
2021-11-04 16:31:38 +08:00
parent 1c699eda26
commit 5c060f8ed9
2 changed files with 11 additions and 11 deletions

View File

@@ -40,10 +40,10 @@ namespace OpenAuth.App
{
throw new CommonException("登录已过期", Define.INVALID_TOKEN);
}
var properties = loginContext.GetProperties("<%=Table.Name%>");
if (properties == null || properties.Count == 0)
var columnFields = loginContext.GetTableColumns("<%=Table.Name%>");
if (columnFields == null || columnFields.Count == 0)
{
throw new Exception("当前登录用户没有访问该模块字段的权限,请联系管理员配置");
throw new Exception("请在代码生成界面配置Category表的字段属性");
}
var result = new TableData();
var objs = UnitWork.Find<<%=Table.Name%>>(null);
@@ -51,8 +51,8 @@ namespace OpenAuth.App
{
objs = objs.Where(u => u.Id.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})");