-- 检查xq_client_log表中的数据
-- 验证手动插入的记录

-- 1. 查看所有项圈日志记录
SELECT 
    id,
    device_id,
    device_voltage,
    device_temp,
    server_device_id,
    latitude,
    longitude,
    walk_steps,
    y_walk_steps,
    create_time,
    update_time
FROM xq_client_log 
ORDER BY create_time DESC;

-- 2. 检查特定设备的数据
SELECT 
    device_id,
    device_voltage,
    device_temp,
    walk_steps,
    latitude,
    longitude,
    create_time
FROM xq_client_log 
WHERE device_id = '24075000139'
ORDER BY create_time DESC;

-- 3. 检查iot_device_data表中的项圈设备数据
-- 找出可能导致截断的数据
SELECT 
    device_id,
    device_type,
    voltage,
    temperature,
    steps,
    latitude,
    longitude,
    LENGTH(CAST(latitude AS CHAR)) as lat_length,
    LENGTH(CAST(longitude AS CHAR)) as lng_length,
    LENGTH(CAST(voltage AS CHAR)) as voltage_length,
    LENGTH(CAST(temperature AS CHAR)) as temp_length
FROM iot_device_data 
WHERE device_type = 4 
ORDER BY update_time DESC
LIMIT 10;