去除重写Order 方法,新增 CatchOrder
This commit is contained in:
parent
3b063ac1fd
commit
6977442b05
@ -187,35 +187,22 @@ class CatchQuery extends Query
|
|||||||
return parent::paginate($listRows, $simple); // TODO: Change the autogenerated stub
|
return parent::paginate($listRows, $simple); // TODO: Change the autogenerated stub
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* order 排序
|
* 默认排序
|
||||||
*
|
*
|
||||||
* @time 2020年04月30日
|
* @time 2020年06月17日
|
||||||
* @param string $field
|
|
||||||
* @param string $order
|
* @param string $order
|
||||||
* @param string $position
|
* @return $this
|
||||||
* @return $this|CatchQuery
|
|
||||||
*/
|
*/
|
||||||
public function order($field = '', string $order = 'desc', $position = 'backend')
|
public function catchOrder($order = 'desc')
|
||||||
{
|
{
|
||||||
// 排序在前
|
|
||||||
if ($position = 'front') {
|
|
||||||
parent::order($field, $order);
|
|
||||||
}
|
|
||||||
if (in_array('sort', array_keys($this->getFields()))) {
|
if (in_array('sort', array_keys($this->getFields()))) {
|
||||||
parent::order('sort', $order);
|
$this->order($this->getTable() . '.sort', $order);
|
||||||
}
|
|
||||||
// 紧跟权重的排序
|
|
||||||
if ($position == 'middle') {
|
|
||||||
parent::order($field, $order);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
parent::order($this->getPk(), $order);
|
$this->order($this->getTable() . '.' . $this->getPk(), $order);
|
||||||
// 最后插入排序
|
|
||||||
if ($position == 'backend') {
|
|
||||||
parent::order($field, $order);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user