简单基类控制器封装

This commit is contained in:
chenchun
2022-09-10 20:49:46 +08:00
parent b5ad7a1721
commit 0dca7acee6
11 changed files with 172 additions and 144 deletions

View File

@@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Localization;
using Yi.Framework.Common.Helper;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Language;
@@ -15,7 +16,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// </summary>
/// <typeparam name="T"></typeparam>
[ApiController]
public class BaseCrudController<T> : ControllerBase where T : class, IBaseModelEntity,new()
public class BaseCrudController<T> : ControllerBase where T : class,new()
{
private readonly ILogger<T> _logger;
private IBaseService<T> _baseService;
@@ -95,7 +96,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
[HttpDelete]
public virtual async Task<Result> DeleteList(List<long> ids)
{
return Result.Success().SetStatus(await _repository.DeleteByLogicAsync(ids));
return Result.Success().SetStatus(await _repository.DeleteByIdAsync(ids.ToDynamicArray()));
}
}
}