优化代码生成

This commit is contained in:
不做码农
2022-06-10 17:47:52 +08:00
parent 39b51f3979
commit 2c005807f8
7 changed files with 37 additions and 26 deletions

View File

@@ -54,7 +54,7 @@ $end
var response = _${replaceDto.ModelTypeName}Repository
.Queryable()
$if(null != genTable.SubTableName && "" != genTable.SubTableName)
.Includes(it => it.Sub.MappingField(z => z.${genTable.SubTableFkName}, () => it.${replaceDto.PKName}))
.Includes(it => it.${genTable.SubTable.ClassName}.MappingField(z => z.${genTable.SubTableFkName}, () => it.${replaceDto.PKName}))
$end
$if(genTable.Options.SortField != "" && genTable.Options.SortField != null)
.OrderBy("${genTable.Options.SortField} ${genTable.Options.SortType}")
@@ -106,6 +106,24 @@ ${foreach(item in genTable.Columns)}
$if((item.IsInsert))
it.$item.CsharpField,
$end
${end}
});
return response;
}
/// <summary>
/// 修改${genTable.FunctionName}
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public int Update${replaceDto.ModelTypeName}(${replaceDto.ModelTypeName} parm)
{
var response = _${replaceDto.ModelTypeName}Repository.Update(w => w.${replaceDto.PKName} == parm.${replaceDto.PKName}, it => new ${replaceDto.ModelTypeName}()
{
$foreach(item in genTable.Columns)
$if((item.IsEdit))
$item.CsharpField = parm.$item.CsharpField,
$end
${end}
});
return response;