feat(): 增加插入的元数据声明
parent
bd3f0dfd07
commit
e3fbe40588
|
@ -0,0 +1,28 @@
|
||||||
|
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: zi run
|
||||||
|
* @Date 2024/8/9 10:44
|
||||||
|
* @Description 实体类字段填充
|
||||||
|
*/
|
||||||
|
@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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1 +1,2 @@
|
||||||
com.muyu.common.datascope.aspect.DataScopeAspect
|
com.muyu.common.datascope.aspect.DataScopeAspect
|
||||||
|
com.muyu.common.datascope.MyMetaObjectHandler
|
||||||
|
|
Loading…
Reference in New Issue