company_permission.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package cygx
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type CompanyReportPermission struct {
  7. CompanyReportPermissionId int64 `orm:"column(company_report_permission_id);pk"`
  8. CompanyId int
  9. ReportPermissionId int
  10. CreatedTime time.Time
  11. LastUpdatedTime time.Time
  12. ChartPermissionId int
  13. StartDate string `description:"权限开始日期"`
  14. EndDate string `description:"权限结束日期"`
  15. ProductId int `description:"产品id"`
  16. ProductName string `description:"产品名称"`
  17. CompanyContractId int `description:"合同id"`
  18. Status string `description:"'正式','试用','关闭'"`
  19. ModifyTime time.Time `description:"修改时间"`
  20. IsUpgrade int `description:"是否升级,1是,0否"`
  21. ExpensiveYx int `description:"权益研选: 0-3w; 1-5w"`
  22. }
  23. // GetCompanyReportPermission 获取权限类型
  24. func GetCompanyReportPermission(companyId, productId int) (items []*CompanyReportPermission, err error) {
  25. o := orm.NewOrm()
  26. sql := `SELECT
  27. re.*
  28. FROM
  29. company_report_permission as re
  30. INNER JOIN chart_permission as c ON c.chart_permission_id = re.chart_permission_id
  31. WHERE
  32. re.company_id = ?
  33. AND re.product_id = ?
  34. AND STATUS = '正式' `
  35. _, err = o.Raw(sql, companyId, productId).QueryRows(&items)
  36. return
  37. }