类 ModelMetaObjectHandler

  • 所有已实现的接口:
    com.baomidou.mybatisplus.core.handlers.MetaObjectHandler

    public class ModelMetaObjectHandler
    extends Object
    implements com.baomidou.mybatisplus.core.handlers.MetaObjectHandler
    当基础字段为空时(创建时间、更新时间等)自动填充

    1. insert 时填充 id, createTime, updateTime, createdBy, updatedBy 2. update 时填充 updateTime, updatedBy todo createTime update 时区问题:数据库采取的是 0 时区,则 NOW() 返回值和 java 的 LocalDateTime.now() 是不一样的

    值来源: id: EntityIdGenerator#next(String, String) createTime updateTime:LocalDateTime.now() createdBy updatedBy:AppContext.getUserId()

    作者:
    lym
    • 方法概要

      所有方法 实例方法 具体方法 
      修饰符和类型 方法 说明
      protected String getIdFieldName​(org.apache.ibatis.reflection.MetaObject metaObject)  
      void insertFill​(org.apache.ibatis.reflection.MetaObject metaObject)
      插入时添加创建时间
      void updateFill​(org.apache.ibatis.reflection.MetaObject metaObject)
      更新时添加更新时间,修改人
      • 从接口继承的方法 com.baomidou.mybatisplus.core.handlers.MetaObjectHandler

        fillStrategy, findTableInfo, getFieldValByName, isFill, openInsertFill, openUpdateFill, setFieldValByName, setFieldValByName, setInsertFieldValByName, setUpdateFieldValByName, strictFill, strictFillStrategy, strictInsertFill, strictInsertFill, strictInsertFill, strictUpdateFill, strictUpdateFill, strictUpdateFill
    • 构造器详细资料

      • ModelMetaObjectHandler

        public ModelMetaObjectHandler()
    • 方法详细资料

      • insertFill

        public void insertFill​(org.apache.ibatis.reflection.MetaObject metaObject)
        插入时添加创建时间
        指定者:
        insertFill 在接口中 com.baomidou.mybatisplus.core.handlers.MetaObjectHandler
        参数:
        metaObject - 页面传递过来的参数的包装对象
      • updateFill

        public void updateFill​(org.apache.ibatis.reflection.MetaObject metaObject)
        更新时添加更新时间,修改人
        指定者:
        updateFill 在接口中 com.baomidou.mybatisplus.core.handlers.MetaObjectHandler
        参数:
        metaObject - 页面传递过来的参数的包装对象
      • getIdFieldName

        @Nonnull
        protected String getIdFieldName​(org.apache.ibatis.reflection.MetaObject metaObject)