You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.1 KiB
38 lines
1.1 KiB
using System;
|
|
using System.Threading.Tasks;
|
|
using Volo.Abp;
|
|
using Volo.Abp.DependencyInjection;
|
|
using Volo.Abp.Domain.Entities.Events;
|
|
using Volo.Abp.Domain.Services;
|
|
using Volo.Abp.EventBus;
|
|
using Volo.Abp.ObjectMapping;
|
|
using Win_in.Sfs.Scp.v1.Domain;
|
|
|
|
namespace Win_in.Sfs.Scp.WebApi
|
|
{
|
|
public class PartEventHandler
|
|
: ILocalEventHandler<EntityCreatedEventData<Part>>
|
|
, ITransientDependency
|
|
{
|
|
private readonly ITaPartRepository _taPartRepository;
|
|
private readonly IObjectMapper _objectMapper;
|
|
|
|
public PartEventHandler(ITaPartRepository taPartRepository,
|
|
IObjectMapper objectMapper)
|
|
{
|
|
_taPartRepository = taPartRepository;
|
|
_objectMapper = objectMapper;
|
|
}
|
|
|
|
public async Task HandleEventAsync(EntityCreatedEventData<Part> eventData)
|
|
{
|
|
var part = eventData.Entity;
|
|
//使用AutoMapper执行类型转换
|
|
var taPart = _objectMapper.Map<Part, TA_PART>(part);
|
|
//根据传入数据新增或修改SCP数据
|
|
await _taPartRepository.UpsertAsync(taPart);
|
|
|
|
}
|
|
|
|
}
|
|
}
|