company_report_permission.go 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type CompanyReportPermission struct {
  7. CompanyReportPermissionId int `orm:"column(company_report_permission_id);pk"`
  8. CompanyId int `description:"客户id"`
  9. ReportPermissionId int `description:"报告权限id"`
  10. CreatedTime time.Time
  11. LastUpdatedTime time.Time
  12. ChartPermissionId int `description:"权限id"`
  13. StartDate string `description:"权限开始日期"`
  14. EndDate string `description:"权限结束日期"`
  15. ProductId int `description:"产品id"`
  16. ProductName string `description:"产品名称"`
  17. ModifyTime string `description:"修改时间"`
  18. CompanyContractId string `description:"合同id"`
  19. Status string `description:"状态 '正式','试用','关闭','永续','潜在' "`
  20. IsUpgrade int `description:"是否升级,1是,0否"`
  21. }
  22. // 通过查询条件获取详情
  23. func GetCompanyReportPermissionDetailByCondition(condition string, pars []interface{}) (item *CompanyReportPermission, err error) {
  24. if condition == "" {
  25. return
  26. }
  27. o := orm.NewOrmUsingDB("weekly_report")
  28. sql := `SELECT * FROM company_report_permission WHERE 1 = 1 ` + condition
  29. err = o.Raw(sql, pars).QueryRow(&item)
  30. return
  31. }
  32. // 列表
  33. func GetCompanyReportPermissionList(condition string, pars []interface{}) (items []*CompanyReportPermission, err error) {
  34. o := orm.NewOrmUsingDB("weekly_report")
  35. sql := `SELECT * FROM company_report_permission WHERE 1= 1 `
  36. if condition != "" {
  37. sql += condition
  38. }
  39. _, err = o.Raw(sql, pars).QueryRows(&items)
  40. return
  41. }