23 lines
960 B
Go
23 lines
960 B
Go
package model
|
|
|
|
import "time"
|
|
|
|
// Department 部门/组织架构模型
|
|
// 使用物化路径实现树形结构
|
|
type Department struct {
|
|
ID uint64 `json:"id" gorm:"primaryKey;autoIncrement"`
|
|
Name string `json:"name" gorm:"size:128;not null"` // 部门名称
|
|
Code string `json:"code" gorm:"uniqueIndex;size:64"` // 部门编码
|
|
ParentID uint64 `json:"parent_id" gorm:"index;default:0"` // 上级部门ID, 0=顶级
|
|
Path string `json:"path" gorm:"size:1024;not null"` // 物化路径
|
|
LeaderID uint64 `json:"leader_id" gorm:"default:0"` // 部门负责人用户ID
|
|
SortOrder int `json:"sort_order" gorm:"default:0"` // 排序
|
|
Status int8 `json:"status" gorm:"default:1"` // 1=启用 0=禁用
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
func (Department) TableName() string {
|
|
return "fs_department"
|
|
}
|