-- localhost/yinni_lms 本地模拟:空轴位=主点位_K,满轴位=主点位_M。 -- 仅补齐缺失字段,保留已有配置;ACS关闭时才执行。 START TRANSACTION; UPDATE st_ivt_sbpointivt SET empty_point_code=CASE WHEN empty_point_code IS NULL OR TRIM(empty_point_code)='' THEN CONCAT(point_code,'_K') ELSE empty_point_code END, full_point_code=CASE WHEN full_point_code IS NULL OR TRIM(full_point_code)='' THEN CONCAT(point_code,'_M') ELSE full_point_code END WHERE point_code IS NOT NULL AND TRIM(point_code)<>'' AND (empty_point_code IS NULL OR TRIM(empty_point_code)='' OR full_point_code IS NULL OR TRIM(full_point_code)='') AND EXISTS (SELECT 1 FROM sys_param WHERE code='is_connect_acs' AND value='0'); SELECT ROW_COUNT() AS updated_devices; COMMIT; SELECT COUNT(*) AS total, SUM(empty_point_code IS NULL OR TRIM(empty_point_code)='') AS missing_empty, SUM(full_point_code IS NULL OR TRIM(full_point_code)='') AS missing_full, COUNT(DISTINCT empty_point_code) AS distinct_empty, COUNT(DISTINCT full_point_code) AS distinct_full FROM st_ivt_sbpointivt;