* [task#133003,done,0.1h] fix conflict.
This commit is contained in:
@@ -115,9 +115,8 @@ class pivotModel extends model
|
||||
*/
|
||||
public function getPivotSpec(int $pivotID, string $version, bool $processDateVar = false, bool $addDrills = true)
|
||||
{
|
||||
$pivot = $this->dao->select('*')->from(TABLE_PIVOTSPEC)->where('pivot')->eq($pivotID)->andWhere('version')->eq($version)->fetch();
|
||||
$pivot = $this->pivotTao->fetchPivot($pivotID, $version);
|
||||
if(!$pivot) return false;
|
||||
$pivot->id = $pivot->pivot;
|
||||
|
||||
$pivot->fieldSettings = array();
|
||||
if(!empty($pivot->fields) && $pivot->fields != 'null')
|
||||
|
||||
+22
-6
@@ -6,17 +6,33 @@ class pivotTao extends pivotModel
|
||||
* 获取透视表。
|
||||
* Fetch pivot by id.
|
||||
*
|
||||
* @param int $id
|
||||
* @param int $id
|
||||
* @param string|null $version
|
||||
* @access public
|
||||
* @return object|bool
|
||||
*/
|
||||
protected function fetchPivot(int $id): object|bool
|
||||
protected function fetchPivot(int $id, string|null $version = null): object|bool
|
||||
{
|
||||
return $this->dao->select('t1.*, t2.*')->from(TABLE_PIVOT)->alias('t1')
|
||||
->leftJoin(TABLE_PIVOTSPEC)->alias('t2')->on('t1.id=t2.pivot and t1.version=t2.version')
|
||||
->where('t1.id')->eq($id)
|
||||
->andWhere('t1.deleted')->eq('0')
|
||||
if(is_null($version))
|
||||
{
|
||||
return $this->dao->select('t1.*, t2.*')->from(TABLE_PIVOT)->alias('t1')
|
||||
->leftJoin(TABLE_PIVOTSPEC)->alias('t2')->on('t1.id=t2.pivot and t1.version=t2.version')
|
||||
->where('t1.id')->eq($id)
|
||||
->andWhere('t1.deleted')->eq('0')
|
||||
->fetch();
|
||||
}
|
||||
|
||||
$pivot = $this->dao->select('*')->from(TABLE_PIVOT)->where('id')->eq($id)->andWhere('deleted')->eq('0')->fetch();
|
||||
if(!$pivot) return false;
|
||||
|
||||
$specData = $this->dao->select('*')->from(TABLE_PIVOTSPEC)
|
||||
->where('pivot')->eq($id)
|
||||
->andWhere('version')->eq($version)
|
||||
->fetch();
|
||||
if(!$specData) return $pivot;
|
||||
|
||||
foreach($specData as $specKey => $specValue) $pivot->$specKey = $specValue;
|
||||
return $pivot;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user