* Finish task #99343.
This commit is contained in:
@@ -1,2 +1,5 @@
|
||||
UPDATE `zt_chart` SET `sql` = 'SELECT IF(t3.id IS NOT NULL, t3.`name`, \"空\") AS deptName,count(1) as count, \r\nIF(t3.id IS NOT NULL, t3.`order`, 9999) AS deptOrder \r\nFROM zt_user AS t1 \r\nLEFT JOIN zt_dept AS t2 ON t1.dept = t2.id\r\nLEFT JOIN zt_dept AS t3 ON FIND_IN_SET(TRIM(\',\' FROM t3.path), TRIM(\',\' FROM t2.path)) AND t3.grade = \'1\'\r\nWHERE t1.deleted = \'0\'\r\nGROUP BY deptName, deptOrder \r\nORDER BY deptOrder ASC'
|
||||
WHERE `id` = 1049;
|
||||
|
||||
ALTER TABLE `zt_privrelation` MODIFY `priv` VARCHAR(100) NOT NULL;
|
||||
ALTER TABLE `zt_privrelation` MODIFY `relationPriv` VARCHAR(100) NOT NULL;
|
||||
|
||||
+3
-3
File diff suppressed because one or more lines are too long
@@ -680,7 +680,7 @@ class upgradeModel extends model
|
||||
$this->loadModel('product')->refreshStats(true);
|
||||
$this->loadModel('program')->refreshStats(true);
|
||||
$this->updatePivotFieldsType();
|
||||
|
||||
$this->updatePrivRelation();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -9661,4 +9661,39 @@ class upgradeModel extends model
|
||||
$this->dao->update(TABLE_PIVOT)->data($data)->where('id')->eq($pivot->id)->exec();
|
||||
}
|
||||
}
|
||||
|
||||
public function updatePrivRelation()
|
||||
{
|
||||
$allPrivs = $this->dao->select('*')->from(TABLE_PRIV)->fetchAll('id');
|
||||
$allRelations = $this->dao->select('*')->from(TABLE_PRIVRELATION)->fetchAll();
|
||||
|
||||
foreach($allRelations as $relation)
|
||||
{
|
||||
if(!isset($allPrivs[$relation->priv]) or !isset($allPrivs[$relation->relationPriv]))
|
||||
{
|
||||
$this->dao->delete()->from(TABLE_PRIVRELATION)
|
||||
->where('priv')->eq($relation->priv)
|
||||
->andWhere('type')->eq($relation->type)
|
||||
->andWhere('relationPriv')->eq($relation->relationPriv)
|
||||
->exec();
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$privModuleMethod = $allPrivs[$relation->priv]->module . '-' . $allPrivs[$relation->priv]->method;
|
||||
$relationPrivModuleMethod = $allPrivs[$relation->relationPriv]->module . '-' . $allPrivs[$relation->relationPriv]->method;
|
||||
|
||||
$relationPriv = new stdclass();
|
||||
$relationPriv->priv = $privModuleMethod;
|
||||
$relationPriv->relationPriv = $relationPrivModuleMethod;
|
||||
|
||||
$this->dao->update(TABLE_PRIVRELATION)->data($relationPriv)
|
||||
->where('priv')->eq($relation->priv)
|
||||
->andWhere('type')->eq($relation->type)
|
||||
->andWhere('relationPriv')->eq($relation->relationPriv)
|
||||
->exec();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user