feat(): 增加输入插入元数据声明
parent
1c2e906c61
commit
4b7120fbdb
|
@ -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 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