65 lines
1.5 KiB
PHP
65 lines
1.5 KiB
PHP
|
<?php
|
||
|
|
||
|
namespace app\admin\lists\customer;
|
||
|
|
||
|
|
||
|
use app\admin\lists\BaseAdminDataLists;
|
||
|
use app\common\model\customer\Customer;
|
||
|
use app\common\lists\ListsSearchInterface;
|
||
|
|
||
|
|
||
|
/**
|
||
|
* 客户管理列表
|
||
|
* Class CustomerLists
|
||
|
* @package app\admin\listscustomer
|
||
|
*/
|
||
|
class CustomerLists extends BaseAdminDataLists implements ListsSearchInterface
|
||
|
{
|
||
|
|
||
|
|
||
|
/**
|
||
|
* @notes 设置搜索条件
|
||
|
* @return \string[][]
|
||
|
* @author likeadmin
|
||
|
* @date 2024/04/23 14:44
|
||
|
*/
|
||
|
public function setSearch(): array
|
||
|
{
|
||
|
return [
|
||
|
'=' => ['name', 'number', 'contacts', 'tel', 'customer_type', 'dept_type', 'related_suppliers', 'invoice_type'],
|
||
|
];
|
||
|
}
|
||
|
|
||
|
|
||
|
/**
|
||
|
* @notes 获取客户管理列表
|
||
|
* @return array
|
||
|
* @throws \think\db\exception\DataNotFoundException
|
||
|
* @throws \think\db\exception\DbException
|
||
|
* @throws \think\db\exception\ModelNotFoundException
|
||
|
* @author likeadmin
|
||
|
* @date 2024/04/23 14:44
|
||
|
*/
|
||
|
public function lists(): array
|
||
|
{
|
||
|
return Customer::where($this->searchWhere)
|
||
|
->field(['id', 'name', 'number', 'contacts', 'tel', 'customer_type', 'dept_type', 'related_suppliers', 'invoice_type'])
|
||
|
->limit($this->limitOffset, $this->limitLength)
|
||
|
->order(['id' => 'desc'])
|
||
|
->select()
|
||
|
->toArray();
|
||
|
}
|
||
|
|
||
|
|
||
|
/**
|
||
|
* @notes 获取客户管理数量
|
||
|
* @return int
|
||
|
* @author likeadmin
|
||
|
* @date 2024/04/23 14:44
|
||
|
*/
|
||
|
public function count(): int
|
||
|
{
|
||
|
return Customer::where($this->searchWhere)->count();
|
||
|
}
|
||
|
|
||
|
}
|