This commit is contained in:
DESKTOP-H2PAFLR\Administrator
2023-10-12 10:23:34 +08:00
parent e43a04bc8f
commit 3a9a961fd6
9 changed files with 55 additions and 43 deletions

View File

@@ -3,17 +3,18 @@ using Microsoft.AspNetCore.Mvc;
using System.Diagnostics.CodeAnalysis;
using ZR.Admin.WebApi.Extensions;
using ZR.Model.mes.md;
using ZR.Model.System.Dto;
using ZR.Service.mes.md;
using ZR.Service.mes.md.IService;
namespace ZR.Admin.WebApi.Controllers.mes.md
{
[Route("mes/md/workshop")]
public class WorkshopController : BaseController
public class MdWorkshopController : BaseController
{
IMdWorkshopService mdWorkshopService;
public WorkshopController(IMdWorkshopService mdWorkshopService)
public MdWorkshopController(IMdWorkshopService mdWorkshopService)
{
this.mdWorkshopService = mdWorkshopService;
}
@@ -43,6 +44,10 @@ namespace ZR.Admin.WebApi.Controllers.mes.md
[HttpPost("addWorkshop")]
public IActionResult AddWorkshop([FromBody] MdWorkshop workshop)
{
if (workshop == null)
{
return ToResponse(new ApiResult((int)ResultCode.NO_DATA, "null"));
}
if (workshop != null)
workshop.ToCreate(HttpContext);
int result = mdWorkshopService.AddWorkshop(workshop);

View File

@@ -85,6 +85,7 @@ builder.Services.AddMvc(options =>
options.JsonSerializerOptions.WriteIndented = true;
options.JsonSerializerOptions.Converters.Add(new JsonConverterUtil.DateTimeConverter());
options.JsonSerializerOptions.Converters.Add(new JsonConverterUtil.DateTimeNullConverter());
options.JsonSerializerOptions.PropertyNameCaseInsensitive = false;
});
builder.Services.AddSwaggerConfig();