feat(): 增加输入插入的元数据声明
parent
7238291e18
commit
056abbe8f7
|
@ -0,0 +1,26 @@
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实体类字段填充
|
||||||
|
*/
|
||||||
|
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