cygx_activity_special_points_company.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type CygxActivitySpecialInheritPointsCompany struct {
  7. Id int `orm:"column(id);pk"`
  8. CompanyId int // 公司ID
  9. CompanyName string // 公司名称
  10. Points int // 公司剩余点数
  11. CreateTime time.Time // 创建时间
  12. ModifyTime time.Time // 更新时间
  13. ChartPermissionId int // 品种ID
  14. ChartPermissionName string // 品种名称
  15. }
  16. func AddCygxActivitySpecialPointsCompany(item *CygxActivitySpecialInheritPointsCompany) (err error) {
  17. o := orm.NewOrm()
  18. _, err = o.Insert(item)
  19. if err != nil {
  20. return
  21. }
  22. return
  23. }
  24. func AddCygxActivitySpecialInheritPointsCompanyMulti(items []*CygxActivitySpecialInheritPointsCompany) (err error) {
  25. o := orm.NewOrm()
  26. _, err = o.InsertMulti(1, items)
  27. return
  28. }
  29. func GetCygxActivitySpecialInheritPointsByCompanyId(companyId int) (list []*CygxActivitySpecialInheritPointsCompany, err error) {
  30. o := orm.NewOrm()
  31. sql := ` SELECT * FROM cygx_activity_special_inherit_points_company WHERE company_id = ? `
  32. _, err = o.Raw(sql,companyId).QueryRows(&list)
  33. return
  34. }
  35. func DelCygxActivitySpecialInheritPointsByCompanyId(companyId int) (err error) {
  36. o := orm.NewOrm()
  37. sql := ` DELETE FROM cygx_activity_special_inherit_points_company WHERE company_id = ? `
  38. _, err = o.Raw(sql,companyId).Exec()
  39. return
  40. }