|
|
|
@ -251,9 +251,9 @@ func getDepartmentParent(departmentID string, dbConn *gorm.DB) (*db.Department,
|
|
|
|
|
var department db.Department
|
|
|
|
|
//var parentID string
|
|
|
|
|
dbConn.LogMode(true)
|
|
|
|
|
// select * from departments where department_id = (select parent_id from departments where department_id= zx234fd);
|
|
|
|
|
//dbConn.Table("departments").Where("department_id=?", departmentID).Pluck("parent_id", parentID).Error
|
|
|
|
|
err := dbConn.Table("departments").Where("department_id=?").Find(&department).Error
|
|
|
|
|
var parentID int
|
|
|
|
|
dbConn.Model(&department).Where("department_id=?", departmentID).Pluck("parent_id", &parentID)
|
|
|
|
|
err := dbConn.Model(&department).Where("department_id = ?", parentID).Find(&department).Error
|
|
|
|
|
return &department, err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|