123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- package yb
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- // Activity 活动表
- type Activity struct {
- ActivityId int `orm:"column(activity_id);pk" description:"活动ID"`
- FirstActivityTypeId int `description:"第一级的活动类型ID"`
- FirstActivityTypeName string `description:"第一级的活动类型名称"`
- ActivityTypeId int `description:"活动类型ID"`
- ActivityTypeName string `description:"活动类型名称"`
- ChartPermissionId int `description:"对应的权限id,表chart_permission中id"`
- ChartPermissionName string `description:"对应的权限名称,表chart_permission中name"`
- ActivityName string `description:"活动标题"`
- StartTime time.Time `description:"活动开始时间"`
- EndTime time.Time `description:"活动结束时间"`
- Speaker string `description:"主讲人"`
- SpeakerHeadPic string `description:"主讲人头像"`
- SpeakerBackgroundPic string `description:"主讲人背景图"`
- MainlandTel string `description:"大陆拨入"`
- HongKongTel string `description:"香港拨入"`
- TaiwanTel string `description:"台湾拨入"`
- AmericaTel string `description:"美国拨入"`
- SingaporeTel string `description:"新加坡拨入"`
- ParticipationCode string `description:"参会密码"`
- LinkParticipants string `description:"参会链接"`
- IsLimitPeople int8 `description:"是否限制人数 1是,0否"`
- LimitPeopleNum int `description:"限制人数数量"`
- ReportLink string `description:"报告链接"`
- City string `description:"城市"`
- Address string `description:"活动地址"`
- PosterUrl string `description:"活动海报地址"`
- Remarks string `description:"备注"`
- UserId int `description:"创建者id"`
- PublishStatus int8 `description:"发布状态,0未发布,1已发布"`
- IsSendWxMsg int8 `description:"是否推送过会议提醒微信消息,未推送:0,已推送:1"`
- IsSendSalonWxMsg int8 `description:"是否推送过沙龙提醒微信消息,未推送:0,已推送:1"`
- IsDelete int8 `description:"是否删除,0:未删除,1:已删除"`
- ArticleId int `description:"报告链接所关联的文章ID"`
- ModifyTime time.Time `description:"修改时间"`
- CreateTime time.Time `description:"创建时间"`
- }
- // TableName 表名变更
- func (activity *Activity) TableName() string {
- return "yb_activity"
- }
- // GetById 根据id获取活动详情
- func GetById(activityId int) (item *Activity, err error) {
- o := orm.NewOrm()
- sql := "select * from yb_activity where activity_id=? AND is_delete = 0 "
- err = o.Raw(sql, activityId).QueryRow(&item)
- return
- }
- type ActivityList struct {
- ActivityId int `orm:"column(activity_id);pk" description:"活动ID"`
- FirstActivityTypeId int `description:"第一级的活动类型ID"`
- FirstActivityTypeName string `description:"第一级的活动类型名称"`
- ActivityTypeId int `description:"活动类型ID"`
- ActivityTypeName string `description:"活动类型名称"`
- ChartPermissionId int `description:"对应的权限id,表chart_permission中id"`
- ChartPermissionName string `description:"对应的权限名称,表chart_permission中name"`
- ActivityName string `description:"活动标题"`
- StartTime time.Time `description:"活动开始时间"`
- EndTime time.Time `description:"活动结束时间"`
- Speaker string `description:"主讲人"`
- MainlandTel string `description:"大陆拨入"`
- HongKongTel string `description:"香港拨入"`
- TaiwanTel string `description:"台湾拨入"`
- AmericaTel string `description:"美国拨入"`
- SingaporeTel string `description:"新加坡拨入"`
- ParticipationCode string `description:"参会密码"`
- LinkParticipants string `description:"参会链接"`
- IsLimitPeople int8 `description:"是否限制人数 1是,0否"`
- LimitPeopleNum int `description:"限制人数数量"`
- ReportLink string `description:"报告链接"`
- City string `description:"城市"`
- Address string `description:"活动地址"`
- PosterUrl string `description:"活动海报地址"`
- Remarks string `description:"备注"`
- UserId int `description:"创建者id"`
- PublishStatus int8 `description:"发布状态,0未发布,1已发布"`
- IsSendWxMsg int8 `description:"是否推送过会议提醒微信消息,未推送:0,已推送:1"`
- IsSendSalonWxMsg int8 `description:"是否推送过沙龙提醒微信消息,未推送:0,已推送:1"`
- ArticleId int `description:"报告链接所关联的文章ID"`
- ModifyTime time.Time `description:"修改时间"`
- CreateTime time.Time `description:"创建时间"`
- VoiceList []*ActivityVoice `description:"音频文件列表"`
- }
- // GetList 获取活动列表数据
- func GetList(condition string, pars []interface{}, startSize, pageSize int) (total int, list []*Activity, err error) {
- o := orm.NewOrm()
- sql := "select * from yb_activity where 1=1 AND is_delete = 0 "
- sql += condition
- sql += ` order by modify_time desc `
- totalSql := `select count(1) total from (` + sql + `) z `
- err = o.Raw(totalSql, pars).QueryRow(&total)
- if err != nil {
- return
- }
- sql += ` LIMIT ?,? `
- _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&list)
- return
- }
- // Update 更新活动
- func (activity *Activity) Update(cols []string) (err error) {
- o := orm.NewOrm()
- _, err = o.Update(activity, cols...)
- return
- }
- // AddActivity 新增活动
- func AddActivity(activity *Activity) (err error) {
- o := orm.NewOrm()
- id, err := o.Insert(activity)
- if err != nil {
- return
- }
- activity.ActivityId = int(id)
- return
- }
|