123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- "hongze/hongze_clpt/utils"
- "time"
- )
- type Admin struct {
- AdminId int `orm:"column(admin_id);pk" description:"系统用户id"`
- AdminName string `description:"系统用户名称"`
- AdminAvatar string `description:"用户头像"`
- RealName string `description:"系统用户姓名"`
- Password string `json:"-"`
- LastUpdatedPasswordTime string `json:"-"`
- Enabled int
- 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 `description:"部门名称"`
- GroupId int `description:"分组id"`
- GroupName string `description:"分组名称"`
- Authority int `description:"管理权限,0:无,1:部门负责人,2:小组负责人,或者ficc销售主管,4:ficc销售组长"`
- Position string `description:"职位"`
- DisableTime time.Time `description:"禁用时间"`
- ChartPermission int8 `description:"图表权限id"`
- OpenId string `description:"弘则部门公众号的openid"`
- UnionId string `description:"微信公众平台唯一标识"`
- EdbPermission int8 `description:"指标库操作权限,0:只能操作 自己的,1:所有指标可操作"`
- MysteelChemicalPermission int8 `description:"钢联化工指标操作权限,0:只能操作 自己的,1:所有指标可操作"`
- PredictEdbPermission int8 `description:"预测指标库操作权限,0:只能操作 自己的,1:所有预测指标可操作"`
- Province string `description:"省"`
- ProvinceCode string `description:"省编码"`
- City string `description:"市"`
- CityCode string `description:"市编码"`
- }
- type AdminMobileResp struct {
- Mobile string `description:"手机号"`
- }
- // 获取销售所能查看到的手机号
- func GetAdminByRole() (items []*AdminMobileResp, err error) {
- o := orm.NewOrmUsingDB("weekly_report")
- sql := ` SELECT mobile FROM admin WHERE role = 'admin' `
- _, err = o.Raw(sql).QueryRows(&items)
- return
- }
- // 获取权益内部人员手机号
- func GetRaiAdmin() (items []*AdminMobileResp, err error) {
- o := orm.NewOrmUsingDB("weekly_report")
- sql := ` SELECT
- mobile
- FROM
- admin
- WHERE
- role_type_code LIKE '%rai%'
- AND group_id NOT IN ( 19, 10 )
- AND enabled = 1
- OR (
- department_name = '产品技术部'
- AND enabled = 1) `
- _, err = o.Raw(sql).QueryRows(&items)
- return
- }
- // 获取IT人员手机号
- func GetRaiAdminIt() (items []*AdminMobileResp, err error) {
- o := orm.NewOrmUsingDB("weekly_report")
- sql := ` SELECT
- mobile
- FROM
- admin
- WHERE
- department_id = 3
- AND enabled = 1 `
- _, err = o.Raw(sql).QueryRows(&items)
- return
- }
- // 根据角色名称获取手机号
- func GetAdminByRoleName(roleName string) (items []*AdminMobileResp, err error) {
- o := orm.NewOrmUsingDB("weekly_report")
- sql := `SELECT mobile FROM admin WHERE role_name =? ' `
- _, err = o.Raw(sql, roleName).QueryRows(&items)
- return
- }
- func GetSysAdminById(adminId int) (item *Admin, err error) {
- sql := `SELECT * FROM admin WHERE admin_id=? `
- o := orm.NewOrmUsingDB("weekly_report")
- err = o.Raw(sql, adminId).QueryRow(&item)
- return
- }
- // 根据多个ID获取管理员列表信息
- func GetAdminByAdminIds(adminId []int) (items []*AdminMobileResp, err error) {
- lenArr := len(adminId)
- if lenArr == 0 {
- return
- }
- o := orm.NewOrmUsingDB("weekly_report")
- sql := ` SELECT mobile FROM admin WHERE admin_id IN (` + utils.GetOrmInReplace(lenArr) + `)`
- _, err = o.Raw(sql, adminId).QueryRows(&items)
- return
- }
|