package models import ( //"fmt" "github.com/beego/beego/v2/client/orm" "time" ) // 专项调研活动列表 type CygxActivitySpecialDetail struct { ActivityId int `description:"活动ID "` ActivityTypeName string `description:"活动名称"` SpecialType int `description:"调研形式、 1 线上 , 2 线下"` City string `description:"调研城市"` ChartPermissionName string `description:"行业名称"` ChartPermissionId int `description:"行业Id"` ResearchTheme string `description:"调研主题"` ActivityTimeText string `description:"活动预期时间带文字"` TripImgLink string `description:"行程图片链接"` IsSignup int `description:"是否感兴趣 1是 ,0 否"` Label string `description:"主题标签"` ImgUrl string `description:"图片链接"` ImgUrlText string `description:"图片链接文字"` IndustrialName string `description:"产业名称"` IndustrialSubjectName string `description:"标的名称(相关公司)"` Scale string `description:"管理规模,空不填,1::50亿以下,2:50~100亿,3:100亿以上。多个用, 隔开"` CustomerTypeIds string `description:"活动可见的客户类型,多个ID用 , 隔开"` IsTrip int `description:"是否报名 1是 ,0 否"` TripNum int `description:"已报名人数"` Days int `description:"调研天数"` Host string `description:"主持人"` PersonInCharge string `description:"纪要负责人"` LimitPeopleNum int `description:"限制人数数量"` TripImgLinkFix string `description:"确定行程之后的图片链接"` ActivityTimeTextByDay string `description:"活动预期时间带周日"` ActivityTime string `description:"活动预期时间"` ActivityTimeEnd string `description:"活动预期结束时间"` ActiveState int `description:"活动进行状态 未开始:1、进行中2、已结束3"` TripStatus int `description:"行程进行状态 1:预报名,2:确定行程"` Explain string `description:"说明"` AdminId int `description:"管理员ID"` LastUpdatedTime time.Time `description:"更新时间"` } // 获取数量 func GetActivitySpecialCount(condition string, pars []interface{}) (count int, err error) { sqlCount := ` SELECT COUNT(1) AS count FROM cygx_activity_special as art WHERE 1= 1 ` if condition != "" { sqlCount += condition } o := orm.NewOrm() err = o.Raw(sqlCount, pars).QueryRow(&count) return } // 主题列表 func GetActivitySpecialListAll(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxActivitySpecialDetail, err error) { o := orm.NewOrm() sql := `SELECT * FROM cygx_activity_special as art WHERE 1= 1 ` if condition != "" { sql += condition } sql += ` ORDER BY art.last_updated_time DESC LIMIT ?,? ` _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items) return } // 修改发布状态 func UpdateActivitySpecialPublishStatus(publishStatus, activityId int) (err error) { sql := ` UPDATE cygx_activity_special SET publish_status= ? WHERE activity_id = ?` o := orm.NewOrm() _, err = o.Raw(sql, publishStatus, activityId).Exec() return }