package cygx import ( "github.com/beego/beego/v2/client/orm" "time" ) type CygxBannerHistory struct { Id int `orm:"column(id);pk"` TimeLineId int UserId int CreateTime time.Time Mobile string `description:"手机号"` Email string `description:"邮箱"` CompanyId int `description:"公司id"` CompanyName string `description:"公司名称"` ModifyTime time.Time `description:"修改时间"` RealName string `description:"用户实际名称"` SellerName string `description:"所属销售"` RegisterPlatform int `description:"来源 1小程序,2:网页"` } // 列表 func GetCygxBannerHistoryList(condition string, pars []interface{}) (items []*CygxBannerHistory, err error) { o := orm.NewOrmUsingDB("hz_cygx") sql := `SELECT * FROM cygx_banner_history as art WHERE 1= 1 ` if condition != "" { sql += condition } _, err = o.Raw(sql, pars).QueryRows(&items) return } // 获取数量 func GetCygxBannerHistoryCount(condition string, pars []interface{}) (count int, err error) { sqlCount := ` SELECT COUNT(1) AS count FROM cygx_banner_history as art WHERE 1= 1 ` if condition != "" { sqlCount += condition } o := orm.NewOrmUsingDB("hz_cygx") err = o.Raw(sqlCount, pars).QueryRow(&count) return } // 获取数量 func GetCygxBannerHistoryCountUv(bannerId int) (count int, err error) { sqlCount := ` SELECT count(*) AS uv FROM ( SELECT count(*) FROM cygx_banner_history WHERE 1 = 1 AND banner_id = ? GROUP BY user_id ) b ` o := orm.NewOrmUsingDB("hz_cygx") err = o.Raw(sqlCount, bannerId).QueryRow(&count) return } // 获取数量 func GetCygxBannerHistoryCountPv(bannerId int) (count int, err error) { sqlCount := ` SELECT COUNT(1) AS count FROM cygx_banner_history as art WHERE 1= 1 AND banner_id = ? ` o := orm.NewOrmUsingDB("hz_cygx") err = o.Raw(sqlCount, bannerId).QueryRow(&count) return }