2131232132131232132132131
@Service
public class MultiDatasourceService {
@Resource
private MultiDatasourceService multiDatasourceService;
@Resource
private TestMapper testMapper;
@Transactional
public void updateNameById(Long id) {
int i = 1;
testMapper.updateById(id, "clcl");
// 调用另外一个事务办法
multiDatasourceService.updateNameById1(id);
int j = 2;
}
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void updateNameById1(Long id) {
int i = 1;
testMapper.updateById(3L, "clcl");
}
}