|
@@ -253,8 +253,8 @@ func (dao *DeviceDaoImpl) Read_Device_List(T_name, T_product_name, T_product_mod
|
|
if len(maps_z) == 0 {
|
|
if len(maps_z) == 0 {
|
|
return r, 0
|
|
return r, 0
|
|
}
|
|
}
|
|
- sql = "SELECT *,latest.t__state as t_device_state,p.t_name AS t_product_name,p.t_model AS t_product_model,p.t_class AS t_product_class,p.t_spec AS t_product_spec " +
|
|
|
|
- "FROM device d JOIN product p ON d.t_product_id = p.ID JOIN (SELECT t_sn,t__state, MAX(create_time) AS max_create_time FROM device GROUP BY t_sn) latest " +
|
|
|
|
|
|
+ sql = "SELECT *,d.t__state as t_device_state,p.t_name AS t_product_name,p.t_model AS t_product_model,p.t_class AS t_product_class,p.t_spec AS t_product_spec " +
|
|
|
|
+ "FROM device d JOIN product p ON d.t_product_id = p.ID JOIN (SELECT t_sn, MAX(create_time) AS max_create_time FROM device GROUP BY t_sn) latest " +
|
|
"ON d.t_sn = latest.t_sn AND d.create_time = latest.max_create_time"
|
|
"ON d.t_sn = latest.t_sn AND d.create_time = latest.max_create_time"
|
|
|
|
|
|
sql = sql + sqlWhere
|
|
sql = sql + sqlWhere
|