更新: 重构代码并优化财务统计逻辑中的筛选功能

This commit is contained in:
mkm 2024-07-24 13:44:58 +08:00
parent b093af676c
commit d42b8150ca

View File

@ -63,19 +63,17 @@ use app\common\model\financial\FinancialInvoice;
*/ */
public function lists(): array public function lists(): array
{ {
$where=[ $this->searchWhere[]=['review_status','=', 1];
['review_status','=', 1], $this->searchWhere[]=['contract_type','=', 0];
['contract_type','=',0], $this->searchWhere[]=['status','=', 1];
['status','=',0]
];
$types=$this->request->get('type_value'); $types=$this->request->get('type_value');
if($types){ if($types){
$data=DictData::where('type_value',$types)->column('value'); $data=DictData::where('type_value',$types)->column('value');
if($data){ if($data){
$where[]=['business_nature','in',$data]; $this->searchWhere[]=['business_nature','in',$data];
} }
} }
return MarketingContract::where($this->searchWhere)->where($where) return MarketingContract::where($this->searchWhere)
->limit($this->limitOffset, $this->limitLength) ->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc']) ->order(['id' => 'desc'])
->select() ->select()
@ -135,11 +133,7 @@ use app\common\model\financial\FinancialInvoice;
*/ */
public function count(): int public function count(): int
{ {
return MarketingContract::where($this->searchWhere)->where([ return MarketingContract::where($this->searchWhere)->count();
['review_status','=', 1],
['contract_type','=',0],
['status','=',0]
])->count();
} }
public function setFileName(): string public function setFileName(): string