jpa中MetaObjectHandler允许子项目覆盖
This commit is contained in:
@ -3,6 +3,7 @@ package com.chinaunicom.mall.ebtp.cloud.jpa.starter;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import org.apache.ibatis.reflection.MetaObject;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.ComponentScan.Filter;
|
||||
@ -21,6 +22,7 @@ import cn.chinaunicom.sdsi.framework.config.mybatis.MyMetaObjectHandler;
|
||||
public class JpaStarterConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(MetaObjectHandler.class)
|
||||
MetaObjectHandler metaObjectHandler() {
|
||||
return new MetaObjectHandler() {
|
||||
/**
|
||||
@ -43,6 +45,8 @@ public class JpaStarterConfiguration {
|
||||
*/
|
||||
@Override
|
||||
public void insertFill(MetaObject metaObject) {
|
||||
setFieldValByName("createBy", "tester", metaObject);
|
||||
|
||||
// Object obj = getFieldValByName("createBy", metaObject);
|
||||
// obj = getFieldValByName("createDate", metaObject);
|
||||
// if (obj == null) {
|
||||
|
Reference in New Issue
Block a user