代码生成新增加导航查询

This commit is contained in:
不做码农
2022-05-08 14:08:18 +08:00
parent aba8768c44
commit 6ab0f86ca2
10 changed files with 67 additions and 36 deletions

View File

@@ -1,26 +1,22 @@
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Infrastructure;
using Infrastructure;
using Infrastructure.Attribute;
using Infrastructure.Enums;
using Infrastructure.Model;
using Mapster;
using Microsoft.AspNetCore.Mvc;
using ${options.ModelsNamespace}.Dto;
using ${options.ModelsNamespace}.Models;
using ${options.IServicsNamespace}.${options.SubNamespace}.I${options.SubNamespace}Service;
using ${options.ApiControllerNamespace}.Extensions;
using ${options.ApiControllerNamespace}.Filters;
using ZR.Common;
using Infrastructure.Extensions;
using System.Linq;
using ${options.BaseNamespace}.Common;
namespace ${options.ApiControllerNamespace}.Controllers
{
/// <summary>
/// ${genTable.functionName}Controller
///
///
/// @tableName ${genTable.TableName}
/// @author ${replaceDto.Author}
/// @date ${replaceDto.AddTime}
/// </summary>
@@ -97,14 +93,8 @@ $if(replaceDto.ShowBtnAdd)
//从 Dto 映射到 实体
var modal = parm.Adapt<${replaceDto.ModelTypeName}>().ToCreate(HttpContext);
var response = _${replaceDto.ModelTypeName}Service.Insert(modal, it => new
{
$foreach(item in genTable.Columns)
$if((item.IsInsert))
it.$item.CsharpField,
$end
${end}
});
var response = _${replaceDto.ModelTypeName}Service.Add${replaceDto.ModelTypeName}(modal);
return ToResponse(response);
}
$end