Commit 61c8a2bc authored by 黄智's avatar 黄智

调整获取角色列表

parent 96d76367
...@@ -78,9 +78,9 @@ func (o *User) OrgUserRoles(oid string) (interface{}, error) { ...@@ -78,9 +78,9 @@ func (o *User) OrgUserRoles(oid string) (interface{}, error) {
} }
session := db.Table("system_role").Where(" is_deleted = 0 and state = 1 ") session := db.Table("system_role").Where(" is_deleted = 0 and state = 1 ")
if org.DataType == 2 { if org.DataType == 2 {
session.Where("role_type <= 2") session.Where("role_type = 0 or role_type = 2")
} else { } else {
session.Where("role_type <= 1") session.Where("role_type = 0 or role_type = 1")
} }
var roles []entity.SystemRole var roles []entity.SystemRole
if err := session.Find(&roles); err != nil { if err := session.Find(&roles); err != nil {
......
...@@ -11,6 +11,7 @@ package util ...@@ -11,6 +11,7 @@ package util
import ( import (
"net/http" "net/http"
"regexp" "regexp"
"strings"
"github.com/Luzifer/go-openssl/v4" "github.com/Luzifer/go-openssl/v4"
"github.com/google/uuid" "github.com/google/uuid"
...@@ -58,3 +59,11 @@ func GetUUID() string { ...@@ -58,3 +59,11 @@ func GetUUID() string {
// Creating UUID Version 4 // Creating UUID Version 4
return uuid.New().String() return uuid.New().String()
} }
func SpecialEscape(keyword string) string {
keyword = strings.Replace(keyword, "\\", "\\\\", -1)
keyword = strings.Replace(keyword, "$", "\\$", -1)
keyword = strings.Replace(keyword, "%", "\\%", -1)
keyword = strings.Replace(keyword, "_", "\\_", -1)
return keyword
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment