12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type CygxActivitySpecialPermissionPoints struct {
- Id int `orm:"column(id);pk"`
- CompanyId int `description:"公司ID"`
- Points int `description:"剩余点数"`
- CompanyName string `description:"公司名称"`
- ChartPermissionId int `description:"行业id"`
- ChartPermissionName string `description:"行业名称"`
- CreateTime time.Time `description:"创建时间"`
- ModifyTime time.Time `description:"更新时间"`
- }
- // 添加
- func AddCygxActivitySpecialPermissionPoints(item *CygxActivitySpecialPermissionPoints) (err error) {
- o := orm.NewOrm()
- _, err = o.Insert(item)
- return
- }
- // 获取公司每个行业剩余研选点数列表
- func GetCygxActivitySpecialPermissionPointsList(condition string, pars []interface{}) (items []*CygxActivitySpecialPermissionPoints, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM cygx_activity_special_permission_points WHERE 1 = 1 `
- if condition != "" {
- sql += condition
- }
- _, err = o.Raw(sql, pars).QueryRows(&items)
- return
- }
- // 更新公司每个行业剩余研选点数
- func UpdateCygxActivitySpecialPermissionPoints(points, companyId, chartPermissionId int) (err error) {
- o := orm.NewOrm()
- sql := `UPDATE cygx_activity_special_permission_points SET points = ? WHERE company_id=? AND chart_permission_id=? `
- _, err = o.Raw(sql, points, companyId, chartPermissionId).Exec()
- return
- }
|