commit
0d2a990056
20 changed files with 143 additions and 138 deletions
@ -0,0 +1,28 @@ |
||||
package com.daqing.framework.utils.handler; |
||||
|
||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; |
||||
import org.apache.ibatis.reflection.MetaObject; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* @Author chen |
||||
* @DATE 2020/10/30 11:13 |
||||
* @Version 1.0 |
||||
* 自动处理添加和修改时间 |
||||
*/ |
||||
@Component |
||||
public class MyMetaObjectHandler implements MetaObjectHandler { |
||||
|
||||
@Override |
||||
public void insertFill(MetaObject metaObject) { |
||||
this.setFieldValByName("createTime", new Date(), metaObject); |
||||
this.setFieldValByName("updateTime", new Date(), metaObject); |
||||
} |
||||
|
||||
@Override |
||||
public void updateFill(MetaObject metaObject) { |
||||
this.setFieldValByName("updateTime", new Date(), metaObject); |
||||
} |
||||
} |
Loading…
Reference in new issue