test_data/model/department.go
2024-07-17 15:13:00 +08:00

26 lines
775 B
Go

package model
import (
"gorm.io/gorm"
"time"
)
type Departments struct {
ID uint `gorm:"primaryKey" json:"id"`
DepartmentId string `json:"department_id" gorm:"index"`
Name string `json:"name"`
Description string `json:"description" gorm:"type:text"`
ParentId uint `json:"parent_id"`
UUID string `json:"uuid"`
DN string `json:"dn"`
TencentID int64 `json:"tencent_id"`
Children []*Departments `json:"children" gorm:"foreignkey:ParentId"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"-"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
}
func (Departments) TableName() string {
return "departments"
}