93 lines
3.3 KiB
PHP
93 lines
3.3 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\marketing;
|
||
|
||
|
||
use app\adminapi\lists\BaseAdminDataLists;
|
||
use app\common\lists\ListsSearchInterface;
|
||
use app\common\model\auth\Admin;
|
||
use app\common\model\marketing\MarketingContract;
|
||
use app\common\model\marketing\MarketingProjectFiling;
|
||
use app\common\model\marketing\MarketingProjectFilingDetail;
|
||
|
||
|
||
/**
|
||
* 市场经营--项目备案明细列表
|
||
* Class MarketingProjectFilingDetailLists
|
||
* @package app\adminapi\listsmarketing
|
||
*/
|
||
class MarketingProjectFilingDetailLists extends BaseAdminDataLists implements ListsSearchInterface
|
||
{
|
||
|
||
|
||
/**
|
||
* @notes 设置搜索条件
|
||
* @return \string[][]
|
||
* @author likeadmin
|
||
* @date 2024/04/05 10:36
|
||
*/
|
||
public function setSearch(): array
|
||
{
|
||
return [
|
||
'=' => ['project_filing_id', 'filing_role', 'status'],
|
||
'%like%' => ['filing_user'],
|
||
];
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 获取市场经营--项目备案明细列表
|
||
* @return array
|
||
* @throws \think\db\exception\DataNotFoundException
|
||
* @throws \think\db\exception\DbException
|
||
* @throws \think\db\exception\ModelNotFoundException
|
||
* @author likeadmin
|
||
* @date 2024/04/05 10:36
|
||
*/
|
||
public function lists(): array
|
||
{
|
||
return MarketingProjectFilingDetail::withoutField('create_time,update_time,delete_time')->where($this->searchWhere)
|
||
->limit($this->limitOffset, $this->limitLength)
|
||
->order(['id' => 'desc'])
|
||
->select()->each(function ($data) {
|
||
$project_filing = MarketingProjectFiling::field('contract_id')->where('id', $data['project_filing_id'])->findOrEmpty();
|
||
$contract = MarketingContract::field('contract_name,contract_code,const_area,business_nature')->where('id', $project_filing['contract_id'])->findOrEmpty();
|
||
$data['contract_name'] = $contract['contract_name'];
|
||
$data['contract_code'] = $contract['contract_code'];
|
||
$data['const_area'] = $contract->const_area_text;
|
||
$data['business_nature'] = $contract->business_nature_text;
|
||
$data['filing_role'] = (string)$data['filing_role'];
|
||
$data['filing_role_text'] = $data->filing_role_text;
|
||
$data['status'] = (string)$data['status'];
|
||
$data['status_text'] = $data->status_text;
|
||
$admin = Admin::field('name')->where('id', $data['filing_user'])->findOrEmpty();
|
||
$data['filing_user_name'] = $admin?->name;
|
||
})
|
||
->toArray();
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 获取市场经营--项目备案明细数量
|
||
* @return int
|
||
* @author likeadmin
|
||
* @date 2024/04/05 10:36
|
||
*/
|
||
public function count(): int
|
||
{
|
||
return MarketingProjectFilingDetail::where($this->searchWhere)->count();
|
||
}
|
||
|
||
} |