|
|
@ -0,0 +1,24 @@ |
|
|
|
package com.storeroom.config; |
|
|
|
|
|
|
|
import com.storeroom.utils.SecurityUtils; |
|
|
|
import org.springframework.data.domain.AuditorAware; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
import java.util.Optional; |
|
|
|
|
|
|
|
@Component("auditorAware") |
|
|
|
public class AuditorConfig implements AuditorAware<String> { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 返回操作员标志信息 |
|
|
|
* @return / |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public Optional<String> getCurrentAuditor() { |
|
|
|
try{ |
|
|
|
return Optional.of(SecurityUtils.getCurrentUsername()); |
|
|
|
}catch (Exception ignored){} |
|
|
|
return Optional.of("System"); |
|
|
|
} |
|
|
|
} |