コード例 #1
0
ファイル: Part.php プロジェクト: VampireMe/admin-9939-com
 public function getLevel1Count($id)
 {
     return part::find()->select("count(id) as count")->where('pid=:pid', [':pid' => $id])->asArray()->one();
 }
コード例 #2
0
ファイル: Part.php プロジェクト: VampireMe/admin-9939-com
 /**
  * 根据条件查询部位
  * @param array $param
  * @return type
  */
 public function getSearch($param)
 {
     $array = array_intersect_key($param, $this->attributes);
     $where = '';
     $bound = [];
     foreach ($array as $k => $v) {
         if (!empty($v)) {
             $where .= ' and ' . $k . ' = :' . $k;
             $bound[':' . $k] = $v;
         }
     }
     $where = substr($where, 5);
     return part::find()->select("id,name,description,child,level")->where($where, $bound)->asArray()->all();
 }