From 36e7e12d9337e842f2c715a865533ffbbac8f5a9 Mon Sep 17 00:00:00 2001 From: chent Date: Sat, 7 Dec 2024 16:17:34 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dlike=E9=A2=84=E7=BC=96?= =?UTF-8?q?=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/system/dept.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 { From ddcf5a65535fd24d177f6f704c902f5942e832f4 Mon Sep 17 00:00:00 2001 From: chent Date: Sun, 8 Dec 2024 15:51:53 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E9=98=B2=E6=AD=A2LDAP=E6=B3=A8=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/ldap/search.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)