public class CustomMetaObjectHandler extends Object implements com.baomidou.mybatisplus.core.handlers.MetaObjectHandler
若实际项目中,字段名称不一样,可以新建一个此类,在yml配置中覆盖mybatis-plus.global-config.metaObject-handler配置即可
注意默认获取的userId为空
| 构造器和说明 |
|---|
CustomMetaObjectHandler() |
| 限定符和类型 | 方法和说明 |
|---|---|
protected String |
getCreateTimeFieldName()
获取创建时间字段的名称(非数据库中字段名称)
|
protected String |
getCreateUserFieldName()
获取创建用户字段的名称(非数据库中字段名称)
|
protected String |
getUpdateTimeFieldName()
获取更新时间字段的名称(非数据库中字段名称)
|
protected String |
getUpdateUserFieldName()
获取更新用户字段的名称(非数据库中字段名称)
|
protected Object |
getUserUniqueId()
获取用户唯一id(注意默认获取的用户唯一id为空,如果想填写则需要继承本类)
|
void |
insertFill(org.apache.ibatis.reflection.MetaObject metaObject) |
void |
updateFill(org.apache.ibatis.reflection.MetaObject metaObject) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcompatibleFillId, fillStrategy, findTableInfo, getFieldValByName, isFill, openInsertFill, openUpdateFill, setFieldValByName, setFieldValByName, setInsertFieldValByName, setUpdateFieldValByName, strictFill, strictFillStrategy, strictInsertFill, strictInsertFill, strictInsertFill, strictUpdateFill, strictUpdateFill, strictUpdateFillpublic void insertFill(org.apache.ibatis.reflection.MetaObject metaObject)
insertFill 在接口中 com.baomidou.mybatisplus.core.handlers.MetaObjectHandlerpublic void updateFill(org.apache.ibatis.reflection.MetaObject metaObject)
updateFill 在接口中 com.baomidou.mybatisplus.core.handlers.MetaObjectHandlerprotected String getCreateTimeFieldName()
protected String getCreateUserFieldName()
protected String getUpdateTimeFieldName()
protected String getUpdateUserFieldName()
protected Object getUserUniqueId()
Copyright © 2019. All rights reserved.