97 lines
3.6 KiB
PHP
97 lines
3.6 KiB
PHP
<?php
|
||
// +----------------------------------------------------------------------
|
||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||
// +----------------------------------------------------------------------
|
||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||
// | 开源版本可自由商用,可去除界面版权logo
|
||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||
// | 访问官网:https://www.likeadmin.cn
|
||
// | likeadmin团队 版权所有 拥有最终解释权
|
||
// +----------------------------------------------------------------------
|
||
// | author: likeadminTeam
|
||
// +----------------------------------------------------------------------
|
||
|
||
namespace app\adminapi\lists\bill;
|
||
|
||
|
||
use app\adminapi\lists\BaseAdminDataLists;
|
||
use app\common\model\bill\TransferBill;
|
||
use app\common\lists\ListsSearchInterface;
|
||
use think\facade\Db;
|
||
|
||
/**
|
||
* TransferBill列表
|
||
* Class TransferBillLists
|
||
* @package app\adminapi\listsbill
|
||
*/
|
||
class TransferBillLists extends BaseAdminDataLists implements ListsSearchInterface
|
||
{
|
||
|
||
|
||
/**
|
||
* @notes 设置搜索条件
|
||
* @return \string[][]
|
||
* @author likeadmin
|
||
* @date 2023/12/20 10:14
|
||
*/
|
||
public function setSearch(): array
|
||
{
|
||
return [
|
||
'=' => ['tb.org_id', 'tb.dept_id', 'tb.supplier_id', 'tb.procurement_contract_id', 'tb.acceptance_bill_id'],
|
||
];
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 获取列表
|
||
* @return array
|
||
* @throws \think\db\exception\DataNotFoundException
|
||
* @throws \think\db\exception\DbException
|
||
* @throws \think\db\exception\ModelNotFoundException
|
||
* @author likeadmin
|
||
* @date 2023/12/20 10:14
|
||
*/
|
||
public function lists(): array
|
||
{
|
||
return Db::name('TransferBill')->alias('tb')
|
||
->where($this->searchWhere)
|
||
->whereNull('tb.delete_time')
|
||
->leftJoin('orgs o','o.id = tb.org_id')
|
||
->leftJoin('dept d','d.id = tb.dept_id')
|
||
->leftJoin('procurement_contract pc','pc.id = tb.procurement_contract_id')
|
||
->leftJoin('project p','p.id = pc.project_id')
|
||
->leftJoin('acceptance_bill ab','ab.id = tb.acceptance_bill_id')
|
||
->leftJoin('bank_account ba','ba.id = ab.bank_account_id')
|
||
->leftJoin('supplier s','s.id = tb.supplier_id')
|
||
->field('tb.*, d.name as dept_name, o.name as org_name, p.name as project_name, pc.contract_no, pc.contract_name, ab.receipt_date, ab.bill_sn, ab.bill_type, ab.draft_acceptance_bank, ab.bill_due_date, ba.deposit_bank, ba.account_name, ba.account, s.supplier_code, s.supplier_name')
|
||
->limit($this->limitOffset, $this->limitLength)
|
||
->order(['tb.id' => 'desc'])
|
||
->select()->each(function($item, $key){
|
||
//关联数据后续添加
|
||
$item['supplier_name'] = '供应商名称';
|
||
return $item;
|
||
})
|
||
->toArray();
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 获取数量
|
||
* @return int
|
||
* @author likeadmin
|
||
* @date 2023/12/20 10:14
|
||
*/
|
||
public function count(): int
|
||
{
|
||
return Db::name('TransferBill')->alias('tb')
|
||
->where($this->searchWhere)
|
||
->whereNull('tb.delete_time')
|
||
->leftJoin('orgs o','o.id = tb.org_id')
|
||
->leftJoin('dept d','d.id = tb.dept_id')
|
||
->leftJoin('procurement_contract pc','pc.id = tb.procurement_contract_id')
|
||
->leftJoin('project p','p.id = pc.project_id')
|
||
->leftJoin('acceptance_bill ab','ab.id = tb.acceptance_bill_id')->count();
|
||
}
|
||
|
||
} |