|
|
|
@ -5,8 +5,6 @@ import com.mybatisflex.core.FlexGlobalConfig; |
|
|
|
import com.mybatisflex.core.audit.AuditManager; |
|
|
|
import com.mybatisflex.core.audit.ConsoleMessageCollector; |
|
|
|
import com.mybatisflex.core.keygen.KeyGenerators; |
|
|
|
import com.mybatisflex.core.mybatis.FlexConfiguration; |
|
|
|
import com.mybatisflex.spring.boot.ConfigurationCustomizer; |
|
|
|
import com.mybatisflex.spring.boot.MyBatisFlexCustomizer; |
|
|
|
import com.thing.common.orm.entity.BaseDateEntity; |
|
|
|
import com.thing.common.orm.entity.BaseEntity; |
|
|
|
@ -15,9 +13,8 @@ import com.thing.common.orm.entity.BaseTenantEntity; |
|
|
|
import com.thing.common.orm.listener.EntityInsertListener; |
|
|
|
import com.thing.common.orm.listener.EntityUpdateListener; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.ibatis.logging.nologging.NoLoggingImpl; |
|
|
|
import org.apache.ibatis.logging.stdout.StdOutImpl; |
|
|
|
import org.mybatis.spring.annotation.MapperScan; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.context.annotation.Configuration; |
|
|
|
|
|
|
|
|
|
|
|
@ -29,11 +26,12 @@ import org.springframework.context.annotation.Configuration; |
|
|
|
@Slf4j |
|
|
|
@Configuration |
|
|
|
@MapperScan(value = {"com.thing.**.mapper"}) |
|
|
|
public class MyBatisFlexConfig implements ConfigurationCustomizer, MyBatisFlexCustomizer { |
|
|
|
@Override |
|
|
|
public void customize(FlexConfiguration configuration) { |
|
|
|
configuration.setLogImpl(NoLoggingImpl.class); |
|
|
|
} |
|
|
|
public class MyBatisFlexConfig implements MyBatisFlexCustomizer { |
|
|
|
|
|
|
|
|
|
|
|
@Value("${mybatis-flex.auditEnable:false}") |
|
|
|
private Boolean auditEnable; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* Mybatis-Flex自定义初始化配置 |
|
|
|
@ -54,7 +52,7 @@ public class MyBatisFlexConfig implements ConfigurationCustomizer, MyBatisFlexCu |
|
|
|
globalConfig.registerUpdateListener(new EntityUpdateListener(), BaseEntity.class, BaseDateEntity.class, BaseInfoEntity.class, BaseTenantEntity.class); |
|
|
|
|
|
|
|
// 开启审计功能 |
|
|
|
AuditManager.setAuditEnable(true); |
|
|
|
AuditManager.setAuditEnable(auditEnable); |
|
|
|
AuditManager.setMessageCollector(new ConsoleMessageCollector()); |
|
|
|
} |
|
|
|
|
|
|
|
|