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

import com.ym.mec.biz.dal.enums.GroupType;
import com.ym.mec.biz.event.EntityChangeEvent;
import com.ym.mec.biz.event.StudentCourseChangeEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @Author qnc99
 * @Date 2020/12/15 0015
 */
@Service
public class EntityChangeEventSource {
    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Resource
    private ApplicationContext applicationContext;

    /**
     * @describe 数据变更事件源
     * @author Joburgess
     * @date 2020.09.24
     * @return void
     */
    public void entityChange(Object oldEntity, Object newEntity, Integer operatorId) {
        applicationContext.publishEvent(new EntityChangeEvent(this, oldEntity, newEntity, operatorId));
    }
}
