-- 测试数据同步功能
-- 验证字段映射和数据插入

-- 1. 检查iot_device_data表中的项圈设备数据
SELECT 
    device_id,
    device_type,
    voltage,
    temperature,
    steps,
    same_day_steps,
    latitude,
    longitude,
    update_time
FROM iot_device_data 
WHERE device_type = 4 
ORDER BY update_time DESC
LIMIT 5;

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

-- 3. 检查xq_client_log表结构
DESCRIBE xq_client_log;

-- 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 (
    '24075000139',
    '3.300',
    '25.80',
    'test_server_id',
    '30.481277875444164',
    '114.40076076679632',
    21,
    0,
    NOW(),
    'TEST',
    NOW(),
    'TEST'
);

-- 5. 验证插入结果
SELECT 
    device_id,
    device_voltage,
    device_temp,
    walk_steps,
    y_walk_steps,
    latitude,
    longitude,
    create_time
FROM xq_client_log 
WHERE device_id = '24075000139'
ORDER BY create_time DESC;
