🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# 组件源码 ``` /** * <b>方法描述:</b> 提交全部事务 <br/> * <b>创建者:</b> admin <br/> * <b>创建时间:</b> 2018-05-17 16:54:44 <br/> * * @return -1 异常<br/> * 1 成功<br/> */ @Component(label = "提交全部事务", style = "判断型", type = "同步组件", comment = "提交当前线程开启全部数据库事务", version = "1.0.0", deprecated = false, author = "admin", date = "2018-05-17 04:54:44") @Returns(returns = {@Return(id = "-1", desp = "异常"), @Return(id = "1", desp = "成功")}) public static ResultBase P_commit() { try { ServiceLocalEnv.commitAllTransactionStatus(); return ResultBase.newSuccessResult(); } catch (Exception e) { AppLog.error(e); return ResultBase.newExceptionResult("TPTD0032", "事务提交失败:" + AppLog.errorMsg(e)); } } ``` # 交易中组件使用方式 ![](https://img.kancloud.cn/63/20/6320b61c2d34b36d8e1cdfb07a34991f_1871x893.png) > 提交事务需要与开启事务联合使用。