修复web_api模板接口名称小写

This commit is contained in:
轻风2016 2024-08-28 16:24:49 +08:00
parent 5f85b9ecc9
commit 4ce691641f
2 changed files with 19 additions and 5 deletions

View File

@ -214,7 +214,7 @@ if(@column.EffectType == "fk" && (@column.WhetherAddUpdate == "Y" || column.Quer
@:/// 获取@(@column.ColumnComment)列表
@:/// </summary>
@:/// <returns></returns>
@:[ApiDescriptionSettings(Name = "@(@column.FkEntityName)@(@column.PropertyName)Dropdown", Description = "获取@(@column.ColumnComment)列表", Order = 940), HttpGet]
@:[ApiDescriptionSettings(Name = "@(LowerFirstLetter(@column.FkEntityName))@(@column.PropertyName)Dropdown", Description = "获取@(@column.ColumnComment)列表", Order = 940), HttpGet]
@:[DisplayName("获取@(@column.ColumnComment)列表")]
@:public async Task<List<LabelValueOutput>> @(@column.FkEntityName)@(@column.PropertyName)Dropdown()
@:{
@ -236,7 +236,7 @@ if(@column.EffectType == "Upload"){
@:/// </summary>
@:/// <param name="file"></param>
@:/// <returns></returns>
@:[ApiDescriptionSettings(Name = "Upload@(@column.PropertyName)", Description = "上传@(@column.ColumnComment)", Order = 930), HttpPost]
@:[ApiDescriptionSettings(Name = "upload@(@column.PropertyName)", Description = "上传@(@column.ColumnComment)", Order = 930), HttpPost]
@:[DisplayName("上传@(@column.ColumnComment)")]
@:public async Task<SysFile> Upload@(@column.PropertyName)([Required] IFormFile file)
@:{
@ -249,7 +249,7 @@ if(@column.EffectType == "Upload"){
@foreach (var column in Model.TableField){
if(@column.EffectType == "ApiTreeSelect" && !definedObjects.ContainsKey("@(@column.FkEntityName)Tree")){
@{definedObjects.Add("@(@column.FkEntityName)Tree", 1);}
@:[ApiDescriptionSettings(Name = ""@(@column.FkEntityName)Tree"", Description = "获取@(@column.ColumnComment)列表", Order = 920), HttpGet]
@:[ApiDescriptionSettings(Name = "@(LowerFirstLetter(@column.FkEntityName))Tree", Description = "获取@(@column.ColumnComment)列表", Order = 920), HttpGet]
@:[DisplayName("获取@(@column.FkEntityName)Tree")]
@:public async Task<dynamic> @(@column.FkEntityName)Tree()
@:{
@ -286,3 +286,10 @@ if(@column.EffectType == "ApiTreeSelect" && !definedObjects.ContainsKey("@(@colu
}
}
@{
string LowerFirstLetter(string text)
{
return text.ToString()[..1].ToLower() + text[1..]; // 首字母小写
}
}

View File

@ -23,10 +23,10 @@ enum Api {
}
@foreach (var column in Model.TableField){
if(@column.EffectType == "fk" && (@column.WhetherAddUpdate == "Y" || column.QueryWhether == "Y")){
@:Get@(@column.FkEntityName)@(@column.PropertyName)Dropdown = '/api/@(@Model.LowerClassName)/@(@column.FkEntityName)@(@column.PropertyName)Dropdown',
@:Get@(@column.FkEntityName)@(@column.PropertyName)Dropdown = '/api/@(@Model.LowerClassName)/@(LowerFirstLetter(@column.FkEntityName))@(@column.PropertyName)Dropdown',
}else if(@column.EffectType == "ApiTreeSelect" && !definedObjects.ContainsKey("Get@(@column.FkEntityName)Tree")){
@{definedObjects.Add("Get@(@column.FkEntityName)Tree", 1);}
@:Get@(@column.FkEntityName)Tree = '/api/@(@Model.LowerClassName)/@(@column.FkEntityName)Tree',
@:Get@(@column.FkEntityName)Tree = '/api/@(@Model.LowerClassName)/@(LowerFirstLetter(@column.FkEntityName))Tree',
}else if(@column.EffectType == "Upload"){
@:Upload@(@column.PropertyName) = '/api/@(@Model.LowerClassName)/upload@(@column.PropertyName)',
}
@ -136,4 +136,11 @@ if(@column.EffectType == "Upload"){
@:method: 'post',
@:data: params,
@:});
}
@{
string LowerFirstLetter(string text)
{
return text.ToString()[..1].ToLower() + text[1..]; // 首字母小写
}
}