activity_special_permission_points.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type CygxActivitySpecialPermissionPoints struct {
  7. Id int `orm:"column(id);pk"`
  8. CompanyId int `description:"公司ID"`
  9. Points int `description:"剩余点数"`
  10. CompanyName string `description:"公司名称"`
  11. ChartPermissionId int `description:"行业id"`
  12. ChartPermissionName string `description:"行业名称"`
  13. CreateTime time.Time `description:"创建时间"`
  14. ModifyTime time.Time `description:"更新时间"`
  15. }
  16. // 获取公司每个行业剩余研选点数列表
  17. func GetCygxActivitySpecialPermissionPointsList(condition string, pars []interface{}) (items []*CygxActivitySpecialPermissionPoints, err error) {
  18. o := orm.NewOrm()
  19. sql := `SELECT * FROM cygx_activity_special_permission_points WHERE 1 = 1 `
  20. if condition != "" {
  21. sql += condition
  22. }
  23. _, err = o.Raw(sql, pars).QueryRows(&items)
  24. return
  25. }
  26. // 更新公司每个行业剩余研选点数
  27. func UpdateCygxActivitySpecialPermissionPoints(points, companyId, chartPermissionId int) (err error) {
  28. o := orm.NewOrm()
  29. sql := `UPDATE cygx_activity_special_permission_points SET points = ? WHERE company_id=? AND chart_permission_id=? `
  30. _, err = o.Raw(sql, points, companyId, chartPermissionId).Exec()
  31. return
  32. }