\App\ModelsSysDept

部门

职责:公司下的树形组织单元。ancestors 祖级路径(0/3/8/)支持 LIKE 子树查询, 并借 SubtreeIds Trait 提供前缀区间子树查询。

Summary

Methods
Properties
Constants
subtreeIds()
timestampCasts()
company()
leader()
region()
posts()
memberships()
postScopes()
userScopes()
$timestamps
$id
$company_id
$parent_id
$ancestors
$name
$dept_code
$phone
$email
$fax
$dept_type
$description
$location
$region_id
$leader_id
$sort
$status
$remark
$create_time
$update_time
No constants found
serializeDate()
casts()
$table
$fillable
N/A
No private methods found
No private properties found
N/A

Properties

$timestamps

$timestamps

$id

$id : int

主键ID

Type

int

$company_id

$company_id : int

所属公司ID

Type

int

$parent_id

$parent_id : int

父部门ID,0=公司直属

Type

int

$ancestors

$ancestors : string

祖级路径

Type

string

$name

$name : string

部门名称

Type

string

$dept_code

$dept_code : string

部门编码

Type

string

$phone

$phone : string

部门电话

Type

string

$email

$email : string

部门邮箱

Type

string

$fax

$fax : string

传真

Type

string

$dept_type

$dept_type : int

部门类型:1 职能部门、2 业务部门、3 项目组

Type

int

$description

$description : string|null

部门职责/简介

Type

string|null

$location

$location : string

办公地点

Type

string

$region_id

$region_id : int

所在地区ID,0=跟随公司

Type

int

$leader_id

$leader_id : int

部门负责人用户ID,0=未设置

Type

int

$sort

$sort : int

排序号

Type

int

$status

$status : int

状态:1 启用,0 停用

Type

int

$remark

$remark : string

备注说明

Type

string

$create_time

$create_time : string

创建时间

Type

string

$update_time

$update_time : string|null

更新时间

┌────────────────── 分区导航(按此顺序阅读)──────────────────┐ 分区 1 · 常量 本地枚举(启停状态 STATUS_* 已单源 HasStatusConstants) 分区 2 · 表名与属性 $table / $fillable / casts 分区 3 · 关联关系 company / leader / region / posts / memberships / postScopes / userScopes └────────────────────────────────────────────────────────────┘

Type

string|null

$table

$table

$fillable

$fillable

Methods

subtreeIds()

subtreeIds(int  $id) : int[]

子树(含自身)节点 id 集。

流程:① 查自身 ancestors ② 计算前缀区间 ③ 区间扫描取全部后代 id ④ 补入自身 id 后返回。

Parameters

int $id

Returns

int[] —

timestampCasts()

timestampCasts() : array<string,string>

全库统一的时间列 cast 段(单源:约 22 个模型 casts() 内重复的两行)。 使用方模型 casts() 内 `return array_merge(self::timestampCasts(), [...])`。

Returns

array

company()

company() : \Illuminate\Database\Eloquent\Relations\BelongsTo

所属公司

Returns

\Illuminate\Database\Eloquent\Relations\BelongsTo —

leader()

leader() : \Illuminate\Database\Eloquent\Relations\BelongsTo

部门负责人用户

Returns

\Illuminate\Database\Eloquent\Relations\BelongsTo —

region()

region() : \Illuminate\Database\Eloquent\Relations\BelongsTo

所属地区(档案字段;region_id=0 未设置)

Returns

\Illuminate\Database\Eloquent\Relations\BelongsTo —

posts()

posts() : \Illuminate\Database\Eloquent\Relations\HasMany

部门下的岗位(岗位唯一归属一个部门)

Returns

\Illuminate\Database\Eloquent\Relations\HasMany —

memberships()

memberships() : \Illuminate\Database\Eloquent\Relations\HasMany

部门下的任职记录(组织轴归属)

Returns

\Illuminate\Database\Eloquent\Relations\HasMany —

postScopes()

postScopes() : \Illuminate\Database\Eloquent\Relations\HasMany

被引用的岗位范围配置(部门删除时级联清理)

Returns

\Illuminate\Database\Eloquent\Relations\HasMany —

userScopes()

userScopes() : \Illuminate\Database\Eloquent\Relations\HasMany

被引用的个人范围配置(部门删除时级联清理)

Returns

\Illuminate\Database\Eloquent\Relations\HasMany —

serializeDate()

serializeDate(\DateTimeInterface  $date) : string

所有日期属性统一按 "年-月-日 时:分:秒" 序列化。

Parameters

\DateTimeInterface $date

Returns

string —

casts()

casts() : array

Returns

array —