增加输入插入的元数据声明
parent
379309f530
commit
556f3df3ac
|
@ -0,0 +1,34 @@
|
|||
package com.muyu.common.datascope;
|
||||
|
||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||
import com.muyu.common.core.text.Convert;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.apache.ibatis.reflection.MetaObject;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Lenovo
|
||||
*/
|
||||
@Log4j2
|
||||
public class MyMetaObjectHandLer implements MetaObjectHandler {
|
||||
|
||||
public MyMetaObjectHandLer () {
|
||||
log.info("元对象字段填充控制器 --------- 加载完成");
|
||||
}
|
||||
@Override
|
||||
public void insertFill(MetaObject metaObject) {
|
||||
this.setFieldValByName("createBy", Convert.utf8Str(SecurityUtils.getUserId()),metaObject);
|
||||
this.setFieldValByName("createTime",new Date(),metaObject);
|
||||
log.info("添加对象元数据字段填充-[createBy:[{}],createTime:[{}]]",
|
||||
SecurityUtils.getUserId(),new Date());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFill(MetaObject metaObject) {
|
||||
this.setFieldValByName("createBy", Convert.utf8Str(SecurityUtils.getUserId()),metaObject);
|
||||
this.setFieldValByName("createTime",new Date(),metaObject);
|
||||
log.info("修改对象元数据字段填充-[updateBy:[{}],updateTime:[{}]]",
|
||||
SecurityUtils.getUserId(),new Date());
|
||||
}
|
||||
}
|
|
@ -1 +1,2 @@
|
|||
com.muyu.common.datascope.aspect.DataScopeAspect
|
||||
com.muyu.common.datascope.MyMetaObjectHandLer
|
||||
|
|
Loading…
Reference in New Issue