diff --git a/models/system/dept.go b/models/system/dept.go index dde27d7a..4ca36a82 100644 --- a/models/system/dept.go +++ b/models/system/dept.go @@ -115,7 +115,7 @@ func (e *Dept) GetPage(bl bool) ([]Dept, error) { table = table.Where("status = ?", e.Status) } if e.DeptPath != "" { - table = table.Where("deptPath like %?%", e.DeptPath) + table = table.Where("dept_path like ?", "%"+e.DeptPath+"%") } if err := table.Order("sort").Find(&doc).Error; err != nil { diff --git a/pkg/ldap/search.go b/pkg/ldap/search.go index 368c56ce..7e3d69ae 100644 --- a/pkg/ldap/search.go +++ b/pkg/ldap/search.go @@ -70,7 +70,7 @@ func searchRequest(username string) (userInfo *ldap.Entry, err error) { 0, 0, false, - fmt.Sprintf("(%v=%v)", viper.GetString("settings.ldap.userField"), username), + fmt.Sprintf("(%v=%v)", viper.GetString("settings.ldap.userField"), ldap.EscapeFilter(username)), ldapFieldsFilter, nil)