添加各个木块代码生成
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Yi.Framework.Common.Models;
|
||||
using Yi.Framework.DtoModel.#ModelName#.#EntityName#;
|
||||
using Yi.Framework.Interface.#ModelName#;
|
||||
|
||||
namespace Yi.Framework.ApiMicroservice.Controllers.#ModelName#
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]/[action]")]
|
||||
public class #EntityName#Controller : ControllerBase
|
||||
{
|
||||
private readonly ILogger<#EntityName#Controller> _logger;
|
||||
private readonly I#EntityName#Service _#LowerEntityName#Service;
|
||||
public #EntityName#Controller(ILogger<#EntityName#Controller> logger, I#EntityName#Service #LowerEntityName#Service)
|
||||
{
|
||||
_logger = logger;
|
||||
_#LowerEntityName#Service = #LowerEntityName#Service;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分页查
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<Result> PageList([FromQuery] #EntityName#CreateUpdateInput input, [FromQuery] PageParModel page)
|
||||
{
|
||||
var result = await _#LowerEntityName#Service.PageListAsync(input, page);
|
||||
return Result.Success().SetData(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 单查
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("{id}")]
|
||||
public async Task<Result> GetById(long id)
|
||||
{
|
||||
var result = await _#LowerEntityName#Service.GetByIdAsync(id);
|
||||
return Result.Success().SetData(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 增
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<Result> Create(#EntityName#CreateUpdateInput input)
|
||||
{
|
||||
var result = await _#LowerEntityName#Service.CreateAsync(input);
|
||||
return Result.Success().SetData(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
[Route("{id}")]
|
||||
public async Task<Result> Update(long id, #EntityName#CreateUpdateInput input)
|
||||
{
|
||||
var result = await _#LowerEntityName#Service.UpdateAsync(id, input);
|
||||
return Result.Success().SetData(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete]
|
||||
public async Task<Result> Del(List<long> ids)
|
||||
{
|
||||
await _#LowerEntityName#Service.DeleteAsync(ids);
|
||||
return Result.Success();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user