1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- "hongze/hongze_task/utils"
- )
- 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
- }
- func GetAdminByAdminIds(adminIds []int) (items []*Admin, err error) {
- sql := `SELECT * FROM admin WHERE admin_id in (` + utils.GetOrmInReplace(len(adminIds)) + `) `
- _, err = orm.NewOrm().Raw(sql, adminIds).QueryRows(&items)
- 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
- }
|