package models import "github.com/beego/beego/v2/client/orm" type Admin struct { AdminId int AdminName string `description:"系统用户名称"` RealName string `description:"系统用户姓名"` Password string `description:"密码"` Mobile string `description:"手机号"` RoleId int `description:"角色id"` RoleName string `description:"角色名称"` RoleTypeCode string `description:"角色编码"` DepartmentId int `description:"部门id"` GroupId int `description:"分组id"` Authority int `description:"管理权限,0:无,1:部门负责人,2:小组负责人"` Position string `description:"职位"` OpenId string `description:"弘则部门公众号的openid"` } func GetAdminByAdminId(adminId int) (item *Admin, err error) { sql := `SELECT * FROM admin WHERE admin_id=? ` err = orm.NewOrm().Raw(sql, adminId).QueryRow(&item) return } type AdminView struct { AdminId int AdminName string `description:"系统用户名称"` RealName string `description:"系统用户姓名"` Password string `description:"密码"` Mobile string `description:"手机号"` RoleId int `description:"角色id"` RoleName string `description:"角色名称"` RoleTypeCode string `description:"角色编码"` DepartmentId int `description:"部门id"` GroupId int `description:"分组id"` GroupName string `description:"分组名称"` Authority int `description:"管理权限,0:无,1:部门负责人,2:小组负责人"` Position string `description:"职位"` } func GetAdminList() (list []*AdminView, err error) { sql := `SELECT * FROM admin ` _, err = orm.NewOrm().Raw(sql).QueryRows(&list) return }