-- ====================================
-- 直接检查项圈设备的实际数据
-- ====================================

-- 1. 检查所有项圈设备的数据
SELECT 
    device_id,
    latitude,
    longitude,
    LENGTH(latitude) as lat_length,
    LENGTH(longitude) as lng_length,
    voltage,
    temperature,
    steps,
    same_day_steps,
    update_time
FROM iot_device_data 
WHERE device_type = 4
ORDER BY update_time DESC;

-- 2. 检查xq_client_log表的当前数据
SELECT COUNT(*) as 'xq_client_log记录数' FROM xq_client_log;

-- 3. 检查xq_client_log表的最新数据
SELECT 
    device_id,
    latitude,
    longitude,
    device_voltage,
    device_temp,
    walk_steps,
    y_walk_steps,
    create_time
FROM xq_client_log 
ORDER BY create_time DESC 
LIMIT 5;

-- 4. 尝试手动插入一条最简单的数据
INSERT INTO xq_client_log (
    device_id, 
    device_voltage, 
    device_temp, 
    server_device_id,
    latitude, 
    longitude, 
    walk_steps, 
    y_walk_steps,
    create_time, 
    create_by, 
    update_time, 
    update_by
) VALUES (
    'TEST_001',
    '3.6',
    '25.5',
    'HOST_001',
    '30.481277875444164',
    '104.123456789012345',
    1000,
    500,
    NOW(),
    'MANUAL_TEST',
    NOW(),
    'MANUAL_TEST'
);

-- 5. 检查插入结果
SELECT * FROM xq_client_log WHERE create_by = 'MANUAL_TEST';

-- 6. 清理测试数据
DELETE FROM xq_client_log WHERE create_by = 'MANUAL_TEST';
