求yii2的oracle分页代码 [ 2.0 版本 ]
求yii2的oracle分页代码,主要是Controller和View的代码,网上大部分都是mysql的,不知道oracle应该怎么处理,我发一段mysql的,请帮看看分页那里应该怎么改为oracle的。
Controller:
$sql = '
select * from (select UPDATETIME,F_ID,F_NAME,F_MPA,F_SPEC,F_MILL,F_PRICE,rank() over (partition by UPDATETIME order by F_ID) rn from T_MILL_PRICE1 ) t where rn=1
order by UPDATETIME desc';
$q = Yii::$app->db->createCommand($sql)->queryAll();
$pages = new Pagination([
'defaultPageSize' => 50,
'totalCount'=>count($q),
]);
$list = Yii::$app->db->createCommand($sql." limit ".$pages->limit." offset ".$pages->offset."")->queryAll();
$dataprovider = new ArrayDataProvider([
'allModels' => $list,
]);
return $this->render('list',[
'dataprovider'=>$dataprovider,
'$pages'=>$pages,
]);
view:
<ul>
<?php foreach ($dataprovider as $country): ?>
<li>
<?= Html::encode("{$country->F_NAME} ({$country->F_MPA})") ?>:
<?= $country->F_SPEC ?>
</li>
<?php endforeach; ?>
</ul>
<?= LinkPager::widget(['pagination' => $pages]) ?>
ayurep
注册时间:2014-11-24
最后登录:2015-09-22
在线时长:2小时51分
最后登录:2015-09-22
在线时长:2小时51分
- 粉丝1
- 金钱10
- 威望0
- 积分30