buhuazhen
5 天以前 f50da3afc73bc458640677c198bb7c99de5b2fe5
src/main/java/com/ruoyi/common/config/MybatisHandler.java
@@ -6,6 +6,7 @@
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.util.Optional;
@Component
public class MybatisHandler implements MetaObjectHandler {
@@ -18,11 +19,12 @@
            tenantId = SecurityUtils.getLoginUser().getTenantId();
        } catch (Exception ignored) {
        }
        System.out.println("执行插入填充...");
        this.strictInsertFill(metaObject, "createTime", LocalDateTime.class, LocalDateTime.now());
        this.strictInsertFill(metaObject, "updateTime",  LocalDateTime.class, LocalDateTime.now());
        this.strictInsertFill(metaObject, "createUser", Integer.class, userId);
        this.strictInsertFill(metaObject, "updateUser", Integer.class, userId);
        this.strictInsertFill(metaObject, "createUser", Long.class, userId == null ? 0 : userId.longValue());
        this.strictInsertFill(metaObject, "updateUser", Long.class, userId == null ? 0 : userId.longValue());
        this.strictInsertFill(metaObject, "tenantId", Long.class, tenantId);
    }
@@ -36,4 +38,4 @@
        this.strictUpdateFill(metaObject, "updateTime", LocalDateTime.class, LocalDateTime.now()); // 起始版本 3.3.0(推荐)
        this.strictUpdateFill(metaObject, "updateUser", Integer.class, userId);
    }
}
}