@Query(value="select s.* from s_sensor s LEFT JOIN s_user_sensor u ON s.deviceid = u.sensorid where u.userid = ?1 ",
nativeQuery=true)
List<Sensor>findSensorByUserid(Longuserid);
@Query(value="select case WHEN (unix_timestamp()-unix_timestamp(s.onlinetime)) <= ((s.timetrack2)/1000)*2 THEN '在线' ELSE '离线' END online, s.* from s_sensor s left join s_user_sensor sus on sus.sensorid = s.deviceid where sus.userid = ?1",
countQuery="select count(1) from s_sensor s left join s_user_sensor sus on sus.sensorid = s.deviceid where sus.userid = ?1",
@Query(value="select case WHEN (unix_timestamp()-unix_timestamp(s.onlinetime)) <= ((s.timetrack2)/1000)*2 THEN '在线' ELSE '离线' END online, s.* from s_sensor s left join s_user_sensor sus on sus.sensorid = s.deviceid where sus.userid = ?1 and s.deviceid like ?2",
countQuery="select count(1) from s_sensor s left join s_user_sensor sus on sus.sensorid = s.deviceid where sus.userid = ?1 and s.deviceid like ?2",
@Query(value="select case WHEN (unix_timestamp()-unix_timestamp(s.onlinetime)) <= ((s.timetrack2)/1000)*2 THEN '在线' ELSE '离线' END online, s.* from s_sensor s left join s_user_sensor sus on sus.sensorid = s.deviceid where sus.userid = ?1 and s.imei like ?2",
countQuery="select count(1) from s_sensor s left join s_user_sensor sus on sus.sensorid = s.deviceid where sus.userid = ?1 and s.imei like ?2",
@Query(value="select case WHEN (unix_timestamp()-unix_timestamp(s.onlinetime)) <= ((s.timetrack2)/1000)*2 THEN '在线' ELSE '离线' END online, s.* from s_sensor s left join s_user_sensor sus on sus.sensorid = s.deviceid where sus.userid = ?1 and s.name like ?2",
countQuery="select count(1) from s_sensor s left join s_user_sensor sus on sus.sensorid = s.deviceid where sus.userid = ?1 and s.name like ?2",
@Query(value="select count(s.id) AS total FROM s_sensor s INNER JOIN s_user_sensor us ON us.sensorid = s.deviceid where unix_timestamp()-unix_timestamp((s.onlinetime)) <= ((s.timetrack2)/1000)*2 and us.userid = ?1",nativeQuery=true)
intqueryOnlineSensorByUser(Longuserid);
@Query(value="select count(s.id) AS total FROM s_sensor s INNER JOIN s_user_sensor us ON us.sensorid = s.deviceid where (unix_timestamp() -unix_timestamp((s.onlinetime)) > ((s.timetrack2)/1000)*2 OR s.onlinetime is NULL) and us.userid = ?1",nativeQuery=true)
intqueryNotOnlineSensorByUser(Longuserid);
@Query(value="select count(s.id) AS total FROM s_sensor s where unix_timestamp()-unix_timestamp((s.onlinetime)) <= ((s.timetrack2)/1000)*2 ",nativeQuery=true)
intqueryOnlineSensorBySuper();
@Query(value="select count(s.id) AS total FROM s_sensor s where unix_timestamp()-unix_timestamp((s.onlinetime)) > ((s.timetrack2)/1000)*2 OR s.onlinetime is NULL ",nativeQuery=true)