Normally a treeview is displaying data from only one table. But you should be able to use three tables, because - as you said - you only need to compile an array with the correct data.
Have a look at XTreeBehavior (used in Yii-Playground and downloadable from github).
It only uses 1 table at a time, but you should be able to amend it.
public function actionAjaxFillTree()
{
// accept only AJAX request (comment this when debugging)
if (!Yii::app()->request->isAjaxRequest) {
exit();
}
// parse the user input
$parentId = "0";
if (isset($_GET['root']) && $_GET['root'] !== 'source') {
$parentId = (int) $_GET['root'];
}
// read the data (this could be in a model)
$children = Yii::app()->db->createCommand(
"SELECT m1.id, m1.title AS text, m2.id IS NOT NULL AS hasChildren "
. "FROM tel_job AS m1 LEFT JOIN tel_job AS m2 ON m1.id=m2.parent "
. "WHERE m1.title!='-' and m1.parent <=> $parentId "
. "GROUP BY m1.id ORDER BY m1.title ASC"
)->queryAll();
echo str_replace(
'"hasChildren":"0"',
'"hasChildren":false',
CTreeView::saveDataAsJson($children)
);
}