@Component public class MyMetaObjectHandler implements MetaObjectHandler { /** * 插入时的填充策略 * * @param metaObject */ @Override public void insertFill(MetaObject metaObject) { this.setFieldValByName("createDate", LocalDateTime.now(), metaObject); this.setFieldValByName("createdDate", LocalDateTime.now(), metaObject); this.setFieldValByName("updateDate", LocalDateTime.now(), metaObject); this.setFieldValByName("updatedDate", LocalDateTime.now(), metaObject); } /** * 更新时的填充策略 * * @param metaObject */ @Override public void updateFill(MetaObject metaObject) { this.setFieldValByName("updateDate", LocalDateTime.now(), metaObject); this.setFieldValByName("updatedDate", LocalDateTime.now(), metaObject); } }
通过handler填充creat_time
最新推荐文章于 2024-11-11 21:19:25 发布
关键词由CSDN通过智能技术生成