代码生成添加方法返回实体类

This commit is contained in:
不做码农 2023-07-20 18:22:36 +08:00
parent 95b0178dd4
commit 6d6a03ddea
3 changed files with 5 additions and 5 deletions

View File

@ -88,7 +88,7 @@ $if(replaceDto.ShowBtnAdd)
var response = _${replaceDto.ModelTypeName}Service.Add${replaceDto.ModelTypeName}(modal); var response = _${replaceDto.ModelTypeName}Service.Add${replaceDto.ModelTypeName}(modal);
return ToResponse(response); return SUCCESS(response);
} }
$end $end

View File

@ -18,7 +18,7 @@ namespace ${options.IServicsNamespace}.${options.SubNamespace}.I${options.SubNam
$if(genTable.TplCategory == "tree") $if(genTable.TplCategory == "tree")
List<${replaceDto.ModelTypeName}> GetTreeList(${replaceDto.ModelTypeName}QueryDto parm); List<${replaceDto.ModelTypeName}> GetTreeList(${replaceDto.ModelTypeName}QueryDto parm);
$end $end
int Add${replaceDto.ModelTypeName}(${replaceDto.ModelTypeName} parm); ${replaceDto.ModelTypeName} Add${replaceDto.ModelTypeName}(${replaceDto.ModelTypeName} parm);
int Update${replaceDto.ModelTypeName}(${replaceDto.ModelTypeName} parm); int Update${replaceDto.ModelTypeName}(${replaceDto.ModelTypeName} parm);
$if(replaceDto.ShowBtnTruncate) $if(replaceDto.ShowBtnTruncate)

View File

@ -112,12 +112,12 @@ $end
/// </summary> /// </summary>
/// <param name="model"></param> /// <param name="model"></param>
/// <returns></returns> /// <returns></returns>
public int Add${replaceDto.ModelTypeName}(${replaceDto.ModelTypeName} model) public ${replaceDto.ModelTypeName} Add${replaceDto.ModelTypeName}(${replaceDto.ModelTypeName} model)
{ {
$if(null != genTable.SubTableName && "" != genTable.SubTableName) $if(null != genTable.SubTableName && "" != genTable.SubTableName)
return Context.InsertNav(model).Include(s1 => s1.${genTable.SubTable.ClassName}Nav).ExecuteCommand() ? 1 : 0; return Context.InsertNav(model).Include(s1 => s1.${genTable.SubTable.ClassName}Nav).ExecuteReturnEntity();
$else $else
return Add(model, true); return Insertable(model).IgnoreColumns(true).ExecuteReturnEntity();
$end $end
} }