测试@Transactional

https://www.toutiao.com/a7025459579328741924/?log_from=8a8f5b7f5de1a_1640749541015

前提使用Mybatis-plus

测试1:测试前displayd = 1 ==>测试后任为1 发生了回滚

    @Override
    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
    public void updateFactory(String factoryId) {
        lambdaUpdate().eq(FactoryPO::getId, factoryId)
                .set(FactoryPO::getDisplayd, Boolean.FALSE)
                .update();
        String str = null;
        str.equals(factoryId);
    }
上一篇:你真的会用 @Transactional 吗?


下一篇:【Spring框架】最全Spring事务总结-满篇硬货(管饱)