排查不生效从这几个方面:
1、对应字段的数据类型是否是int, Integer, long, Long, Date, Timestamp, LocalDateTime中的一个。
2、使用的是否是MyBatis-Plus的updateById(entity) 和 update(entity, wrapper), saveOrUpdate(entity), insertOrUpdate(entity) 这几个方法。
3、配置中是否加入了addInnerInterceptor(new OptimisticLockerInnerInterceptor())配置。