* [task#133002,doing,0.2h] get max version.

This commit is contained in:
zhouxin
2024-11-21 15:54:24 +08:00
committed by 宋辰轩
parent c3142854e2
commit 5bf2dda62b
+20
View File
@@ -2827,6 +2827,26 @@ class pivotModel extends model
{
return $this->dao->select('*')->from(TABLE_PIVOTSPEC)->where('pivot')->eq($pivotID)->fetchAll();
}
/**
* Get max version.
*
* @param int $pivotID
* @access public
* @return string
*/
public function getMaxVersion(int $pivotID): string
{
$versions = $this->dao->select('version')->from(TABLE_PIVOTSPEC)->where('pivot')->eq($pivotID)->fetchPairs();
$maxVersion = current($versions);
foreach($versions as $version)
{
if(version_compare($version, $maxVersion, '>')) $maxVersion = $version;
}
return $maxVersion;
}
}
/**