代码生成新增是否显示指定按钮
This commit is contained in:
@@ -52,6 +52,10 @@ namespace ZR.CodeGenerator
|
||||
replaceDto.ModelTypeName = dto.GenTable.ClassName;//表名对应C# 实体类名
|
||||
replaceDto.PermissionPrefix = $"{dto.GenTable.ModuleName}:{dto.GenTable.ClassName.ToLower()}";//权限
|
||||
replaceDto.Author = dto.GenTable.FunctionAuthor;
|
||||
replaceDto.ShowBtnAdd = dto.CheckedBtn.Any(f => f == 1);
|
||||
replaceDto.ShowBtnEdit = dto.CheckedBtn.Any(f => f == 2);
|
||||
replaceDto.ShowBtnDelete = dto.CheckedBtn.Any(f => f == 3);
|
||||
replaceDto.ShowBtnExport = dto.CheckedBtn.Any(f => f == 4);
|
||||
|
||||
//循环表字段信息
|
||||
foreach (GenTableColumn dbFieldInfo in dto.GenTable.Columns)
|
||||
@@ -262,7 +266,7 @@ namespace ZR.CodeGenerator
|
||||
{
|
||||
if (!string.IsNullOrEmpty(searcList[i].ToString()))
|
||||
{
|
||||
tableName = tableName.Replace(searcList[i], "");
|
||||
tableName = tableName.Replace(searcList[i], "", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -276,11 +280,11 @@ namespace ZR.CodeGenerator
|
||||
/// <returns>业务名</returns>
|
||||
public static string GetBusinessName(string tableName)
|
||||
{
|
||||
int lastIndex = tableName.IndexOf("_");//_前缀长度
|
||||
int nameLength = tableName.Length;
|
||||
int subLength = (nameLength - lastIndex) - 1;
|
||||
string businessName = tableName[(lastIndex + 1)..];
|
||||
return businessName.Substring(0, 1).ToUpper() + tableName[1..].Replace("_", "");
|
||||
//int firstIndex = tableName.IndexOf("_");//_前缀长度
|
||||
//int nameLength = tableName.Length;
|
||||
//int subLength = (nameLength - lastIndex) - 1;
|
||||
//string businessName = tableName[(lastIndex + 1)..];
|
||||
return tableName.Substring(0, 1).ToUpper() + tableName[1..].Replace("_", "");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -427,9 +431,11 @@ namespace ZR.CodeGenerator
|
||||
options.Data.Set("replaceDto", replaceDto);
|
||||
options.Data.Set("options", dto.GenOptions);
|
||||
options.Data.Set("genTable", dto.GenTable);
|
||||
options.Data.Set("btns", dto.CheckedBtn);
|
||||
//options.Data.Set("codeTool", new CodeGeneratorTool());
|
||||
options.EnableCache = true;
|
||||
//...其它数据
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,10 @@ namespace ZR.CodeGenerator.Model
|
||||
/// 生成代码的数据库类型 0、mysql 1、sqlserver
|
||||
/// </summary>
|
||||
public int DbType { get; set; }
|
||||
/// <summary>
|
||||
/// 生成的按钮功能
|
||||
/// </summary>
|
||||
public int[] CheckedBtn { get; set; }
|
||||
public GenTable GenTable { get; set; }
|
||||
public CodeGenerateOption GenOptions { get; set; }
|
||||
#region 存储路径
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace ZR.CodeGenerator.Model
|
||||
/// </summary>
|
||||
public string ModelTypeName { get; set; }
|
||||
//vue、api
|
||||
public string VueViewFormResetHtml { get; set; }
|
||||
//public string VueViewFormResetHtml { get; set; }
|
||||
/// <summary>
|
||||
/// 前端列表查询html
|
||||
/// </summary>
|
||||
@@ -47,7 +47,10 @@ namespace ZR.CodeGenerator.Model
|
||||
/// 查询条件
|
||||
/// </summary>
|
||||
public string QueryCondition { get; set; } = "";
|
||||
|
||||
public bool ShowBtnExport { get; set; }
|
||||
public bool ShowBtnAdd { get; set; }
|
||||
public bool ShowBtnEdit { get; set; }
|
||||
public bool ShowBtnDelete { get; set; }
|
||||
/// <summary>
|
||||
/// 上传URL data
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user