You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
747 B
26 lines
747 B
package com.teaching.backend.utils; |
|
|
|
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; |
|
import org.apache.ibatis.reflection.MetaObject; |
|
import org.springframework.stereotype.Component; |
|
|
|
import java.time.LocalDateTime; |
|
import java.util.Date; |
|
|
|
/** |
|
* 自动填充时间 |
|
*/ |
|
@Component |
|
public class MyMetaObjectHandler implements MetaObjectHandler { |
|
@Override |
|
public void insertFill(MetaObject metaObject) { |
|
this.setFieldValByName("createTime", LocalDateTime.now(), metaObject); |
|
this.setFieldValByName("updateTime", LocalDateTime.now(), metaObject); |
|
} |
|
|
|
@Override |
|
public void updateFill(MetaObject metaObject) { |
|
this.setFieldValByName("updateTime", LocalDateTime.now(), metaObject); |
|
|
|
} |
|
}
|
|
|