|
|
@@ -18,6 +18,8 @@ namespace app\adminapi\lists\property;
|
|
|
use app\adminapi\lists\BaseAdminDataLists;
|
|
|
use app\common\model\property\PropertyCommission;
|
|
|
use app\common\lists\ListsSearchInterface;
|
|
|
+use app\common\model\property\PropertyHead;
|
|
|
+use app\common\model\property\PropertyUser;
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -42,7 +44,19 @@ class PropertyCommissionLists extends BaseAdminDataLists implements ListsSearchI
|
|
|
|
|
|
];
|
|
|
}
|
|
|
-
|
|
|
+ public function queryWhere()
|
|
|
+ {
|
|
|
+ $where = [];
|
|
|
+ if(isset($this->params['head_name']) && !empty($this->params['head_name'])){
|
|
|
+ $property_head_ids = PropertyHead::where('head_name', 'like', '%'.$this->params['head_name'].'%')->column('id');
|
|
|
+ $where[] = ['property_head_id','IN',$property_head_ids];
|
|
|
+ }
|
|
|
+ if(isset($this->params['householder_name']) && !empty($this->params['householder_name'])){
|
|
|
+ $property_user_ids = PropertyUser::where('householder_name', 'like', '%'.$this->params['householder_name'].'%')->column('id');
|
|
|
+ $where[] = ['property_user_id','IN',$property_user_ids];
|
|
|
+ }
|
|
|
+ return $where;
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* @notes 获取列表
|
|
|
@@ -55,7 +69,7 @@ class PropertyCommissionLists extends BaseAdminDataLists implements ListsSearchI
|
|
|
*/
|
|
|
public function lists(): array
|
|
|
{
|
|
|
- return PropertyCommission::where($this->searchWhere)
|
|
|
+ return PropertyCommission::with(['propertyHead','propertyUser'])->where($this->searchWhere)->where($this->queryWhere())
|
|
|
->field(['id', 'property_head_id', 'property_user_id', 'property_order_id', 'work_id', 'order_amount', 'ratio', 'commission_amount'])
|
|
|
->limit($this->limitOffset, $this->limitLength)
|
|
|
->order(['id' => 'desc'])
|
|
|
@@ -72,7 +86,7 @@ class PropertyCommissionLists extends BaseAdminDataLists implements ListsSearchI
|
|
|
*/
|
|
|
public function count(): int
|
|
|
{
|
|
|
- return PropertyCommission::where($this->searchWhere)->count();
|
|
|
+ return PropertyCommission::where($this->searchWhere)->where($this->queryWhere())->count();
|
|
|
}
|
|
|
|
|
|
}
|