| 123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- namespace app\common\model;
- class ProductModel extends BaseModel
- {
- protected $table = 'erp_product';
- protected function genSchema(array $schema)
- {
- // TODO: Implement genSchema() method.
- }
- /**
- * @param array $params
- * @return \think\Paginator
- * @throws \think\db\exception\DbException
- */
- public function findByPaginate(array $params) {
- $where = [
- ['is_delete', '=', 0]
- ];
- if($params['bar_code'] != null)
- array_push($where,['bar_code', 'like', "%".$params['bar_code']."%"]);
- if($params['category_id'] != null)
- array_push($where,['category_id', '=', $params['category_id']]);
- if($params['is_serve'] != null)
- array_push($where,['is_serve', '=', $params['is_serve']]);
- return $this->where($where)->order('create_time','desc')->paginate(['list_rows'=>10, "query" => $params]);
- }
- }
|