98 lines
3.2 KiB
PHP
98 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\oa\lists\works\hr;
|
||
|
||
|
||
use app\common\model\auth\Admin;
|
||
use app\oa\lists\BaseAdminDataLists;
|
||
use app\common\model\works\rlzy\OaDepartmentChange;
|
||
use app\common\lists\ListsSearchInterface;
|
||
|
||
|
||
/**
|
||
* 人事调动列表
|
||
* Class OaDepartmentChangeLists
|
||
* @package app\adminapi\listsworks\hr
|
||
*/
|
||
class OaDepartmentChangeLists extends BaseAdminDataLists implements ListsSearchInterface
|
||
{
|
||
|
||
|
||
/**
|
||
* @notes 设置搜索条件
|
||
* @return \string[][]
|
||
* @author likeadmin
|
||
* @date 2024/05/22 17:55
|
||
*/
|
||
public function setSearch(): array
|
||
{
|
||
return [
|
||
'=' => ['uid', 'from_did', 'to_did', 'status'],
|
||
];
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 获取人事调动列表
|
||
* @return array
|
||
* @throws \think\db\exception\DataNotFoundException
|
||
* @throws \think\db\exception\DbException
|
||
* @throws \think\db\exception\ModelNotFoundException
|
||
* @author likeadmin
|
||
* @date 2024/05/22 17:55
|
||
*/
|
||
public function lists(): array
|
||
{
|
||
$query = OaDepartmentChange::where($this->searchWhere);
|
||
if (!empty($this->params['uid_name'])) {
|
||
$userIds = Admin::whereLike('name', $this->params['uid_name'])->column('id');
|
||
$query->whereIn('uid', $userIds);
|
||
}
|
||
if (!empty($this->params['move_time'])) {
|
||
$query->whereTime('move_time', $this->params['move_time']);
|
||
}
|
||
return $query->field(['id', 'uid', 'from_did', 'to_did', 'remark', 'admin_id', 'status', 'move_time'])
|
||
->limit($this->limitOffset, $this->limitLength)
|
||
->order(['id' => 'desc'])
|
||
->select()->each(function($data){
|
||
$data['user_name'] = $data->user_name;
|
||
$data['from_dept'] = $data->from_dept;
|
||
$data['to_dept'] = $data->to_dept;
|
||
$data['status_text'] = $data->status_text;
|
||
})
|
||
->toArray();
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 获取人事调动数量
|
||
* @return int
|
||
* @author likeadmin
|
||
* @date 2024/05/22 17:55
|
||
*/
|
||
public function count(): int
|
||
{
|
||
$query = OaDepartmentChange::where($this->searchWhere);
|
||
if (!empty($this->params['uid_name'])) {
|
||
$userIds = Admin::whereLike('name', $this->params['uid_name'])->column('id');
|
||
$query->whereIn('uid', $userIds);
|
||
}
|
||
if (!empty($this->params['move_time'])) {
|
||
$query->whereTime('move_time', $this->params['move_time']);
|
||
}
|
||
return $query->count();
|
||
}
|
||
|
||
} |