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