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
929 B

package sysService
import (
"GoBanpen/core/comm"
"GoBanpen/models"
"github.com/xormplus/builder"
"strings"
)
func FindRole(uuid string) *models.SysRole {
e := new(models.SysRole)
ok, err := comm.DbMain.Where("uuid=?", uuid).Get(e)
if err != nil {
return nil
}
if ok {
return e
}
return nil
}
func FindPermission(uuid string) *models.SysPermssion {
e := new(models.SysPermssion)
ok, err := comm.DbMain.Where("uuid=?", uuid).Get(e)
if err != nil {
return nil
}
if ok {
return e
}
return nil
}
func FindPermissions(uuids string) string {
if len(uuids) <= 0 {
return ""
}
rets := ""
permssions := make([]*models.SysPermssion, 0)
err := comm.DbMain.Where(builder.In("uuid", strings.Split(uuids, ","))).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
}