dept.go 910 B

1234567891011121314151617181920212223
  1. package dao
  2. // 部门
  3. type Dept struct {
  4. ID int `gorm:"primary_key;type:int" json:"id"` //部门id
  5. DeptName string `gorm:"type:varchar(12)" json:"dept_name"` //部门名称
  6. ParentId int `gorm:"type:int" json:"parent_id"` //父部门id
  7. IsDeleted int `gorm:"type:int;default:0" json:"isDeleted"` //是否删除
  8. Remark string `gorm:"type:varchar(45)" json:"remark"` //备注
  9. Responsible string `gorm:"type:varchar(25)" json:"responsible"` //负责人"
  10. Phone string `gorm:"type:varchar(25)" json:"phone"` //联系电话"
  11. SysUsers []SysUser `gorm:"-" json:"users"` //用户们
  12. }
  13. func (*Dept) TableName() string {
  14. return "dept"
  15. }
  16. func (d *Dept) GetDepts(deptIDs []int) ([]Dept, error) {
  17. var depts []Dept
  18. err := Db.Model(&d).Where("id IN (?)", deptIDs).Find(&depts).Error
  19. return depts, err
  20. }