Search in sources :

Example 1 with OperationRecord

use of com.weibo.model.OperationRecord in project motan by weibocom.

the class LoggingAspect method logAfter.

@AfterReturning(value = "anyPublicOperation() && execCommandOperation()", returning = "result")
public void logAfter(JoinPoint joinPoint, boolean result) {
    Object[] args = joinPoint.getArgs();
    OperationRecord record = new OperationRecord();
    record.setOperator(getUsername());
    record.setType(joinPoint.getSignature().getName());
    record.setGroupName(args[0].toString());
    record.setCommand(JSON.toJSONString(args[1]));
    int status = result ? 1 : 0;
    record.setStatus((byte) status);
    if (recordMapper == null) {
        LoggerUtil.accessLog(JSON.toJSONString(record));
    } else {
        recordMapper.insertSelective(record);
    }
}
Also used : OperationRecord(com.weibo.model.OperationRecord) JoinPoint(org.aspectj.lang.JoinPoint) AfterReturning(org.aspectj.lang.annotation.AfterReturning)

Aggregations

OperationRecord (com.weibo.model.OperationRecord)1 JoinPoint (org.aspectj.lang.JoinPoint)1 AfterReturning (org.aspectj.lang.annotation.AfterReturning)1