|
@@ -5,6 +5,10 @@ import (
|
|
|
"time"
|
|
|
)
|
|
|
|
|
|
+const (
|
|
|
+ Publish = 3
|
|
|
+)
|
|
|
+
|
|
|
type HTReport struct {
|
|
|
Id int `gorm:"primary_key;auto_increment"`
|
|
|
PlateId int `grom:"plate_id"`
|
|
@@ -14,11 +18,13 @@ type HTReport struct {
|
|
|
ReportName string `gorm:"column:report_name"`
|
|
|
PublishTime int `gorm:"column:publish_time"`
|
|
|
PublishedTime string `gorm:"column:published_time"`
|
|
|
+ IsDelete int `gorm:"column:is_delete"`
|
|
|
+ Status int `gorm:"column:status"`
|
|
|
}
|
|
|
|
|
|
func GetHTReports(id int) (reports []HTReport, err error) {
|
|
|
db := models.HT()
|
|
|
- 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"
|
|
|
+ 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,t.is_delete as is_delete,t.status as status 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"
|
|
|
err = db.Model(&HTReport{}).Raw(sql, id).Scan(&reports).Error
|
|
|
return
|
|
|
}
|
|
@@ -26,7 +32,7 @@ func GetUpdateHTReports() (reports []HTReport, err error) {
|
|
|
duration := time.Now().Add(-30 * time.Second)
|
|
|
updateTime := duration.UnixMilli()
|
|
|
db := models.HT()
|
|
|
- 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.update_time > ? order by t.id asc"
|
|
|
+ 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,t.is_delete as is_delete,t.status as status 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.report_file_path<>'' and t.update_time > ? order by t.id asc"
|
|
|
err = db.Model(&HTReport{}).Raw(sql, updateTime).Scan(&reports).Error
|
|
|
return
|
|
|
}
|