package com.ym.mec.biz.event.listener;

import com.ym.mec.biz.event.EntityChangeEvent;
import com.ym.mec.biz.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * @Author qnc99
 * @Date 2020/12/15 0015
 */
@Component
public class EntityChangeListener {

    @Autowired
    private LogService logService;

    @Async
    @EventListener
    public void onEntityChangedEvent(EntityChangeEvent entityChangeEvent) {
        logService.entityVariationAnalysis(entityChangeEvent.getOldEntity(), entityChangeEvent.getNewEntity(), entityChangeEvent.getOperatorId());
    }

}
