96 lines
3.2 KiB
PHP
96 lines
3.2 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\jxgl;
|
||
|
||
|
||
use app\adminapi\lists\BaseAdminDataLists;
|
||
use app\common\model\auth\Admin;
|
||
use app\common\model\jxgl\OaExamineTemp;
|
||
use app\common\model\jxgl\OaExamineTempItem;
|
||
use app\common\model\jxgl\OaSelfExamine;
|
||
use app\common\lists\ListsSearchInterface;
|
||
use app\common\model\jxgl\OaSelfExamineDetail;
|
||
|
||
|
||
/**
|
||
* 自评记录列表
|
||
* Class OaSelfExamineLists
|
||
* @package app\adminapi\listsjxgl
|
||
*/
|
||
class OaSelfExamineLists extends BaseAdminDataLists implements ListsSearchInterface
|
||
{
|
||
|
||
private $where = [];
|
||
|
||
/**
|
||
* @notes 设置搜索条件
|
||
* @return \string[][]
|
||
* @author likeadmin
|
||
* @date 2024/06/03 15:36
|
||
*/
|
||
public function setSearch(): array
|
||
{
|
||
return [
|
||
'=' => ['examine_type'],
|
||
];
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 获取自评记录列表
|
||
* @return array
|
||
* @throws \think\db\exception\DataNotFoundException
|
||
* @throws \think\db\exception\DbException
|
||
* @throws \think\db\exception\ModelNotFoundException
|
||
* @author likeadmin
|
||
* @date 2024/06/03 15:36
|
||
*/
|
||
public function lists(): array
|
||
{
|
||
$params = $this->request->get();
|
||
if(!empty($params['examine_month'])){
|
||
$this->where[] = ['examine_month','=',strtotime($params['examine_month'])];
|
||
}
|
||
if(!empty($params['user_id'])){
|
||
$this->where[] = ['user_id','=',$params['user_id']];
|
||
}else{
|
||
$this->where[] = ['user_id','=',$this->adminId];
|
||
}
|
||
return OaSelfExamine::withoutField('update_time,delete_time')->where($this->searchWhere)->where($this->where)
|
||
->limit($this->limitOffset, $this->limitLength)
|
||
->order(['id' => 'desc'])
|
||
->select()->each(function($data){
|
||
$data['user_name'] = Admin::where('id',$data['user_id'])->value('name');
|
||
$data['temp_name'] = OaExamineTemp::where('id',$data['examine_temp_id'])->value('temp_name');
|
||
$data['examine_type_text'] = $data->examine_type_text;
|
||
$data['total_score'] = OaExamineTempItem::where('examine_temp_id',$data['examine_temp_id'])->sum('score');
|
||
$data['total_self_score'] = OaSelfExamineDetail::where('self_examine_id',$data['id'])->sum('self_score');
|
||
})
|
||
->toArray();
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 获取自评记录数量
|
||
* @return int
|
||
* @author likeadmin
|
||
* @date 2024/06/03 15:36
|
||
*/
|
||
public function count(): int
|
||
{
|
||
return OaSelfExamine::where($this->searchWhere)->where($this->where)->count();
|
||
}
|
||
|
||
} |