更新仓储层上下文对象与接口命名规范

This commit is contained in:
chenchun
2022-04-12 18:09:13 +08:00
parent e7a27cc474
commit 796bba1abe
9 changed files with 57 additions and 7 deletions

View File

@@ -11,7 +11,7 @@ using Yi.Framework.WebCore.AttributeExtend;
namespace Yi.Framework.ApiMicroservice.Controllers
{
/// <summary>
/// 6666
/// Json To Sql 类比模式,通用模型
/// </summary>
/// <typeparam name="T"></typeparam>
[ApiController]
@@ -35,7 +35,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// <returns></returns>
[Permission($"{nameof(T)}:get:one")]
[HttpGet]
public async Task<Result> Get(long id)
public async Task<Result> GetById(long id)
{
return Result.Success().SetData(await _repository.GetByIdAsync(id));
}
@@ -58,7 +58,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// <returns></returns>
[Permission($"{nameof(T)}:get:page")]
[HttpPost]
public async Task<Result> Page(QueryPageCondition queryCondition)
public async Task<Result> PageList(QueryPageCondition queryCondition)
{
return Result.Success().SetData(await _repository.CommonPageAsync(queryCondition));
}

View File

@@ -22,10 +22,24 @@ namespace Yi.Framework.ApiMicroservice.Controllers
public class TestController : ControllerBase
{
private IStringLocalizer<LocalLanguage> _local;
private IUserService _iUserService;
public TestController(ILogger<UserEntity> logger, IUserService iUserService, IStringLocalizer<LocalLanguage> local)
{
_local = local;
_iUserService = iUserService;
}
/// <summary>
/// 仓储上下文对象测试
/// </summary>
/// <returns></returns>
[HttpGet]
/// 特点:仓储代理上下文对象,用起来就是爽
public async Task<Result> DbTest()
{
return Result.Success().SetData(await _iUserService.DbTest());
}
/// <summary>
/// 国际化测试
/// </summary>

View File

@@ -19,8 +19,10 @@ namespace Yi.Framework.ApiMicroservice.Controllers
[Route("api/[controller]/[action]")]
public class UserController : BaseCrudController<UserEntity>
{
private IUserService _iUserService;
public UserController(ILogger<UserEntity> logger, IUserService iUserService) : base(logger, iUserService)
{
_iUserService = iUserService;
}
}
}