ht_report.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. package ht
  2. import "eta/eta_mini_ht_api/models"
  3. type HTReport struct {
  4. Id int `gorm:"primary_key;auto_increment"`
  5. PlateId int `grom:"plate_id"`
  6. PlateName string `gorm:"column:plate_name"`
  7. PermissionName string `gorm:"column:permission_name"`
  8. PublishUserName string `gorm:"column:publish_user_name"`
  9. ReportName string `gorm:"column:report_name"`
  10. PublishTime int `gorm:"column:publish_time"`
  11. PublishedTime string `gorm:"column:published_time"`
  12. }
  13. func GetHTReports(id int) (reports []HTReport, err error) {
  14. db := models.HT()
  15. sql := "select tirtp.plate_id as plate_id, tip.plate_name as plate_name, t.id as id ,t.report_name as report_name,t.publish_user_name as publish_user_name,t.publish_time as publish_time from t_iirp_report_to_plate tirtp left join t_iirp_report_info t on t.id=tirtp.report_id left JOIN t_iirp_plate tip on tip.id=tirtp.plate_id where t.is_delete =0 and t.`status` =3 and t.report_file_path<>'' and t.id > ? order by t.id asc"
  16. err = db.Model(&HTReport{}).Raw(sql, id).Scan(&reports).Error
  17. return
  18. }
  19. func GetPDFUrl(id int) (url string, err error) {
  20. db := models.HT()
  21. sql := "select report_file_path from t_iirp_report_info where id=?"
  22. err = db.Model(&HTReport{}).Raw(sql, id).Scan(&url).Error
  23. return
  24. }
  25. type HtQuery struct {
  26. Plate string
  27. Permission string
  28. }
  29. func GetHTReportIdsByPermissionIds(query []HtQuery) (ids []int, err error) {
  30. return
  31. }