commit
95827848ec
@ -1,22 +1,35 @@
|
||||
package com.aurora.listener;
|
||||
|
||||
import com.aurora.entity.ExceptionLog;
|
||||
import com.aurora.entity.OperationLog;
|
||||
import com.aurora.event.ExceptionLogEvent;
|
||||
import com.aurora.event.OperationLogEvent;
|
||||
import com.aurora.mapper.ExceptionLogMapper;
|
||||
import com.aurora.mapper.OperationLogMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class ExceptionLogListener {
|
||||
public class AuroraListener {
|
||||
|
||||
@Autowired
|
||||
private OperationLogMapper operationLogMapper;
|
||||
|
||||
@Autowired
|
||||
private ExceptionLogMapper exceptionLogMapper;
|
||||
|
||||
@Async
|
||||
@EventListener(OperationLogEvent.class)
|
||||
public void saveOperationLog(OperationLogEvent operationLogEvent) {
|
||||
operationLogMapper.insert((OperationLog) operationLogEvent.getSource());
|
||||
}
|
||||
|
||||
@Async
|
||||
@EventListener(ExceptionLogEvent.class)
|
||||
public void saveExceptionLog(ExceptionLogEvent exceptionLogEvent) {
|
||||
exceptionLogMapper.insert((ExceptionLog) exceptionLogEvent.getSource());
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,22 +0,0 @@
|
||||
package com.aurora.listener;
|
||||
|
||||
import com.aurora.entity.OperationLog;
|
||||
import com.aurora.event.OperationLogEvent;
|
||||
import com.aurora.mapper.OperationLogMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class OperationLogListener {
|
||||
|
||||
@Autowired
|
||||
private OperationLogMapper operationLogMapper;
|
||||
|
||||
@Async
|
||||
@EventListener(OperationLogEvent.class)
|
||||
public void saveOperationLog(OperationLogEvent operationLogEvent) {
|
||||
operationLogMapper.insert((OperationLog) operationLogEvent.getSource());
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue