44 lines
1.0 KiB
PHP
Raw Normal View History

2020-01-09 08:21:44 +08:00
<?php
namespace catchAdmin\permissions\model;
2020-01-13 21:23:24 +08:00
use catchAdmin\permissions\model\search\DepartmentSearch;
2020-01-09 08:21:44 +08:00
use catcher\base\CatchModel;
class Department extends CatchModel
{
2020-01-13 21:23:24 +08:00
use DepartmentSearch;
2020-01-12 09:30:56 +08:00
protected $name = 'departments';
2020-01-09 08:21:44 +08:00
protected $field = [
2020-01-09 22:20:36 +08:00
'id', //
'department_name', // 部门名称
'parent_id', // 父级ID
'principal', // 负责人
'mobile', // 联系电话
'email', // 联系又想
'creator_id', // 创建人ID
'status', // 1 正常 2 停用
'sort', // 排序字段
'created_at', // 创建时间
'updated_at', // 更新时间
'deleted_at', // 删除状态null 未删除 timestamp 已删除
];
/**
* 列表数据
*
* @time 2020年01月09日
* @param $params
2020-01-13 21:39:42 +08:00
* @return array
2020-01-09 22:20:36 +08:00
* @throws \think\db\exception\DbException
*/
2020-01-13 21:23:24 +08:00
public function getList(): array
2020-01-09 22:20:36 +08:00
{
2020-01-13 21:39:42 +08:00
return $this->withoutField(['department_name'])
->addFields(['department_name as title'])
2020-01-13 21:23:24 +08:00
->catchSearch()
2020-01-09 22:20:36 +08:00
->select()->toArray();
}
}