zoukankan      html  css  js  c++  java
  • Yii2 分表后 使用 union all 分页实现代码

    $query1 = Class1::find()->where($where);
    $query2 = Class1::find()->alias('a')->join('left join', Class2::tableName() . 'as b', 'b.id = a.objId')
                  ->select('a.*')->where($where2); $queryAll = $query1->union($query2, true); $query = (new Query())->from(['c' => $queryAll])->select('c.*,d.type,d.title')        ->join('left join', Class3::tableName() . 'as d', 'd.id = c.objId')->distinct(true)->orderBy(['c.time'=>SORT_DESC]); $sql = $query->createCommand()->getRawSql(); $result = $query->offset(($page - 1) * 10)->limit(10)->all(); $totalCount = $query->count(); $pagination = new Pagination(['totalCount'=>$totalCount, 'pageSize'=>10]); $result = $query->offset($pagination->offset)->limit($pagination->limit)->all();

      

  • 相关阅读:
    自定义Dialog
    AlertDialog
    Toast
    WebView
    《构建之法》阅读笔记3
    UI组件之GridView
    ScrollView&HorizontalScrollView
    UI组件之ImageView
    UI组件之ListView
    每周总结(1.24)
  • 原文地址:https://www.cnblogs.com/jimz/p/13534722.html
Copyright © 2011-2022 走看看