2
This commit is contained in:
parent
0ba9af398e
commit
3eff16f73b
|
|
@ -408,10 +408,12 @@ public class LowCodeTableService : ApplicationService<IRepository<LowCodeTable>>
|
|||
clientIndexPath = targetTable.ClientIndexPath,
|
||||
clientInfoPath = targetTable.ClientInfoPath,
|
||||
clientServicePath = targetTable.ClientServicePath,
|
||||
menuPath = targetTable.MenuPath,
|
||||
routerPath = targetTable.RouterPath,
|
||||
isCover = targetTable.IsCover ?? false
|
||||
};
|
||||
res["menu"] = $"views/apps/{targetTable.TableName}s/Index.vue";
|
||||
res["router"] = $"/apps/{targetTable.TableName?.ToLower()}s";
|
||||
res["menu"] = targetTable.MenuPath ?? $"views/apps/{targetTable.TableName}s/Index.vue";
|
||||
res["router"] = targetTable.RouterPath ?? $"/apps/{targetTable.TableName?.ToLower()}s";
|
||||
|
||||
return Task.FromResult(res);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,6 +50,16 @@ public class DataSourceConfig
|
|||
/// </summary>
|
||||
public string ClientServicePathTemplate { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 前端菜单路径模板(支持占位符:{TableName}, {TableNameLower})
|
||||
/// </summary>
|
||||
public string MenuPathTemplate { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 前端路由路径模板(支持占位符:{TableName}, {TableNameLower})
|
||||
/// </summary>
|
||||
public string RouterPathTemplate { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 代码生成模板目录
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ public class PathResolver : IScopedDependency
|
|||
|
||||
var entityName = GetEntityName(tableName, config);
|
||||
var entityNamePlural = config.UsesPluralPath ? entityName + "s" : entityName;
|
||||
var tableNameLower = string.IsNullOrWhiteSpace(tableName) ? string.Empty : tableName.ToLower();
|
||||
|
||||
return template
|
||||
.Replace("{RootPath}", rootPath)
|
||||
|
|
@ -40,7 +41,8 @@ public class PathResolver : IScopedDependency
|
|||
.Replace("{Namespace}", config.EntityNamespace)
|
||||
.Replace("{EntityName}", entityName)
|
||||
.Replace("{EntityNamePlural}", entityNamePlural)
|
||||
.Replace("{TableName}", tableName);
|
||||
.Replace("{TableName}", tableName)
|
||||
.Replace("{TableNameLower}", tableNameLower);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -70,6 +70,16 @@ public class LowCodeTable
|
|||
/// </summary>
|
||||
public string? ClientServicePath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 前端菜单路径
|
||||
/// </summary>
|
||||
public string? MenuPath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 前端路由路径
|
||||
/// </summary>
|
||||
public string? RouterPath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否覆盖生成
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -177,19 +177,31 @@ public class CodeGenerationService : ICodeGenerationService, IScopedDependency
|
|||
if (string.IsNullOrWhiteSpace(lowCodeTable.ClientIndexPath))
|
||||
{
|
||||
lowCodeTable.ClientIndexPath = _pathResolver.ResolvePath(
|
||||
config.ClientIndexPathTemplate, config, lowCodeTable.TableName);
|
||||
config.ClientIndexPathTemplate, config, lowCodeTable.TableName ?? string.Empty);
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(lowCodeTable.ClientInfoPath))
|
||||
{
|
||||
lowCodeTable.ClientInfoPath = _pathResolver.ResolvePath(
|
||||
config.ClientInfoPathTemplate, config, lowCodeTable.TableName);
|
||||
config.ClientInfoPathTemplate, config, lowCodeTable.TableName ?? string.Empty);
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(lowCodeTable.ClientServicePath))
|
||||
{
|
||||
lowCodeTable.ClientServicePath = _pathResolver.ResolvePath(
|
||||
config.ClientServicePathTemplate, config, lowCodeTable.TableName);
|
||||
config.ClientServicePathTemplate, config, lowCodeTable.TableName ?? string.Empty);
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(lowCodeTable.MenuPath))
|
||||
{
|
||||
lowCodeTable.MenuPath = _pathResolver.ResolvePath(
|
||||
config.MenuPathTemplate, config, lowCodeTable.TableName ?? string.Empty);
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(lowCodeTable.RouterPath))
|
||||
{
|
||||
lowCodeTable.RouterPath = _pathResolver.ResolvePath(
|
||||
config.RouterPathTemplate, config, lowCodeTable.TableName ?? string.Empty);
|
||||
}
|
||||
|
||||
return lowCodeTable;
|
||||
|
|
|
|||
|
|
@ -21,9 +21,11 @@ public class AdminDataSourceProvider : IDataSourceProvider, IScopedDependency
|
|||
ModelPathTemplate = "{RootPath}\\{Namespace}\\Entities\\Apps\\{EntityNamePlural}",
|
||||
ServicePathTemplate = "{AppPath}\\ApplicationServices\\Apps\\{EntityNamePlural}",
|
||||
ControllerPathTemplate = "{AppPath}\\Controllers\\Apps\\{EntityNamePlural}",
|
||||
ClientIndexPathTemplate = "{RootPath}\\admin-client\\src\\views\\apps\\{TableName}s",
|
||||
ClientInfoPathTemplate = "{RootPath}\\admin-client\\src\\views\\apps\\{TableName}s",
|
||||
ClientServicePathTemplate = "{RootPath}\\admin-client\\src\\services\\apps\\{TableName}s",
|
||||
ClientIndexPathTemplate = "{RootPath}\\admin-client\\src\\views\\apps\\{TableNameLower}s",
|
||||
ClientInfoPathTemplate = "{RootPath}\\admin-client\\src\\views\\apps\\{TableNameLower}s",
|
||||
ClientServicePathTemplate = "{RootPath}\\admin-client\\src\\services\\apps\\{TableNameLower}s",
|
||||
MenuPathTemplate = "views/apps/{TableNameLower}s/Index.vue",
|
||||
RouterPathTemplate = "/apps/{TableNameLower}s",
|
||||
TemplatePath = "/wwwroot/code_generation/template/",
|
||||
NamingStrategy = EntityNamingStrategy.ToPascalCase,
|
||||
Order = 1,
|
||||
|
|
|
|||
|
|
@ -21,9 +21,11 @@ public class MiaoYuChatDataSourceProvider : IDataSourceProvider, IScopedDependen
|
|||
ModelPathTemplate = "{RootPath}\\{Namespace}\\Entities\\Apps\\{EntityNamePlural}",
|
||||
ServicePathTemplate = "{AppPath}\\ApplicationServices\\Apps\\ChatAI\\{EntityNamePlural}",
|
||||
ControllerPathTemplate = "{AppPath}\\Controllers\\Apps\\ChatAI\\{EntityNamePlural}",
|
||||
ClientIndexPathTemplate = "{RootPath}\\admin-client\\src\\views\\apps\\chatai\\{TableName}s",
|
||||
ClientInfoPathTemplate = "{RootPath}\\admin-client\\src\\views\\apps\\chatai\\{TableName}s",
|
||||
ClientServicePathTemplate = "{RootPath}\\admin-client\\src\\services\\apps\\chatai\\{TableName}s",
|
||||
ClientIndexPathTemplate = "{RootPath}\\admin-client\\src\\views\\apps\\chatai\\{TableNameLower}s",
|
||||
ClientInfoPathTemplate = "{RootPath}\\admin-client\\src\\views\\apps\\chatai\\{TableNameLower}s",
|
||||
ClientServicePathTemplate = "{RootPath}\\admin-client\\src\\services\\apps\\chatai\\{TableNameLower}s",
|
||||
MenuPathTemplate = "views/apps/chatai/{TableNameLower}s/Index.vue",
|
||||
RouterPathTemplate = "/apps/chatai/{TableNameLower}s",
|
||||
TemplatePath = "/wwwroot/code_generation/template/",
|
||||
NamingStrategy = EntityNamingStrategy.ToPascalCase,
|
||||
Order = 2,
|
||||
|
|
|
|||
|
|
@ -21,9 +21,11 @@ public class LiveForumDataSourceProvider : IDataSourceProvider, IScopedDependenc
|
|||
ModelPathTemplate = "{RootPath}\\{Namespace}\\Entities\\Apps\\{EntityNamePlural}",
|
||||
ServicePathTemplate = "{AppPath}\\ApplicationServices\\Apps\\LiveForum\\{EntityNamePlural}",
|
||||
ControllerPathTemplate = "{AppPath}\\Controllers\\Apps\\LiveForum\\{EntityNamePlural}",
|
||||
ClientIndexPathTemplate = "{RootPath}\\admin-client\\src\\views\\apps\\liveforum\\{TableName}",
|
||||
ClientInfoPathTemplate = "{RootPath}\\admin-client\\src\\views\\apps\\liveforum\\{TableName}",
|
||||
ClientServicePathTemplate = "{RootPath}\\admin-client\\src\\services\\apps\\liveforum\\{TableName}",
|
||||
ClientIndexPathTemplate = "{RootPath}\\admin-client\\src\\views\\apps\\liveforum\\{TableNameLower}",
|
||||
ClientInfoPathTemplate = "{RootPath}\\admin-client\\src\\views\\apps\\liveforum\\{TableNameLower}",
|
||||
ClientServicePathTemplate = "{RootPath}\\admin-client\\src\\services\\apps\\liveforum\\{TableNameLower}",
|
||||
MenuPathTemplate = "views/apps/liveforum/{TableNameLower}/Index.vue",
|
||||
RouterPathTemplate = "/apps/liveforum/{TableNameLower}",
|
||||
TemplatePath = "/wwwroot/code_generation/template/",
|
||||
NamingStrategy = EntityNamingStrategy.KeepOriginal,
|
||||
Order = 3,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user