diff --git a/src/main/java/com/config/MyMetaObjectHandler.java b/src/main/java/com/config/MyMetaObjectHandler.java new file mode 100644 index 0000000..2f9e793 --- /dev/null +++ b/src/main/java/com/config/MyMetaObjectHandler.java @@ -0,0 +1,28 @@ +package com.config; + +import java.util.Date; + +import org.apache.ibatis.reflection.MetaObject; + +import com.baomidou.mybatisplus.mapper.MetaObjectHandler; + +/** + * 自定义填充处理器 + */ +public class MyMetaObjectHandler extends MetaObjectHandler { + + @Override + public void insertFill(MetaObject metaObject) { + this.setFieldValByName("ctime", new Date(), metaObject); + } + + @Override + public boolean openUpdateFill() { + return false; + } + + @Override + public void updateFill(MetaObject metaObject) { + // 关闭更新填充、这里不执行 + } +}