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