company_user.go 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package company
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type CompanyUser struct {
  7. UserId int64 `orm:"column(user_id);pk"`
  8. CountryCode string `description:"区号,86、852、886等"`
  9. Mobile string `description:"手机号"`
  10. Email string `description:"邮箱"`
  11. CompanyId int `description:"公司id"`
  12. CompanyName string `description:"公司名称"`
  13. RealName string `description:"姓名"`
  14. CreatedTime string `description:"创建时间"`
  15. MobileTwo string `description:"备用手机号"`
  16. BusinessCardUrl string `description:"名片地址"`
  17. IsMaker int `description:"是否决策人,1:是,0:否"`
  18. Position string `description:"职位"`
  19. Sex int `description:"普通用户性别,1为男性,2为女性"`
  20. IsRegister bool `description:"是否注册,true:已注册,false:未注册"`
  21. OpenId string `json:"-"`
  22. DepartmentName string `description:"联系人部门"`
  23. SellerRealName string `description:"销售"`
  24. Status string `description:"客户状态"`
  25. HasMove bool `description:"true:可移动,false:显示知道了"`
  26. ViewTotal int `description:"累计阅读次数"`
  27. LastViewTime time.Time `json:"-" description:"最后一次阅读时间"`
  28. LastViewTimeStr string `description:"最后一次阅读时间"`
  29. ApplyMethod int `description:"0:未申请,1:已付费客户申请试用,2:非客户申请试用"`
  30. RegisterTime string `description:"注册时间"`
  31. RegisterPlatform int `description:"注册平台,1:微信端,2:网页端"`
  32. SellerId int `description:"销售id"`
  33. SellerName string `description:"销售名称"`
  34. GroupId int `description:"所属销售分组id"`
  35. DepartmentId int `description:"所属销售分组id"`
  36. IsShared bool `description:"是否共享联系人"`
  37. ProductIds string `description:"商品权限集合,用英文,隔开"`
  38. IsChartPermissionSetting int `description:"是否设置过图表权限, 0-未设置,1-已设置,2-无需设置"`
  39. }
  40. // GetFiccCompanyUserByUserIds 批量查询用户的购买ficc的产品详情
  41. func GetFiccCompanyUserByUserIds(userIds string) (list []*CompanyUser, err error) {
  42. o := orm.NewOrm()
  43. sql := ` SELECT a.user_id, a.real_name, if(b.company_id=1,"",b.company_name) as company_name, c.status, b.company_id
  44. FROM wx_user AS a
  45. LEFT JOIN company AS b ON a.company_id=b.company_id
  46. LEFT JOIN company_product AS c ON a.company_id=c.company_id and c.product_id=1
  47. WHERE a.user_id in (` + userIds + `)`
  48. _, err = o.Raw(sql).QueryRows(&list)
  49. return
  50. }