码迷,mamicode.com
首页 > 数据库 > 详细

yii2 oracle 原生sql分页

时间:2019-10-18 19:22:24      阅读:100      评论:0      收藏:0      [点我收藏+]

标签:lda   ota   efault   sql   get   paginati   select   tno   yii2   

   $sql_list = "SELECT ID, FID, INSID,
                FLIGHTNO, DEPNAME, ARRNAME,              
                to_char(DEPDATE,‘yyyy-MM-dd HH24:mi‘) as DEPDATE,                  
                CHECKID,CERTNAME,CERTTYPE, CERTNO, MOBILE, PRODUCTNAME, PRICE, TOTAL,
                ETN,
                DEP,ARR,
                PAYSTATUS,OSTATUS,
                to_char(CREATE_TIME,‘yyyy-MM-dd HH24:mi‘) as CREATE_TIME FROM wx_checkin_insure
                where 1=1 and {$time_condition} {$condition_sql}";
        $dataProvider = new SqlDataProvider([
            ‘sql‘ => $sql_list,
            ‘params‘ => [‘:status‘ => 1],
            ‘totalCount‘ => $total,
            ‘sort‘ => [
                ‘attributes‘ => [
                    ‘age‘,
                    ‘name‘ => [
                        ‘desc‘ => [‘CREATE_TIME‘ => SORT_DESC],
                    ],
                ],
            ],
            ‘pagination‘ => [
                ‘defaultPageSize‘ => $limit,
                ‘totalCount‘      => $total
            ],
        ]);
        $dataProvider->getPagination()->setPage(2);
        $this->_data[‘offset‘] = $dataProvider->getPagination()->offset;
        $litst = $dataProvider->getModels();


        $this->_data[‘page_data‘]  = $litst; // 分页数据
        $this->_data[‘page_total‘] = $dataProvider->getPagination()->getPageCount(); // 总共页数
        $this->_data[‘page‘]       = $page;
        $this->_data[‘limit‘] = $limit;

  

yii2 oracle 原生sql分页

标签:lda   ota   efault   sql   get   paginati   select   tno   yii2   

原文地址:https://www.cnblogs.com/achengmu/p/11700025.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!