package cygx

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

type CygxUserLabelActivitySpecial 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 GetCygxUserLabelActivitySpecial(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxUserLabelActivitySpecial, err error) {
	o := orm.NewOrmUsingDB("hz_cygx")
	sql := `SELECT * FROM cygx_user_label_activity_special as art WHERE 1= 1 `
	if condition != "" {
		sql += condition
	}
	sql += ` LIMIT ?,?  `
	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
	return
}

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