package com.tofly.feesapi.common;

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

import java.util.Date;

@Component
@Slf4j
public class MyMetaObjectHandler implements MetaObjectHandler {

    @Override
    public void insertFill(MetaObject metaObject) {
        this.setFieldValByName("lrrq", new Date(), metaObject);
        this.setFieldValByName("xgrq", new Date(), metaObject);
        this.setFieldValByName("czsj", new Date(), metaObject);
    }

    @Override
    public void updateFill(MetaObject metaObject) {
        this.setFieldValByName("lrrq", new Date(), metaObject);
        this.setFieldValByName("xgrq", new Date(), metaObject);
        this.setFieldValByName("czsj", new Date(), metaObject);
    }
}
