//删除设备
@Transactional(rollbackFor = Exception.class)
public int deleteDevice(String uuid) throws Exception {
//删除设备信息
int i = deviceExtMapper.delete(uuid);
//删除对应的管道信息
int j = devicePipelineExtMapper.deleteDevicePipeline(uuid);
//删除对应的标签信息
int o = deviceTagExtMapper.deleteByDeviceUuid(uuid);
if (i <= 0 || j <= 0) {
throw new Exception("删除设备及其管道时错误");
}
if( i > 0 && j > 0){
return 1;
}else{
return 0;
}
}
java后端开启事务使用Demo
最新推荐文章于 2024-02-13 16:55:47 发布