use of com.baomidou.mybatisplus.core.handlers.MetaObjectHandler in project muses by acgist.
the class MyBatisAutoConfiguration method metaObjectHandler.
@Bean
@ConditionalOnMissingBean
public MetaObjectHandler metaObjectHandler(@Autowired IdService idService) {
return new MetaObjectHandler() {
@Override
public void insertFill(MetaObject metaObject) {
final Date date = new Date();
this.setFieldValByName(BootEntity.PROPERTY_CREATE_DATE, date, metaObject);
this.setFieldValByName(BootEntity.PROPERTY_MODIFY_DATE, date, metaObject);
}
@Override
public void updateFill(MetaObject metaObject) {
this.setFieldValByName(BootEntity.PROPERTY_MODIFY_DATE, new Date(), metaObject);
}
};
}
use of com.baomidou.mybatisplus.core.handlers.MetaObjectHandler in project muses by acgist.
the class MyBatisAutoConfiguration method metaObjectHandler.
@Bean
@ConditionalOnMissingBean
public MetaObjectHandler metaObjectHandler(@Autowired IdService idService) {
return new MetaObjectHandler() {
@Override
public void insertFill(MetaObject metaObject) {
final LocalDateTime now = LocalDateTime.now();
this.setFieldValByName(BootEntity.PROPERTY_CREATE_DATE, now, metaObject);
this.setFieldValByName(BootEntity.PROPERTY_MODIFY_DATE, now, metaObject);
}
@Override
public void updateFill(MetaObject metaObject) {
final LocalDateTime now = LocalDateTime.now();
this.setFieldValByName(BootEntity.PROPERTY_MODIFY_DATE, now, metaObject);
}
};
}
Aggregations