|
|
@@ -219,8 +219,8 @@ public class SysCodeGenService : IDynamicApiController, ITransient
|
|
|
{
|
|
|
var columnOutput = result[i];
|
|
|
// 先找自定义字段名的,如果找不到就再找自动生成字段名的(并且过滤掉没有SugarColumn的属性)
|
|
|
- var propertyInfo = entityProperties.FirstOrDefault(p => (p.GetCustomAttribute<SugarColumn>()?.ColumnName ?? "").ToLower() == columnOutput.ColumnName.ToLower()) ??
|
|
|
- entityProperties.FirstOrDefault(p => p.GetCustomAttribute<SugarColumn>() != null && p.Name.ToLower() == (config.DbSettings.EnableUnderLine
|
|
|
+ var propertyInfo = entityProperties.FirstOrDefault(u => (u.GetCustomAttribute<SugarColumn>()?.ColumnName ?? "").ToLower() == columnOutput.ColumnName.ToLower()) ??
|
|
|
+ entityProperties.FirstOrDefault(u => u.GetCustomAttribute<SugarColumn>() != null && u.Name.ToLower() == (config.DbSettings.EnableUnderLine
|
|
|
? CodeGenUtil.CamelColumnName(columnOutput.ColumnName, entityBasePropertyNames).ToLower()
|
|
|
: columnOutput.ColumnName.ToLower()));
|
|
|
if (propertyInfo != null)
|
|
|
@@ -269,11 +269,11 @@ public class SysCodeGenService : IDynamicApiController, ITransient
|
|
|
}
|
|
|
).ToArray();
|
|
|
|
|
|
- foreach (var c in cosType)
|
|
|
+ foreach (var ct in cosType)
|
|
|
{
|
|
|
- var sugarAttribute = c.GetCustomAttributes(type, true)?.FirstOrDefault();
|
|
|
+ var sugarAttribute = ct.GetCustomAttributes(type, true)?.FirstOrDefault();
|
|
|
|
|
|
- var des = c.GetCustomAttributes(typeof(DescriptionAttribute), true);
|
|
|
+ var des = ct.GetCustomAttributes(typeof(DescriptionAttribute), true);
|
|
|
var description = "";
|
|
|
if (des.Length > 0)
|
|
|
{
|
|
|
@@ -281,10 +281,10 @@ public class SysCodeGenService : IDynamicApiController, ITransient
|
|
|
}
|
|
|
entityInfos.Add(new EntityInfo()
|
|
|
{
|
|
|
- EntityName = c.Name,
|
|
|
- DbTableName = sugarAttribute == null ? c.Name : ((SugarTable)sugarAttribute).TableName,
|
|
|
+ EntityName = ct.Name,
|
|
|
+ DbTableName = sugarAttribute == null ? ct.Name : ((SugarTable)sugarAttribute).TableName,
|
|
|
TableDescription = sugarAttribute == null ? description : ((SugarTable)sugarAttribute).TableDescription,
|
|
|
- Type = c
|
|
|
+ Type = ct
|
|
|
});
|
|
|
}
|
|
|
return await Task.FromResult(entityInfos);
|
|
|
@@ -408,6 +408,7 @@ public class SysCodeGenService : IDynamicApiController, ITransient
|
|
|
/// <param name="busName"></param>
|
|
|
/// <param name="pid"></param>
|
|
|
/// <param name="menuIcon"></param>
|
|
|
+ /// <param name="pagePath"></param>
|
|
|
/// <param name="tableFieldList"></param>
|
|
|
/// <returns></returns>
|
|
|
private async Task AddMenu(string className, string busName, long pid, string menuIcon, string pagePath, List<CodeGenConfig> tableFieldList)
|