|
@@ -310,25 +310,15 @@ func getEdbDataListByMongo(source, subSource, edbInfoId int, startDate, endDate
|
|
|
queryConditions := bson.M{
|
|
|
"edb_info_id": edbInfoId,
|
|
|
}
|
|
|
-
|
|
|
- // 数据开始日期
|
|
|
- if startDate != `` {
|
|
|
- startDateTime, tmpErr := time.ParseInLocation(utils.FormatDate, startDate, time.Local)
|
|
|
- if tmpErr != nil {
|
|
|
- err = tmpErr
|
|
|
- return
|
|
|
- }
|
|
|
- queryConditions["data_time"] = bson.M{"$gte": startDateTime}
|
|
|
+ // 日期
|
|
|
+ dateCondition, err := mgo.BuildDateCondition(startDate, endDate)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
}
|
|
|
- // 数据结束日期
|
|
|
- if endDate != "" {
|
|
|
- endDateTime, tmpErr := time.ParseInLocation(utils.FormatDate, endDate, time.Local)
|
|
|
- if tmpErr != nil {
|
|
|
- err = tmpErr
|
|
|
- return
|
|
|
- }
|
|
|
- queryConditions["data_time"] = bson.M{"$lte": endDateTime}
|
|
|
+ if len(dateCondition) > 0 {
|
|
|
+ queryConditions["data_time"] = dateCondition
|
|
|
}
|
|
|
+
|
|
|
// 获取列表数据
|
|
|
tmpDataList, tmpErr := mogDataObj.GetAllDataList(queryConditions, []string{"data_time"})
|
|
|
if tmpErr != nil {
|