using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Aspose.Cells.Drawing;
using JNPF.Common.Core.Manager;
using JNPF.Common.Enums;
using JNPF.DependencyInjection;
using JNPF.DynamicApiController;
using JNPF.FriendlyException;
using Mapster;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using Tnb.EquipMgr.Entities;
using Tnb.EquipMgr.Entities.Dto;
using Tnb.EquipMgr.Interfaces;
namespace Tnb.EquipMgr
{
///
/// 模具保养规则定义服务
///
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
[Route("api/[area]/[controller]/[action]")]
public class ToolMoldMaintainRuleService : IToolMoldMaintainRuleService, IDynamicApiController, ITransient
{
private readonly ISqlSugarRepository _repository;
private readonly IUserManager _userManager;
private readonly ISqlSugarClient _db;
public ToolMoldMaintainRuleService(ISqlSugarRepository repository, IUserManager userManager)
{
_repository = repository;
_userManager = userManager;
_db = repository.AsSugarClient();
}
///
/// 关联模具
///
/// 关联模具输入参数
///
///
[HttpPost]
public async Task RelevanceMold(RelevanceMoldInput input)
{
if (input is null) throw new ArgumentNullException(nameof(input));
var entity = input.Adapt();
var row = await _db.Insertable(entity).ExecuteCommandAsync();
if (row < 1) throw Oops.Oh(ErrorCode.COM1000);
}
}
}