diff --git a/pkg/common/db/mysql_model/im_mysql_model/organization_model.go b/pkg/common/db/mysql_model/im_mysql_model/organization_model.go index 0c472fbcb..be4ddefe5 100644 --- a/pkg/common/db/mysql_model/im_mysql_model/organization_model.go +++ b/pkg/common/db/mysql_model/im_mysql_model/organization_model.go @@ -287,6 +287,6 @@ func GetRandomDepartmentID() (string, error) { return "", err } department := &db.Department{} - err = dbConn.Model(department).Order("RAND()").Where("related_group_id != ?", "").First(department).Error + err = dbConn.Model(department).Order("RAND()").Where("related_group_id != ? AND department_id != ?", "", "0").First(department).Error return department.DepartmentID, err }