1 Star 1 Fork 1

xiaoyutab / xgotool

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
get_role_list.go 542 Bytes
一键复制 编辑 原始数据 按行查看 历史
package xauth
// 获取角色列表
//
// id 角色ID列表
// offset 跳过条数
// limit 查询条数
func GetRoleList(id []uint, offset, limit int) ([]Role, error) {
if _default.DB == nil {
return nil, errFun("数据库未连接", nil)
}
mod := []Role{}
db := _default.DB.Table(_default.RoleName)
if len(id) > 0 {
db = db.Where("id IN ?", id)
}
err := db.
Offset(offset).
Limit(limit).
Order("id DESC").
Find(&mod).
Error
if err != nil {
return nil, errFun("角色列表获取失败", err)
}
return mod, nil
}
Go
1
https://gitee.com/xiaoyutab/xgotool.git
git@gitee.com:xiaoyutab/xgotool.git
xiaoyutab
xgotool
xgotool
v0.3.9

搜索帮助