first commit
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
using F9WebAiTest.Application.Common;
|
||||
using F9WebAiTest.Application.Dtos;
|
||||
using F9WebAiTest.Application.Dtos.Prod;
|
||||
using F9WebAiTest.Application.Services;
|
||||
using F9WebAiTest.Application.Services.Prod;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace F9WebAiTest.Api.Controllers.Prod;
|
||||
|
||||
[ApiController]
|
||||
[Route("api/hbjy")]
|
||||
[Authorize]
|
||||
public class HbjyController : ControllerBase
|
||||
{
|
||||
private readonly IHbjyService _svc;
|
||||
public HbjyController(IHbjyService svc) => _svc = svc;
|
||||
|
||||
// 黑板检验列表
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> GetPaged(
|
||||
[FromQuery] int pageIndex = 1, [FromQuery] int pageSize = 20,
|
||||
[FromQuery] DateTime? date = null, [FromQuery] long? deptId = null)
|
||||
=> Ok(ApiResult<PageResult<HbjyListItemDto>>.Ok(await _svc.GetPagedAsync(pageIndex, pageSize, date, deptId)));
|
||||
|
||||
// 获取检验编辑数据
|
||||
[HttpGet("{lsjlId}")]
|
||||
public async Task<IActionResult> GetEdit(long lsjlId)
|
||||
{
|
||||
try { return Ok(ApiResult<HbjyEditDto>.Ok(await _svc.GetEditAsync(lsjlId))); }
|
||||
catch (ServiceException ex) { return StatusCode(ex.Code, ApiResult<object>.Fail(ex.Message, ex.Code)); }
|
||||
}
|
||||
|
||||
// 保存黑板检验
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> Save([FromBody] HbjySaveDto dto)
|
||||
{
|
||||
try { await _svc.SaveAsync(dto); return Ok(ApiResult<object>.Ok(null, "保存成功")); }
|
||||
catch (ServiceException ex) { return StatusCode(ex.Code, ApiResult<object>.Fail(ex.Message, ex.Code)); }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user