12345678910111213141516171819202122232425262728293031 |
- package cygx
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type CygxActivityPointsCompany struct {
- Id int `gorm:"column:id;primary_key;AUTO_INCREMENT" json:""`
- CompanyId int `gorm:"column:company_id;default:0" json:""` // 公司ID
- CompanyName string `gorm:"column:company_name" json:""` // 公司名称
- Points float64 `gorm:"column:points;default:0;NOT NULL" json:""` // 公司剩余点数
- CreateTime time.Time `gorm:"column:create_time;NOT NULL" json:""` // 创建时间
- ModifyTime time.Time `gorm:"column:modify_time;NOT NULL" json:""` // 更新时间
- }
- // 通过公司ID获取详情
- func GetCygxActivityPointsCompanyByCompanyId(companyId int) (item *CygxActivityPointsCompany, err error) {
- o := orm.NewOrmUsingDB("hz_cygx")
- sql := `SELECT * FROM cygx_activity_points_company WHERE company_id=? `
- err = o.Raw(sql, companyId).QueryRow(&item)
- return
- }
- // 获取公司剩余点数
- func GetCompanyPoints(companyId int) (comapnyPointsNum float64, err error) {
- o := orm.NewOrmUsingDB("hz_cygx")
- sql := `SELECT points FROM cygx_activity_points_company WHERE company_id=? `
- err = o.Raw(sql, companyId).QueryRow(&comapnyPointsNum)
- return
- }
|