|
|
@@ -44,7 +44,7 @@ public class @(@Model.ClassName)Service : IDynamicApiController, ITransient
|
|
|
@if (haveLikeCdt) {
|
|
|
@:input.SearchKey = input.SearchKey?.Trim();
|
|
|
}
|
|
|
- var query = @(@Model.EntityName)Rep.AsQueryable()
|
|
|
+ var query = @(@Model.ClassName)Rep.AsQueryable()
|
|
|
@{string conditionFlag = "";}
|
|
|
@if (haveLikeCdt) {
|
|
|
@:.WhereIF(!string.IsNullOrEmpty(input.SearchKey), u =>
|
|
|
@@ -124,7 +124,7 @@ if (@column.QueryWhether == "Y"){
|
|
|
public async Task<long> Add(Add@(@Model.ClassName)Input input)
|
|
|
{
|
|
|
var entity = input.Adapt<@(@Model.ClassName)>();
|
|
|
- await @(@Model.EntityName)Rep.InsertAsync(entity);
|
|
|
+ await @(@Model.ClassName)Rep.InsertAsync(entity);
|
|
|
return entity.Id;
|
|
|
}
|
|
|
|
|
|
@@ -139,11 +139,11 @@ if (@column.QueryWhether == "Y"){
|
|
|
{
|
|
|
@foreach (var column in Model.TableField){
|
|
|
if (@column.ColumnKey == "True"){
|
|
|
- @:var entity = await @(@Model.EntityName)Rep.GetFirstAsync(u => u.@(@column.PropertyName) == input.@(@column.PropertyName)) ?? throw Oops.Oh(ErrorCodeEnum.D1002);
|
|
|
+ @:var entity = await @(@Model.ClassName)Rep.GetFirstAsync(u => u.@(@column.PropertyName) == input.@(@column.PropertyName)) ?? throw Oops.Oh(ErrorCodeEnum.D1002);
|
|
|
}
|
|
|
}
|
|
|
- await @(@Model.EntityName)Rep.FakeDeleteAsync(entity); //假删除
|
|
|
- //await @(@Model.EntityName)Rep.DeleteAsync(entity); //真删除
|
|
|
+ await @(@Model.ClassName)Rep.FakeDeleteAsync(entity); //假删除
|
|
|
+ //await @(@Model.ClassName)Rep.DeleteAsync(entity); //真删除
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -156,7 +156,7 @@ if (@column.ColumnKey == "True"){
|
|
|
public async Task Update(Update@(@Model.ClassName)Input input)
|
|
|
{
|
|
|
var entity = input.Adapt<@(@Model.ClassName)>();
|
|
|
- await @(@Model.EntityName)Rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
+ await @(@Model.ClassName)Rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -170,7 +170,7 @@ if (@column.ColumnKey == "True"){
|
|
|
{
|
|
|
@foreach (var column in Model.TableField){
|
|
|
if (@column.ColumnKey == "True"){
|
|
|
- @:return await @(@Model.EntityName)Rep.GetFirstAsync(u => u.@(@column.PropertyName) == input.@(@column.PropertyName));
|
|
|
+ @:return await @(@Model.ClassName)Rep.GetFirstAsync(u => u.@(@column.PropertyName) == input.@(@column.PropertyName));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -184,7 +184,7 @@ if (@column.ColumnKey == "True"){
|
|
|
[ApiDescriptionSettings(Name = "List")]
|
|
|
public async Task<List<@(@Model.ClassName)Output>> List([FromQuery] @(@Model.ClassName)Input input)
|
|
|
{
|
|
|
- return await @(@Model.EntityName)Rep.AsQueryable().Select<@(@Model.ClassName)Output>().ToListAsync();
|
|
|
+ return await @(@Model.ClassName)Rep.AsQueryable().Select<@(@Model.ClassName)Output>().ToListAsync();
|
|
|
}
|
|
|
|
|
|
@foreach (var column in Model.TableField){
|
|
|
@@ -197,7 +197,7 @@ if(@column.EffectType == "fk" && (@column.WhetherAddUpdate == "Y" || column.Quer
|
|
|
@:[ApiDescriptionSettings(Name = "@(@column.FkEntityName)@(@column.PropertyName)Dropdown"), HttpGet]
|
|
|
@:public async Task<dynamic> @(@column.FkEntityName)@(@column.PropertyName)Dropdown()
|
|
|
@:{
|
|
|
- @:return await @(@Model.EntityName)Rep.Context.Queryable<@(@column.FkEntityName)>()
|
|
|
+ @:return await @(@Model.ClassName)Rep.Context.Queryable<@(@column.FkEntityName)>()
|
|
|
@:.Select(u => new
|
|
|
@:{
|
|
|
@:Label = u.@(@column.FkColumnName),
|
|
|
@@ -231,7 +231,7 @@ if(@column.EffectType == "ApiTreeSelect" && !definedObjects.ContainsKey("@(@colu
|
|
|
@:[HttpGet("@(@column.FkEntityName)Tree")]
|
|
|
@:public async Task<dynamic> @(@column.FkEntityName)Tree()
|
|
|
@:{
|
|
|
- @:return await @(@Model.EntityName)Rep.Context.Queryable<@(@column.FkEntityName)>().ToTreeAsync(u => u.Children, u => u.@(@column.PidColumn), 0);
|
|
|
+ @:return await @(@Model.ClassName)Rep.Context.Queryable<@(@column.FkEntityName)>().ToTreeAsync(u => u.Children, u => u.@(@column.PidColumn), 0);
|
|
|
@:}
|
|
|
}
|
|
|
}
|