|
@@ -184,7 +184,7 @@ func CREATE_DeviceData(SN string) bool {
|
|
|
// // 查看是否 有记录
|
|
|
// var maps_z []orm2.ParamsList
|
|
|
//
|
|
|
-// sql := "SELECT COUNT(ID) FROM z_devicedata_" + SN + " WHERE t_time = '" + t_time + "' AND t_id = " + t_id
|
|
|
+// sql := "SELECT COUNT(*) FROM z_devicedata_" + SN + " WHERE t_time = '" + t_time + "' AND t_id = " + t_id
|
|
|
// //logs.Println(sql)
|
|
|
// _, err := o.Raw(sql).ValuesList(&maps_z)
|
|
|
//
|
|
@@ -259,7 +259,7 @@ func Read_DeviceSensorData_ById_List(SN string, Time_start_ string, Time_end_ st
|
|
|
sql_time = strings.TrimRight(sql_time, "AND ")
|
|
|
}
|
|
|
|
|
|
- sql := "SELECT COUNT(ID) FROM z_devicedata_" + SN
|
|
|
+ sql := "SELECT COUNT(*) FROM z_devicedata_" + SN
|
|
|
if len(sql_time) > 0 {
|
|
|
sql += " WHERE " + sql_time
|
|
|
}
|
|
@@ -342,7 +342,7 @@ func Read_DeviceData_Count_By_snid(SN string, T_id int, Time_start_ string, Time
|
|
|
sql_time += " t_time <= '" + Time_end_ + "' AND "
|
|
|
}
|
|
|
|
|
|
- sql := "SELECT COUNT(ID) FROM z_devicedata_" + SN + " WHERE " + sql_time + " t_id = " + strconv.Itoa(T_id)
|
|
|
+ sql := "SELECT COUNT(*) FROM z_devicedata_" + SN + " WHERE " + sql_time + " t_id = " + strconv.Itoa(T_id)
|
|
|
logs.Println(sql)
|
|
|
_, err := o.Raw(sql).ValuesList(&maps_z)
|
|
|
if err != nil {
|
|
@@ -380,7 +380,7 @@ func Read_DeviceSensorData_List(SN string, Time_start_ string, Time_end_ string,
|
|
|
sql_time += " t_time <= '" + Time_end_ + "' "
|
|
|
}
|
|
|
|
|
|
- sql := "SELECT COUNT(ID) FROM z_devicedata_" + SN + " " + sql_time
|
|
|
+ sql := "SELECT COUNT(*) FROM z_devicedata_" + SN + " " + sql_time
|
|
|
logs.Println(sql)
|
|
|
_, err := o.Raw(sql).ValuesList(&maps_z)
|
|
|
if err != nil {
|
|
@@ -422,7 +422,7 @@ func Read_DeviceSensorData_List_z(SN string, Time_start_ string) int {
|
|
|
//sql_time += " t_time <= '" + Time_end_ + "' AND "
|
|
|
}
|
|
|
|
|
|
- sql := "SELECT COUNT(ID) FROM z_devicedata_" + SN + " " + sql_time
|
|
|
+ sql := "SELECT COUNT(*) FROM z_devicedata_" + SN + " " + sql_time
|
|
|
logs.Println(sql)
|
|
|
_, err := o.Raw(sql).ValuesList(&maps_z)
|
|
|
if err != nil {
|