You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

51 lines
946 B

package sysService
import (
"GoClouds/core/comm"
"GoClouds/models"
"strings"
"xorm.io/builder"
)
func FindRole(xid string) *models.SysRole {
e := new(models.SysRole)
ok, err := comm.DbSysHelper.GetDB().Where("xid=?", xid).Get(e)
if err != nil {
return nil
}
if ok {
return e
}
return nil
}
func FindPermission(xid string) *models.SysPermssion {
e := new(models.SysPermssion)
ok, err := comm.DbSysHelper.GetDB().Where("xid=?", xid).Get(e)
if err != nil {
return nil
}
if ok {
return e
}
return nil
}
func FindPermissions(xids string) string {
if len(xids) <= 0 {
return ""
}
rets := ""
permssions := make([]*models.SysPermssion, 0)
err := comm.DbSysHelper.GetDB().Where(builder.In("xid", strings.Split(xids, ","))).Find(&permssions)
if err == nil {
ln := len(permssions)
for i, o := range permssions {
if i < ln-1 {
rets += o.Title + ","
} else {
rets += o.Title
}
}
}
return rets
}