12345678910111213141516171819202122232425 |
- package system
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type SysRoleAdmin struct {
- Id int `orm:"column(id);pk" description:"自增ID"`
- AdminId int `orm:"column(admin_id);" description:"系统用户id"`
- RoleId int `orm:"column(role_id);" description:"角色ID"`
- CreateTime time.Time `orm:"column(create_time);" description:"创建时间"`
- }
- func (sa *SysRoleAdmin) TableName() string {
- return "sys_role_admin"
- }
- // GetRoleIdsByAdminId 根据管理员账号查询角色ID
- func GetRoleIdsByAdminId(adminId int) (items []*SysRoleAdmin, err error) {
- sql := `SELECT * from sys_role_admin where admin_id = ?`
- _, err = orm.NewOrm().Raw(sql, adminId).QueryRows(&items)
- return
- }
|