查询条件处理

This commit is contained in:
wanyongkang
2020-10-24 15:40:56 +08:00
parent 6390d6f8a7
commit 565a159745
4 changed files with 110 additions and 20 deletions

View File

@@ -2,7 +2,7 @@
/*
* @Author: your name
* @Date: 2020-09-30 17:32:46
* @LastEditTime: 2020-10-23 16:23:12
* @LastEditTime: 2020-10-24 12:11:18
* @LastEditors: kangkang
* @Description: In User Settings Edit
* @FilePath: /phptest/fastphp/base/Model.php
@@ -52,6 +52,18 @@ class Model extends Sql
return $this->field($fields)->where($where)->order($order)->limit($limit)->fetchAll();
}
/**
* 按照页数获取数据 复杂查询
* @param $fields 'id,count(1)...'
* @param $order 'id desc'/'id asc'
* @param $limit = '100' 限制查询100条
* $limit = '2,100' 查询第二页 100条数据
*/
public function getListPages($where = [], $fields = '*', $order = 'id desc', $limit = '50')
{
return $this->field($fields)->wheres($where)->order($order)->limit($limit)->fetchAll();
}
/**
* @description: 获取一条数据
* @param {type}