package com.zfire.jiasm.syncdata.config;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;


/**
 * 自动补充插入或更新时的值
 */
@Slf4j
@Component
public class MpMetaObjectHandler implements MetaObjectHandler {
    /**
     * 插入时的填充策略
     * @param metaObject
     */
    @Override
    public void insertFill(MetaObject metaObject) {
        //this.setFieldValByName("createBy", CommonUtils.getUserId(),metaObject);
        //this.setFieldValByName("createTime", new Date(), metaObject);
        //this.setFieldValByName("updateBy",  CommonUtils.getUserId(),metaObject);
        // this.setFieldValByName("updateTime", new Date(), metaObject);
    }

    /**
     * 更新时的填充策略
     * @param metaObject
     */
    @Override
    public void updateFill(MetaObject metaObject) {
        // this.setFieldValByName("updateBy", CommonUtils.getUserId(), metaObject);
        //this.setFieldValByName("updateTime", new Date(), metaObject);
    }
}
