activity_special_permission_points.go 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 AddCygxActivitySpecialPermissionPoints(item *CygxActivitySpecialPermissionPoints) (err error) {
  18. o := orm.NewOrm()
  19. _, err = o.Insert(item)
  20. return
  21. }
  22. // 获取公司每个行业剩余研选点数列表
  23. func GetCygxActivitySpecialPermissionPointsList(condition string, pars []interface{}) (items []*CygxActivitySpecialPermissionPoints, err error) {
  24. o := orm.NewOrm()
  25. sql := `SELECT * FROM cygx_activity_special_permission_points WHERE 1 = 1 `
  26. if condition != "" {
  27. sql += condition
  28. }
  29. _, err = o.Raw(sql, pars).QueryRows(&items)
  30. return
  31. }
  32. // 更新公司每个行业剩余研选点数
  33. func UpdateCygxActivitySpecialPermissionPoints(points, companyId, chartPermissionId int) (err error) {
  34. o := orm.NewOrm()
  35. sql := `UPDATE cygx_activity_special_permission_points SET points = ? WHERE company_id=? AND chart_permission_id=? `
  36. _, err = o.Raw(sql, points, companyId, chartPermissionId).Exec()
  37. return
  38. }