123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- package system
- import (
- "github.com/beego/beego/v2/client/orm"
- "github.com/rdlucklib/rdluck_tools/paging"
- "time"
- )
- type AdminItem struct {
- AdminId int `description:"系统用户id"`
- AdminName string `description:"系统用户名称"`
- RealName string `description:"系统用户姓名"`
- Password string
- LastUpdatedPasswordTime string `json:"-"`
- Enabled int `description:"1:有效,0:禁用"`
- Email string `description:"系统用户邮箱"`
- LastLoginTime string
- CreatedTime time.Time
- LastUpdatedTime string
- Role string `description:"系统用户角色"`
- Mobile string `description:"手机号"`
- RoleType int `description:"角色类型:1需要录入指标,0:不需要"`
- RoleId int `description:"角色id"`
- RoleName string `description:"角色名称"`
- RoleTypeCode string `description:"角色编码"`
- DepartmentId int `description:"部门id"`
- DepartmentName string `json:"-" description:"部门名称"`
- TeamId int `description:"三级id"`
- GroupId int `description:"分组id"`
- GroupName string `json:"-" description:"分组名称"`
- Authority int `description:"管理权限,0:无,1:部门负责人,2:小组负责人,或者ficc销售主管,4:ficc销售组长"`
- Position string `description:"职位"`
- DepartmentGroup string `description:"部门分组"`
- LabelVal int `description:"标签:1:超级管理员,2:管理员,3:部门经理,4:组长,5:ficc销售主管"`
- ResearchGroupName string `description:"研究方向分组名称"`
- Province string `description:"省"`
- ProvinceCode string `description:"省编码"`
- City string `description:"市"`
- CityCode string `description:"市编码"`
- }
- type AdminRespItem struct {
- AdminId int `description:"系统用户id"`
- AdminName string `description:"系统用户名称"`
- RealName string `description:"系统用户姓名"`
- Password string
- LastUpdatedPasswordTime string `json:"-"`
- Enabled int `description:"1:有效,0:禁用"`
- Email string `description:"系统用户邮箱"`
- LastLoginTime string
- CreatedTime time.Time
- LastUpdatedTime string
- Role string `description:"系统用户角色"`
- Mobile string `description:"手机号"`
- RoleType int `description:"角色类型:1需要录入指标,0:不需要"`
- RoleId int `description:"角色id"`
- RoleName string `description:"角色名称"`
- RoleTypeCode string `description:"角色编码"`
- DepartmentId int `description:"部门id"`
- DepartmentName string `json:"-" description:"部门名称"`
- parentId int `description:"父级id"`
- GroupId int `description:"分组id"`
- GroupName string `json:"-" description:"分组名称"`
- Authority int `description:"管理权限,0:无,1:部门负责人,2:小组负责人,或者ficc销售主管,4:ficc销售组长"`
- Position string `description:"职位"`
- DepartmentGroup string `description:"部门分组"`
- LabelVal int `description:"标签:1:超级管理员,2:管理员,3:部门经理,4:组长,5:ficc销售主管"`
- }
- type SysuserListResp struct {
- List []*AdminItem
- Paging *paging.PagingItem `description:"分页数据"`
- }
- type SysuserAddReq struct {
- AdminName string `description:"系统用户名称"`
- AdminAvatar string `description:"用户头像"`
- RealName string `description:"系统用户姓名"`
- Password string `description:"密码"`
- Mobile string `description:"手机号"`
- RoleId int `description:"角色id"`
- DepartmentId int `description:"部门id"`
- GroupId int `description:"分组id"`
- TeamId int `description:"小组id"`
- //Authority int `description:"管理权限,0:无,1:部门负责人,2:小组负责人"`
- Position string `description:"职位"`
- ResearchGroupIds string `description:"研究方向分组IDs"`
- Province string `description:"省"`
- ProvinceCode string `description:"省编码"`
- City string `description:"市"`
- CityCode string `description:"市编码"`
- }
- type SysuserEditReq struct {
- AdminId int `description:"系统用户id"`
- AdminName string `description:"系统用户名称"`
- AdminAvatar string `description:"用户头像"`
- RealName string `description:"系统用户姓名"`
- Password string `description:"密码"`
- Mobile string `description:"手机号"`
- RoleId int `description:"角色id"`
- DepartmentId int `description:"部门id"`
- GroupId int `description:"分组id"`
- TeamId int `description:"小组id"`
- Enabled int `description:"1:有效,0:禁用"`
- //Authority int `description:"管理权限,0:无,1:部门负责人,2:小组负责人"`
- Position string `description:"职位"`
- ResearchGroupIds string `description:"研究方向分组IDs"`
- Province string `description:"省"`
- ProvinceCode string `description:"省编码"`
- City string `description:"市"`
- CityCode string `description:"市编码"`
- }
- // 用户状态编辑
- type SysuserEditEnabledReq struct {
- AdminId int `description:"系统用户id"`
- Enabled int `description:"1:有效,0:禁用"`
- }
- type SysuserDeleteReq struct {
- AdminId int `description:"系统用户id"`
- }
- func GetSysUserItems(condition string, pars []interface{}) (items []*AdminItem, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM admin WHERE 1=1 `
- if condition != "" {
- sql += condition
- }
- sql += `ORDER BY last_updated_time DESC `
- _, err = o.Raw(sql, pars).QueryRows(&items)
- return
- }
- type OpenIdList struct {
- OpenId string
- AdminId int
- }
- // ResearcherAdminAndUser 研究员admin信息及wx_user信息
- type ResearcherAdminAndUser struct {
- UserId int `description:"用户ID"`
- UserName string `description:"用户名称"`
- AdminId int `description:"管理员ID"`
- AdminName string `description:"管理员姓名"`
- OpenId string `description:"openid"`
- }
- func GetSysUserItemsOrderByCreated(condition string, pars []interface{}) (items []*AdminItem, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM admin WHERE 1=1 `
- if condition != "" {
- sql += condition
- }
- sql += ` ORDER BY created_time DESC `
- _, err = o.Raw(sql, pars).QueryRows(&items)
- return
- }
- func GetAdminList() (items []*AdminItem, err error) {
- sql := `SELECT * FROM admin`
- o := orm.NewOrm()
- _, err = o.Raw(sql).QueryRows(&items)
- return
- }
|