package models

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

type CygxActivitySpecialMeetingDetail struct {
	Id          int       `orm:"column(id);pk"`
	UserId      int       `description:"用户id"`
	ActivityId  int       `description:"活动ID"`
	CreateTime  time.Time `description:"创建时间"`
	Mobile      string    `description:"手机号"`
	Email       string    `description:"邮箱号"`
	CompanyId   int       `description:"公司ID"`
	CompanyName string    `description:"公司名称"`
	IsMeeting   int       `description:"是否到会  1.是 ，0否"`
	IsAirborne  int       `description:"是否属于空降  1.是 ，0否"`
	RealName    string    `description:"真实姓名"`
}

// 添加
func AddCygxActivitySpecialMeetingDetail(item *CygxActivitySpecialMeetingDetail) (err error) {
	o := orm.NewOrm()
	_, err = o.Insert(item)
	return
}

// 取消
func CancelCygxActivitySpecialMeetingDetail(uid, activityId int) (err error) {
	o := orm.NewOrm()
	sql := `DELETE  FROM cygx_activity_special_meeting_detail   WHERE user_id=?  AND activity_id=? `
	_, err = o.Raw(sql, uid, activityId).Exec()
	return
}

func GetCygxActivitySpecialmeetingDetailList(condition string, pars []interface{}) (item []*CygxActivitySpecialTripResp, err error) {
	o := orm.NewOrm()
	sql := `SELECT *
			FROM
			cygx_activity_special_meeting_detail  
			WHERE 1 = 1 ` + condition
	_, err = o.Raw(sql, pars).QueryRows(&item)
	return
}
