12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type CygxIndustrialActivityGroupManagement struct {
- Id int `orm:"column(id);pk" description:"主键ID"`
- ActivityId int `description:"活动ID"`
- IndustrialManagementId int `description:"cygx_industrial_management表的主键ID"`
- Source int `description:"来源,1 活动,2专项调研"`
- CreateTime time.Time `description:"创建时间"`
- }
- type CygxIndustrialActivityGroupSubject struct {
- Id int `orm:"column(id);pk" description:"主键ID"`
- ActivityId int `description:"活动ID"`
- IndustrialSubjectId int `description:"cygx_industrial_subject表的文章ID"`
- Source int `description:"来源,1 活动,2专项调研"`
- CreateTime time.Time `description:"创建时间"`
- }
- // GetActivityIndustryRelationList 获取活动与产业关联列表
- func GetActivityIndustryRelationList(condition string, pars []interface{}) (list []*CygxIndustrialActivityGroupManagement, err error) {
- sql := `SELECT
- a.activity_id,
- b.industrial_management_id
- FROM
- cygx_activity AS a
- JOIN cygx_industrial_activity_group_management AS b ON a.activity_id = b.activity_id
- WHERE
- 1 = 1 AND b.source = 1 `
- if condition != `` {
- sql += condition
- }
- _, err = orm.NewOrm().Raw(sql, pars).QueryRows(&list)
- return
- }
- // 列表
- func GetIndustrialActivityGroupManagementList(activityId int) (items []*IndustrialManagementRep, err error) {
- o := orm.NewOrm()
- sql := `SELECT
- m.chart_permission_id,
- m.industrial_management_id,
- m.industry_name
- FROM
- cygx_industrial_activity_group_management AS am
- INNER JOIN cygx_industrial_management AS m ON m.industrial_management_id = am.industrial_management_id
- WHERE
- am.activity_id = ? AND am.source = 1`
- _, err = o.Raw(sql, activityId).QueryRows(&items)
- return
- }
|