feat(): 增加数据插入的元数据声明
parent
7a1ae052ad
commit
98c72436df
|
@ -0,0 +1,30 @@
|
||||||
|
package com.muyu.common.datascope;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||||
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
|
import org.apache.ibatis.reflection.MetaObject;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:LiDongJia
|
||||||
|
* @Package:com.muyu.common.datascope
|
||||||
|
* @Project:cloud-common-datascope
|
||||||
|
* @name:MyMetaObjectHandler
|
||||||
|
* @Date:2024/8/10 19:49
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class MyMetaObjectHandler implements MetaObjectHandler {
|
||||||
|
@Override
|
||||||
|
public void insertFill(MetaObject metaObject) {
|
||||||
|
this.setFieldValByName("createBy", SecurityUtils.getUserId(), metaObject);
|
||||||
|
this.setFieldValByName("createTime", new Date(), metaObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateFill(MetaObject metaObject) {
|
||||||
|
this.setFieldValByName("updateBy", SecurityUtils.getUserId(), metaObject);
|
||||||
|
this.setFieldValByName("updateTime", new Date(), metaObject);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue