package models

import (
	"github.com/beego/beego/v2/client/orm"
	"time"
)

type CygxUserLabelActivity struct {
	Id                     int       `orm:"column(id);pk"`
	UserId                 int       `description:"用户ID"`
	CompanyId              int       `description:"公司id"`
	RealName               string    `description:"用户实际名称"`
	Mobile                 string    `description:"手机号"`
	Email                  string    `description:"邮箱"`
	Label                  string    `description:"标签内容"`
	ActivityId             int       `description:"活动ID"`
	IndustrialManagementId int       `description:"cygx_industrial_management表的主键ID"`
	CreateTime             time.Time `description:"创建时间"`
	ModifyTime             time.Time `description:"更新时间"`
}

// 列表
func GetCygxUserLabelActivity(condition string, pars []interface{}) (items []*CygxUserLabelActivity, err error) {
	o := orm.NewOrm()
	sql := `SELECT * FROM cygx_user_label_activity as art WHERE 1= 1 `
	if condition != "" {
		sql += condition
	}
	_, err = o.Raw(sql, pars).QueryRows(&items)
	return
}

// 批量添加
func AddCygxUserLabelActivityList(items []*CygxUserLabelActivity) (lastId int64, err error) {
	lenitems := len(items)
	if lenitems == 0 {
		return
	}
	o := orm.NewOrm()
	_, err = o.InsertMulti(1, items)
	return
}
