85 lines
2.7 KiB
PHP
85 lines
2.7 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\works\rlzy;
|
||
|
||
|
||
use app\adminapi\lists\BaseAdminDataLists;
|
||
use app\common\model\auth\Admin;
|
||
use app\common\model\works\rlzy\OaPersonalQuit;
|
||
use app\common\lists\ListsSearchInterface;
|
||
|
||
|
||
/**
|
||
* 离职档案列表
|
||
* Class OaPersonalQuitLists
|
||
* @package app\adminapi\listsworks\rlzy
|
||
*/
|
||
class OaPersonalQuitLists extends BaseAdminDataLists implements ListsSearchInterface
|
||
{
|
||
|
||
|
||
/**
|
||
* @notes 设置搜索条件
|
||
* @return \string[][]
|
||
* @author likeadmin
|
||
* @date 2024/05/23 09:43
|
||
*/
|
||
public function setSearch(): array
|
||
{
|
||
return [
|
||
'=' => ['uid', 'lead_admin_id', 'connect_id', 'quit_time'],
|
||
];
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 获取离职档案列表
|
||
* @return array
|
||
* @throws \think\db\exception\DataNotFoundException
|
||
* @throws \think\db\exception\DbException
|
||
* @throws \think\db\exception\ModelNotFoundException
|
||
* @author likeadmin
|
||
* @date 2024/05/23 09:43
|
||
*/
|
||
public function lists(): array
|
||
{
|
||
return OaPersonalQuit::where($this->searchWhere)
|
||
->limit($this->limitOffset, $this->limitLength)
|
||
->order(['id' => 'desc'])
|
||
->select()->each(function($data){
|
||
$user = Admin::where('id',$data['uid'])->findOrEmpty();
|
||
$other_user = Admin::where('id','in',[$data['lead_admin_id'],$data['connect_id']])->column('name','id');
|
||
$connect_users = Admin::where('id','in',$data['connect_uids'])->column('name');
|
||
$data['user_name'] = $user['name'];
|
||
$data['lead_admin_name'] = $other_user[$data['lead_admin_id']] ?? '';
|
||
$data['connect_user_name'] = $other_user[$data['connect_id']] ?? '';
|
||
$data['connect_users'] = implode(',',$connect_users);
|
||
})
|
||
->toArray();
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 获取离职档案数量
|
||
* @return int
|
||
* @author likeadmin
|
||
* @date 2024/05/23 09:43
|
||
*/
|
||
public function count(): int
|
||
{
|
||
return OaPersonalQuit::where($this->searchWhere)->count();
|
||
}
|
||
|
||
} |