|
@@ -0,0 +1,49 @@
|
|
|
+package company
|
|
|
+
|
|
|
+import (
|
|
|
+ "github.com/beego/beego/v2/client/orm"
|
|
|
+ "hongze/hz_crm_api/utils"
|
|
|
+ "time"
|
|
|
+)
|
|
|
+
|
|
|
+type UserProduct struct {
|
|
|
+ UserProductId int `orm:"column(user_product_id);pk" description:"用户产品id"`
|
|
|
+ CompanyId int `description:"客户id"`
|
|
|
+ ProductId int `description:"产品id"`
|
|
|
+ ProductName string `description:"产品名称"`
|
|
|
+ CompanyName string `description:"客户名称"`
|
|
|
+ Status string `description:"客户状态"`
|
|
|
+ IsSuspend int `description:"1:暂停,0:启用"`
|
|
|
+ SuspendTime time.Time `description:"暂停启用时间"`
|
|
|
+ TryOutTime time.Time `description:"正式转试用时间"`
|
|
|
+ CreateTime time.Time `description:"创建时间"`
|
|
|
+ ModifyTime time.Time `description:"修改时间"`
|
|
|
+ StartDate string `description:"开始日期"`
|
|
|
+ EndDate string `description:"结束日期"`
|
|
|
+ ContractEndDate time.Time `description:"合同结束日期"`
|
|
|
+ CloseReason string `description:"关闭原因"`
|
|
|
+ CloseTime time.Time `description:"关闭时间"`
|
|
|
+ RealName string `description:"用户姓名"`
|
|
|
+ Mobile string `description:"手机号"`
|
|
|
+ Email string `description:"邮箱"`
|
|
|
+ UserId int `description:"用户ID"`
|
|
|
+}
|
|
|
+
|
|
|
+// 新增客户产品
|
|
|
+func AddUserProduct(item *UserProduct) (newId int64, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ newId, err = o.Insert(item)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// 根据用户ID获取列表信息
|
|
|
+func GetUserProductByUserIds(userIds []int) (items []*UserProduct, err error) {
|
|
|
+ lenArr := len(userIds)
|
|
|
+ if lenArr == 0 {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sql := `SELECT * FROM user_product WHERE user_id IN (` + utils.GetOrmInReplace(lenArr) + `) `
|
|
|
+ _, err = o.Raw(sql, userIds).QueryRows(&items)
|
|
|
+ return
|
|
|
+}
|