更新细节

This commit is contained in:
yaooo 2023-12-20 14:19:13 +08:00
parent 972383d028
commit 6b7c1fdbd5
2 changed files with 31 additions and 15 deletions

View File

@ -18,7 +18,7 @@ namespace app\adminapi\lists\cost;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\cost\CostBudgetAdjustDetail;
use app\common\lists\ListsSearchInterface;
use think\facade\Db;
/**
* CostBudgetAdjustDetail列表
@ -54,15 +54,17 @@ class CostBudgetAdjustDetailLists extends BaseAdminDataLists implements ListsSea
*/
public function lists(): array
{
return CostBudgetAdjustDetail::where($this->searchWhere)
->field(['id', 'cost_subject_id', 'cost_budget_adjust_id', 'month1', 'month2', 'month3', 'month4', 'month5', 'month6', 'month7', 'month8', 'month9', 'month10', 'month11', 'month12'])
return Db::name('CostBudgetAdjustDetail')->alias('cbad')
->where($this->searchWhere)
->whereNull('cbad.delete_time')
->leftJoin('cost_subject cs','cs.id = cbad.cost_subject_id')
->leftJoin('cost_budget_adjust cbd','cbd.id = cbad.cost_budget_adjust_id')
->leftJoin('orgs o','o.id = cbd.org_id')
->leftJoin('dept d','d.id = cbd.dept_id')
->field('cbad.*, d.name as dept_name, o.name as org_name, cbd.years, cs.sn, cs.subject1, cs.subject2')
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->order(['cbad.id' => 'desc'])
->select()->each(function($item, $key){
//关联数据后续添加
$item['subject_no'] = '科目编号';
$item['subject_first'] = '一级科目';
$item['subject_second'] = '二级科目';
return $item;
})
->toArray();
@ -77,7 +79,13 @@ class CostBudgetAdjustDetailLists extends BaseAdminDataLists implements ListsSea
*/
public function count(): int
{
return CostBudgetAdjustDetail::where($this->searchWhere)->count();
return Db::name('CostBudgetAdjustDetail')->alias('cbad')
->where($this->searchWhere)
->whereNull('cbad.delete_time')
->leftJoin('cost_subject cs','cs.id = cbad.cost_subject_id')
->leftJoin('cost_budget_adjust cbd','cbd.id = cbad.cost_budget_adjust_id')
->leftJoin('orgs o','o.id = cbd.org_id')
->leftJoin('dept d','d.id = cbd.dept_id')->count();
}
}

View File

@ -18,7 +18,7 @@ namespace app\adminapi\lists\cost;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\cost\CostBudgetAdjust;
use app\common\lists\ListsSearchInterface;
use think\facade\Db;
/**
* CostBudgetAdjust列表
@ -38,7 +38,7 @@ class CostBudgetAdjustLists extends BaseAdminDataLists implements ListsSearchInt
public function setSearch(): array
{
return [
'=' => ['approve_id', 'years', 'document_preparation_time'],
'=' => ['cba.approve_id', 'cba.years', 'cba.document_preparation_time'],
];
}
@ -54,10 +54,14 @@ class CostBudgetAdjustLists extends BaseAdminDataLists implements ListsSearchInt
*/
public function lists(): array
{
return CostBudgetAdjust::where($this->searchWhere)
->field(['id', 'approve_id', 'years', 'document_preparation_time', 'remark', 'annex'])
return Db::name('CostBudgetAdjust')->alias('cba')
->where($this->searchWhere)
->whereNull('cba.delete_time')
->leftJoin('orgs o','o.id = cba.org_id')
->leftJoin('dept d','d.id = cba.dept_id')
->field('cba.*, d.name as dept_name, o.name as org_name')
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->order(['cba.id' => 'desc'])
->select()->each(function($item, $key){
//关联数据后续添加
$item['approve_no'] = '付款单号';
@ -77,7 +81,11 @@ class CostBudgetAdjustLists extends BaseAdminDataLists implements ListsSearchInt
*/
public function count(): int
{
return CostBudgetAdjust::where($this->searchWhere)->count();
return Db::name('CostBudgetAdjust')->alias('cba')
->where($this->searchWhere)
->whereNull('cba.delete_time')
->leftJoin('orgs o','o.id = cba.org_id')
->leftJoin('dept d','d.id = cba.dept_id')->count();
}
}