feat():添加添加,修改的元数据的声明
parent
ae24373946
commit
6d890f63a9
|
@ -1,6 +1,7 @@
|
||||||
package com.muyu.common.datascope;
|
package com.muyu.common.datascope;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||||
|
import com.muyu.common.core.text.Convert;
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.apache.ibatis.reflection.MetaObject;
|
import org.apache.ibatis.reflection.MetaObject;
|
||||||
|
@ -25,14 +26,14 @@ public class MyMetaObjectHandler implements MetaObjectHandler {
|
||||||
|
|
||||||
@Override //插入元对象字段填充(用于插入时对公共字段的填充)
|
@Override //插入元对象字段填充(用于插入时对公共字段的填充)
|
||||||
public void insertFill(MetaObject metaObject) {
|
public void insertFill(MetaObject metaObject) {
|
||||||
this.setFieldValByName("createBy", SecurityUtils.getUserId(),metaObject);
|
this.setFieldValByName("createBy", Convert.utf8Str(SecurityUtils.getUserId()),metaObject);
|
||||||
this.setFieldValByName("createTime", new Date(),metaObject);
|
this.setFieldValByName("createTime", new Date(),metaObject);
|
||||||
log.info("添加对象元数据字段填充-[createBy:[{}],createTime:[{}]",
|
log.info("添加对象元数据字段填充-[createBy:[{}],createTime:[{}]",
|
||||||
SecurityUtils.getUserId(),new Date());
|
SecurityUtils.getUserId(),new Date());
|
||||||
}
|
}
|
||||||
@Override //更新元对象字段填充(用于更新是对公共字段的填充)
|
@Override //更新元对象字段填充(用于更新是对公共字段的填充)
|
||||||
public void updateFill(MetaObject metaObject) {
|
public void updateFill(MetaObject metaObject) {
|
||||||
this.setFieldValByName("updateBy", SecurityUtils.getUserId(),metaObject);
|
this.setFieldValByName("updateBy",Convert.utf8Str(SecurityUtils.getUserId()),metaObject);
|
||||||
this.setFieldValByName("updateTime", new Date(),metaObject);
|
this.setFieldValByName("updateTime", new Date(),metaObject);
|
||||||
log.info("修改对象元数据字段填充-[updateBy:[{}],updateTime:[{}]",
|
log.info("修改对象元数据字段填充-[updateBy:[{}],updateTime:[{}]",
|
||||||
SecurityUtils.getUserId(),new Date());
|
SecurityUtils.getUserId(),new Date());
|
||||||
|
|
Loading…
Reference in New Issue