|
@@ -2,6 +2,7 @@ package module
|
|
|
|
|
|
import (
|
|
|
"errors"
|
|
|
+ "fmt"
|
|
|
"tmr-watch/http/handle/restful"
|
|
|
"tmr-watch/models"
|
|
|
)
|
|
@@ -164,9 +165,11 @@ func ProcessAnalysisData(req *models.AnalysisAccuracyRequest) ([]*models.Process
|
|
|
|
|
|
func SprinkleStatistics(req *models.SprinkleStatisticsRequest) ([]*models.SprinkleStatisticsDataList, error) {
|
|
|
res := make([]*models.SprinkleStatisticsDataList, 0)
|
|
|
- newSql := restful.Engine.Table("downloadplandtl2").Alias("a").Select("a.fbarid,a.fname,a.intime,a.processtime,b.times").
|
|
|
- Join("LEFT", []string{"downloadedplan", "b"}, "a.pastureid = b.pastureid AND b.pid = a.pid").
|
|
|
- Where("a.pastureid = ?", req.PastureId).And("b.times > 0 ").And("a.fbarid > 0")
|
|
|
+ newSql := restful.Engine.Table("downloadedplan").Alias("b").
|
|
|
+ Select("a.fbarid,a.fname,a.intime,a.processtime,b.times").
|
|
|
+ Join("LEFT", []string{"downloadplandtl2", "a"}, "a.pastureid = b.pastureid AND b.pid = a.flpid").
|
|
|
+ Where("a.pastureid = ?", req.PastureId).And("b.times > 0 ").
|
|
|
+ And("a.fbarid > 0").And("a.intime IS NOT NULL").And("a.processtime IS NOT NULL")
|
|
|
if len(req.StartDate) > 0 && len(req.EndDate) > 0 {
|
|
|
newSql.And("a.date >= ? and a.date <= ?", req.StartDate, req.EndDate)
|
|
|
}
|
|
@@ -178,6 +181,8 @@ func SprinkleStatistics(req *models.SprinkleStatisticsRequest) ([]*models.Sprink
|
|
|
if err := newSql.GroupBy("a.fbarid ,b.intime").Find(&res); err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
+ str, err := newSql.LastSQL()
|
|
|
+ fmt.Println("=======str,err===", str, err)
|
|
|
|
|
|
return res, nil
|
|
|
}
|