2026-08-19 16:24:02 +08:00
-- Baiyue last-leg platform incremental database archive
-- Encoding: UTF-8 without BOM
-- Policy:
-- 1. Append new numbered sections; never rewrite an applied section.
-- 2. DDL must be repeatable and must preserve existing business rows.
-- 3. Every new column and index must use an information_schema guard.
-- 4. Do not place test fixtures, DELETE, TRUNCATE or business-data UPDATE here.
-- ============================================================================
-- 2026-08-15 / 001
-- Event Bridge inbox and delivery-attempt baseline
-- ============================================================================
CREATE DATABASE IF NOT EXISTS baiyue_event_bridge
DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ;
USE baiyue_event_bridge ;
CREATE TABLE IF NOT EXISTS bridge_inbox (
event_id VARCHAR ( 128 ) NOT NULL COMMENT '事件全局标识' ,
idempotency_key VARCHAR ( 191 ) NOT NULL COMMENT '接收幂等键' ,
event_type VARCHAR ( 64 ) NOT NULL COMMENT '事件类型' ,
event_version INT NOT NULL COMMENT '事件契约版本' ,
source_region VARCHAR ( 32 ) NOT NULL COMMENT '来源区域' ,
target_region VARCHAR ( 32 ) NOT NULL COMMENT '目标区域' ,
tenant_id VARCHAR ( 128 ) NOT NULL COMMENT '租户标识' ,
aggregate_type VARCHAR ( 64 ) NOT NULL COMMENT '聚合类型' ,
aggregate_id VARCHAR ( 128 ) NOT NULL COMMENT '聚合标识' ,
aggregate_version BIGINT NOT NULL COMMENT '聚合版本' ,
handover_version BIGINT NULL COMMENT '跨区交接版本' ,
trace_id VARCHAR ( 128 ) NOT NULL COMMENT '链路标识' ,
correlation_id VARCHAR ( 128 ) NOT NULL COMMENT '业务关联标识' ,
causation_id VARCHAR ( 128 ) NULL COMMENT '上游事件标识' ,
occurred_at DATETIME ( 3 ) NOT NULL COMMENT '业务事实发生时间' ,
payload_hash VARCHAR ( 71 ) NOT NULL COMMENT '规范化负载摘要' ,
payload_json JSON NOT NULL COMMENT '事件负载' ,
status VARCHAR ( 32 ) NOT NULL DEFAULT 'RECEIVED' COMMENT '消费状态' ,
lease_owner VARCHAR ( 128 ) NULL COMMENT '消费租约持有者' ,
lease_until DATETIME ( 3 ) NULL COMMENT '消费租约截止时间' ,
retry_count INT NOT NULL DEFAULT 0 COMMENT '消费重试次数' ,
next_retry_at DATETIME ( 3 ) NULL COMMENT '下次消费时间' ,
last_error VARCHAR ( 1000 ) NULL COMMENT '最后错误' ,
received_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '接收时间' ,
processed_at DATETIME ( 3 ) NULL COMMENT '消费完成时间' ,
PRIMARY KEY ( event_id ),
UNIQUE KEY uk_bridge_inbox_idempotency ( idempotency_key ),
KEY idx_bridge_inbox_consume ( status , next_retry_at , lease_until )
) ENGINE = InnoDB COMMENT = '跨区域事件已接收箱' ;
CREATE TABLE IF NOT EXISTS bridge_delivery_attempt (
id BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键' ,
event_id VARCHAR ( 128 ) NOT NULL COMMENT '事件全局标识' ,
source_region VARCHAR ( 32 ) NOT NULL COMMENT '来源区域' ,
target_region VARCHAR ( 32 ) NOT NULL COMMENT '目标区域' ,
attempt_no INT NOT NULL COMMENT '投递序号' ,
status VARCHAR ( 32 ) NOT NULL COMMENT '投递结果' ,
response_code VARCHAR ( 64 ) NULL COMMENT '对端响应码' ,
error_message VARCHAR ( 1000 ) NULL COMMENT '错误信息' ,
started_at DATETIME ( 3 ) NOT NULL COMMENT '开始时间' ,
finished_at DATETIME ( 3 ) NULL COMMENT '完成时间' ,
PRIMARY KEY ( id ),
UNIQUE KEY uk_bridge_attempt ( event_id , attempt_no ),
KEY idx_bridge_attempt_event ( event_id , started_at )
) ENGINE = InnoDB COMMENT = '跨区域事件投递尝试记录' ;
-- Upgrade an existing bridge_inbox without replacing payload JSON or other rows.
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'bridge_inbox' AND column_name = 'lease_owner' ), 'SELECT 1' , 'ALTER TABLE bridge_inbox ADD COLUMN lease_owner VARCHAR(128) NULL COMMENT ''消费租约持有者'' AFTER status' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
-- ============================================================================
-- 2026-08-15 / 002
-- Warehouse locations, pallets, resource locks and UTF-8 descriptions
-- ============================================================================
2026-08-19 16:49:41 +08:00
CREATE DATABASE IF NOT EXISTS baiyue_lastlag_warehouse
2026-08-19 16:24:02 +08:00
DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ;
2026-08-19 16:49:41 +08:00
USE baiyue_lastlag_warehouse ;
2026-08-19 16:24:02 +08:00
CREATE TABLE IF NOT EXISTS wh_location (
id BIGINT UNSIGNED NOT NULL COMMENT '库位ID(雪花ID) ' ,
tenant_id BIGINT UNSIGNED NOT NULL COMMENT '数据所属租户ID' ,
warehouse_id BIGINT UNSIGNED NOT NULL COMMENT '所属仓库ID' ,
zone_code VARCHAR ( 50 ) NOT NULL COMMENT '仓库分区编码' ,
location_code VARCHAR ( 64 ) NOT NULL COMMENT '仓库内唯一库位编码' ,
location_type VARCHAR ( 32 ) NOT NULL COMMENT '库位类型' ,
max_load_kg DECIMAL ( 18 , 3 ) NOT NULL COMMENT '最大承重(千克)' ,
status VARCHAR ( 20 ) NOT NULL DEFAULT 'ACTIVE' COMMENT '库位状态:ACTIVE启用、INACTIVE停用' ,
remark VARCHAR ( 500 ) NULL COMMENT '备注' ,
created_by BIGINT UNSIGNED NULL COMMENT '创建人ID' ,
created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' ,
updated_by BIGINT UNSIGNED NULL COMMENT '最后修改人ID' ,
updated_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) ON UPDATE CURRENT_TIMESTAMP ( 3 ) COMMENT '更新时间' ,
deleted TINYINT ( 1 ) NOT NULL DEFAULT 0 COMMENT '逻辑删除标记' ,
version INT NOT NULL DEFAULT 0 COMMENT '乐观锁版本号' ,
PRIMARY KEY ( id ),
UNIQUE KEY uk_location_code ( tenant_id , warehouse_id , location_code , deleted ),
KEY idx_location_query ( tenant_id , warehouse_id , zone_code , status , deleted )
) ENGINE = InnoDB COMMENT = '仓库库位表:按租户和仓库维护库位及承重信息' ;
CREATE TABLE IF NOT EXISTS wh_pallet (
id BIGINT UNSIGNED NOT NULL COMMENT '托盘ID(雪花ID) ' ,
tenant_id BIGINT UNSIGNED NOT NULL COMMENT '数据所属租户ID' ,
warehouse_id BIGINT UNSIGNED NOT NULL COMMENT '所属仓库ID' ,
location_id BIGINT UNSIGNED NULL COMMENT '同仓库内绑定的库位ID,可为空' ,
pallet_code VARCHAR ( 128 ) NOT NULL COMMENT '仓库内唯一托盘编码' ,
pallet_type VARCHAR ( 32 ) NOT NULL COMMENT '托盘类型' ,
capacity_cbm DECIMAL ( 18 , 4 ) NOT NULL DEFAULT 2 . 0000 COMMENT '托盘容量(立方米)' ,
unit_price DECIMAL ( 18 , 2 ) NOT NULL DEFAULT 0 . 00 COMMENT '托盘单价' ,
status VARCHAR ( 20 ) NOT NULL DEFAULT 'IDLE' COMMENT '托盘状态:IDLE闲置、OCCUPIED占用、SCRAPPED废弃' ,
remark VARCHAR ( 500 ) NULL COMMENT '备注' ,
created_by BIGINT UNSIGNED NULL COMMENT '创建人ID' ,
created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' ,
updated_by BIGINT UNSIGNED NULL COMMENT '最后修改人ID' ,
updated_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) ON UPDATE CURRENT_TIMESTAMP ( 3 ) COMMENT '更新时间' ,
deleted TINYINT ( 1 ) NOT NULL DEFAULT 0 COMMENT '逻辑删除标记' ,
version INT NOT NULL DEFAULT 0 COMMENT '乐观锁版本号' ,
PRIMARY KEY ( id ),
UNIQUE KEY uk_pallet_code ( tenant_id , warehouse_id , pallet_code , deleted ),
KEY idx_pallet_query ( tenant_id , warehouse_id , status , deleted ),
KEY idx_pallet_location ( tenant_id , warehouse_id , location_id , deleted )
) ENGINE = InnoDB COMMENT = '仓库托盘表:按租户和仓库维护托盘、容量、单价及状态' ;
CREATE TABLE IF NOT EXISTS wh_resource_lock (
id BIGINT UNSIGNED NOT NULL COMMENT '资源锁ID(雪花ID) ' ,
tenant_id BIGINT UNSIGNED NOT NULL COMMENT '数据所属租户ID' ,
warehouse_id BIGINT UNSIGNED NOT NULL COMMENT '所属仓库ID' ,
pallet_id BIGINT UNSIGNED NOT NULL COMMENT '锁定的托盘ID' ,
location_id BIGINT UNSIGNED NOT NULL COMMENT '锁定的库位ID' ,
business_type VARCHAR ( 50 ) NOT NULL COMMENT '调用方业务类型' ,
business_id VARCHAR ( 100 ) NOT NULL COMMENT '调用方业务标识' ,
reservation_key VARCHAR ( 160 ) NOT NULL COMMENT '调用方资源预留幂等键' ,
status VARCHAR ( 20 ) NOT NULL DEFAULT 'ACTIVE' COMMENT '资源锁状态:ACTIVE有效、RELEASED释放、SCRAPPED报废' ,
locked_at DATETIME ( 3 ) NOT NULL COMMENT '锁定时间' ,
released_at DATETIME ( 3 ) NULL COMMENT '释放或报废时间' ,
created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' ,
updated_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) ON UPDATE CURRENT_TIMESTAMP ( 3 ) COMMENT '更新时间' ,
PRIMARY KEY ( id ),
UNIQUE KEY uk_resource_lock_reservation ( tenant_id , reservation_key ),
KEY idx_resource_lock_pallet ( tenant_id , warehouse_id , pallet_id , status ),
KEY idx_resource_lock_location ( tenant_id , warehouse_id , location_id , status ),
KEY idx_resource_lock_business ( tenant_id , business_type , business_id )
) ENGINE = InnoDB COMMENT = '仓库托盘与库位资源锁表:支持跨服务幂等预留和释放' ;
-- Fix legacy mojibake/English descriptions without changing row values.
ALTER TABLE wh_location COMMENT = '仓库库位表:按租户和仓库维护库位及承重信息' ;
ALTER TABLE wh_location
MODIFY COLUMN id BIGINT UNSIGNED NOT NULL COMMENT '库位ID(雪花ID) ' ,
MODIFY COLUMN tenant_id BIGINT UNSIGNED NOT NULL COMMENT '数据所属租户ID' ,
MODIFY COLUMN warehouse_id BIGINT UNSIGNED NOT NULL COMMENT '所属仓库ID' ,
MODIFY COLUMN zone_code VARCHAR ( 50 ) NOT NULL COMMENT '仓库分区编码' ,
MODIFY COLUMN location_code VARCHAR ( 64 ) NOT NULL COMMENT '仓库内唯一库位编码' ,
MODIFY COLUMN location_type VARCHAR ( 32 ) NOT NULL COMMENT '库位类型' ,
MODIFY COLUMN max_load_kg DECIMAL ( 18 , 3 ) NOT NULL COMMENT '最大承重(千克)' ,
MODIFY COLUMN status VARCHAR ( 20 ) NOT NULL DEFAULT 'ACTIVE' COMMENT '库位状态:ACTIVE启用、INACTIVE停用' ,
MODIFY COLUMN remark VARCHAR ( 500 ) NULL COMMENT '备注' ,
MODIFY COLUMN created_by BIGINT UNSIGNED NULL COMMENT '创建人ID' ,
MODIFY COLUMN created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' ,
MODIFY COLUMN updated_by BIGINT UNSIGNED NULL COMMENT '最后修改人ID' ,
MODIFY COLUMN updated_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) ON UPDATE CURRENT_TIMESTAMP ( 3 ) COMMENT '更新时间' ,
MODIFY COLUMN deleted TINYINT ( 1 ) NOT NULL DEFAULT 0 COMMENT '逻辑删除标记' ,
MODIFY COLUMN version INT NOT NULL DEFAULT 0 COMMENT '乐观锁版本号' ;
ALTER TABLE wh_pallet COMMENT = '仓库托盘表:按租户和仓库维护托盘、容量、单价及状态' ;
ALTER TABLE wh_pallet
MODIFY COLUMN id BIGINT UNSIGNED NOT NULL COMMENT '托盘ID(雪花ID) ' ,
MODIFY COLUMN tenant_id BIGINT UNSIGNED NOT NULL COMMENT '数据所属租户ID' ,
MODIFY COLUMN warehouse_id BIGINT UNSIGNED NOT NULL COMMENT '所属仓库ID' ,
MODIFY COLUMN location_id BIGINT UNSIGNED NULL COMMENT '同仓库内绑定的库位ID,可为空' ,
MODIFY COLUMN pallet_code VARCHAR ( 128 ) NOT NULL COMMENT '仓库内唯一托盘编码' ,
MODIFY COLUMN pallet_type VARCHAR ( 32 ) NOT NULL COMMENT '托盘类型' ,
MODIFY COLUMN capacity_cbm DECIMAL ( 18 , 4 ) NOT NULL DEFAULT 2 . 0000 COMMENT '托盘容量(立方米)' ,
MODIFY COLUMN unit_price DECIMAL ( 18 , 2 ) NOT NULL DEFAULT 0 . 00 COMMENT '托盘单价' ,
MODIFY COLUMN status VARCHAR ( 20 ) NOT NULL DEFAULT 'IDLE' COMMENT '托盘状态:IDLE闲置、OCCUPIED占用、SCRAPPED废弃' ,
MODIFY COLUMN remark VARCHAR ( 500 ) NULL COMMENT '备注' ,
MODIFY COLUMN created_by BIGINT UNSIGNED NULL COMMENT '创建人ID' ,
MODIFY COLUMN created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' ,
MODIFY COLUMN updated_by BIGINT UNSIGNED NULL COMMENT '最后修改人ID' ,
MODIFY COLUMN updated_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) ON UPDATE CURRENT_TIMESTAMP ( 3 ) COMMENT '更新时间' ,
MODIFY COLUMN deleted TINYINT ( 1 ) NOT NULL DEFAULT 0 COMMENT '逻辑删除标记' ,
MODIFY COLUMN version INT NOT NULL DEFAULT 0 COMMENT '乐观锁版本号' ;
ALTER TABLE wh_resource_lock COMMENT = '仓库托盘与库位资源锁表:支持跨服务幂等预留和释放' ;
ALTER TABLE wh_resource_lock
MODIFY COLUMN id BIGINT UNSIGNED NOT NULL COMMENT '资源锁ID(雪花ID) ' ,
MODIFY COLUMN tenant_id BIGINT UNSIGNED NOT NULL COMMENT '数据所属租户ID' ,
MODIFY COLUMN warehouse_id BIGINT UNSIGNED NOT NULL COMMENT '所属仓库ID' ,
MODIFY COLUMN pallet_id BIGINT UNSIGNED NOT NULL COMMENT '锁定的托盘ID' ,
MODIFY COLUMN location_id BIGINT UNSIGNED NOT NULL COMMENT '锁定的库位ID' ,
MODIFY COLUMN business_type VARCHAR ( 50 ) NOT NULL COMMENT '调用方业务类型' ,
MODIFY COLUMN business_id VARCHAR ( 100 ) NOT NULL COMMENT '调用方业务标识' ,
MODIFY COLUMN reservation_key VARCHAR ( 160 ) NOT NULL COMMENT '调用方资源预留幂等键' ,
MODIFY COLUMN status VARCHAR ( 20 ) NOT NULL DEFAULT 'ACTIVE' COMMENT '资源锁状态:ACTIVE有效、RELEASED释放、SCRAPPED报废' ,
MODIFY COLUMN locked_at DATETIME ( 3 ) NOT NULL COMMENT '锁定时间' ,
MODIFY COLUMN released_at DATETIME ( 3 ) NULL COMMENT '释放或报废时间' ,
MODIFY COLUMN created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' ,
MODIFY COLUMN updated_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) ON UPDATE CURRENT_TIMESTAMP ( 3 ) COMMENT '更新时间' ;
-- Guard every operational index for existing installations.
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'wh_location' AND index_name = 'uk_location_code' ), 'SELECT 1' , 'CREATE UNIQUE INDEX uk_location_code ON wh_location(tenant_id,warehouse_id,location_code,deleted)' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'wh_location' AND index_name = 'idx_location_query' ), 'SELECT 1' , 'CREATE INDEX idx_location_query ON wh_location(tenant_id,warehouse_id,zone_code,status,deleted)' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'wh_pallet' AND index_name = 'uk_pallet_code' ), 'SELECT 1' , 'CREATE UNIQUE INDEX uk_pallet_code ON wh_pallet(tenant_id,warehouse_id,pallet_code,deleted)' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'wh_pallet' AND index_name = 'idx_pallet_query' ), 'SELECT 1' , 'CREATE INDEX idx_pallet_query ON wh_pallet(tenant_id,warehouse_id,status,deleted)' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'wh_pallet' AND index_name = 'idx_pallet_location' ), 'SELECT 1' , 'CREATE INDEX idx_pallet_location ON wh_pallet(tenant_id,warehouse_id,location_id,deleted)' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'wh_resource_lock' AND index_name = 'uk_resource_lock_reservation' ), 'SELECT 1' , 'CREATE UNIQUE INDEX uk_resource_lock_reservation ON wh_resource_lock(tenant_id,reservation_key)' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'wh_resource_lock' AND index_name = 'idx_resource_lock_pallet' ), 'SELECT 1' , 'CREATE INDEX idx_resource_lock_pallet ON wh_resource_lock(tenant_id,warehouse_id,pallet_id,status)' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'wh_resource_lock' AND index_name = 'idx_resource_lock_location' ), 'SELECT 1' , 'CREATE INDEX idx_resource_lock_location ON wh_resource_lock(tenant_id,warehouse_id,location_id,status)' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'wh_resource_lock' AND index_name = 'idx_resource_lock_business' ), 'SELECT 1' , 'CREATE INDEX idx_resource_lock_business ON wh_resource_lock(tenant_id,business_type,business_id)' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
-- ============================================================================
-- 2026-08-15 / 003
-- Last-leg inbound plan, pallet allocation and PDA workflow
-- ============================================================================
CREATE DATABASE IF NOT EXISTS baiyue_lastleg
DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ;
USE baiyue_lastleg ;
CREATE TABLE IF NOT EXISTS ll_inbound_plan (
id BIGINT NOT NULL COMMENT '入库计划ID(雪花ID) ' ,
plan_no VARCHAR ( 32 ) NOT NULL COMMENT '入库单号' ,
tenant_id VARCHAR ( 128 ) NOT NULL COMMENT '租户/客户账号标识' ,
container_no VARCHAR ( 64 ) NOT NULL COMMENT '实际集装箱号' ,
status VARCHAR ( 32 ) NOT NULL DEFAULT 'PENDING_ASSIGNMENT' COMMENT '入库计划状态' ,
line_count INT NOT NULL DEFAULT 0 COMMENT '入仓码明细数量' ,
pallet_count INT NOT NULL DEFAULT 0 COMMENT '系统自动分配托盘数量' ,
total_volume_cbm DECIMAL ( 18 , 4 ) NOT NULL DEFAULT 0 COMMENT '集装箱总体积(立方米)' ,
created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' ,
updated_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) ON UPDATE CURRENT_TIMESTAMP ( 3 ) COMMENT '更新时间' ,
PRIMARY KEY ( id ),
UNIQUE KEY uk_ll_inbound_plan_no ( plan_no ),
UNIQUE KEY uk_ll_inbound_plan_container ( tenant_id , container_no )
) ENGINE = InnoDB COMMENT = '尾程入库计划表:每个租户的每个集装箱生成一张入库单' ;
CREATE TABLE IF NOT EXISTS ll_inbound_plan_line (
id BIGINT NOT NULL COMMENT '入库计划明细ID(雪花ID) ' ,
plan_id BIGINT NOT NULL COMMENT '入库计划ID' ,
order_id BIGINT NOT NULL COMMENT '尾程订单ID' ,
inbound_code VARCHAR ( 128 ) NOT NULL COMMENT '头程入仓码快照' ,
destination_warehouse_id VARCHAR ( 128 ) NULL COMMENT '目的仓ID快照' ,
destination_warehouse_code VARCHAR ( 128 ) NULL COMMENT '目的仓编码快照' ,
destination_warehouse_name VARCHAR ( 255 ) NULL COMMENT '目的仓名称快照' ,
volume_cbm DECIMAL ( 18 , 4 ) NOT NULL DEFAULT 0 COMMENT '入仓码体积(立方米)' ,
planned_pallet_count INT NOT NULL DEFAULT 0 COMMENT '该明细分配的托盘数量' ,
required_package_count INT NOT NULL DEFAULT 0 COMMENT '计划应收箱数' ,
PRIMARY KEY ( id ),
UNIQUE KEY uk_ll_inbound_line_order ( plan_id , order_id ),
KEY idx_ll_inbound_line_plan ( plan_id )
) ENGINE = InnoDB COMMENT = '尾程入库计划明细表:按入仓码和尾程订单维度记录' ;
CREATE TABLE IF NOT EXISTS ll_inbound_plan_pallet (
id BIGINT NOT NULL COMMENT '计划托盘ID(雪花ID) ' ,
plan_id BIGINT NOT NULL COMMENT '入库计划ID' ,
pallet_no VARCHAR ( 64 ) NOT NULL COMMENT '计划托盘编号' ,
destination_warehouse_id VARCHAR ( 128 ) NULL COMMENT '目的仓ID快照' ,
destination_warehouse_code VARCHAR ( 128 ) NULL COMMENT '目的仓编码快照' ,
destination_warehouse_name VARCHAR ( 255 ) NULL COMMENT '目的仓名称快照' ,
capacity_cbm DECIMAL ( 18 , 4 ) NOT NULL DEFAULT 2 . 0000 COMMENT '托盘容量(立方米)' ,
allocated_volume_cbm DECIMAL ( 18 , 4 ) NOT NULL DEFAULT 0 COMMENT '已分配体积(立方米)' ,
sequence_no INT NOT NULL COMMENT '计划内托盘序号' ,
warehouse_pallet_id BIGINT NULL COMMENT '仓库托盘ID' ,
warehouse_location_id BIGINT NULL COMMENT '仓库库位ID' ,
warehouse_resource_lock_id BIGINT NULL COMMENT '仓库资源锁ID' ,
assignment_status VARCHAR ( 32 ) NOT NULL DEFAULT 'UNASSIGNED' COMMENT '仓库资源分配状态' ,
locked_at DATETIME ( 3 ) NULL COMMENT '资源锁定时间' ,
actual_volume_cbm DECIMAL ( 18 , 4 ) NOT NULL DEFAULT 0 COMMENT '实际入托体积(立方米)' ,
actual_package_count INT NOT NULL DEFAULT 0 COMMENT '实际入托箱数' ,
PRIMARY KEY ( id ),
UNIQUE KEY uk_ll_inbound_pallet_no ( pallet_no ),
UNIQUE KEY uk_ll_inbound_pallet_sequence ( plan_id , sequence_no ),
KEY idx_ll_inbound_pallet_plan ( plan_id )
) ENGINE = InnoDB COMMENT = '尾程入库计划托盘表:按目的仓隔离合托' ;
CREATE TABLE IF NOT EXISTS ll_inbound_plan_pallet_allocation (
id BIGINT NOT NULL COMMENT '托盘分配记录ID(雪花ID) ' ,
plan_id BIGINT NOT NULL COMMENT '入库计划ID' ,
line_id BIGINT NOT NULL COMMENT '入库计划明细ID' ,
pallet_id BIGINT NOT NULL COMMENT '计划托盘ID' ,
allocated_volume_cbm DECIMAL ( 18 , 4 ) NOT NULL COMMENT '计划分配体积(立方米)' ,
planned_package_count INT NOT NULL DEFAULT 0 COMMENT '计划分配箱数' ,
counted_package_count INT NOT NULL DEFAULT 0 COMMENT '清点箱数' ,
picked_package_count INT NOT NULL DEFAULT 0 COMMENT '上架箱数' ,
actual_volume_cbm DECIMAL ( 18 , 4 ) NOT NULL DEFAULT 0 COMMENT '实际分配体积(立方米)' ,
status VARCHAR ( 32 ) NOT NULL DEFAULT 'PENDING_COUNT' COMMENT 'PDA作业状态' ,
version INT NOT NULL DEFAULT 0 COMMENT '乐观锁版本号' ,
PRIMARY KEY ( id ),
UNIQUE KEY uk_ll_inbound_allocation ( line_id , pallet_id ),
KEY idx_ll_inbound_allocation_plan ( plan_id ),
KEY idx_ll_inbound_allocation_pallet ( pallet_id )
) ENGINE = InnoDB COMMENT = '尾程入库计划托盘分配表:记录入仓码明细与计划托盘的分配关系' ;
-- Columns introduced after the initial inbound-plan release.
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_line' AND column_name = 'required_package_count' ), 'SELECT 1' , 'ALTER TABLE ll_inbound_plan_line ADD COLUMN required_package_count INT NOT NULL DEFAULT 0 COMMENT ''计划应收箱数''' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_pallet' AND column_name = 'warehouse_pallet_id' ), 'SELECT 1' , 'ALTER TABLE ll_inbound_plan_pallet ADD COLUMN warehouse_pallet_id BIGINT NULL COMMENT ''仓库托盘ID''' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_pallet' AND column_name = 'warehouse_location_id' ), 'SELECT 1' , 'ALTER TABLE ll_inbound_plan_pallet ADD COLUMN warehouse_location_id BIGINT NULL COMMENT ''仓库库位ID''' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_pallet' AND column_name = 'warehouse_resource_lock_id' ), 'SELECT 1' , 'ALTER TABLE ll_inbound_plan_pallet ADD COLUMN warehouse_resource_lock_id BIGINT NULL COMMENT ''仓库资源锁ID''' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_pallet' AND column_name = 'assignment_status' ), 'SELECT 1' , 'ALTER TABLE ll_inbound_plan_pallet ADD COLUMN assignment_status VARCHAR(32) NOT NULL DEFAULT ''UNASSIGNED'' COMMENT ''仓库资源分配状态''' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_pallet' AND column_name = 'locked_at' ), 'SELECT 1' , 'ALTER TABLE ll_inbound_plan_pallet ADD COLUMN locked_at DATETIME(3) NULL COMMENT ''资源锁定时间''' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_pallet' AND column_name = 'actual_volume_cbm' ), 'SELECT 1' , 'ALTER TABLE ll_inbound_plan_pallet ADD COLUMN actual_volume_cbm DECIMAL(18,4) NOT NULL DEFAULT 0 COMMENT ''实际入托体积(立方米)''' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_pallet' AND column_name = 'actual_package_count' ), 'SELECT 1' , 'ALTER TABLE ll_inbound_plan_pallet ADD COLUMN actual_package_count INT NOT NULL DEFAULT 0 COMMENT ''实际入托箱数''' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_pallet_allocation' AND column_name = 'planned_package_count' ), 'SELECT 1' , 'ALTER TABLE ll_inbound_plan_pallet_allocation ADD COLUMN planned_package_count INT NOT NULL DEFAULT 0 COMMENT ''计划分配箱数''' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_pallet_allocation' AND column_name = 'counted_package_count' ), 'SELECT 1' , 'ALTER TABLE ll_inbound_plan_pallet_allocation ADD COLUMN counted_package_count INT NOT NULL DEFAULT 0 COMMENT ''清点箱数''' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_pallet_allocation' AND column_name = 'picked_package_count' ), 'SELECT 1' , 'ALTER TABLE ll_inbound_plan_pallet_allocation ADD COLUMN picked_package_count INT NOT NULL DEFAULT 0 COMMENT ''上架箱数''' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_pallet_allocation' AND column_name = 'actual_volume_cbm' ), 'SELECT 1' , 'ALTER TABLE ll_inbound_plan_pallet_allocation ADD COLUMN actual_volume_cbm DECIMAL(18,4) NOT NULL DEFAULT 0 COMMENT ''实际分配体积(立方米)''' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_pallet_allocation' AND column_name = 'status' ), 'SELECT 1' , 'ALTER TABLE ll_inbound_plan_pallet_allocation ADD COLUMN status VARCHAR(32) NOT NULL DEFAULT ''PENDING_COUNT'' COMMENT ''PDA作业状态''' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_pallet_allocation' AND column_name = 'version' ), 'SELECT 1' , 'ALTER TABLE ll_inbound_plan_pallet_allocation ADD COLUMN version INT NOT NULL DEFAULT 0 COMMENT ''乐观锁版本号''' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
CREATE TABLE IF NOT EXISTS ll_inbound_pda_task (
id BIGINT NOT NULL COMMENT 'PDA任务ID' , tenant_id VARCHAR ( 128 ) NOT NULL COMMENT '租户ID' ,
plan_id BIGINT NOT NULL COMMENT '入库计划ID' , task_no VARCHAR ( 64 ) NOT NULL COMMENT 'PDA任务号' ,
status VARCHAR ( 32 ) NOT NULL DEFAULT 'PENDING' COMMENT '任务状态' , operator_id VARCHAR ( 128 ) NULL COMMENT '操作人ID' ,
operator_name VARCHAR ( 255 ) NULL COMMENT '操作人名称' , pushed_at DATETIME ( 3 ) NULL COMMENT '推送时间' ,
started_at DATETIME ( 3 ) NULL COMMENT '开始时间' , completed_at DATETIME ( 3 ) NULL COMMENT '完成时间' ,
version INT NOT NULL DEFAULT 0 COMMENT '乐观锁版本号' , created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' ,
updated_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) ON UPDATE CURRENT_TIMESTAMP ( 3 ) COMMENT '更新时间' ,
PRIMARY KEY ( id ), UNIQUE KEY uk_ll_inbound_pda_task_plan ( tenant_id , plan_id ),
UNIQUE KEY uk_ll_inbound_pda_task_no ( task_no )
) ENGINE = InnoDB COMMENT = '尾程入库PDA任务表' ;
CREATE TABLE IF NOT EXISTS ll_inbound_pda_operation (
id BIGINT NOT NULL COMMENT 'PDA操作记录ID' , tenant_id VARCHAR ( 128 ) NOT NULL COMMENT '租户ID' ,
task_id BIGINT NOT NULL COMMENT 'PDA任务ID' , allocation_id BIGINT NULL COMMENT '托盘分配记录ID' ,
action VARCHAR ( 32 ) NOT NULL COMMENT '操作类型' , idempotency_key VARCHAR ( 255 ) NOT NULL COMMENT '操作幂等键' ,
request_hash VARCHAR ( 128 ) NOT NULL COMMENT '请求摘要' , request_json LONGTEXT NOT NULL COMMENT '请求JSON' ,
result_json LONGTEXT NOT NULL COMMENT '结果JSON' , created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' ,
PRIMARY KEY ( id ), UNIQUE KEY uk_ll_inbound_pda_operation_key ( tenant_id , idempotency_key ),
KEY idx_ll_inbound_pda_operation_task ( task_id ), KEY idx_ll_inbound_pda_operation_allocation ( allocation_id )
) ENGINE = InnoDB COMMENT = '尾程入库PDA幂等操作记录' ;
CREATE TABLE IF NOT EXISTS ll_inbound_pallet_merge (
id BIGINT NOT NULL COMMENT '合托记录ID' , tenant_id VARCHAR ( 128 ) NOT NULL COMMENT '租户ID' ,
task_id BIGINT NOT NULL COMMENT 'PDA任务ID' , merge_group_no VARCHAR ( 64 ) NOT NULL COMMENT '合托组号' ,
source_pallet_id BIGINT NOT NULL COMMENT '来源托盘ID' , target_pallet_id BIGINT NOT NULL COMMENT '目标托盘ID' ,
source_allocation_id BIGINT NOT NULL COMMENT '来源分配ID' , target_allocation_id BIGINT NOT NULL COMMENT '目标分配ID' ,
source_line_id BIGINT NOT NULL COMMENT '来源计划明细ID' , target_line_id BIGINT NOT NULL COMMENT '目标计划明细ID' ,
source_order_id BIGINT NOT NULL COMMENT '来源订单ID' , target_order_id BIGINT NOT NULL COMMENT '目标订单ID' ,
moved_package_count INT NOT NULL COMMENT '移动箱数' , moved_volume_cbm DECIMAL ( 18 , 4 ) NOT NULL DEFAULT 0 COMMENT '移动体积(立方米)' ,
source_pallet_scrapped TINYINT NOT NULL DEFAULT 0 COMMENT '来源托盘是否报废' , status VARCHAR ( 32 ) NOT NULL COMMENT '合托状态' ,
created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' , PRIMARY KEY ( id ),
KEY idx_ll_inbound_merge_task ( tenant_id , task_id ), KEY idx_ll_inbound_merge_group ( merge_group_no )
) ENGINE = InnoDB COMMENT = '尾程入库PDA合托记录' ;
-- ============================================================================
-- 2026-08-15 / 004
-- Upgrade an existing Event Bridge inbox with retry/lease fields and indexes
-- ============================================================================
USE baiyue_event_bridge ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'bridge_inbox' AND column_name = 'lease_until' ), 'SELECT 1' , 'ALTER TABLE bridge_inbox ADD COLUMN lease_until DATETIME(3) NULL COMMENT ''消费租约截止时间'' AFTER lease_owner' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'bridge_inbox' AND column_name = 'retry_count' ), 'SELECT 1' , 'ALTER TABLE bridge_inbox ADD COLUMN retry_count INT NOT NULL DEFAULT 0 COMMENT ''消费重试次数'' AFTER lease_until' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'bridge_inbox' AND column_name = 'next_retry_at' ), 'SELECT 1' , 'ALTER TABLE bridge_inbox ADD COLUMN next_retry_at DATETIME(3) NULL COMMENT ''下次消费时间'' AFTER retry_count' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'bridge_inbox' AND column_name = 'last_error' ), 'SELECT 1' , 'ALTER TABLE bridge_inbox ADD COLUMN last_error VARCHAR(1000) NULL COMMENT ''最后错误'' AFTER next_retry_at' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'bridge_inbox' AND index_name = 'idx_bridge_inbox_consume' ), 'SELECT 1' , 'CREATE INDEX idx_bridge_inbox_consume ON bridge_inbox(status,next_retry_at,lease_until)' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'bridge_inbox' AND index_name = 'uk_bridge_inbox_idempotency' ), 'SELECT 1' , 'CREATE UNIQUE INDEX uk_bridge_inbox_idempotency ON bridge_inbox(idempotency_key)' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
-- ============================================================================
-- 2026-08-15 / 005
-- FirstLegLoadingPlanCompleted -> last-leg order projection
-- ============================================================================
CREATE DATABASE IF NOT EXISTS baiyue_lastleg
DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ;
USE baiyue_lastleg ;
CREATE TABLE IF NOT EXISTS ll_loading_event_inbox (
event_id VARCHAR ( 128 ) NOT NULL COMMENT '事件全局唯一标识' ,
tenant_id VARCHAR ( 128 ) NOT NULL COMMENT '租户/客户账号标识' ,
event_type VARCHAR ( 64 ) NOT NULL COMMENT '事件类型' ,
event_version INT NOT NULL COMMENT '事件契约版本' ,
payload_hash VARCHAR ( 71 ) NOT NULL COMMENT '规范化事件负载SHA-256摘要' ,
payload_json JSON NOT NULL COMMENT '事件冻结负载JSON' ,
status VARCHAR ( 32 ) NOT NULL DEFAULT 'RECEIVED' COMMENT '消费状态:RECEIVED/PROCESSED' ,
received_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '接收时间' ,
processed_at DATETIME ( 3 ) NULL COMMENT '处理完成时间' ,
last_error VARCHAR ( 1000 ) NULL COMMENT '最近一次处理错误' ,
PRIMARY KEY ( event_id ),
UNIQUE KEY uk_ll_loading_inbox_tenant_key ( tenant_id , event_type , event_id )
) ENGINE = InnoDB COMMENT = '头程装柜完成事件接收幂等箱' ;
CREATE TABLE IF NOT EXISTS ll_order (
id BIGINT NOT NULL COMMENT '雪花ID' ,
order_no VARCHAR ( 32 ) NOT NULL COMMENT '尾程单号,同柜入仓单共享' ,
tenant_id VARCHAR ( 128 ) NOT NULL COMMENT '租户/客户账号标识' ,
order_type VARCHAR ( 32 ) NOT NULL DEFAULT 'FIRST_LEG' COMMENT '订单类型' ,
inbound_code VARCHAR ( 128 ) NOT NULL COMMENT '入仓码' ,
source_region VARCHAR ( 32 ) NOT NULL COMMENT '来源区域/系统' ,
source_inbound_id VARCHAR ( 128 ) NOT NULL COMMENT '最终实装LOADED分片ID,建单幂等键' ,
root_inbound_id VARCHAR ( 128 ) NULL COMMENT '根入仓单ID' ,
source_order_id VARCHAR ( 128 ) NULL COMMENT '来源订单ID' ,
source_order_no VARCHAR ( 128 ) NULL COMMENT '来源订单号' ,
root_order_id VARCHAR ( 128 ) NULL COMMENT '根订单ID' ,
customer_name VARCHAR ( 255 ) NULL COMMENT '货主名称' ,
overseas_warehouse_id VARCHAR ( 128 ) NULL COMMENT '海外仓ID' ,
overseas_warehouse_name VARCHAR ( 255 ) NULL COMMENT '海外仓名称' ,
transfer_warehouse_id VARCHAR ( 128 ) NULL COMMENT '转入目的仓ID' ,
transfer_warehouse_code VARCHAR ( 128 ) NULL COMMENT '转入目的仓编码' ,
transfer_warehouse_name VARCHAR ( 255 ) NULL COMMENT '转入目的仓名称' ,
fba_warehouse_code VARCHAR ( 128 ) NULL COMMENT 'FBA仓库编码' ,
container_no VARCHAR ( 64 ) NULL COMMENT '实际集装箱号' ,
container_status VARCHAR ( 32 ) NULL DEFAULT '待转柜' COMMENT '货柜状态' ,
abnormal TINYINT NOT NULL DEFAULT 0 COMMENT '是否异常:0否1是' ,
detained TINYINT NOT NULL DEFAULT 0 COMMENT '是否暂扣:0否1是' ,
pallet_count INT NOT NULL DEFAULT 0 COMMENT '托数' ,
package_count INT NOT NULL DEFAULT 0 COMMENT '箱数' ,
volume_cbm DECIMAL ( 18 , 4 ) NULL COMMENT '体积(立方米)' ,
product_quantity INT NULL COMMENT '货物数量' ,
volume_weight_kg DECIMAL ( 18 , 4 ) NULL COMMENT '体积重量(千克)' ,
estimated_arrival_at DATETIME ( 3 ) NULL COMMENT '预计到港时间' ,
actual_arrival_at DATETIME ( 3 ) NULL COMMENT '实际到港时间' ,
estimated_warehouse_at DATETIME ( 3 ) NULL COMMENT '预计到仓时间' ,
inbound_order_no VARCHAR ( 128 ) NULL COMMENT '入库单号' ,
outbound_order_no VARCHAR ( 128 ) NULL COMMENT '出库单号' ,
delivery_order_no VARCHAR ( 128 ) NULL COMMENT '派送单号' ,
relabel_order_no VARCHAR ( 128 ) NULL COMMENT '换标单号' ,
relabel_status VARCHAR ( 32 ) NULL COMMENT '换标状态' ,
pallet_merge_flag VARCHAR ( 32 ) NULL COMMENT '合托标记' ,
current_status VARCHAR ( 32 ) NOT NULL DEFAULT 'PENDING_ASSIGNMENT' COMMENT '当前业务状态' ,
private_remark VARCHAR ( 1000 ) NULL COMMENT '备注(仅自己)' ,
customer_remark VARCHAR ( 1000 ) NULL COMMENT '备注(客户)' ,
warehouse_remark VARCHAR ( 1000 ) NULL COMMENT '备注(仓库)' ,
source_event_id VARCHAR ( 128 ) NOT NULL COMMENT '来源事件ID' ,
source_loading_plan_id VARCHAR ( 128 ) NOT NULL COMMENT '来源装柜计划ID' ,
source_loading_plan_version BIGINT NULL COMMENT '来源装柜计划版本' ,
source_handover_version BIGINT NULL COMMENT '交接版本' ,
source_payload_hash VARCHAR ( 71 ) NOT NULL COMMENT '来源入仓单快照摘要' ,
created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' ,
updated_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) ON UPDATE CURRENT_TIMESTAMP ( 3 ) COMMENT '更新时间' ,
PRIMARY KEY ( id ),
UNIQUE KEY uk_ll_order_source ( tenant_id , source_region , source_inbound_id ),
KEY idx_ll_order_group ( tenant_id , order_no ),
KEY idx_ll_order_list ( tenant_id , current_status , created_at )
) ENGINE = InnoDB COMMENT = '尾程订单主表' ;
CREATE TABLE IF NOT EXISTS ll_order_detail (
id BIGINT NOT NULL AUTO_INCREMENT COMMENT '订单明细主键' ,
order_id BIGINT NOT NULL COMMENT '尾程订单ID' ,
source_inbound_detail_id VARCHAR ( 128 ) NOT NULL COMMENT '来源入仓明细ID' ,
sku_code VARCHAR ( 128 ) NULL COMMENT 'SKU编码' ,
product_name_zh VARCHAR ( 255 ) NULL COMMENT '中文品名' ,
product_name_en VARCHAR ( 255 ) NULL COMMENT '英文品名' ,
package_count INT NOT NULL DEFAULT 0 COMMENT '箱数' ,
product_quantity INT NULL COMMENT '数量' ,
pallet_count INT NULL COMMENT '托数' ,
gross_weight_kg DECIMAL ( 18 , 4 ) NULL COMMENT '毛重(千克)' ,
net_weight_kg DECIMAL ( 18 , 4 ) NULL COMMENT '净重(千克)' ,
dimensional_weight_kg DECIMAL ( 18 , 4 ) NULL COMMENT '体积重量(千克)' ,
volume_cbm DECIMAL ( 18 , 4 ) NULL COMMENT '体积(立方米)' ,
destination_warehouse_id VARCHAR ( 128 ) NULL COMMENT '目的仓ID' ,
destination_warehouse_code VARCHAR ( 128 ) NULL COMMENT '目的仓编码' ,
destination_warehouse_name VARCHAR ( 255 ) NULL COMMENT '目的仓名称' ,
fba_tracking_no VARCHAR ( 255 ) NULL COMMENT 'FBA跟踪号' ,
shipment_no VARCHAR ( 255 ) NULL COMMENT '货件编号' ,
shipping_mark VARCHAR ( 255 ) NULL COMMENT '唛头' ,
PRIMARY KEY ( id ),
UNIQUE KEY uk_ll_detail_source ( order_id , source_inbound_detail_id ),
KEY idx_ll_detail_order ( order_id )
) ENGINE = InnoDB COMMENT = '尾程订单实装商品冻结明细' ;
CREATE TABLE IF NOT EXISTS ll_loading_order_status_history (
id BIGINT NOT NULL AUTO_INCREMENT COMMENT '状态历史主键' ,
order_id BIGINT NOT NULL COMMENT '尾程订单ID' ,
from_status VARCHAR ( 32 ) NULL COMMENT '变更前状态' ,
to_status VARCHAR ( 32 ) NOT NULL COMMENT '变更后状态' ,
event_id VARCHAR ( 128 ) NULL COMMENT '触发事件ID' ,
remark VARCHAR ( 500 ) NULL COMMENT '状态变更备注' ,
created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '记录时间' ,
PRIMARY KEY ( id ),
KEY idx_ll_loading_history_order ( order_id , created_at )
) ENGINE = InnoDB COMMENT = '尾程订单状态变更历史' ;
-- Existing order installations: add transfer fields without replacing row data.
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'transfer_warehouse_id' ), 'SELECT 1' , 'ALTER TABLE ll_order ADD COLUMN transfer_warehouse_id VARCHAR(128) NULL COMMENT ''转入目的仓ID'' AFTER overseas_warehouse_name' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'transfer_warehouse_code' ), 'SELECT 1' , 'ALTER TABLE ll_order ADD COLUMN transfer_warehouse_code VARCHAR(128) NULL COMMENT ''转入目的仓编码'' AFTER transfer_warehouse_id' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'transfer_warehouse_name' ), 'SELECT 1' , 'ALTER TABLE ll_order ADD COLUMN transfer_warehouse_name VARCHAR(255) NULL COMMENT ''转入目的仓名称'' AFTER transfer_warehouse_code' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
-- One container/loading-plan number groups multiple inbound-code rows, so order_no
-- must not be unique. Source inbound identity remains uniquely constrained.
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_order' AND index_name = 'uk_ll_order_no' AND non_unique = 0 ), 'ALTER TABLE ll_order DROP INDEX uk_ll_order_no' , 'SELECT 1' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_order' AND index_name = 'idx_ll_order_group' ), 'SELECT 1' , 'CREATE INDEX idx_ll_order_group ON ll_order(tenant_id,order_no)' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_order' AND index_name = 'uk_ll_order_source' ), 'SELECT 1' , 'CREATE UNIQUE INDEX uk_ll_order_source ON ll_order(tenant_id,source_region,source_inbound_id)' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_order' AND index_name = 'idx_ll_order_list' ), 'SELECT 1' , 'CREATE INDEX idx_ll_order_list ON ll_order(tenant_id,current_status,created_at)' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_loading_event_inbox' AND index_name = 'uk_ll_loading_inbox_tenant_key' ), 'SELECT 1' , 'CREATE UNIQUE INDEX uk_ll_loading_inbox_tenant_key ON ll_loading_event_inbox(tenant_id,event_type,event_id)' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
-- ============================================================================
-- 2026-08-15 / 006
-- Warehouse master-data descriptions and query indexes
-- ============================================================================
2026-08-19 16:49:41 +08:00
USE baiyue_lastlag_warehouse ;
2026-08-19 16:24:02 +08:00
CREATE TABLE IF NOT EXISTS wh_warehouse (
id BIGINT UNSIGNED NOT NULL COMMENT '仓库ID(雪花ID) ' , tenant_id BIGINT UNSIGNED NOT NULL COMMENT '仓库所属租户ID' ,
warehouse_code VARCHAR ( 50 ) NOT NULL COMMENT '租户内唯一仓库编码' , warehouse_name VARCHAR ( 120 ) NOT NULL COMMENT '仓库名称' ,
warehouse_type VARCHAR ( 32 ) NOT NULL DEFAULT 'OVERSEAS' COMMENT '仓库类型' , country_code CHAR ( 2 ) NOT NULL COMMENT '所在国家二字码' ,
timezone VARCHAR ( 64 ) NOT NULL COMMENT '仓库所在地IANA时区' , contact_name VARCHAR ( 64 ) NULL COMMENT '仓库联系人' ,
contact_phone VARCHAR ( 32 ) NULL COMMENT '联系电话' , contact_email VARCHAR ( 128 ) NULL COMMENT '联系邮箱' ,
status VARCHAR ( 20 ) NOT NULL DEFAULT 'ACTIVE' COMMENT '仓库状态' , remark VARCHAR ( 500 ) NULL COMMENT '仓库备注' ,
created_by BIGINT UNSIGNED NULL COMMENT '创建人ID' , created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' ,
updated_by BIGINT UNSIGNED NULL COMMENT '最后修改人ID' , updated_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) ON UPDATE CURRENT_TIMESTAMP ( 3 ) COMMENT '更新时间' ,
deleted TINYINT ( 1 ) NOT NULL DEFAULT 0 COMMENT '逻辑删除标记' , version INT NOT NULL DEFAULT 0 COMMENT '乐观锁版本号' ,
PRIMARY KEY ( id ), UNIQUE KEY uk_wh_tenant_code ( tenant_id , warehouse_code , deleted ),
KEY idx_wh_tenant_status ( tenant_id , status , deleted ), KEY idx_wh_country ( tenant_id , country_code , deleted )
) ENGINE = InnoDB COMMENT = '仓库主数据表:以租户为边界维护仓库编码、名称、国家、时区和启停状态' ;
CREATE TABLE IF NOT EXISTS wh_warehouse_address (
id BIGINT UNSIGNED NOT NULL COMMENT '仓库地址ID' , tenant_id BIGINT UNSIGNED NOT NULL COMMENT '数据所属租户ID' ,
warehouse_id BIGINT UNSIGNED NOT NULL COMMENT '所属仓库ID' , address_type VARCHAR ( 20 ) NOT NULL DEFAULT 'OPERATING' COMMENT '地址类型:OPERATING运营、RETURN退货' ,
country_code CHAR ( 2 ) NOT NULL COMMENT '国家二字码' , state_province VARCHAR ( 100 ) NULL COMMENT '省或州' ,
city VARCHAR ( 100 ) NOT NULL COMMENT '城市' , district VARCHAR ( 100 ) NULL COMMENT '区县' , postal_code VARCHAR ( 20 ) NULL COMMENT '邮政编码' ,
address_line1 VARCHAR ( 255 ) NOT NULL COMMENT '主地址行' , address_line2 VARCHAR ( 255 ) NULL COMMENT '补充地址行' ,
latitude DECIMAL ( 10 , 7 ) NULL COMMENT '纬度' , longitude DECIMAL ( 10 , 7 ) NULL COMMENT '经度' ,
created_by BIGINT UNSIGNED NULL COMMENT '创建人ID' , created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' ,
updated_by BIGINT UNSIGNED NULL COMMENT '最后修改人ID' , updated_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) ON UPDATE CURRENT_TIMESTAMP ( 3 ) COMMENT '更新时间' ,
deleted TINYINT ( 1 ) NOT NULL DEFAULT 0 COMMENT '逻辑删除标记' , version INT NOT NULL DEFAULT 0 COMMENT '乐观锁版本号' ,
PRIMARY KEY ( id ), UNIQUE KEY uk_address_type ( tenant_id , warehouse_id , address_type , deleted ),
KEY idx_address_warehouse ( tenant_id , warehouse_id , deleted )
) ENGINE = InnoDB COMMENT = '仓库地址表:保存运营、退货等不同用途的地址及可选经纬度' ;
CREATE TABLE IF NOT EXISTS wh_service_capability (
id BIGINT UNSIGNED NOT NULL COMMENT '服务能力ID' , tenant_id BIGINT UNSIGNED NOT NULL COMMENT '数据所属租户ID' ,
warehouse_id BIGINT UNSIGNED NOT NULL COMMENT '所属仓库ID' , capability_code VARCHAR ( 50 ) NOT NULL COMMENT '能力编码' ,
capability_name VARCHAR ( 100 ) NOT NULL COMMENT '能力名称' , enabled TINYINT ( 1 ) NOT NULL DEFAULT 1 COMMENT '是否启用' ,
cutoff_time TIME NULL COMMENT '当日作业截单时间' , description VARCHAR ( 500 ) NULL COMMENT '能力说明' ,
created_by BIGINT UNSIGNED NULL COMMENT '创建人ID' , created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' ,
updated_by BIGINT UNSIGNED NULL COMMENT '最后修改人ID' , updated_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) ON UPDATE CURRENT_TIMESTAMP ( 3 ) COMMENT '更新时间' ,
deleted TINYINT ( 1 ) NOT NULL DEFAULT 0 COMMENT '逻辑删除标记' , version INT NOT NULL DEFAULT 0 COMMENT '乐观锁版本号' ,
PRIMARY KEY ( id ), UNIQUE KEY uk_capability ( tenant_id , warehouse_id , capability_code , deleted ),
KEY idx_capability_query ( tenant_id , warehouse_id , enabled , deleted )
) ENGINE = InnoDB COMMENT = '仓库服务能力表:声明仓库可提供的收货、仓储、拣包、退货等能力及截单时间' ;
ALTER TABLE wh_warehouse COMMENT = '仓库主数据表:以租户为边界维护仓库编码、名称、国家、时区和启停状态' ;
ALTER TABLE wh_warehouse
MODIFY COLUMN id BIGINT UNSIGNED NOT NULL COMMENT '仓库ID(雪花ID) ' , MODIFY COLUMN tenant_id BIGINT UNSIGNED NOT NULL COMMENT '仓库所属租户ID' ,
MODIFY COLUMN warehouse_code VARCHAR ( 50 ) NOT NULL COMMENT '租户内唯一仓库编码' , MODIFY COLUMN warehouse_name VARCHAR ( 120 ) NOT NULL COMMENT '仓库名称' ,
MODIFY COLUMN warehouse_type VARCHAR ( 32 ) NOT NULL DEFAULT 'OVERSEAS' COMMENT '仓库类型' , MODIFY COLUMN country_code CHAR ( 2 ) NOT NULL COMMENT '所在国家二字码' ,
MODIFY COLUMN timezone VARCHAR ( 64 ) NOT NULL COMMENT '仓库所在地IANA时区' , MODIFY COLUMN contact_name VARCHAR ( 64 ) NULL COMMENT '仓库联系人' ,
MODIFY COLUMN contact_phone VARCHAR ( 32 ) NULL COMMENT '联系电话' , MODIFY COLUMN contact_email VARCHAR ( 128 ) NULL COMMENT '联系邮箱' ,
MODIFY COLUMN status VARCHAR ( 20 ) NOT NULL DEFAULT 'ACTIVE' COMMENT '仓库状态' , MODIFY COLUMN remark VARCHAR ( 500 ) NULL COMMENT '仓库备注' ,
MODIFY COLUMN created_by BIGINT UNSIGNED NULL COMMENT '创建人ID' , MODIFY COLUMN created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' ,
MODIFY COLUMN updated_by BIGINT UNSIGNED NULL COMMENT '最后修改人ID' , MODIFY COLUMN updated_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) ON UPDATE CURRENT_TIMESTAMP ( 3 ) COMMENT '更新时间' ,
MODIFY COLUMN deleted TINYINT ( 1 ) NOT NULL DEFAULT 0 COMMENT '逻辑删除标记' , MODIFY COLUMN version INT NOT NULL DEFAULT 0 COMMENT '乐观锁版本号' ;
ALTER TABLE wh_warehouse_address COMMENT = '仓库地址表:保存运营、退货等不同用途的地址及可选经纬度' ;
ALTER TABLE wh_warehouse_address
MODIFY COLUMN id BIGINT UNSIGNED NOT NULL COMMENT '仓库地址ID' , MODIFY COLUMN tenant_id BIGINT UNSIGNED NOT NULL COMMENT '数据所属租户ID' ,
MODIFY COLUMN warehouse_id BIGINT UNSIGNED NOT NULL COMMENT '所属仓库ID' , MODIFY COLUMN address_type VARCHAR ( 20 ) NOT NULL DEFAULT 'OPERATING' COMMENT '地址类型:OPERATING运营、RETURN退货' ,
MODIFY COLUMN country_code CHAR ( 2 ) NOT NULL COMMENT '国家二字码' , MODIFY COLUMN state_province VARCHAR ( 100 ) NULL COMMENT '省或州' ,
MODIFY COLUMN city VARCHAR ( 100 ) NOT NULL COMMENT '城市' , MODIFY COLUMN district VARCHAR ( 100 ) NULL COMMENT '区县' ,
MODIFY COLUMN postal_code VARCHAR ( 20 ) NULL COMMENT '邮政编码' , MODIFY COLUMN address_line1 VARCHAR ( 255 ) NOT NULL COMMENT '主地址行' ,
MODIFY COLUMN address_line2 VARCHAR ( 255 ) NULL COMMENT '补充地址行' , MODIFY COLUMN latitude DECIMAL ( 10 , 7 ) NULL COMMENT '纬度' ,
MODIFY COLUMN longitude DECIMAL ( 10 , 7 ) NULL COMMENT '经度' , MODIFY COLUMN created_by BIGINT UNSIGNED NULL COMMENT '创建人ID' ,
MODIFY COLUMN created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' , MODIFY COLUMN updated_by BIGINT UNSIGNED NULL COMMENT '最后修改人ID' ,
MODIFY COLUMN updated_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) ON UPDATE CURRENT_TIMESTAMP ( 3 ) COMMENT '更新时间' ,
MODIFY COLUMN deleted TINYINT ( 1 ) NOT NULL DEFAULT 0 COMMENT '逻辑删除标记' , MODIFY COLUMN version INT NOT NULL DEFAULT 0 COMMENT '乐观锁版本号' ;
ALTER TABLE wh_service_capability COMMENT = '仓库服务能力表:声明仓库可提供的收货、仓储、拣包、退货等能力及截单时间' ;
ALTER TABLE wh_service_capability
MODIFY COLUMN id BIGINT UNSIGNED NOT NULL COMMENT '服务能力ID' , MODIFY COLUMN tenant_id BIGINT UNSIGNED NOT NULL COMMENT '数据所属租户ID' ,
MODIFY COLUMN warehouse_id BIGINT UNSIGNED NOT NULL COMMENT '所属仓库ID' , MODIFY COLUMN capability_code VARCHAR ( 50 ) NOT NULL COMMENT '能力编码:RECEIVING收货、STORAGE仓储、PICK_PACK拣包、RETURN退货' ,
MODIFY COLUMN capability_name VARCHAR ( 100 ) NOT NULL COMMENT '能力名称' , MODIFY COLUMN enabled TINYINT ( 1 ) NOT NULL DEFAULT 1 COMMENT '是否启用' ,
MODIFY COLUMN cutoff_time TIME NULL COMMENT '当日作业截单时间' , MODIFY COLUMN description VARCHAR ( 500 ) NULL COMMENT '能力说明' ,
MODIFY COLUMN created_by BIGINT UNSIGNED NULL COMMENT '创建人ID' , MODIFY COLUMN created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' ,
MODIFY COLUMN updated_by BIGINT UNSIGNED NULL COMMENT '最后修改人ID' , MODIFY COLUMN updated_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) ON UPDATE CURRENT_TIMESTAMP ( 3 ) COMMENT '更新时间' ,
MODIFY COLUMN deleted TINYINT ( 1 ) NOT NULL DEFAULT 0 COMMENT '逻辑删除标记' , MODIFY COLUMN version INT NOT NULL DEFAULT 0 COMMENT '乐观锁版本号' ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse' AND index_name = 'uk_wh_tenant_code' ), 'SELECT 1' , 'CREATE UNIQUE INDEX uk_wh_tenant_code ON wh_warehouse(tenant_id,warehouse_code,deleted)' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse' AND index_name = 'idx_wh_tenant_status' ), 'SELECT 1' , 'CREATE INDEX idx_wh_tenant_status ON wh_warehouse(tenant_id,status,deleted)' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse' AND index_name = 'idx_wh_country' ), 'SELECT 1' , 'CREATE INDEX idx_wh_country ON wh_warehouse(tenant_id,country_code,deleted)' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse_address' AND index_name = 'uk_address_type' ), 'SELECT 1' , 'CREATE UNIQUE INDEX uk_address_type ON wh_warehouse_address(tenant_id,warehouse_id,address_type,deleted)' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse_address' AND index_name = 'idx_address_warehouse' ), 'SELECT 1' , 'CREATE INDEX idx_address_warehouse ON wh_warehouse_address(tenant_id,warehouse_id,deleted)' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'wh_service_capability' AND index_name = 'uk_capability' ), 'SELECT 1' , 'CREATE UNIQUE INDEX uk_capability ON wh_service_capability(tenant_id,warehouse_id,capability_code,deleted)' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'wh_service_capability' AND index_name = 'idx_capability_query' ), 'SELECT 1' , 'CREATE INDEX idx_capability_query ON wh_service_capability(tenant_id,warehouse_id,enabled,deleted)' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
-- ============================================================================
-- 2026-08-17 / 007
-- Last-leg batch FBA appointments
-- ============================================================================
USE baiyue_lastleg ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_line' AND column_name = 'fba_warehouse_code' ), 'SELECT 1' , 'ALTER TABLE ll_inbound_plan_line ADD COLUMN fba_warehouse_code VARCHAR(128) NULL AFTER inbound_code' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
UPDATE ll_inbound_plan_line l JOIN ll_order o ON o . id = l . order_id
SET l . fba_warehouse_code = o . fba_warehouse_code
WHERE l . fba_warehouse_code IS NULL AND o . fba_warehouse_code IS NOT NULL ;
CREATE TABLE IF NOT EXISTS ll_inbound_fba_appointment (
id BIGINT NOT NULL COMMENT '主键ID' ,
tenant_id VARCHAR ( 128 ) NOT NULL COMMENT '租户ID' ,
appointment_no VARCHAR ( 64 ) NOT NULL COMMENT '预约单号' ,
appointment_at DATETIME ( 3 ) NOT NULL COMMENT '预约时间' ,
appointment_status VARCHAR ( 32 ) NOT NULL DEFAULT 'PENDING' COMMENT '预约状态' ,
appointment_remark VARCHAR ( 1000 ) NULL COMMENT '预约备注' ,
fba_warehouse_code VARCHAR ( 128 ) NOT NULL COMMENT 'FBA仓库编码' ,
selected_count INT NOT NULL DEFAULT 0 COMMENT '已选明细数量' ,
created_by VARCHAR ( 128 ) NULL COMMENT '创建人ID' ,
created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' ,
updated_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) ON UPDATE CURRENT_TIMESTAMP ( 3 ) COMMENT '更新时间' ,
PRIMARY KEY ( id ),
UNIQUE KEY uk_ll_fba_appointment_no ( tenant_id , appointment_no ),
KEY idx_ll_fba_appointment_list ( tenant_id , appointment_status , fba_warehouse_code , created_at )
) ENGINE = InnoDB COMMENT = 'FBA入仓预约单' ;
CREATE TABLE IF NOT EXISTS ll_inbound_fba_appointment_item (
id BIGINT NOT NULL COMMENT '主键ID' ,
appointment_id BIGINT NOT NULL COMMENT '预约单ID' ,
plan_id BIGINT NOT NULL COMMENT '入仓计划ID' ,
line_id BIGINT NOT NULL COMMENT '入仓计划明细ID' ,
order_id BIGINT NOT NULL COMMENT '订单ID' ,
inbound_code VARCHAR ( 128 ) NOT NULL COMMENT '入仓单号快照' ,
fba_warehouse_code VARCHAR ( 128 ) NOT NULL COMMENT 'FBA仓库编码' ,
created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' ,
PRIMARY KEY ( id ),
UNIQUE KEY uk_ll_fba_appointment_item_line ( appointment_id , line_id ),
KEY idx_ll_fba_appointment_item_plan ( plan_id ),
KEY idx_ll_fba_appointment_item_order ( order_id )
) ENGINE = InnoDB COMMENT = 'FBA入仓预约明细' ;
-- ============================================================================
-- 2026-08-17 / 008
-- Last-leg inbound-order/package inventory balances, positions and immutable ledger
-- ============================================================================
USE baiyue_lastleg ;
CREATE TABLE IF NOT EXISTS ll_inventory_balance (
id BIGINT NOT NULL COMMENT '主键ID' , tenant_id VARCHAR ( 128 ) NOT NULL COMMENT '租户ID' , customer_name VARCHAR ( 255 ) NULL COMMENT '客户名称快照' ,
overseas_warehouse_id VARCHAR ( 128 ) NOT NULL COMMENT '海外仓ID' , overseas_warehouse_code VARCHAR ( 128 ) NULL COMMENT '海外仓编码快照' ,
overseas_warehouse_name VARCHAR ( 255 ) NULL COMMENT '海外仓名称快照' , destination_warehouse_id VARCHAR ( 128 ) NULL COMMENT '目的仓ID' ,
destination_warehouse_code VARCHAR ( 128 ) NOT NULL DEFAULT '' COMMENT '目的仓编码快照' , destination_warehouse_name VARCHAR ( 255 ) NULL COMMENT '目的仓名称快照' ,
inbound_order_id BIGINT NOT NULL COMMENT '入仓单ID' , inbound_order_no VARCHAR ( 128 ) NULL COMMENT '入仓单号快照' , inbound_code VARCHAR ( 128 ) NOT NULL COMMENT '入仓单号快照' ,
available_packages BIGINT NOT NULL DEFAULT 0 COMMENT '可用箱数' , hold_packages BIGINT NOT NULL DEFAULT 0 COMMENT '冻结箱数' ,
allocated_packages BIGINT NOT NULL DEFAULT 0 COMMENT '已分配箱数' , picked_packages BIGINT NOT NULL DEFAULT 0 COMMENT '已拣箱数' ,
in_transit_packages BIGINT NOT NULL DEFAULT 0 COMMENT '在途箱数' , receiving_packages BIGINT NOT NULL DEFAULT 0 COMMENT '收货处理中箱数' ,
procurement_packages BIGINT NOT NULL DEFAULT 0 COMMENT '采购业务占用箱数' , version BIGINT NOT NULL DEFAULT 0 COMMENT '乐观锁版本' ,
created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' ,
updated_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) ON UPDATE CURRENT_TIMESTAMP ( 3 ) COMMENT '更新时间' ,
PRIMARY KEY ( id ),
UNIQUE KEY uk_ll_inventory_dimension ( tenant_id , overseas_warehouse_id , destination_warehouse_code , inbound_order_id , inbound_code ),
KEY idx_ll_inventory_list ( tenant_id , overseas_warehouse_id , updated_at ),
KEY idx_ll_inventory_inbound ( tenant_id , inbound_code )
) ENGINE = InnoDB COMMENT = '入仓单维度实时库存余额' ;
CREATE TABLE IF NOT EXISTS ll_inventory_position (
id BIGINT NOT NULL COMMENT '主键ID' , tenant_id VARCHAR ( 128 ) NOT NULL COMMENT '租户ID' , balance_id BIGINT NOT NULL COMMENT '库存余额记录ID' ,
overseas_warehouse_id VARCHAR ( 128 ) NOT NULL COMMENT '海外仓ID' , destination_warehouse_code VARCHAR ( 128 ) NOT NULL DEFAULT '' COMMENT '目的仓编码快照' ,
pallet_id BIGINT NOT NULL COMMENT '托盘ID' , pallet_no VARCHAR ( 64 ) NOT NULL COMMENT '托盘号' ,
batch_no VARCHAR ( 128 ) NOT NULL DEFAULT '' COMMENT '库存批次号' , warehouse_location_id BIGINT NULL COMMENT '仓库库位ID' ,
warehouse_location_code VARCHAR ( 128 ) NOT NULL COMMENT '仓库库位编码' ,
available_packages BIGINT NOT NULL DEFAULT 0 COMMENT '可用箱数' , hold_packages BIGINT NOT NULL DEFAULT 0 COMMENT '冻结箱数' ,
allocated_packages BIGINT NOT NULL DEFAULT 0 COMMENT '已分配箱数' , picked_packages BIGINT NOT NULL DEFAULT 0 COMMENT '已拣箱数' ,
receiving_packages BIGINT NOT NULL DEFAULT 0 COMMENT '收货处理中箱数' ,
status VARCHAR ( 32 ) NOT NULL DEFAULT 'ACTIVE' COMMENT '业务状态' , version BIGINT NOT NULL DEFAULT 0 COMMENT '乐观锁版本' ,
created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' ,
updated_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) ON UPDATE CURRENT_TIMESTAMP ( 3 ) COMMENT '更新时间' ,
PRIMARY KEY ( id ), UNIQUE KEY uk_ll_inventory_position ( balance_id , pallet_id , batch_no ),
KEY idx_ll_inventory_position_pallet ( tenant_id , pallet_id ),
KEY idx_ll_inventory_position_location ( tenant_id , overseas_warehouse_id , warehouse_location_code )
) ENGINE = InnoDB COMMENT = '托盘库位批次库存明细' ;
CREATE TABLE IF NOT EXISTS ll_inventory_ledger (
id BIGINT NOT NULL COMMENT '主键ID' , tenant_id VARCHAR ( 128 ) NOT NULL COMMENT '租户ID' ,
balance_id BIGINT NOT NULL COMMENT '库存余额记录ID' , position_id BIGINT NULL COMMENT '库存仓位记录ID' , overseas_warehouse_id VARCHAR ( 128 ) NOT NULL COMMENT '海外仓ID' ,
destination_warehouse_code VARCHAR ( 128 ) NOT NULL DEFAULT '' COMMENT '目的仓编码快照' , inbound_order_id BIGINT NOT NULL COMMENT '入仓单ID' ,
pallet_id BIGINT NULL COMMENT '托盘ID' , pallet_no VARCHAR ( 64 ) NULL COMMENT '托盘号' , batch_no VARCHAR ( 128 ) NULL COMMENT '库存批次号' ,
warehouse_location_code VARCHAR ( 128 ) NULL COMMENT '仓库库位编码' , business_type VARCHAR ( 32 ) NOT NULL COMMENT '业务类型' ,
business_order_id BIGINT NULL COMMENT '业务单据ID' , business_order_no VARCHAR ( 128 ) NULL COMMENT '业务单号' , inbound_code VARCHAR ( 128 ) NULL COMMENT '入仓单号快照' ,
inbound_order_no VARCHAR ( 128 ) NULL COMMENT '入仓单号快照' , outbound_order_no VARCHAR ( 128 ) NULL COMMENT '出库单号' ,
source_event_id VARCHAR ( 128 ) NULL COMMENT '来源事件ID' , idempotency_key VARCHAR ( 255 ) NOT NULL COMMENT '业务幂等键' ,
status_from VARCHAR ( 32 ) NULL COMMENT '操作前状态' , status_to VARCHAR ( 32 ) NULL COMMENT '操作后状态' ,
before_packages BIGINT NOT NULL COMMENT '变动前箱数' , delta_packages BIGINT NOT NULL COMMENT '箱数变动量' , after_packages BIGINT NOT NULL COMMENT '变动后箱数' ,
operator_id VARCHAR ( 128 ) NULL COMMENT '操作人ID' , remark VARCHAR ( 1000 ) NULL COMMENT '备注' ,
occurred_at DATETIME ( 3 ) NOT NULL COMMENT '业务发生时间' , created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' ,
PRIMARY KEY ( id ), UNIQUE KEY uk_ll_inventory_ledger_idempotency ( tenant_id , idempotency_key ),
KEY idx_ll_inventory_ledger_query ( tenant_id , overseas_warehouse_id , occurred_at ),
KEY idx_ll_inventory_ledger_inbound ( tenant_id , inbound_code , occurred_at ),
KEY idx_ll_inventory_ledger_business ( tenant_id , business_type , business_order_no )
) ENGINE = InnoDB COMMENT = '不可变库存变动流水' ;
CREATE TABLE IF NOT EXISTS ll_inventory_operation (
id BIGINT NOT NULL COMMENT '主键ID' , tenant_id VARCHAR ( 128 ) NOT NULL COMMENT '租户ID' ,
idempotency_key VARCHAR ( 255 ) NOT NULL COMMENT '业务幂等键' , operation_type VARCHAR ( 32 ) NOT NULL COMMENT '操作类型' ,
request_hash VARCHAR ( 128 ) NOT NULL COMMENT '请求内容哈希' , status VARCHAR ( 32 ) NOT NULL DEFAULT 'PROCESSING' COMMENT '库存命令处理状态' ,
result_json LONGTEXT NULL COMMENT '处理结果JSON' , last_error VARCHAR ( 2000 ) NULL COMMENT '最后错误信息' ,
created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' ,
updated_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) ON UPDATE CURRENT_TIMESTAMP ( 3 ) COMMENT '更新时间' ,
PRIMARY KEY ( id ), UNIQUE KEY uk_ll_inventory_operation_key ( tenant_id , idempotency_key ),
KEY idx_ll_inventory_operation_status ( tenant_id , status , updated_at )
) ENGINE = InnoDB COMMENT = '库存命令幂等记录' ;
-- ============================================================================
-- 2026-08-17 / 009
-- PDA SKU/pallet receipt snapshots for stock-in closure
-- ============================================================================
USE baiyue_lastleg ;
CREATE TABLE IF NOT EXISTS ll_inbound_stock_receipt (
id BIGINT NOT NULL COMMENT '主键ID' , tenant_id VARCHAR ( 128 ) NOT NULL COMMENT '租户ID' ,
plan_id BIGINT NOT NULL COMMENT '入仓计划ID' , task_id BIGINT NOT NULL COMMENT 'PDA任务ID' , allocation_id BIGINT NOT NULL COMMENT '分配记录ID' ,
line_id BIGINT NOT NULL COMMENT '入仓计划明细ID' , order_id BIGINT NOT NULL COMMENT '订单ID' , inbound_code VARCHAR ( 128 ) NOT NULL COMMENT '入仓单号快照' ,
sku_code VARCHAR ( 128 ) NOT NULL COMMENT 'SKU编码' , sku_name_zh VARCHAR ( 255 ) NULL COMMENT 'SKU中文名称' , source_detail_ids VARCHAR ( 2000 ) NULL COMMENT '来源明细ID集合' ,
warehouse_pallet_id BIGINT NOT NULL COMMENT '仓库实物托盘ID' , pallet_no VARCHAR ( 64 ) NOT NULL COMMENT '托盘号' ,
warehouse_location_id BIGINT NULL COMMENT '仓库库位ID' , warehouse_location_code VARCHAR ( 128 ) NULL COMMENT '仓库库位编码' ,
batch_no VARCHAR ( 128 ) NOT NULL COMMENT '库存批次号' , received_packages BIGINT NOT NULL COMMENT '实收箱数' , received_quantity BIGINT NOT NULL COMMENT '实收产品数量' ,
inventory_balance_id BIGINT NOT NULL COMMENT '库存余额记录ID' , inventory_position_id BIGINT NOT NULL COMMENT '库存仓位记录ID' ,
inventory_operation_key VARCHAR ( 255 ) NOT NULL COMMENT '库存操作幂等键' , received_at DATETIME ( 3 ) NOT NULL COMMENT '实收时间' ,
created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' ,
PRIMARY KEY ( id ), UNIQUE KEY uk_ll_stock_receipt_task_allocation_sku ( tenant_id , task_id , allocation_id , sku_code ),
KEY idx_ll_stock_receipt_plan ( tenant_id , plan_id , line_id ), KEY idx_ll_stock_receipt_inventory ( inventory_balance_id , inventory_position_id )
) ENGINE = InnoDB COMMENT = '入仓PDA库存实收快照' ;
-- 2026-08-17 warehouse virtual location and generated pallet code support.
2026-08-19 16:49:41 +08:00
USE baiyue_lastlag_warehouse ;
2026-08-19 16:24:02 +08:00
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE ()
AND table_name = 'wh_pallet' AND column_name = 'pallet_code' ),
'ALTER TABLE wh_pallet MODIFY COLUMN pallet_code VARCHAR(128) NOT NULL COMMENT ''Warehouse pallet code''' , 'SELECT 1' ));
PREPARE stmt FROM @ ddl ; EXECUTE stmt ; DEALLOCATE PREPARE stmt ;
2026-08-21 11:43:03 +08:00
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE ()
AND table_name = 'wh_pallet' AND column_name = 'fba_warehouse_code' ),
'ALTER TABLE wh_pallet MODIFY COLUMN fba_warehouse_code VARCHAR(128) NULL COMMENT ''所属FBA仓编码''' ,
'ALTER TABLE wh_pallet ADD COLUMN fba_warehouse_code VARCHAR(128) NULL COMMENT ''所属FBA仓编码'' AFTER remark' ));
PREPARE stmt FROM @ ddl ; EXECUTE stmt ; DEALLOCATE PREPARE stmt ;
2026-08-19 16:24:02 +08:00
INSERT INTO wh_location ( id , tenant_id , warehouse_id , zone_code , location_code , location_type ,
max_load_kg , status , remark )
SELECT UUID_SHORT (), w . tenant_id , w . id , 'DEFAULT' , CONCAT ( 'LOC-' , w . warehouse_code , '-DEFAULT' ),
'VIRTUAL' , 999999999 . 000 , 'ACTIVE' , 'System default virtual location'
FROM wh_warehouse w
WHERE NOT EXISTS (
SELECT 1 FROM wh_location l
WHERE l . tenant_id = w . tenant_id AND l . warehouse_id = w . id
AND l . location_code = CONCAT ( 'LOC-' , w . warehouse_code , '-DEFAULT' ) AND l . deleted = 0
);
-- ============================================================================
-- 2026-08-17 / 010
-- Last-leg pre-dispatch orders and pallet locks
-- ============================================================================
USE baiyue_lastleg ;
CREATE TABLE IF NOT EXISTS ll_dispatch_order (
id BIGINT NOT NULL COMMENT '主键ID' , tenant_id VARCHAR ( 128 ) NOT NULL COMMENT '租户ID' ,
dispatch_no VARCHAR ( 64 ) NOT NULL COMMENT '派车单号' , overseas_warehouse_id VARCHAR ( 128 ) NULL COMMENT '海外仓ID' , overseas_warehouse_name VARCHAR ( 255 ) NULL COMMENT '海外仓名称快照' ,
vehicle_plate VARCHAR ( 64 ) NULL COMMENT '车牌号' , driver_name VARCHAR ( 128 ) NULL COMMENT '司机姓名' ,
driver_phone VARCHAR ( 64 ) NULL COMMENT '司机电话' , carrier_name VARCHAR ( 255 ) NULL COMMENT '承运商名称' , route VARCHAR ( 255 ) NULL COMMENT '运输路线' ,
depart_at DATETIME ( 3 ) NULL COMMENT '发车时间' , fba_appointment_no VARCHAR ( 64 ) NULL COMMENT 'FBA预约号' ,
fba_appointment_status VARCHAR ( 32 ) NOT NULL DEFAULT 'PENDING' COMMENT 'FBA预约状态' ,
vehicle_appointment_status VARCHAR ( 32 ) NOT NULL DEFAULT 'PENDING' COMMENT '车辆预约状态' ,
estimated_arrival_at DATETIME ( 3 ) NULL COMMENT '预计到达时间' , status VARCHAR ( 32 ) NOT NULL DEFAULT 'PENDING_DEPARTURE' COMMENT '业务状态' ,
item_count INT NOT NULL DEFAULT 0 COMMENT '明细数量' , pallet_count INT NOT NULL DEFAULT 0 COMMENT '托盘数' , package_count INT NOT NULL DEFAULT 0 COMMENT '箱数' ,
created_by VARCHAR ( 128 ) NULL COMMENT '创建人ID' , created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' ,
updated_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) ON UPDATE CURRENT_TIMESTAMP ( 3 ) COMMENT '更新时间' ,
PRIMARY KEY ( id ), UNIQUE KEY uk_ll_dispatch_order_no ( tenant_id , dispatch_no ),
KEY idx_ll_dispatch_order_list ( tenant_id , status , depart_at ), KEY idx_ll_dispatch_order_vehicle ( tenant_id , vehicle_plate )
) ENGINE = InnoDB COMMENT = '尾程派车单' ;
CREATE TABLE IF NOT EXISTS ll_dispatch_item (
id BIGINT NOT NULL COMMENT '主键ID' , dispatch_order_id BIGINT NOT NULL COMMENT '派车单ID' , tenant_id VARCHAR ( 128 ) NOT NULL COMMENT '租户ID' ,
plan_id BIGINT NULL COMMENT '入仓计划ID' , plan_pallet_id BIGINT NULL COMMENT '计划托盘ID' , warehouse_pallet_id BIGINT NULL COMMENT '仓库实物托盘ID' ,
order_id BIGINT NULL COMMENT '订单ID' , order_no VARCHAR ( 64 ) NULL COMMENT '订单号' , order_refs VARCHAR ( 2000 ) NULL COMMENT '关联订单信息' , inbound_code VARCHAR ( 128 ) NULL COMMENT '入仓单号快照' , pallet_no VARCHAR ( 128 ) NOT NULL COMMENT '托盘号' ,
overseas_warehouse_id VARCHAR ( 128 ) NULL COMMENT '海外仓ID' , overseas_warehouse_name VARCHAR ( 255 ) NULL COMMENT '海外仓名称快照' ,
destination_warehouse_id VARCHAR ( 128 ) NULL COMMENT '目的仓ID' , destination_warehouse_code VARCHAR ( 128 ) NULL COMMENT '目的仓编码快照' ,
destination_warehouse_name VARCHAR ( 255 ) NULL COMMENT '目的仓名称快照' , fba_warehouse_code VARCHAR ( 128 ) NULL COMMENT 'FBA仓库编码' ,
package_count INT NOT NULL DEFAULT 0 COMMENT '箱数' , volume_cbm DECIMAL ( 18 , 4 ) NOT NULL DEFAULT 0 COMMENT '体积(立方米)' ,
source_stage VARCHAR ( 32 ) NOT NULL COMMENT '数据来源阶段' , created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' ,
PRIMARY KEY ( id ), UNIQUE KEY uk_ll_dispatch_item_source ( dispatch_order_id , plan_pallet_id , warehouse_pallet_id ),
KEY idx_ll_dispatch_item_order ( tenant_id , order_id ), KEY idx_ll_dispatch_item_inbound ( tenant_id , inbound_code ),
KEY idx_ll_dispatch_item_pallet ( tenant_id , plan_pallet_id , warehouse_pallet_id )
) ENGINE = InnoDB COMMENT = '派车货物冻结明细' ;
CREATE TABLE IF NOT EXISTS ll_dispatch_pallet_lock (
id BIGINT NOT NULL COMMENT '主键ID' , tenant_id VARCHAR ( 128 ) NOT NULL COMMENT '租户ID' ,
source_pallet_key VARCHAR ( 160 ) NOT NULL COMMENT '来源托盘业务键' , active_key VARCHAR ( 160 ) NULL COMMENT '生效中的资源排他键' ,
plan_id BIGINT NULL COMMENT '入仓计划ID' , plan_pallet_id BIGINT NULL COMMENT '计划托盘ID' , warehouse_pallet_id BIGINT NULL COMMENT '仓库实物托盘ID' ,
dispatch_order_id BIGINT NOT NULL COMMENT '派车单ID' , status VARCHAR ( 32 ) NOT NULL DEFAULT 'ACTIVE' COMMENT '业务状态' ,
locked_at DATETIME ( 3 ) NOT NULL COMMENT '锁定时间' , released_at DATETIME ( 3 ) NULL COMMENT '释放时间' ,
created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' ,
updated_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) ON UPDATE CURRENT_TIMESTAMP ( 3 ) COMMENT '更新时间' ,
PRIMARY KEY ( id ), UNIQUE KEY uk_ll_dispatch_active_pallet ( tenant_id , active_key ),
KEY idx_ll_dispatch_pallet_lock_order ( tenant_id , dispatch_order_id , status ),
KEY idx_ll_dispatch_pallet_lock_source ( tenant_id , source_pallet_key , status )
) ENGINE = InnoDB COMMENT = '派车托盘排他锁' ;
-- ============================================================================
-- 2026-08-17 / 011
-- Dispatch PDA task and immutable pallet pick operations
-- ============================================================================
USE baiyue_lastleg ;
CREATE TABLE IF NOT EXISTS ll_dispatch_pda_task (
id BIGINT NOT NULL COMMENT '主键ID' , tenant_id VARCHAR ( 128 ) NOT NULL COMMENT '租户ID' , dispatch_order_id BIGINT NOT NULL COMMENT '派车单ID' ,
task_no VARCHAR ( 64 ) NOT NULL COMMENT 'PDA任务号' , status VARCHAR ( 32 ) NOT NULL COMMENT '业务状态' , operator_id VARCHAR ( 128 ) NULL COMMENT '操作人ID' ,
operator_name VARCHAR ( 128 ) NULL COMMENT '操作人姓名' , warehouse_id VARCHAR ( 128 ) NULL COMMENT '仓库ID' ,
pushed_at DATETIME ( 3 ) NOT NULL COMMENT '任务下发时间' , completed_at DATETIME ( 3 ) NULL COMMENT '完成时间' ,
created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' ,
updated_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) ON UPDATE CURRENT_TIMESTAMP ( 3 ) COMMENT '更新时间' ,
PRIMARY KEY ( id ), UNIQUE KEY uk_ll_dispatch_pda_task_dispatch ( tenant_id , dispatch_order_id ),
UNIQUE KEY uk_ll_dispatch_pda_task_no ( tenant_id , task_no )
) ENGINE = InnoDB COMMENT = '派车PDA拣货任务' ;
CREATE TABLE IF NOT EXISTS ll_dispatch_pda_pick (
id BIGINT NOT NULL COMMENT '主键ID' , tenant_id VARCHAR ( 128 ) NOT NULL COMMENT '租户ID' , task_id BIGINT NOT NULL COMMENT 'PDA任务ID' ,
dispatch_item_id BIGINT NOT NULL COMMENT '派车明细ID' , inventory_position_id BIGINT NOT NULL COMMENT '库存仓位记录ID' ,
packages BIGINT NOT NULL COMMENT '本次操作箱数' , product_quantity BIGINT NOT NULL DEFAULT 0 COMMENT '产品数量' , idempotency_key VARCHAR ( 255 ) NOT NULL COMMENT '业务幂等键' ,
picked_at DATETIME ( 3 ) NOT NULL COMMENT '拣货时间' , created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' ,
PRIMARY KEY ( id ), UNIQUE KEY uk_ll_dispatch_pda_pick_key ( tenant_id , idempotency_key ),
KEY idx_ll_dispatch_pda_pick_item ( tenant_id , task_id , dispatch_item_id )
) ENGINE = InnoDB COMMENT = '派车PDA拣货记录' ;
CREATE TABLE IF NOT EXISTS ll_dispatch_pda_operation (
id BIGINT NOT NULL COMMENT '主键ID' , tenant_id VARCHAR ( 128 ) NOT NULL COMMENT '租户ID' , task_id BIGINT NULL COMMENT 'PDA任务ID' ,
operation_type VARCHAR ( 32 ) NOT NULL COMMENT 'PDA操作类型' , idempotency_key VARCHAR ( 255 ) NOT NULL COMMENT '业务幂等键' , request_hash CHAR ( 64 ) NOT NULL COMMENT '请求内容哈希' ,
result_json LONGTEXT NULL COMMENT '处理结果JSON' , status VARCHAR ( 32 ) NOT NULL COMMENT 'PDA操作处理状态' ,
created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' ,
updated_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) ON UPDATE CURRENT_TIMESTAMP ( 3 ) COMMENT '更新时间' ,
PRIMARY KEY ( id ), UNIQUE KEY uk_ll_dispatch_pda_operation_key ( tenant_id , idempotency_key )
) ENGINE = InnoDB COMMENT = '派车PDA操作幂等记录' ;
-- ============================================================================
-- 2026-08-17 / 012
-- Preserve all tail-leg orders included in one merged dispatch pallet
-- ============================================================================
USE baiyue_lastleg ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_item' AND column_name = 'order_refs' ), 'SELECT 1' , 'ALTER TABLE ll_dispatch_item ADD COLUMN order_refs VARCHAR(2000) NULL AFTER order_no' ));
PREPARE migration_stmt FROM @ ddl ; EXECUTE migration_stmt ; DEALLOCATE PREPARE migration_stmt ;
-- ============================================================================
-- 2026-08-17 / 013
-- Partial dispatch completion and cumulative package counters
-- ============================================================================
USE baiyue_lastleg ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_order' AND column_name = 'overseas_warehouse_id' ), 'SELECT 1' , 'ALTER TABLE ll_dispatch_order ADD COLUMN overseas_warehouse_id VARCHAR(128) NULL AFTER dispatch_no' ));
PREPARE warehouse_scope_stmt FROM @ ddl ; EXECUTE warehouse_scope_stmt ; DEALLOCATE PREPARE warehouse_scope_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_order' AND column_name = 'overseas_warehouse_name' ), 'SELECT 1' , 'ALTER TABLE ll_dispatch_order ADD COLUMN overseas_warehouse_name VARCHAR(255) NULL AFTER overseas_warehouse_id' ));
PREPARE warehouse_scope_stmt FROM @ ddl ; EXECUTE warehouse_scope_stmt ; DEALLOCATE PREPARE warehouse_scope_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_item' AND column_name = 'overseas_warehouse_id' ), 'SELECT 1' , 'ALTER TABLE ll_dispatch_item ADD COLUMN overseas_warehouse_id VARCHAR(128) NULL AFTER pallet_no' ));
PREPARE warehouse_scope_stmt FROM @ ddl ; EXECUTE warehouse_scope_stmt ; DEALLOCATE PREPARE warehouse_scope_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_item' AND column_name = 'overseas_warehouse_name' ), 'SELECT 1' , 'ALTER TABLE ll_dispatch_item ADD COLUMN overseas_warehouse_name VARCHAR(255) NULL AFTER overseas_warehouse_id' ));
PREPARE warehouse_scope_stmt FROM @ ddl ; EXECUTE warehouse_scope_stmt ; DEALLOCATE PREPARE warehouse_scope_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_task' AND column_name = 'warehouse_id' ), 'SELECT 1' , 'ALTER TABLE ll_dispatch_pda_task ADD COLUMN warehouse_id VARCHAR(128) NULL AFTER operator_name' ));
PREPARE warehouse_scope_stmt FROM @ ddl ; EXECUTE warehouse_scope_stmt ; DEALLOCATE PREPARE warehouse_scope_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_order' AND column_name = 'picked_package_count' ), 'SELECT 1' , 'ALTER TABLE ll_dispatch_order ADD COLUMN picked_package_count INT NOT NULL DEFAULT 0 AFTER package_count' ));
PREPARE dispatch_partial_stmt FROM @ ddl ; EXECUTE dispatch_partial_stmt ; DEALLOCATE PREPARE dispatch_partial_stmt ;
CREATE TABLE IF NOT EXISTS ll_dispatch_pda_pick_order (
id BIGINT NOT NULL COMMENT '主键ID' , tenant_id VARCHAR ( 128 ) NOT NULL COMMENT '租户ID' , pick_id BIGINT NOT NULL COMMENT 'PDA拣货记录ID' ,
receipt_id BIGINT NOT NULL COMMENT '入仓实收记录ID' , order_id BIGINT NOT NULL COMMENT '订单ID' , packages BIGINT NOT NULL COMMENT '本次操作箱数' ,
product_quantity BIGINT NOT NULL DEFAULT 0 COMMENT '产品数量' , created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' ,
PRIMARY KEY ( id ), KEY idx_ll_dispatch_pick_order_pick ( tenant_id , pick_id ),
KEY idx_ll_dispatch_pick_order_receipt ( tenant_id , receipt_id )
) ENGINE = InnoDB COMMENT = 'PDA拣货订单归属记录' ;
-- Tail order cumulative picking/shipping counters. Original package_count is immutable.
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'picked_package_count' ), 'SELECT 1' , 'ALTER TABLE ll_order ADD COLUMN picked_package_count INT NOT NULL DEFAULT 0 AFTER package_count' ));
PREPARE tail_order_partial_stmt FROM @ ddl ; EXECUTE tail_order_partial_stmt ; DEALLOCATE PREPARE tail_order_partial_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'shipped_package_count' ), 'SELECT 1' , 'ALTER TABLE ll_order ADD COLUMN shipped_package_count INT NOT NULL DEFAULT 0 AFTER picked_package_count' ));
PREPARE tail_order_partial_stmt FROM @ ddl ; EXECUTE tail_order_partial_stmt ; DEALLOCATE PREPARE tail_order_partial_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_order' AND column_name = 'shipped_package_count' ), 'SELECT 1' , 'ALTER TABLE ll_dispatch_order ADD COLUMN shipped_package_count INT NOT NULL DEFAULT 0 AFTER picked_package_count' ));
PREPARE dispatch_partial_stmt FROM @ ddl ; EXECUTE dispatch_partial_stmt ; DEALLOCATE PREPARE dispatch_partial_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_order' AND column_name = 'partial_completion_reason' ), 'SELECT 1' , 'ALTER TABLE ll_dispatch_order ADD COLUMN partial_completion_reason VARCHAR(1000) NULL AFTER shipped_package_count' ));
PREPARE dispatch_partial_stmt FROM @ ddl ; EXECUTE dispatch_partial_stmt ; DEALLOCATE PREPARE dispatch_partial_stmt ;
-- ============================================================================
-- 2026-08-17 / 014
-- Dispatch transfer to outbound and delivery documents
-- ============================================================================
USE baiyue_lastleg ;
CREATE TABLE IF NOT EXISTS ll_outbound_order (
id BIGINT NOT NULL COMMENT '主键ID' , tenant_id VARCHAR ( 128 ) NOT NULL COMMENT '租户ID' ,
outbound_no VARCHAR ( 64 ) NOT NULL COMMENT '出库单号' , dispatch_order_id BIGINT NOT NULL COMMENT '派车单ID' , dispatch_no VARCHAR ( 64 ) NOT NULL COMMENT '派车单号' ,
overseas_warehouse_id VARCHAR ( 128 ) NULL COMMENT '海外仓ID' , status VARCHAR ( 32 ) NOT NULL DEFAULT 'WAIT_OUTBOUND' COMMENT '业务状态' ,
package_count INT NOT NULL DEFAULT 0 COMMENT '箱数' , pallet_count INT NOT NULL DEFAULT 0 COMMENT '托盘数' ,
idempotency_key VARCHAR ( 255 ) NOT NULL COMMENT '业务幂等键' , created_by VARCHAR ( 128 ) NULL COMMENT '创建人ID' ,
created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' , updated_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) ON UPDATE CURRENT_TIMESTAMP ( 3 ) COMMENT '更新时间' ,
PRIMARY KEY ( id ), UNIQUE KEY uk_ll_outbound_no ( tenant_id , outbound_no ),
UNIQUE KEY uk_ll_outbound_idempotency ( tenant_id , idempotency_key ), UNIQUE KEY uk_ll_outbound_dispatch ( tenant_id , dispatch_order_id ),
KEY idx_ll_outbound_list ( tenant_id , status , created_at )
) ENGINE = InnoDB COMMENT = '尾程出库单' ;
CREATE TABLE IF NOT EXISTS ll_outbound_pallet_item (
id BIGINT NOT NULL COMMENT '主键ID' , tenant_id VARCHAR ( 128 ) NOT NULL COMMENT '租户ID' , outbound_order_id BIGINT NOT NULL COMMENT '出库单ID' ,
warehouse_pallet_id BIGINT NOT NULL COMMENT '仓库实物托盘ID' , pallet_no VARCHAR ( 128 ) NOT NULL COMMENT '托盘号' ,
destination_warehouse_id VARCHAR ( 128 ) NULL COMMENT '目的仓ID' , destination_warehouse_code VARCHAR ( 128 ) NULL COMMENT '目的仓编码快照' , destination_warehouse_name VARCHAR ( 255 ) NULL COMMENT '目的仓名称快照' ,
package_count INT NOT NULL DEFAULT 0 COMMENT '箱数' , order_refs VARCHAR ( 2000 ) NULL COMMENT '关联订单信息' , inbound_code VARCHAR ( 128 ) NULL COMMENT '入仓单号快照' ,
created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' , PRIMARY KEY ( id ),
UNIQUE KEY uk_ll_outbound_pallet ( tenant_id , outbound_order_id , warehouse_pallet_id ),
KEY idx_ll_outbound_pallet_list ( tenant_id , outbound_order_id ), KEY idx_ll_outbound_pallet_destination ( tenant_id , destination_warehouse_code )
) ENGINE = InnoDB COMMENT = '出库托盘明细' ;
CREATE TABLE IF NOT EXISTS ll_delivery_order (
id BIGINT NOT NULL COMMENT '主键ID' , tenant_id VARCHAR ( 128 ) NOT NULL COMMENT '租户ID' ,
delivery_no VARCHAR ( 64 ) NOT NULL COMMENT '派送单号' , outbound_order_id BIGINT NOT NULL COMMENT '出库单ID' , outbound_no VARCHAR ( 64 ) NOT NULL COMMENT '出库单号' ,
dispatch_order_id BIGINT NOT NULL COMMENT '派车单ID' , dispatch_no VARCHAR ( 64 ) NOT NULL COMMENT '派车单号' , overseas_warehouse_id VARCHAR ( 128 ) NULL COMMENT '海外仓ID' ,
status VARCHAR ( 32 ) NOT NULL DEFAULT 'WAIT_DELIVERY' COMMENT '业务状态' , package_count INT NOT NULL DEFAULT 0 COMMENT '箱数' , pallet_count INT NOT NULL DEFAULT 0 COMMENT '托盘数' ,
idempotency_key VARCHAR ( 255 ) NOT NULL COMMENT '业务幂等键' , created_by VARCHAR ( 128 ) NULL COMMENT '创建人ID' ,
created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' , updated_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) ON UPDATE CURRENT_TIMESTAMP ( 3 ) COMMENT '更新时间' ,
PRIMARY KEY ( id ), UNIQUE KEY uk_ll_delivery_no ( tenant_id , delivery_no ),
UNIQUE KEY uk_ll_delivery_idempotency ( tenant_id , idempotency_key ), UNIQUE KEY uk_ll_delivery_outbound ( tenant_id , outbound_order_id ),
KEY idx_ll_delivery_list ( tenant_id , status , created_at )
) ENGINE = InnoDB COMMENT = '尾程派送单' ;
-- ============================================================================
-- 2026-08-17 / 015
-- Change inventory ownership from SKU/quantity to inbound-order/package count.
-- Legacy SKU columns become nullable and quantity columns remain untouched so original data is preserved.
-- ============================================================================
USE baiyue_lastleg ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'inbound_order_id' ), 'SELECT 1' , 'ALTER TABLE ll_inventory_balance ADD COLUMN inbound_order_id BIGINT NULL AFTER destination_warehouse_name' ));
PREPARE inventory_v2_stmt FROM @ ddl ; EXECUTE inventory_v2_stmt ; DEALLOCATE PREPARE inventory_v2_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'inbound_order_no' ), 'SELECT 1' , 'ALTER TABLE ll_inventory_balance ADD COLUMN inbound_order_no VARCHAR(128) NULL AFTER inbound_order_id' ));
PREPARE inventory_v2_stmt FROM @ ddl ; EXECUTE inventory_v2_stmt ; DEALLOCATE PREPARE inventory_v2_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'inbound_code' ), 'SELECT 1' , 'ALTER TABLE ll_inventory_balance ADD COLUMN inbound_code VARCHAR(128) NULL AFTER inbound_order_no' ));
PREPARE inventory_v2_stmt FROM @ ddl ; EXECUTE inventory_v2_stmt ; DEALLOCATE PREPARE inventory_v2_stmt ;
-- One legacy balance row represented one SKU. Keep each row intact and give it a
-- collision-free migration identity while retaining the best known inbound snapshots.
UPDATE ll_inventory_balance b
LEFT JOIN (
SELECT balance_id , MAX ( inbound_order_no ) AS inbound_order_no , MAX ( inbound_code ) AS inbound_code
FROM ll_inventory_ledger GROUP BY balance_id
) l ON l . balance_id = b . id
SET b . inbound_order_id = COALESCE ( b . inbound_order_id , b . id ),
b . inbound_order_no = COALESCE ( b . inbound_order_no , l . inbound_order_no ),
b . inbound_code = COALESCE ( NULLIF ( b . inbound_code , '' ), NULLIF ( l . inbound_code , '' ), CONCAT ( 'LEGACY-' , b . id ))
WHERE b . inbound_order_id IS NULL OR b . inbound_code IS NULL OR b . inbound_code = '' ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'sku_code' ), 'ALTER TABLE ll_inventory_balance MODIFY COLUMN sku_code VARCHAR(128) NULL' , 'SELECT 1' ));
PREPARE inventory_v2_stmt FROM @ ddl ; EXECUTE inventory_v2_stmt ; DEALLOCATE PREPARE inventory_v2_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'inbound_order_id' ), 'ALTER TABLE ll_inventory_balance MODIFY COLUMN inbound_order_id BIGINT NOT NULL' , 'SELECT 1' ));
PREPARE inventory_v2_stmt FROM @ ddl ; EXECUTE inventory_v2_stmt ; DEALLOCATE PREPARE inventory_v2_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'inbound_code' ), 'ALTER TABLE ll_inventory_balance MODIFY COLUMN inbound_code VARCHAR(128) NOT NULL' , 'SELECT 1' ));
PREPARE inventory_v2_stmt FROM @ ddl ; EXECUTE inventory_v2_stmt ; DEALLOCATE PREPARE inventory_v2_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND index_name = 'uk_ll_inventory_dimension' ), 'ALTER TABLE ll_inventory_balance DROP INDEX uk_ll_inventory_dimension' , 'SELECT 1' ));
PREPARE inventory_v2_stmt FROM @ ddl ; EXECUTE inventory_v2_stmt ; DEALLOCATE PREPARE inventory_v2_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND index_name = 'uk_ll_inventory_dimension' ), 'SELECT 1' , CONCAT ( 'ALTER TABLE ll_inventory_balance ADD UNIQUE KEY uk_ll_inventory_dimension (' , IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'customer_id' ), 'customer_id' , 'tenant_id' ), ',overseas_warehouse_id,destination_warehouse_code,inbound_order_id,inbound_code)' )));
PREPARE inventory_v2_stmt FROM @ ddl ; EXECUTE inventory_v2_stmt ; DEALLOCATE PREPARE inventory_v2_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND index_name = 'idx_ll_inventory_inbound' ), 'SELECT 1' , CONCAT ( 'ALTER TABLE ll_inventory_balance ADD KEY idx_ll_inventory_inbound (' , IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'customer_id' ), 'customer_id' , 'tenant_id' ), ',inbound_code)' )));
PREPARE inventory_v2_stmt FROM @ ddl ; EXECUTE inventory_v2_stmt ; DEALLOCATE PREPARE inventory_v2_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND index_name = 'idx_ll_inventory_sku' ), 'ALTER TABLE ll_inventory_balance DROP INDEX idx_ll_inventory_sku' , 'SELECT 1' ));
PREPARE inventory_v2_stmt FROM @ ddl ; EXECUTE inventory_v2_stmt ; DEALLOCATE PREPARE inventory_v2_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_position' AND column_name = 'sku_code' ), 'ALTER TABLE ll_inventory_position MODIFY COLUMN sku_code VARCHAR(128) NULL' , 'SELECT 1' ));
PREPARE inventory_v2_stmt FROM @ ddl ; EXECUTE inventory_v2_stmt ; DEALLOCATE PREPARE inventory_v2_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'inbound_order_id' ), 'SELECT 1' , 'ALTER TABLE ll_inventory_ledger ADD COLUMN inbound_order_id BIGINT NULL AFTER destination_warehouse_code' ));
PREPARE inventory_v2_stmt FROM @ ddl ; EXECUTE inventory_v2_stmt ; DEALLOCATE PREPARE inventory_v2_stmt ;
UPDATE ll_inventory_ledger SET inbound_order_id = COALESCE ( inbound_order_id , business_order_id , balance_id ) WHERE inbound_order_id IS NULL ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'sku_code' ), 'ALTER TABLE ll_inventory_ledger MODIFY COLUMN sku_code VARCHAR(128) NULL' , 'SELECT 1' ));
PREPARE inventory_v2_stmt FROM @ ddl ; EXECUTE inventory_v2_stmt ; DEALLOCATE PREPARE inventory_v2_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'inbound_order_id' ), 'ALTER TABLE ll_inventory_ledger MODIFY COLUMN inbound_order_id BIGINT NOT NULL' , 'SELECT 1' ));
PREPARE inventory_v2_stmt FROM @ ddl ; EXECUTE inventory_v2_stmt ; DEALLOCATE PREPARE inventory_v2_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND index_name = 'idx_ll_inventory_ledger_inbound' ), 'SELECT 1' , 'ALTER TABLE ll_inventory_ledger ADD KEY idx_ll_inventory_ledger_inbound (tenant_id,inbound_code,occurred_at)' ));
PREPARE inventory_v2_stmt FROM @ ddl ; EXECUTE inventory_v2_stmt ; DEALLOCATE PREPARE inventory_v2_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND index_name = 'idx_ll_inventory_ledger_sku' ), 'ALTER TABLE ll_inventory_ledger DROP INDEX idx_ll_inventory_ledger_sku' , 'SELECT 1' ));
PREPARE inventory_v2_stmt FROM @ ddl ; EXECUTE inventory_v2_stmt ; DEALLOCATE PREPARE inventory_v2_stmt ;
-- ============================================================================
-- 2026-08-17 / 016
-- PDA stock receipts follow the same inbound-order/package-only inventory model.
-- Legacy SKU and quantity columns remain in place but become nullable/defaulted.
-- ============================================================================
USE baiyue_lastleg ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_stock_receipt' AND column_name = 'sku_code' ), 'ALTER TABLE ll_inbound_stock_receipt MODIFY COLUMN sku_code VARCHAR(128) NULL' , 'SELECT 1' ));
PREPARE stock_receipt_v2_stmt FROM @ ddl ; EXECUTE stock_receipt_v2_stmt ; DEALLOCATE PREPARE stock_receipt_v2_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_stock_receipt' AND column_name = 'received_quantity' ), 'ALTER TABLE ll_inbound_stock_receipt MODIFY COLUMN received_quantity BIGINT NULL DEFAULT 0' , 'SELECT 1' ));
PREPARE stock_receipt_v2_stmt FROM @ ddl ; EXECUTE stock_receipt_v2_stmt ; DEALLOCATE PREPARE stock_receipt_v2_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_inbound_stock_receipt' AND index_name = 'uk_ll_stock_receipt_task_allocation_sku' ), 'ALTER TABLE ll_inbound_stock_receipt DROP INDEX uk_ll_stock_receipt_task_allocation_sku' , 'SELECT 1' ));
PREPARE stock_receipt_v2_stmt FROM @ ddl ; EXECUTE stock_receipt_v2_stmt ; DEALLOCATE PREPARE stock_receipt_v2_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_inbound_stock_receipt' AND index_name = 'uk_ll_stock_receipt_task_allocation' ), 'SELECT 1' , 'ALTER TABLE ll_inbound_stock_receipt ADD UNIQUE KEY uk_ll_stock_receipt_task_allocation (tenant_id,task_id,allocation_id)' ));
PREPARE stock_receipt_v2_stmt FROM @ ddl ; EXECUTE stock_receipt_v2_stmt ; DEALLOCATE PREPARE stock_receipt_v2_stmt ;
-- ============================================================================
-- 2026-08-17 / 017
-- Customer relabel applications, cargo snapshots, and process status history
-- ============================================================================
USE baiyue_lastleg ;
CREATE TABLE IF NOT EXISTS ll_relabel_application (
id BIGINT NOT NULL COMMENT '主键ID' , tenant_id VARCHAR ( 128 ) NOT NULL COMMENT '租户ID' ,
relabel_no VARCHAR ( 64 ) NOT NULL COMMENT '换标申请单号' , lastleg_order_id BIGINT NOT NULL COMMENT '尾程订单ID' ,
customer_order_no VARCHAR ( 128 ) NOT NULL COMMENT '客户订单号' , overseas_warehouse_id VARCHAR ( 128 ) NOT NULL COMMENT '海外仓ID' ,
label_deadline DATETIME ( 3 ) NOT NULL COMMENT '换标截止时间' , contact_name VARCHAR ( 128 ) NOT NULL COMMENT '联系人姓名' ,
contact_phone VARCHAR ( 64 ) NOT NULL COMMENT '联系人电话' , remark VARCHAR ( 1000 ) NULL COMMENT '备注' ,
status VARCHAR ( 32 ) NOT NULL DEFAULT 'PENDING_PROCESSING' COMMENT '业务状态' , item_count INT NOT NULL DEFAULT 0 COMMENT '明细数量' ,
total_package_count INT NOT NULL DEFAULT 0 COMMENT '总箱数' , notified_package_count INT NOT NULL DEFAULT 0 COMMENT '已通知箱数' ,
idempotency_key VARCHAR ( 255 ) NOT NULL COMMENT '业务幂等键' , request_hash CHAR ( 64 ) NOT NULL COMMENT '请求内容哈希' ,
created_by VARCHAR ( 128 ) NULL COMMENT '创建人ID' , created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' ,
updated_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) ON UPDATE CURRENT_TIMESTAMP ( 3 ) COMMENT '更新时间' ,
PRIMARY KEY ( id )
) ENGINE = InnoDB COMMENT = '客户换标申请单' ;
CREATE TABLE IF NOT EXISTS ll_relabel_item (
id BIGINT NOT NULL COMMENT '主键ID' , application_id BIGINT NOT NULL COMMENT '申请单ID' , tenant_id VARCHAR ( 128 ) NOT NULL COMMENT '租户ID' ,
sku_code VARCHAR ( 128 ) NOT NULL COMMENT 'SKU编码' , product_image_file_id VARCHAR ( 128 ) NULL COMMENT '产品图片文件ID' ,
product_image_file_name VARCHAR ( 255 ) NULL COMMENT '产品图片文件名' , product_image_url VARCHAR ( 1000 ) NULL COMMENT '产品图片地址' ,
product_name_zh VARCHAR ( 255 ) NOT NULL COMMENT '产品中文名称' , total_package_count INT NOT NULL COMMENT '总箱数' , notified_package_count INT NOT NULL COMMENT '已通知箱数' ,
shipment_no VARCHAR ( 128 ) NOT NULL COMMENT '货件编号' , tracking_code VARCHAR ( 255 ) NULL COMMENT '物流跟踪编码' , new_sku_code VARCHAR ( 128 ) NOT NULL COMMENT '换标后SKU编码' ,
label_requirement VARCHAR ( 1000 ) NULL COMMENT '换标要求' , relabel_file_id VARCHAR ( 128 ) NULL COMMENT '换标文件ID' ,
relabel_file_name VARCHAR ( 255 ) NULL COMMENT '换标文件名' , relabel_file_url VARCHAR ( 1000 ) NULL COMMENT '换标文件地址' ,
created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' , PRIMARY KEY ( id )
) ENGINE = InnoDB COMMENT = '换标货物冻结明细' ;
CREATE TABLE IF NOT EXISTS ll_relabel_status_history (
id BIGINT NOT NULL COMMENT '主键ID' , tenant_id VARCHAR ( 128 ) NOT NULL COMMENT '租户ID' , application_id BIGINT NOT NULL COMMENT '申请单ID' ,
from_status VARCHAR ( 32 ) NULL COMMENT '变更前状态' , to_status VARCHAR ( 32 ) NOT NULL COMMENT '变更后状态' , operator_id VARCHAR ( 128 ) NULL COMMENT '操作人ID' ,
remark VARCHAR ( 1000 ) NULL COMMENT '备注' , created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' , PRIMARY KEY ( id )
) ENGINE = InnoDB COMMENT = '换标状态变更历史' ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_relabel_application' AND index_name = 'uk_ll_relabel_application_no' ), 'SELECT 1' , 'ALTER TABLE ll_relabel_application ADD UNIQUE KEY uk_ll_relabel_application_no (tenant_id,relabel_no)' ));
PREPARE relabel_schema_stmt FROM @ ddl ; EXECUTE relabel_schema_stmt ; DEALLOCATE PREPARE relabel_schema_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_relabel_application' AND index_name = 'uk_ll_relabel_application_idempotency' ), 'SELECT 1' , 'ALTER TABLE ll_relabel_application ADD UNIQUE KEY uk_ll_relabel_application_idempotency (tenant_id,idempotency_key)' ));
PREPARE relabel_schema_stmt FROM @ ddl ; EXECUTE relabel_schema_stmt ; DEALLOCATE PREPARE relabel_schema_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_relabel_application' AND index_name = 'uk_ll_relabel_application_order' ), 'SELECT 1' , 'ALTER TABLE ll_relabel_application ADD UNIQUE KEY uk_ll_relabel_application_order (lastleg_order_id)' ));
PREPARE relabel_schema_stmt FROM @ ddl ; EXECUTE relabel_schema_stmt ; DEALLOCATE PREPARE relabel_schema_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_relabel_application' AND index_name = 'idx_ll_relabel_application_list' ), 'SELECT 1' , 'ALTER TABLE ll_relabel_application ADD KEY idx_ll_relabel_application_list (tenant_id,status,created_at)' ));
PREPARE relabel_schema_stmt FROM @ ddl ; EXECUTE relabel_schema_stmt ; DEALLOCATE PREPARE relabel_schema_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_relabel_application' AND index_name = 'idx_ll_relabel_application_customer' ), 'SELECT 1' , 'ALTER TABLE ll_relabel_application ADD KEY idx_ll_relabel_application_customer (tenant_id,customer_order_no)' ));
PREPARE relabel_schema_stmt FROM @ ddl ; EXECUTE relabel_schema_stmt ; DEALLOCATE PREPARE relabel_schema_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_relabel_application' AND index_name = 'idx_ll_relabel_application_warehouse' ), 'SELECT 1' , 'ALTER TABLE ll_relabel_application ADD KEY idx_ll_relabel_application_warehouse (tenant_id,overseas_warehouse_id)' ));
PREPARE relabel_schema_stmt FROM @ ddl ; EXECUTE relabel_schema_stmt ; DEALLOCATE PREPARE relabel_schema_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_relabel_item' AND index_name = 'idx_ll_relabel_item_application' ), 'SELECT 1' , 'ALTER TABLE ll_relabel_item ADD KEY idx_ll_relabel_item_application (tenant_id,application_id)' ));
PREPARE relabel_schema_stmt FROM @ ddl ; EXECUTE relabel_schema_stmt ; DEALLOCATE PREPARE relabel_schema_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_relabel_item' AND index_name = 'idx_ll_relabel_item_sku' ), 'SELECT 1' , 'ALTER TABLE ll_relabel_item ADD KEY idx_ll_relabel_item_sku (tenant_id,sku_code)' ));
PREPARE relabel_schema_stmt FROM @ ddl ; EXECUTE relabel_schema_stmt ; DEALLOCATE PREPARE relabel_schema_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_relabel_status_history' AND index_name = 'idx_ll_relabel_status_history_application' ), 'SELECT 1' , 'ALTER TABLE ll_relabel_status_history ADD KEY idx_ll_relabel_status_history_application (tenant_id,application_id,created_at)' ));
PREPARE relabel_schema_stmt FROM @ ddl ; EXECUTE relabel_schema_stmt ; DEALLOCATE PREPARE relabel_schema_stmt ;
-- ============================================================================
-- 2026-08-17 / 018
-- Existing-table correction: apply schema changes with ADD/UPDATE/ALTER guards
-- ============================================================================
-- Sections 008-017 keep CREATE TABLE definitions for fresh databases. This
-- section is the authoritative path for databases that already contain those
-- tables. Legacy SKU/quantity columns are retained and made nullable; no
-- business rows or Outbox rows are deleted.
USE baiyue_lastleg ;
-- Tail orders: cumulative PDA picking/shipping counters.
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'picked_package_count' ), 'SELECT 1' , 'ALTER TABLE ll_order ADD COLUMN picked_package_count INT NOT NULL DEFAULT 0 COMMENT ''累计已拣箱数'' AFTER package_count' ));
PREPARE migration_018 FROM @ ddl ; EXECUTE migration_018 ; DEALLOCATE PREPARE migration_018 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'shipped_package_count' ), 'SELECT 1' , 'ALTER TABLE ll_order ADD COLUMN shipped_package_count INT NOT NULL DEFAULT 0 COMMENT ''累计已出库箱数'' AFTER picked_package_count' ));
PREPARE migration_018 FROM @ ddl ; EXECUTE migration_018 ; DEALLOCATE PREPARE migration_018 ;
-- Inventory balance: add inbound-order identity without dropping legacy SKU data.
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'inbound_order_id' ), 'SELECT 1' , 'ALTER TABLE ll_inventory_balance ADD COLUMN inbound_order_id BIGINT NULL COMMENT ''入仓单ID'' AFTER destination_warehouse_name' ));
PREPARE migration_018 FROM @ ddl ; EXECUTE migration_018 ; DEALLOCATE PREPARE migration_018 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'inbound_order_no' ), 'SELECT 1' , 'ALTER TABLE ll_inventory_balance ADD COLUMN inbound_order_no VARCHAR(128) NULL COMMENT ''入库单号快照'' AFTER inbound_order_id' ));
PREPARE migration_018 FROM @ ddl ; EXECUTE migration_018 ; DEALLOCATE PREPARE migration_018 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'inbound_code' ), 'SELECT 1' , 'ALTER TABLE ll_inventory_balance ADD COLUMN inbound_code VARCHAR(128) NULL COMMENT ''入仓码快照'' AFTER inbound_order_no' ));
PREPARE migration_018 FROM @ ddl ; EXECUTE migration_018 ; DEALLOCATE PREPARE migration_018 ;
UPDATE ll_inventory_balance
SET inbound_order_id = COALESCE ( inbound_order_id , id ),
inbound_code = COALESCE ( NULLIF ( inbound_code , '' ), CONCAT ( 'LEGACY-' , id ))
WHERE inbound_order_id IS NULL OR inbound_code IS NULL OR inbound_code = '' ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'inbound_order_id' ), 'ALTER TABLE ll_inventory_balance MODIFY COLUMN inbound_order_id BIGINT NOT NULL' , 'SELECT 1' ));
PREPARE migration_018 FROM @ ddl ; EXECUTE migration_018 ; DEALLOCATE PREPARE migration_018 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'inbound_code' ), 'ALTER TABLE ll_inventory_balance MODIFY COLUMN inbound_code VARCHAR(128) NOT NULL' , 'SELECT 1' ));
PREPARE migration_018 FROM @ ddl ; EXECUTE migration_018 ; DEALLOCATE PREPARE migration_018 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND index_name = 'uk_ll_inventory_dimension' ), 'ALTER TABLE ll_inventory_balance DROP INDEX uk_ll_inventory_dimension' , 'SELECT 1' ));
PREPARE migration_018 FROM @ ddl ; EXECUTE migration_018 ; DEALLOCATE PREPARE migration_018 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND index_name = 'uk_ll_inventory_dimension' ), 'SELECT 1' , CONCAT ( 'ALTER TABLE ll_inventory_balance ADD UNIQUE KEY uk_ll_inventory_dimension (' , IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'customer_id' ), 'customer_id' , 'tenant_id' ), ',overseas_warehouse_id,destination_warehouse_code,inbound_order_id,inbound_code)' )));
PREPARE migration_018 FROM @ ddl ; EXECUTE migration_018 ; DEALLOCATE PREPARE migration_018 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND index_name = 'idx_ll_inventory_sku' ), 'ALTER TABLE ll_inventory_balance DROP INDEX idx_ll_inventory_sku' , 'SELECT 1' ));
PREPARE migration_018 FROM @ ddl ; EXECUTE migration_018 ; DEALLOCATE PREPARE migration_018 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND index_name = 'idx_ll_inventory_inbound' ), 'SELECT 1' , CONCAT ( 'ALTER TABLE ll_inventory_balance ADD KEY idx_ll_inventory_inbound (' , IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'customer_id' ), 'customer_id' , 'tenant_id' ), ',inbound_code)' )));
PREPARE migration_018 FROM @ ddl ; EXECUTE migration_018 ; DEALLOCATE PREPARE migration_018 ;
-- Inventory positions and ledger: preserve SKU columns, add inbound identity.
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_position' AND column_name = 'sku_code' ), 'ALTER TABLE ll_inventory_position MODIFY COLUMN sku_code VARCHAR(128) NULL' , 'SELECT 1' ));
PREPARE migration_018 FROM @ ddl ; EXECUTE migration_018 ; DEALLOCATE PREPARE migration_018 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'inbound_order_id' ), 'SELECT 1' , 'ALTER TABLE ll_inventory_ledger ADD COLUMN inbound_order_id BIGINT NULL COMMENT ''入仓单ID'' AFTER destination_warehouse_code' ));
PREPARE migration_018 FROM @ ddl ; EXECUTE migration_018 ; DEALLOCATE PREPARE migration_018 ;
UPDATE ll_inventory_ledger
SET inbound_order_id = COALESCE ( inbound_order_id , business_order_id , balance_id )
WHERE inbound_order_id IS NULL ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'inbound_order_id' ), 'ALTER TABLE ll_inventory_ledger MODIFY COLUMN inbound_order_id BIGINT NOT NULL' , 'SELECT 1' ));
PREPARE migration_018 FROM @ ddl ; EXECUTE migration_018 ; DEALLOCATE PREPARE migration_018 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'sku_code' ), 'ALTER TABLE ll_inventory_ledger MODIFY COLUMN sku_code VARCHAR(128) NULL' , 'SELECT 1' ));
PREPARE migration_018 FROM @ ddl ; EXECUTE migration_018 ; DEALLOCATE PREPARE migration_018 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND index_name = 'idx_ll_inventory_ledger_sku' ), 'ALTER TABLE ll_inventory_ledger DROP INDEX idx_ll_inventory_ledger_sku' , 'SELECT 1' ));
PREPARE migration_018 FROM @ ddl ; EXECUTE migration_018 ; DEALLOCATE PREPARE migration_018 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND index_name = 'idx_ll_inventory_ledger_inbound' ), 'SELECT 1' , 'ALTER TABLE ll_inventory_ledger ADD KEY idx_ll_inventory_ledger_inbound (tenant_id,inbound_code,occurred_at)' ));
PREPARE migration_018 FROM @ ddl ; EXECUTE migration_018 ; DEALLOCATE PREPARE migration_018 ;
-- Stock receipts: keep legacy SKU/quantity snapshots but allow inbound-only rows.
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_stock_receipt' AND column_name = 'sku_code' ), 'ALTER TABLE ll_inbound_stock_receipt MODIFY COLUMN sku_code VARCHAR(128) NULL' , 'SELECT 1' ));
PREPARE migration_018 FROM @ ddl ; EXECUTE migration_018 ; DEALLOCATE PREPARE migration_018 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_stock_receipt' AND column_name = 'received_quantity' ), 'ALTER TABLE ll_inbound_stock_receipt MODIFY COLUMN received_quantity BIGINT NULL DEFAULT 0' , 'SELECT 1' ));
PREPARE migration_018 FROM @ ddl ; EXECUTE migration_018 ; DEALLOCATE PREPARE migration_018 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_inbound_stock_receipt' AND index_name = 'uk_ll_stock_receipt_task_allocation_sku' ), 'ALTER TABLE ll_inbound_stock_receipt DROP INDEX uk_ll_stock_receipt_task_allocation_sku' , 'SELECT 1' ));
PREPARE migration_018 FROM @ ddl ; EXECUTE migration_018 ; DEALLOCATE PREPARE migration_018 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_inbound_stock_receipt' AND index_name = 'uk_ll_stock_receipt_task_allocation' ), 'SELECT 1' , 'ALTER TABLE ll_inbound_stock_receipt ADD UNIQUE KEY uk_ll_stock_receipt_task_allocation (tenant_id,task_id,allocation_id)' ));
PREPARE migration_018 FROM @ ddl ; EXECUTE migration_018 ; DEALLOCATE PREPARE migration_018 ;
-- Dispatch/PDA fields are also ADD operations for existing installations.
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_order' AND column_name = 'picked_package_count' ), 'SELECT 1' , 'ALTER TABLE ll_dispatch_order ADD COLUMN picked_package_count INT NOT NULL DEFAULT 0 COMMENT ''累计已拣箱数'' AFTER package_count' ));
PREPARE migration_018 FROM @ ddl ; EXECUTE migration_018 ; DEALLOCATE PREPARE migration_018 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_order' AND column_name = 'shipped_package_count' ), 'SELECT 1' , 'ALTER TABLE ll_dispatch_order ADD COLUMN shipped_package_count INT NOT NULL DEFAULT 0 COMMENT ''累计已出库箱数'' AFTER picked_package_count' ));
PREPARE migration_018 FROM @ ddl ; EXECUTE migration_018 ; DEALLOCATE PREPARE migration_018 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_order' AND column_name = 'partial_completion_reason' ), 'SELECT 1' , 'ALTER TABLE ll_dispatch_order ADD COLUMN partial_completion_reason VARCHAR(1000) NULL COMMENT ''部分完成原因'' AFTER shipped_package_count' ));
PREPARE migration_018 FROM @ ddl ; EXECUTE migration_018 ; DEALLOCATE PREPARE migration_018 ;
-- No DROP COLUMN is included. Existing columns and business rows remain recoverable.
-- ============================================================================
-- 2026-08-17 / 019
-- Warehouse transfer orders with historical customer-order/inbound bindings.
-- ============================================================================
USE baiyue_lastleg ;
CREATE TABLE IF NOT EXISTS ll_warehouse_transfer_order (
id BIGINT NOT NULL COMMENT '主键ID' , tenant_id VARCHAR ( 128 ) NOT NULL COMMENT '租户ID' ,
transfer_no VARCHAR ( 64 ) NOT NULL COMMENT '转仓单号' , inbound_order_id BIGINT NOT NULL COMMENT '入仓单ID' , inbound_code VARCHAR ( 128 ) NOT NULL COMMENT '入仓单号快照' ,
lastleg_order_id BIGINT NOT NULL COMMENT '尾程订单ID' , lastleg_order_no VARCHAR ( 32 ) NOT NULL COMMENT '尾程订单号' ,
operating_warehouse_id VARCHAR ( 128 ) NOT NULL COMMENT '作业仓库ID' , fba_warehouse_code VARCHAR ( 128 ) NOT NULL COMMENT 'FBA仓库编码' ,
delivery_address VARCHAR ( 1000 ) NOT NULL COMMENT '派送地址' , package_count INT NOT NULL COMMENT '箱数' , delivery_method VARCHAR ( 64 ) NOT NULL COMMENT '派送方式' ,
estimated_arrival_at DATETIME ( 3 ) NOT NULL COMMENT '预计到达时间' , fba_shipment_no VARCHAR ( 128 ) NOT NULL COMMENT 'FBA货件编号' ,
tracking_no VARCHAR ( 255 ) NULL COMMENT '物流跟踪号' , fba_box_nos VARCHAR ( 2000 ) NULL COMMENT 'FBA箱号集合' , remark VARCHAR ( 1000 ) NULL COMMENT '备注' ,
need_relabel TINYINT NOT NULL DEFAULT 0 COMMENT '是否需要换标' , relabel_application_id BIGINT NULL COMMENT '换标申请单ID' , relabel_no VARCHAR ( 64 ) NULL COMMENT '换标申请单号' ,
status VARCHAR ( 32 ) NOT NULL DEFAULT 'PENDING_REVIEW' COMMENT '业务状态' , idempotency_key VARCHAR ( 255 ) NOT NULL COMMENT '业务幂等键' ,
request_hash CHAR ( 64 ) NOT NULL COMMENT '请求内容哈希' , created_by VARCHAR ( 128 ) NULL COMMENT '创建人ID' ,
created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' ,
updated_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) ON UPDATE CURRENT_TIMESTAMP ( 3 ) COMMENT '更新时间' , PRIMARY KEY ( id )
) ENGINE = InnoDB COMMENT = '客户转仓单' ;
CREATE TABLE IF NOT EXISTS ll_warehouse_transfer_source_order (
id BIGINT NOT NULL COMMENT '主键ID' , transfer_order_id BIGINT NOT NULL COMMENT '转仓单ID' , tenant_id VARCHAR ( 128 ) NOT NULL COMMENT '租户ID' ,
source_lastleg_order_id BIGINT NOT NULL COMMENT '来源尾程订单ID' , source_lastleg_order_no VARCHAR ( 32 ) NOT NULL COMMENT '来源尾程订单号' ,
inbound_order_id BIGINT NOT NULL COMMENT '入仓单ID' , inbound_code VARCHAR ( 128 ) NOT NULL COMMENT '入仓单号快照' ,
created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' , PRIMARY KEY ( id )
) ENGINE = InnoDB COMMENT = '转仓来源历史订单绑定' ;
CREATE TABLE IF NOT EXISTS ll_warehouse_transfer_item (
id BIGINT NOT NULL COMMENT '主键ID' , transfer_order_id BIGINT NOT NULL COMMENT '转仓单ID' , tenant_id VARCHAR ( 128 ) NOT NULL COMMENT '租户ID' ,
sku_code VARCHAR ( 128 ) NOT NULL COMMENT 'SKU编码' , product_name_zh VARCHAR ( 255 ) NOT NULL COMMENT '产品中文名称' ,
package_count INT NOT NULL COMMENT '箱数' , shipping_mark VARCHAR ( 255 ) NULL COMMENT '运输唛头' ,
created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' , PRIMARY KEY ( id )
) ENGINE = InnoDB COMMENT = '转仓货物冻结明细' ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND index_name = 'uk_ll_wh_transfer_no' ), 'SELECT 1' , 'ALTER TABLE ll_warehouse_transfer_order ADD UNIQUE KEY uk_ll_wh_transfer_no (tenant_id,transfer_no)' ));
PREPARE transfer_019 FROM @ ddl ; EXECUTE transfer_019 ; DEALLOCATE PREPARE transfer_019 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND index_name = 'uk_ll_wh_transfer_key' ), 'SELECT 1' , 'ALTER TABLE ll_warehouse_transfer_order ADD UNIQUE KEY uk_ll_wh_transfer_key (tenant_id,idempotency_key)' ));
PREPARE transfer_019 FROM @ ddl ; EXECUTE transfer_019 ; DEALLOCATE PREPARE transfer_019 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND index_name = 'uk_ll_wh_transfer_tail_order' ), 'SELECT 1' , 'ALTER TABLE ll_warehouse_transfer_order ADD UNIQUE KEY uk_ll_wh_transfer_tail_order (lastleg_order_id)' ));
PREPARE transfer_019 FROM @ ddl ; EXECUTE transfer_019 ; DEALLOCATE PREPARE transfer_019 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND index_name = 'idx_ll_wh_transfer_list' ), 'SELECT 1' , 'ALTER TABLE ll_warehouse_transfer_order ADD KEY idx_ll_wh_transfer_list (tenant_id,status,created_at)' ));
PREPARE transfer_019 FROM @ ddl ; EXECUTE transfer_019 ; DEALLOCATE PREPARE transfer_019 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND index_name = 'idx_ll_wh_transfer_inbound' ), 'SELECT 1' , 'ALTER TABLE ll_warehouse_transfer_order ADD KEY idx_ll_wh_transfer_inbound (tenant_id,inbound_code)' ));
PREPARE transfer_019 FROM @ ddl ; EXECUTE transfer_019 ; DEALLOCATE PREPARE transfer_019 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_source_order' AND index_name = 'uk_ll_wh_transfer_source' ), 'SELECT 1' , 'ALTER TABLE ll_warehouse_transfer_source_order ADD UNIQUE KEY uk_ll_wh_transfer_source (transfer_order_id,source_lastleg_order_id)' ));
PREPARE transfer_019 FROM @ ddl ; EXECUTE transfer_019 ; DEALLOCATE PREPARE transfer_019 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_source_order' AND index_name = 'idx_ll_wh_transfer_source_list' ), 'SELECT 1' , 'ALTER TABLE ll_warehouse_transfer_source_order ADD KEY idx_ll_wh_transfer_source_list (tenant_id,transfer_order_id)' ));
PREPARE transfer_019 FROM @ ddl ; EXECUTE transfer_019 ; DEALLOCATE PREPARE transfer_019 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_item' AND index_name = 'idx_ll_wh_transfer_item_list' ), 'SELECT 1' , 'ALTER TABLE ll_warehouse_transfer_item ADD KEY idx_ll_wh_transfer_item_list (tenant_id,transfer_order_id)' ));
PREPARE transfer_019 FROM @ ddl ; EXECUTE transfer_019 ; DEALLOCATE PREPARE transfer_019 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_item' AND index_name = 'idx_ll_wh_transfer_item_sku' ), 'SELECT 1' , 'ALTER TABLE ll_warehouse_transfer_item ADD KEY idx_ll_wh_transfer_item_sku (tenant_id,sku_code)' ));
PREPARE transfer_019 FROM @ ddl ; EXECUTE transfer_019 ; DEALLOCATE PREPARE transfer_019 ;
-- 2026-08-17 / customer naming and one-click dropship carton inventory.
-- Rename only existing columns; deployed data and index definitions remain intact.
DELIMITER //
CREATE PROCEDURE migrate_tenant_columns_to_customer ()
BEGIN
DECLARE done INT DEFAULT FALSE ;
DECLARE table_name_value VARCHAR ( 128 );
DECLARE column_cursor CURSOR FOR
SELECT c . table_name FROM information_schema . columns c
WHERE c . table_schema = DATABASE () AND c . column_name = 'tenant_id'
AND NOT EXISTS ( SELECT 1 FROM information_schema . columns c2
WHERE c2 . table_schema = c . table_schema AND c2 . table_name = c . table_name AND c2 . column_name = 'customer_id' );
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE ;
OPEN column_cursor ;
rename_loop : LOOP
FETCH column_cursor INTO table_name_value ;
IF done THEN LEAVE rename_loop ; END IF ;
SET @ rename_sql = CONCAT ( 'ALTER TABLE `' , table_name_value , '` RENAME COLUMN tenant_id TO customer_id' );
PREPARE rename_statement FROM @ rename_sql ;
EXECUTE rename_statement ;
DEALLOCATE PREPARE rename_statement ;
END LOOP ;
CLOSE column_cursor ;
END //
DELIMITER ;
CALL migrate_tenant_columns_to_customer ();
DROP PROCEDURE migrate_tenant_columns_to_customer ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'sku_code' ), 'SELECT 1' , 'ALTER TABLE ll_inventory_ledger ADD COLUMN sku_code VARCHAR(128) NULL AFTER batch_no' ));
PREPARE inventory_sku_020 FROM @ ddl ; EXECUTE inventory_sku_020 ; DEALLOCATE PREPARE inventory_sku_020 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'carton_mark' ), 'SELECT 1' , IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'carton_no' ), 'ALTER TABLE ll_inventory_ledger RENAME COLUMN carton_no TO carton_mark' , 'ALTER TABLE ll_inventory_ledger ADD COLUMN carton_mark VARCHAR(128) NULL AFTER sku_code' )));
PREPARE inventory_carton_020 FROM @ ddl ; EXECUTE inventory_carton_020 ; DEALLOCATE PREPARE inventory_carton_020 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'carton_packages' ), 'SELECT 1' , 'ALTER TABLE ll_inventory_ledger ADD COLUMN carton_packages BIGINT NULL AFTER carton_mark' ));
PREPARE inventory_carton_qty_020 FROM @ ddl ; EXECUTE inventory_carton_qty_020 ; DEALLOCATE PREPARE inventory_carton_qty_020 ;
CREATE TABLE IF NOT EXISTS ll_dropship_order_profile (
id BIGINT NOT NULL COMMENT '主键ID' , customer_id VARCHAR ( 128 ) NOT NULL COMMENT '客户租户ID' , order_id BIGINT NOT NULL COMMENT '订单ID' ,
warehouse_pallet_id BIGINT NOT NULL COMMENT '仓库实物托盘ID' , pallet_no VARCHAR ( 128 ) NOT NULL COMMENT '托盘号' , inventory_position_id BIGINT NULL COMMENT '库存仓位记录ID' ,
status VARCHAR ( 32 ) NOT NULL DEFAULT 'RECEIVED' COMMENT '业务状态' , idempotency_key VARCHAR ( 255 ) NOT NULL COMMENT '业务幂等键' , version BIGINT NOT NULL DEFAULT 0 COMMENT '乐观锁版本' ,
created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' , updated_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) ON UPDATE CURRENT_TIMESTAMP ( 3 ) COMMENT '更新时间' ,
PRIMARY KEY ( id ), UNIQUE KEY uk_ll_dropship_profile_order ( customer_id , order_id ), UNIQUE KEY uk_ll_dropship_profile_key ( customer_id , idempotency_key )
) ENGINE = InnoDB COMMENT = '一件代发托盘档案' ;
CREATE TABLE IF NOT EXISTS ll_dropship_carton (
id BIGINT NOT NULL COMMENT '主键ID' , customer_id VARCHAR ( 128 ) NOT NULL COMMENT '客户租户ID' , order_id BIGINT NOT NULL COMMENT '订单ID' , profile_id BIGINT NOT NULL COMMENT '托盘档案ID' ,
warehouse_pallet_id BIGINT NOT NULL COMMENT '仓库实物托盘ID' , pallet_no VARCHAR ( 128 ) NOT NULL COMMENT '托盘号' , sku_code VARCHAR ( 128 ) NOT NULL COMMENT 'SKU编码' , carton_mark VARCHAR ( 128 ) NOT NULL COMMENT '箱唛' , carton_sequence INT NOT NULL COMMENT '箱唛序号' ,
status VARCHAR ( 32 ) NOT NULL DEFAULT 'AVAILABLE' COMMENT '业务状态' , outbound_order_no VARCHAR ( 128 ) NULL COMMENT '出库单号' , version BIGINT NOT NULL DEFAULT 0 COMMENT '乐观锁版本' ,
created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' , updated_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) ON UPDATE CURRENT_TIMESTAMP ( 3 ) COMMENT '更新时间' ,
PRIMARY KEY ( id ), UNIQUE KEY uk_ll_dropship_carton ( customer_id , order_id , carton_mark ), KEY idx_ll_dropship_carton_status ( customer_id , status ),
KEY idx_ll_dropship_carton_sku ( customer_id , sku_code , status )
) ENGINE = InnoDB COMMENT = '一件代发箱唛明细' ;
CREATE TABLE IF NOT EXISTS ll_dropship_sku_inventory (
id BIGINT NOT NULL COMMENT '主键ID' , customer_id VARCHAR ( 128 ) NOT NULL COMMENT '客户租户ID' , order_id BIGINT NOT NULL COMMENT '订单ID' , profile_id BIGINT NOT NULL COMMENT '托盘档案ID' ,
sku_code VARCHAR ( 128 ) NOT NULL COMMENT 'SKU编码' , product_name VARCHAR ( 255 ) NULL COMMENT '产品名称' , package_count BIGINT NOT NULL COMMENT '箱数' , product_quantity BIGINT NOT NULL COMMENT '产品数量' ,
created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' , updated_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) ON UPDATE CURRENT_TIMESTAMP ( 3 ) COMMENT '更新时间' ,
PRIMARY KEY ( id ), UNIQUE KEY uk_ll_dropship_sku_inventory ( customer_id , order_id , sku_code )
) ENGINE = InnoDB COMMENT = '一件代发SKU库存汇总' ;
CREATE TABLE IF NOT EXISTS ll_dropship_carton_ledger (
id BIGINT NOT NULL COMMENT '主键ID' , customer_id VARCHAR ( 128 ) NOT NULL COMMENT '客户租户ID' , order_id BIGINT NOT NULL COMMENT '订单ID' , carton_id BIGINT NOT NULL COMMENT '箱唛记录ID' ,
carton_mark VARCHAR ( 128 ) NOT NULL COMMENT '箱唛' , sku_code VARCHAR ( 128 ) NOT NULL COMMENT 'SKU编码' , operation_type VARCHAR ( 32 ) NOT NULL COMMENT '操作类型' ,
before_packages BIGINT NOT NULL COMMENT '变动前箱数' , delta_packages BIGINT NOT NULL COMMENT '箱数变动量' , after_packages BIGINT NOT NULL COMMENT '变动后箱数' ,
business_order_no VARCHAR ( 128 ) NULL COMMENT '业务单号' , idempotency_key VARCHAR ( 255 ) NOT NULL COMMENT '业务幂等键' , remark VARCHAR ( 1000 ) NULL COMMENT '备注' , occurred_at DATETIME ( 3 ) NOT NULL COMMENT '业务发生时间' ,
created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' , PRIMARY KEY ( id ), UNIQUE KEY uk_ll_dropship_ledger_key ( customer_id , idempotency_key ),
KEY idx_ll_dropship_ledger_sku ( customer_id , sku_code , carton_mark )
) ENGINE = InnoDB COMMENT = '一件代发箱唛库存流水' ;
-- Dropship profile stores the immutable first-leg pallet number snapshot.
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_order_profile' AND column_name = 'source_pallet_no' ), 'SELECT 1' , 'ALTER TABLE ll_dropship_order_profile ADD COLUMN source_pallet_no VARCHAR(128) NULL COMMENT ''Pallet number snapshot supplied by first-leg handover'' AFTER pallet_no' ));
PREPARE dropship_source_pallet_no_stmt FROM @ ddl ; EXECUTE dropship_source_pallet_no_stmt ; DEALLOCATE PREPARE dropship_source_pallet_no_stmt ;
-- Explicit index upgrades for existing installations. CREATE TABLE IF NOT EXISTS
-- does not add indexes to tables that already exist.
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_order' AND index_name = 'idx_ll_order_container' ), 'SELECT 1' , 'ALTER TABLE ll_order ADD KEY idx_ll_order_container (customer_id,container_no)' ));
PREPARE lastleg_indexes_020 FROM @ ddl ; EXECUTE lastleg_indexes_020 ; DEALLOCATE PREPARE lastleg_indexes_020 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_dropship_order_profile' AND index_name = 'uk_ll_dropship_profile_key' ), 'SELECT 1' , 'ALTER TABLE ll_dropship_order_profile ADD UNIQUE KEY uk_ll_dropship_profile_key (customer_id,idempotency_key)' ));
PREPARE lastleg_indexes_020 FROM @ ddl ; EXECUTE lastleg_indexes_020 ; DEALLOCATE PREPARE lastleg_indexes_020 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton' AND index_name = 'uk_ll_dropship_carton' ), 'SELECT 1' , 'ALTER TABLE ll_dropship_carton ADD UNIQUE KEY uk_ll_dropship_carton (customer_id,order_id,carton_mark)' ));
PREPARE lastleg_indexes_020 FROM @ ddl ; EXECUTE lastleg_indexes_020 ; DEALLOCATE PREPARE lastleg_indexes_020 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton' AND index_name = 'idx_ll_dropship_carton_status' ), 'SELECT 1' , 'ALTER TABLE ll_dropship_carton ADD KEY idx_ll_dropship_carton_status (customer_id,status)' ));
PREPARE lastleg_indexes_020 FROM @ ddl ; EXECUTE lastleg_indexes_020 ; DEALLOCATE PREPARE lastleg_indexes_020 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton' AND index_name = 'idx_ll_dropship_carton_sku' ), 'SELECT 1' , 'ALTER TABLE ll_dropship_carton ADD KEY idx_ll_dropship_carton_sku (customer_id,sku_code,status)' ));
PREPARE lastleg_indexes_020 FROM @ ddl ; EXECUTE lastleg_indexes_020 ; DEALLOCATE PREPARE lastleg_indexes_020 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton_ledger' AND index_name = 'uk_ll_dropship_ledger_key' ), 'SELECT 1' , 'ALTER TABLE ll_dropship_carton_ledger ADD UNIQUE KEY uk_ll_dropship_ledger_key (customer_id,idempotency_key)' ));
PREPARE lastleg_indexes_020 FROM @ ddl ; EXECUTE lastleg_indexes_020 ; DEALLOCATE PREPARE lastleg_indexes_020 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton_ledger' AND index_name = 'idx_ll_dropship_ledger_sku' ), 'SELECT 1' , 'ALTER TABLE ll_dropship_carton_ledger ADD KEY idx_ll_dropship_ledger_sku (customer_id,sku_code,carton_mark)' ));
PREPARE lastleg_indexes_020 FROM @ ddl ; EXECUTE lastleg_indexes_020 ; DEALLOCATE PREPARE lastleg_indexes_020 ;
-- ============================================================================
-- 2026-08-18 / dropship multi-pallet cardinality
-- One one-click dropship inbound order may own multiple source pallets.
-- ============================================================================
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_dropship_order_profile' AND index_name = 'uk_ll_dropship_profile_order' ), 'ALTER TABLE ll_dropship_order_profile DROP INDEX uk_ll_dropship_profile_order' , 'SELECT 1' ));
PREPARE dropship_drop_single_pallet_stmt FROM @ ddl ; EXECUTE dropship_drop_single_pallet_stmt ; DEALLOCATE PREPARE dropship_drop_single_pallet_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_dropship_order_profile' AND index_name = 'uk_ll_dropship_profile_order_pallet' ), 'SELECT 1' , 'ALTER TABLE ll_dropship_order_profile ADD UNIQUE KEY uk_ll_dropship_profile_order_pallet(customer_id,order_id,source_pallet_no)' ));
PREPARE dropship_add_order_pallet_stmt FROM @ ddl ; EXECUTE dropship_add_order_pallet_stmt ; DEALLOCATE PREPARE dropship_add_order_pallet_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_dropship_order_profile' AND index_name = 'idx_ll_dropship_profile_order' ), 'SELECT 1' , 'ALTER TABLE ll_dropship_order_profile ADD KEY idx_ll_dropship_profile_order(customer_id,order_id)' ));
PREPARE dropship_add_order_idx_stmt FROM @ ddl ; EXECUTE dropship_add_order_idx_stmt ; DEALLOCATE PREPARE dropship_add_order_idx_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_dropship_sku_inventory' AND index_name = 'uk_ll_dropship_sku_inventory' ), 'ALTER TABLE ll_dropship_sku_inventory DROP INDEX uk_ll_dropship_sku_inventory' , 'SELECT 1' ));
PREPARE dropship_drop_order_sku_stmt FROM @ ddl ; EXECUTE dropship_drop_order_sku_stmt ; DEALLOCATE PREPARE dropship_drop_order_sku_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_dropship_sku_inventory' AND index_name = 'uk_ll_dropship_sku_profile' ), 'SELECT 1' , 'ALTER TABLE ll_dropship_sku_inventory ADD UNIQUE KEY uk_ll_dropship_sku_profile(profile_id,sku_code)' ));
PREPARE dropship_add_profile_sku_stmt FROM @ ddl ; EXECUTE dropship_add_profile_sku_stmt ; DEALLOCATE PREPARE dropship_add_profile_sku_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_dropship_sku_inventory' AND index_name = 'idx_ll_dropship_sku_order' ), 'SELECT 1' , 'ALTER TABLE ll_dropship_sku_inventory ADD KEY idx_ll_dropship_sku_order(customer_id,order_id,sku_code)' ));
PREPARE dropship_add_order_sku_idx_stmt FROM @ ddl ; EXECUTE dropship_add_order_sku_idx_stmt ; DEALLOCATE PREPARE dropship_add_order_sku_idx_stmt ;
-- Dropship event snapshots are not physical stock until overseas PDA stock-in completes.
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_order_profile' AND column_name = 'warehouse_pallet_id' AND is_nullable = 'NO' ), 'ALTER TABLE ll_dropship_order_profile MODIFY COLUMN warehouse_pallet_id BIGINT NULL' , 'SELECT 1' ));
PREPARE dropship_profile_pallet_nullable_stmt FROM @ ddl ; EXECUTE dropship_profile_pallet_nullable_stmt ; DEALLOCATE PREPARE dropship_profile_pallet_nullable_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_order_profile' AND column_name = 'pallet_no' AND is_nullable = 'NO' ), 'ALTER TABLE ll_dropship_order_profile MODIFY COLUMN pallet_no VARCHAR(128) NULL' , 'SELECT 1' ));
PREPARE dropship_profile_no_nullable_stmt FROM @ ddl ; EXECUTE dropship_profile_no_nullable_stmt ; DEALLOCATE PREPARE dropship_profile_no_nullable_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton' AND column_name = 'warehouse_pallet_id' AND is_nullable = 'NO' ), 'ALTER TABLE ll_dropship_carton MODIFY COLUMN warehouse_pallet_id BIGINT NULL' , 'SELECT 1' ));
PREPARE dropship_carton_pallet_nullable_stmt FROM @ ddl ; EXECUTE dropship_carton_pallet_nullable_stmt ; DEALLOCATE PREPARE dropship_carton_pallet_nullable_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton' AND column_name = 'pallet_no' AND is_nullable = 'NO' ), 'ALTER TABLE ll_dropship_carton MODIFY COLUMN pallet_no VARCHAR(128) NULL' , 'SELECT 1' ));
PREPARE dropship_carton_no_nullable_stmt FROM @ ddl ; EXECUTE dropship_carton_no_nullable_stmt ; DEALLOCATE PREPARE dropship_carton_no_nullable_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_order_profile' AND column_name = 'status' AND column_default <> 'PENDING_INBOUND' ), 'ALTER TABLE ll_dropship_order_profile MODIFY COLUMN status VARCHAR(32) NOT NULL DEFAULT ''PENDING_INBOUND''' , 'SELECT 1' ));
PREPARE dropship_profile_pending_default_stmt FROM @ ddl ; EXECUTE dropship_profile_pending_default_stmt ; DEALLOCATE PREPARE dropship_profile_pending_default_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton' AND column_name = 'status' AND column_default <> 'PENDING_INBOUND' ), 'ALTER TABLE ll_dropship_carton MODIFY COLUMN status VARCHAR(32) NOT NULL DEFAULT ''PENDING_INBOUND''' , 'SELECT 1' ));
PREPARE dropship_carton_pending_default_stmt FROM @ ddl ; EXECUTE dropship_carton_pending_default_stmt ; DEALLOCATE PREPARE dropship_carton_pending_default_stmt ;
-- ============================================================================
-- 2026-08-18 / 021 cargo discard application, carton reservation and approval.
-- ============================================================================
USE baiyue_lastleg ;
CREATE TABLE IF NOT EXISTS ll_cargo_discard_application (
id BIGINT NOT NULL COMMENT '主键ID' , customer_id VARCHAR ( 128 ) NOT NULL COMMENT '客户租户ID' ,
discard_no VARCHAR ( 64 ) NOT NULL COMMENT '废弃申请单号' , overseas_warehouse_id VARCHAR ( 128 ) NOT NULL COMMENT '海外仓ID' ,
overseas_warehouse_name VARCHAR ( 255 ) NULL COMMENT '海外仓名称快照' , inbound_codes VARCHAR ( 2000 ) NOT NULL COMMENT '入仓单号集合' ,
total_packages INT NOT NULL COMMENT '总箱数' , fee_per_package DECIMAL ( 18 , 2 ) NOT NULL COMMENT '每箱处理费用' ,
total_fee DECIMAL ( 18 , 2 ) NOT NULL COMMENT '费用合计' , currency CHAR ( 3 ) NOT NULL DEFAULT 'USD' COMMENT '币种' ,
status VARCHAR ( 32 ) NOT NULL DEFAULT 'PENDING_REVIEW' COMMENT '业务状态' , remark VARCHAR ( 1000 ) NULL COMMENT '备注' ,
idempotency_key VARCHAR ( 255 ) NOT NULL COMMENT '业务幂等键' , request_hash CHAR ( 64 ) NOT NULL COMMENT '请求内容哈希' ,
created_by VARCHAR ( 128 ) NULL COMMENT '创建人ID' , reviewed_by VARCHAR ( 128 ) NULL COMMENT '审核人ID' , review_remark VARCHAR ( 1000 ) NULL COMMENT '审核备注' ,
reviewed_at DATETIME ( 3 ) NULL COMMENT '审核时间' , created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' ,
updated_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) ON UPDATE CURRENT_TIMESTAMP ( 3 ) COMMENT '更新时间' ,
PRIMARY KEY ( id ), UNIQUE KEY uk_ll_cargo_discard_no ( customer_id , discard_no ),
UNIQUE KEY uk_ll_cargo_discard_key ( customer_id , idempotency_key ),
KEY idx_ll_cargo_discard_list ( customer_id , status , created_at ),
KEY idx_ll_cargo_discard_warehouse ( customer_id , overseas_warehouse_id , created_at )
) ENGINE = InnoDB COMMENT = '货物废弃申请单' ;
CREATE TABLE IF NOT EXISTS ll_cargo_discard_item (
id BIGINT NOT NULL COMMENT '主键ID' , application_id BIGINT NOT NULL COMMENT '申请单ID' , customer_id VARCHAR ( 128 ) NOT NULL COMMENT '客户租户ID' ,
order_id BIGINT NOT NULL COMMENT '订单ID' , inbound_code VARCHAR ( 128 ) NOT NULL COMMENT '入仓单号快照' , profile_id BIGINT NOT NULL COMMENT '托盘档案ID' ,
sku_inventory_id BIGINT NOT NULL COMMENT 'SKU库存记录ID' , sku_code VARCHAR ( 128 ) NOT NULL COMMENT 'SKU编码' , product_name VARCHAR ( 255 ) NULL COMMENT '产品名称' ,
available_packages_snapshot INT NOT NULL COMMENT '可用箱数快照' , discard_packages INT NOT NULL COMMENT '废弃箱数' ,
created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' , PRIMARY KEY ( id ),
UNIQUE KEY uk_ll_cargo_discard_item ( application_id , profile_id , sku_code ),
KEY idx_ll_cargo_discard_item_list ( customer_id , application_id ),
KEY idx_ll_cargo_discard_item_inbound ( customer_id , inbound_code , sku_code )
) ENGINE = InnoDB COMMENT = '货物废弃SKU明细' ;
CREATE TABLE IF NOT EXISTS ll_cargo_discard_carton (
id BIGINT NOT NULL COMMENT '主键ID' , application_id BIGINT NOT NULL COMMENT '申请单ID' , item_id BIGINT NOT NULL COMMENT '明细ID' ,
customer_id VARCHAR ( 128 ) NOT NULL COMMENT '客户租户ID' , carton_id BIGINT NOT NULL COMMENT '箱唛记录ID' , carton_mark VARCHAR ( 128 ) NOT NULL COMMENT '箱唛' ,
created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' , PRIMARY KEY ( id ),
UNIQUE KEY uk_ll_cargo_discard_carton ( application_id , carton_id ),
KEY idx_ll_cargo_discard_carton_application ( customer_id , application_id , item_id ),
KEY idx_ll_cargo_discard_carton_identity ( customer_id , carton_id )
) ENGINE = InnoDB COMMENT = '货物废弃锁定箱明细' ;
CREATE TABLE IF NOT EXISTS ll_cargo_discard_status_history (
id BIGINT NOT NULL COMMENT '主键ID' , application_id BIGINT NOT NULL COMMENT '申请单ID' , customer_id VARCHAR ( 128 ) NOT NULL COMMENT '客户租户ID' ,
from_status VARCHAR ( 32 ) NULL COMMENT '变更前状态' , to_status VARCHAR ( 32 ) NOT NULL COMMENT '变更后状态' , operator_id VARCHAR ( 128 ) NULL COMMENT '操作人ID' ,
remark VARCHAR ( 1000 ) NULL COMMENT '备注' , created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' , PRIMARY KEY ( id ),
KEY idx_ll_cargo_discard_history ( customer_id , application_id , created_at )
) ENGINE = InnoDB COMMENT = '货物废弃审批历史' ;
-- ============================================================================
-- 2026-08-18 / 022 overseas procurement approval, inventory and outbound flow.
-- ============================================================================
USE baiyue_lastleg ;
CREATE TABLE IF NOT EXISTS ll_overseas_procurement_order (
id BIGINT NOT NULL COMMENT '主键ID' , customer_id VARCHAR ( 128 ) NOT NULL COMMENT '客户租户ID' , customer_name VARCHAR ( 255 ) NULL COMMENT '客户名称快照' ,
order_no VARCHAR ( 64 ) NOT NULL COMMENT '订单号' , purchase_category VARCHAR ( 128 ) NOT NULL COMMENT '采购品类' , product_name VARCHAR ( 255 ) NOT NULL COMMENT '产品名称' ,
product_specification VARCHAR ( 500 ) NULL COMMENT '产品规格' , product_url VARCHAR ( 2000 ) NULL COMMENT '产品链接' , purchase_quantity BIGINT NOT NULL COMMENT '采购数量' ,
budget_unit_price DECIMAL ( 18 , 2 ) NULL COMMENT '预算单价' , currency CHAR ( 3 ) NOT NULL DEFAULT 'USD' COMMENT '币种' , receiving_address VARCHAR ( 1000 ) NULL COMMENT '收货地址' ,
contact_name VARCHAR ( 128 ) NOT NULL COMMENT '联系人姓名' , contact_phone VARCHAR ( 64 ) NOT NULL COMMENT '联系人电话' , purchase_warehouse_id VARCHAR ( 128 ) NULL COMMENT '采购入仓仓库ID' ,
purchase_warehouse_name VARCHAR ( 255 ) NULL COMMENT '采购入仓仓库名称' , inbound_quantity BIGINT NOT NULL DEFAULT 0 COMMENT '累计入库数量' , outbound_quantity BIGINT NOT NULL DEFAULT 0 COMMENT '累计出库数量' ,
domestic_carrier VARCHAR ( 128 ) NULL COMMENT '境内承运商' , domestic_tracking_no VARCHAR ( 128 ) NULL COMMENT '境内物流单号' , overseas_carrier VARCHAR ( 128 ) NULL COMMENT '海外承运商' ,
overseas_tracking_no VARCHAR ( 128 ) NULL COMMENT '海外物流单号' , estimated_arrival_at DATETIME ( 3 ) NULL COMMENT '预计到达时间' , status VARCHAR ( 32 ) NOT NULL DEFAULT 'PENDING_REVIEW' COMMENT '业务状态' ,
remark VARCHAR ( 1000 ) NULL COMMENT '备注' , idempotency_key VARCHAR ( 255 ) NOT NULL COMMENT '业务幂等键' , request_hash CHAR ( 64 ) NOT NULL COMMENT '请求内容哈希' ,
created_by VARCHAR ( 128 ) NULL COMMENT '创建人ID' , reviewed_by VARCHAR ( 128 ) NULL COMMENT '审核人ID' , review_remark VARCHAR ( 1000 ) NULL COMMENT '审核备注' , reviewed_at DATETIME ( 3 ) NULL COMMENT '审核时间' ,
version BIGINT NOT NULL DEFAULT 0 COMMENT '乐观锁版本' , created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' ,
updated_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) ON UPDATE CURRENT_TIMESTAMP ( 3 ) COMMENT '更新时间' , PRIMARY KEY ( id ),
UNIQUE KEY uk_ll_overseas_procurement_order_no ( customer_id , order_no ), UNIQUE KEY uk_ll_overseas_procurement_order_key ( customer_id , idempotency_key ),
KEY idx_ll_overseas_procurement_list ( customer_id , status , created_at ), KEY idx_ll_overseas_procurement_warehouse ( customer_id , purchase_warehouse_id , created_at )
) ENGINE = InnoDB COMMENT = '海外采购订单' ;
CREATE TABLE IF NOT EXISTS ll_overseas_procurement_outbound (
id BIGINT NOT NULL COMMENT '主键ID' , order_id BIGINT NOT NULL COMMENT '订单ID' , customer_id VARCHAR ( 128 ) NOT NULL COMMENT '客户租户ID' , quantity BIGINT NOT NULL COMMENT '数量' ,
outbound_no VARCHAR ( 128 ) NOT NULL COMMENT '出库单号' , carrier VARCHAR ( 128 ) NULL COMMENT '承运商' , tracking_no VARCHAR ( 128 ) NULL COMMENT '物流跟踪号' , outbound_at DATETIME ( 3 ) NOT NULL COMMENT '出库时间' ,
remark VARCHAR ( 1000 ) NULL COMMENT '备注' , created_by VARCHAR ( 128 ) NULL COMMENT '创建人ID' , created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' , PRIMARY KEY ( id ),
UNIQUE KEY uk_ll_overseas_procurement_outbound_no ( customer_id , order_id , outbound_no ), KEY idx_ll_overseas_procurement_outbound_order ( customer_id , order_id , outbound_at )
) ENGINE = InnoDB COMMENT = '海外采购出库记录' ;
CREATE TABLE IF NOT EXISTS ll_overseas_procurement_status_history (
id BIGINT NOT NULL COMMENT '主键ID' , order_id BIGINT NOT NULL COMMENT '订单ID' , customer_id VARCHAR ( 128 ) NOT NULL COMMENT '客户租户ID' ,
from_status VARCHAR ( 32 ) NULL COMMENT '变更前状态' , to_status VARCHAR ( 32 ) NOT NULL COMMENT '变更后状态' , operator_id VARCHAR ( 128 ) NULL COMMENT '操作人ID' , remark VARCHAR ( 1000 ) NULL COMMENT '备注' ,
created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' , PRIMARY KEY ( id ), KEY idx_ll_overseas_procurement_history ( customer_id , order_id , created_at )
) ENGINE = InnoDB COMMENT = '海外采购审核历史' ;
-- 2026-08-18 / 023 US domestic trucking customer and platform workflow.
USE baiyue_lastleg ;
CREATE TABLE IF NOT EXISTS ll_us_truck_order (
id BIGINT NOT NULL COMMENT '主键ID' , customer_id VARCHAR ( 128 ) NOT NULL COMMENT '客户租户ID' , order_no VARCHAR ( 64 ) NOT NULL COMMENT '订单号' ,
transport_type VARCHAR ( 32 ) NULL COMMENT '运输类型' , origin VARCHAR ( 255 ) NOT NULL COMMENT '起运地' , origin_address VARCHAR ( 500 ) NULL COMMENT '起运地址' ,
destination VARCHAR ( 255 ) NOT NULL COMMENT '目的地' , destination_address VARCHAR ( 500 ) NULL COMMENT '目的地址' , container_type VARCHAR ( 32 ) NULL COMMENT '历史兼容设备类型,零担托盘业务不采集' ,
pallet_count INT NOT NULL DEFAULT 1 COMMENT '客户申报托盘数' , package_count INT NULL COMMENT '可选箱数,零或空值均有效' ,
received_pallet_count INT NOT NULL DEFAULT 0 COMMENT 'PDA实收托盘数' ,
allocated_pallet_count INT NOT NULL DEFAULT 0 COMMENT '已分配到合车行程的托盘数' , shipped_pallet_count INT NOT NULL DEFAULT 0 COMMENT '已出库托盘数' ,
total_weight_kg DECIMAL ( 18 , 3 ) NOT NULL DEFAULT 0 COMMENT '总重量(千克)' ,
total_volume_cbm DECIMAL ( 18 , 6 ) NOT NULL DEFAULT 0 COMMENT '总体积(立方米)' , budget_amount DECIMAL ( 18 , 2 ) NULL COMMENT '预算金额' ,
currency VARCHAR ( 3 ) NOT NULL DEFAULT 'USD' COMMENT '币种' , contact_name VARCHAR ( 128 ) NOT NULL COMMENT '联系人姓名' ,
contact_info VARCHAR ( 128 ) NOT NULL COMMENT '联系人联系方式' , requested_date DATE NOT NULL COMMENT '要求服务日期' , status VARCHAR ( 32 ) NOT NULL COMMENT '美国卡车订单状态' ,
remark VARCHAR ( 1000 ) NULL COMMENT '备注' , receipt_idempotency_key VARCHAR ( 255 ) NULL COMMENT '实物收货幂等键' ,
receipt_request_hash CHAR ( 64 ) NULL COMMENT '实物收货请求哈希' ,
idempotency_key VARCHAR ( 255 ) NOT NULL COMMENT '业务幂等键' , request_hash CHAR ( 64 ) NOT NULL COMMENT '请求内容哈希' ,
created_by VARCHAR ( 128 ) NULL COMMENT '创建人ID' , version BIGINT NOT NULL DEFAULT 0 COMMENT '乐观锁版本' ,
created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' , updated_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '更新时间' ,
PRIMARY KEY ( id ), UNIQUE KEY uk_ll_us_truck_order_no ( customer_id , order_no ),
UNIQUE KEY uk_ll_us_truck_order_key ( customer_id , idempotency_key ),
KEY idx_ll_us_truck_order_list ( customer_id , status , created_at ),
KEY idx_ll_us_truck_order_date ( customer_id , requested_date , created_at )
) ENGINE = InnoDB COMMENT = '美国卡车运输订单' ;
CREATE TABLE IF NOT EXISTS ll_us_truck_order_status_history (
id BIGINT NOT NULL COMMENT '主键ID' , order_id BIGINT NOT NULL COMMENT '订单ID' , customer_id VARCHAR ( 128 ) NOT NULL COMMENT '客户租户ID' ,
from_status VARCHAR ( 32 ) NULL COMMENT '变更前状态' , to_status VARCHAR ( 32 ) NOT NULL COMMENT '变更后状态' , operator_id VARCHAR ( 128 ) NULL COMMENT '操作人ID' ,
remark VARCHAR ( 1000 ) NULL COMMENT '备注' , created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' ,
PRIMARY KEY ( id ), KEY idx_ll_us_truck_history ( customer_id , order_id , created_at )
) ENGINE = InnoDB COMMENT = '美国卡车订单状态历史' ;
-- ============================================================================
-- 2026-08-18 / 024 warehouse transfer inventory allocation, outbound and receipt.
-- Creation and approval remain document-only. Inventory moves on outbound and receipt.
-- ============================================================================
USE baiyue_lastleg ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND column_name = 'allocation_idempotency_key' ), 'SELECT 1' , 'ALTER TABLE ll_warehouse_transfer_order ADD COLUMN allocation_idempotency_key VARCHAR(255) NULL COMMENT ''库存分配幂等键'' AFTER status' ));
PREPARE transfer_inventory_024 FROM @ ddl ; EXECUTE transfer_inventory_024 ; DEALLOCATE PREPARE transfer_inventory_024 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND column_name = 'allocation_request_hash' ), 'SELECT 1' , 'ALTER TABLE ll_warehouse_transfer_order ADD COLUMN allocation_request_hash CHAR(64) NULL COMMENT ''库存分配请求哈希'' AFTER allocation_idempotency_key' ));
PREPARE transfer_inventory_024 FROM @ ddl ; EXECUTE transfer_inventory_024 ; DEALLOCATE PREPARE transfer_inventory_024 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND column_name = 'outbound_idempotency_key' ), 'SELECT 1' , 'ALTER TABLE ll_warehouse_transfer_order ADD COLUMN outbound_idempotency_key VARCHAR(255) NULL COMMENT ''出库幂等键'' AFTER allocation_request_hash' ));
PREPARE transfer_inventory_024 FROM @ ddl ; EXECUTE transfer_inventory_024 ; DEALLOCATE PREPARE transfer_inventory_024 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND column_name = 'outbound_request_hash' ), 'SELECT 1' , 'ALTER TABLE ll_warehouse_transfer_order ADD COLUMN outbound_request_hash CHAR(64) NULL COMMENT ''出库请求哈希'' AFTER outbound_idempotency_key' ));
PREPARE transfer_inventory_024 FROM @ ddl ; EXECUTE transfer_inventory_024 ; DEALLOCATE PREPARE transfer_inventory_024 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND column_name = 'outbound_at' ), 'SELECT 1' , 'ALTER TABLE ll_warehouse_transfer_order ADD COLUMN outbound_at DATETIME(3) NULL COMMENT ''出库时间'' AFTER outbound_request_hash' ));
PREPARE transfer_inventory_024 FROM @ ddl ; EXECUTE transfer_inventory_024 ; DEALLOCATE PREPARE transfer_inventory_024 ;
CREATE TABLE IF NOT EXISTS ll_warehouse_transfer_inventory_allocation (
id BIGINT NOT NULL COMMENT '雪花主键' , transfer_order_id BIGINT NOT NULL COMMENT '转仓单ID' , customer_id VARCHAR ( 128 ) NOT NULL COMMENT '客户租户ID' ,
inventory_position_id BIGINT NOT NULL COMMENT '来源库存仓位记录ID' , inventory_balance_id BIGINT NOT NULL COMMENT '来源库存余额记录ID' ,
inbound_order_id BIGINT NOT NULL COMMENT '来源入仓单ID' , inbound_code VARCHAR ( 128 ) NOT NULL COMMENT '来源入仓单号快照' ,
pallet_id BIGINT NOT NULL COMMENT '来源托盘ID' , pallet_no VARCHAR ( 128 ) NOT NULL COMMENT '来源托盘号快照' , package_count INT NOT NULL COMMENT '分配箱数' ,
status VARCHAR ( 32 ) NOT NULL DEFAULT 'RESERVED' COMMENT '分配状态' , active_position_key VARCHAR ( 255 ) NULL COMMENT '生效中的仓位排他键' ,
allocated_at DATETIME ( 3 ) NOT NULL COMMENT '分配时间' , shipped_at DATETIME ( 3 ) NULL COMMENT '出库时间' , received_at DATETIME ( 3 ) NULL COMMENT '收货时间' ,
created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' ,
updated_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) ON UPDATE CURRENT_TIMESTAMP ( 3 ) COMMENT '更新时间' , PRIMARY KEY ( id )
) ENGINE = InnoDB COMMENT = '转仓单来源库存分配记录' ;
CREATE TABLE IF NOT EXISTS ll_warehouse_transfer_receipt (
id BIGINT NOT NULL COMMENT '雪花主键' , transfer_order_id BIGINT NOT NULL COMMENT '转仓单ID' , allocation_id BIGINT NOT NULL COMMENT '库存分配记录ID' ,
customer_id VARCHAR ( 128 ) NOT NULL COMMENT '客户租户ID' , source_inventory_position_id BIGINT NOT NULL COMMENT '来源库存仓位记录ID' ,
destination_inventory_balance_id BIGINT NOT NULL COMMENT '目标库存余额记录ID' , destination_inventory_position_id BIGINT NOT NULL COMMENT '目标库存仓位记录ID' ,
package_count INT NOT NULL COMMENT '收货箱数' , idempotency_key VARCHAR ( 255 ) NOT NULL COMMENT '收货幂等键' , request_hash CHAR ( 64 ) NOT NULL COMMENT '收货请求哈希' ,
inventory_operation_key VARCHAR ( 255 ) NOT NULL COMMENT '库存操作幂等键' , created_by VARCHAR ( 128 ) NULL COMMENT '创建人ID' ,
received_at DATETIME ( 3 ) NOT NULL COMMENT '收货时间' , created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' , PRIMARY KEY ( id )
) ENGINE = InnoDB COMMENT = '转仓来源仓位的目标库存收货记录' ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_inventory_allocation' AND index_name = 'uk_ll_wh_transfer_allocation_position' ), 'SELECT 1' , 'ALTER TABLE ll_warehouse_transfer_inventory_allocation ADD UNIQUE KEY uk_ll_wh_transfer_allocation_position(transfer_order_id,inventory_position_id)' ));
PREPARE transfer_inventory_024 FROM @ ddl ; EXECUTE transfer_inventory_024 ; DEALLOCATE PREPARE transfer_inventory_024 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_inventory_allocation' AND index_name = 'uk_ll_wh_transfer_active_position' ), 'SELECT 1' , 'ALTER TABLE ll_warehouse_transfer_inventory_allocation ADD UNIQUE KEY uk_ll_wh_transfer_active_position(customer_id,active_position_key)' ));
PREPARE transfer_inventory_024 FROM @ ddl ; EXECUTE transfer_inventory_024 ; DEALLOCATE PREPARE transfer_inventory_024 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_inventory_allocation' AND index_name = 'idx_ll_wh_transfer_allocation_list' ), 'SELECT 1' , 'ALTER TABLE ll_warehouse_transfer_inventory_allocation ADD KEY idx_ll_wh_transfer_allocation_list(customer_id,transfer_order_id,status)' ));
PREPARE transfer_inventory_024 FROM @ ddl ; EXECUTE transfer_inventory_024 ; DEALLOCATE PREPARE transfer_inventory_024 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_receipt' AND index_name = 'uk_ll_wh_transfer_receipt_source' ), 'SELECT 1' , 'ALTER TABLE ll_warehouse_transfer_receipt ADD UNIQUE KEY uk_ll_wh_transfer_receipt_source(transfer_order_id,source_inventory_position_id)' ));
PREPARE transfer_inventory_024 FROM @ ddl ; EXECUTE transfer_inventory_024 ; DEALLOCATE PREPARE transfer_inventory_024 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_receipt' AND index_name = 'uk_ll_wh_transfer_receipt_key' ), 'SELECT 1' , 'ALTER TABLE ll_warehouse_transfer_receipt ADD UNIQUE KEY uk_ll_wh_transfer_receipt_key(customer_id,idempotency_key)' ));
PREPARE transfer_inventory_024 FROM @ ddl ; EXECUTE transfer_inventory_024 ; DEALLOCATE PREPARE transfer_inventory_024 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_receipt' AND index_name = 'uk_ll_wh_transfer_receipt_operation' ), 'SELECT 1' , 'ALTER TABLE ll_warehouse_transfer_receipt ADD UNIQUE KEY uk_ll_wh_transfer_receipt_operation(customer_id,inventory_operation_key)' ));
PREPARE transfer_inventory_024 FROM @ ddl ; EXECUTE transfer_inventory_024 ; DEALLOCATE PREPARE transfer_inventory_024 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_receipt' AND index_name = 'idx_ll_wh_transfer_receipt_list' ), 'SELECT 1' , 'ALTER TABLE ll_warehouse_transfer_receipt ADD KEY idx_ll_wh_transfer_receipt_list(customer_id,transfer_order_id,received_at)' ));
PREPARE transfer_inventory_024 FROM @ ddl ; EXECUTE transfer_inventory_024 ; DEALLOCATE PREPARE transfer_inventory_024 ;
-- 2026-08-18 / 024 Pallet-first US domestic trucking receipt workflow.
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'transport_type' AND is_nullable = 'NO' ), 'ALTER TABLE ll_us_truck_order MODIFY COLUMN transport_type VARCHAR(32) NULL COMMENT ''运输类型''' , 'SELECT 1' ));
PREPARE us_truck_transport_type_stmt FROM @ ddl ; EXECUTE us_truck_transport_type_stmt ; DEALLOCATE PREPARE us_truck_transport_type_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'container_type' AND is_nullable = 'NO' ), 'ALTER TABLE ll_us_truck_order MODIFY COLUMN container_type VARCHAR(32) NULL COMMENT ''历史兼容设备类型,零担托盘业务不采集''' , 'SELECT 1' ));
PREPARE us_truck_container_type_stmt FROM @ ddl ; EXECUTE us_truck_container_type_stmt ; DEALLOCATE PREPARE us_truck_container_type_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'pallet_count' ), 'SELECT 1' , 'ALTER TABLE ll_us_truck_order ADD COLUMN pallet_count INT NOT NULL DEFAULT 1 COMMENT ''客户申报托盘数'' AFTER container_type' ));
PREPARE us_truck_pallet_count_stmt FROM @ ddl ; EXECUTE us_truck_pallet_count_stmt ; DEALLOCATE PREPARE us_truck_pallet_count_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'received_pallet_count' ), 'SELECT 1' , 'ALTER TABLE ll_us_truck_order ADD COLUMN received_pallet_count INT NOT NULL DEFAULT 0 COMMENT ''PDA实收托盘数'' AFTER package_count' ));
PREPARE us_truck_received_stmt FROM @ ddl ; EXECUTE us_truck_received_stmt ; DEALLOCATE PREPARE us_truck_received_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'allocated_pallet_count' ), 'SELECT 1' , 'ALTER TABLE ll_us_truck_order ADD COLUMN allocated_pallet_count INT NOT NULL DEFAULT 0 COMMENT ''已分配到合车行程的托盘数'' AFTER received_pallet_count' ));
PREPARE us_truck_allocated_stmt FROM @ ddl ; EXECUTE us_truck_allocated_stmt ; DEALLOCATE PREPARE us_truck_allocated_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'shipped_pallet_count' ), 'SELECT 1' , 'ALTER TABLE ll_us_truck_order ADD COLUMN shipped_pallet_count INT NOT NULL DEFAULT 0 COMMENT ''已出库托盘数'' AFTER allocated_pallet_count' ));
PREPARE us_truck_shipped_stmt FROM @ ddl ; EXECUTE us_truck_shipped_stmt ; DEALLOCATE PREPARE us_truck_shipped_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'receipt_idempotency_key' ), 'SELECT 1' , 'ALTER TABLE ll_us_truck_order ADD COLUMN receipt_idempotency_key VARCHAR(255) NULL COMMENT ''实物收货幂等键'' AFTER remark' ));
PREPARE us_truck_receipt_key_stmt FROM @ ddl ; EXECUTE us_truck_receipt_key_stmt ; DEALLOCATE PREPARE us_truck_receipt_key_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'receipt_request_hash' ), 'SELECT 1' , 'ALTER TABLE ll_us_truck_order ADD COLUMN receipt_request_hash CHAR(64) NULL COMMENT ''实物收货请求哈希'' AFTER receipt_idempotency_key' ));
PREPARE us_truck_receipt_hash_stmt FROM @ ddl ; EXECUTE us_truck_receipt_hash_stmt ; DEALLOCATE PREPARE us_truck_receipt_hash_stmt ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND index_name = 'uk_ll_us_truck_receipt_key' ), 'SELECT 1' , 'ALTER TABLE ll_us_truck_order ADD UNIQUE KEY uk_ll_us_truck_receipt_key(customer_id,receipt_idempotency_key)' ));
PREPARE us_truck_receipt_index_stmt FROM @ ddl ; EXECUTE us_truck_receipt_index_stmt ; DEALLOCATE PREPARE us_truck_receipt_index_stmt ;
CREATE TABLE IF NOT EXISTS ll_us_truck_order_pallet (
id BIGINT NOT NULL COMMENT '托盘记录ID' , order_id BIGINT NOT NULL COMMENT '美国卡车订单ID' , customer_id VARCHAR ( 128 ) NOT NULL COMMENT '客户租户ID' ,
pallet_no VARCHAR ( 128 ) NOT NULL COMMENT '业务托盘号' , sequence_no INT NOT NULL COMMENT '订单内托盘序号' , source VARCHAR ( 32 ) NOT NULL COMMENT '托盘来源:订单计划或PDA超收' ,
status VARCHAR ( 32 ) NOT NULL COMMENT '托盘状态:待收、已收或超收待审核' , warehouse_pallet_id BIGINT NULL COMMENT '仓库实物托盘资源ID' , package_count INT NULL COMMENT '托盘箱数' ,
received_at DATETIME ( 3 ) NULL COMMENT '实收时间' , created_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) COMMENT '创建时间' ,
updated_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) ON UPDATE CURRENT_TIMESTAMP ( 3 ) COMMENT '更新时间' ,
PRIMARY KEY ( id ), UNIQUE KEY uk_ll_us_truck_order_pallet_no ( customer_id , order_id , pallet_no ),
UNIQUE KEY uk_ll_us_truck_order_pallet_seq ( customer_id , order_id , sequence_no ),
KEY idx_ll_us_truck_order_pallet_list ( customer_id , order_id , status )
) ENGINE = InnoDB COMMENT = '美国卡车订单托盘实收记录' ; +
-- ============================================================================
2026-08-20 18:02:38 +08:00
CREATE TABLE IF NOT EXISTS ll_inbound_plan_carton (
id BIGINT NOT NULL COMMENT '箱唛作业主键' , customer_id VARCHAR ( 128 ) NOT NULL COMMENT '客户租户ID' ,
order_id BIGINT NULL COMMENT '海外首扫确权后的尾程订单ID' , source_inbound_detail_id VARCHAR ( 128 ) NOT NULL COMMENT '来源入库明细ID' ,
sku_code VARCHAR ( 128 ) NULL COMMENT 'SKU编码快照' , carton_mark VARCHAR ( 128 ) NOT NULL COMMENT '国内冻结箱唛' ,
destination_warehouse_id VARCHAR ( 128 ) NULL COMMENT '目的仓ID快照' , destination_warehouse_code VARCHAR ( 128 ) NULL COMMENT '目的仓编码快照' ,
destination_warehouse_name VARCHAR ( 255 ) NULL COMMENT '目的仓名称快照' , plan_id BIGINT NULL COMMENT '海外入库计划ID' ,
line_id BIGINT NULL COMMENT '入库计划明细ID' , plan_pallet_id BIGINT NULL COMMENT '海外计划托盘ID' , warehouse_pallet_id BIGINT NULL COMMENT '海外实物托盘ID' ,
warehouse_location_id BIGINT NULL COMMENT '海外库位ID' , pda_task_id BIGINT NULL COMMENT '首次扫码PDA任务ID' ,
status VARCHAR ( 32 ) NOT NULL COMMENT '箱唛状态:UNASSIGNED、ON_PALLET、AVAILABLE' , version INT NOT NULL DEFAULT 0 COMMENT '乐观锁版本' ,
bound_at DATETIME ( 3 ) NULL COMMENT '绑定托盘时间' , received_at DATETIME ( 3 ) NULL COMMENT '完成入库时间' ,
updated_at DATETIME ( 3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ( 3 ) ON UPDATE CURRENT_TIMESTAMP ( 3 ) COMMENT '更新时间' ,
PRIMARY KEY ( id ), UNIQUE KEY uk_ll_inbound_carton_mark ( customer_id , carton_mark ),
KEY idx_ll_inbound_carton_plan ( plan_id , status ), KEY idx_ll_inbound_carton_pallet ( plan_pallet_id , status ),
KEY idx_ll_inbound_carton_order ( order_id , status )
) ENGINE = InnoDB COMMENT = '柜次冻结箱唛及海外入库箱级作业账' ;
2026-08-19 16:24:02 +08:00
-- 2026-08-18 / 025 Chinese table and column comments for Lastleg and Warehouse.
-- Idempotently updates metadata for databases where CREATE TABLE already ran.
-- ============================================================================
USE baiyue_lastleg ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_loading_event_inbox' AND COALESCE ( table_comment , '' ) <> '头程装柜完成事件接收幂等箱' ), 'ALTER TABLE ll_loading_event_inbox COMMENT = ''头程装柜完成事件接收幂等箱''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_loading_event_inbox' AND column_name = 'event_id' AND COALESCE ( column_comment , '' ) <> '事件全局唯一标识' ), 'ALTER TABLE ll_loading_event_inbox MODIFY COLUMN event_id VARCHAR(128) NOT NULL COMMENT ''事件全局唯一标识''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_loading_event_inbox' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '租户/客户账号标识' ), 'ALTER TABLE ll_loading_event_inbox MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''租户/客户账号标识''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_loading_event_inbox' AND column_name = 'event_type' AND COALESCE ( column_comment , '' ) <> '事件类型' ), 'ALTER TABLE ll_loading_event_inbox MODIFY COLUMN event_type VARCHAR(64) NOT NULL COMMENT ''事件类型''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_loading_event_inbox' AND column_name = 'event_version' AND COALESCE ( column_comment , '' ) <> '事件契约版本' ), 'ALTER TABLE ll_loading_event_inbox MODIFY COLUMN event_version INT NOT NULL COMMENT ''事件契约版本''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_loading_event_inbox' AND column_name = 'payload_hash' AND COALESCE ( column_comment , '' ) <> '规范化事件负载 SHA-256 摘要' ), 'ALTER TABLE ll_loading_event_inbox MODIFY COLUMN payload_hash VARCHAR(71) NOT NULL COMMENT ''规范化事件负载 SHA-256 摘要''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_loading_event_inbox' AND column_name = 'payload_json' AND COALESCE ( column_comment , '' ) <> '事件冻结负载 JSON' ), 'ALTER TABLE ll_loading_event_inbox MODIFY COLUMN payload_json JSON NOT NULL COMMENT ''事件冻结负载 JSON''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_loading_event_inbox' AND column_name = 'status' AND COALESCE ( column_comment , '' ) <> '消费状态:RECEIVED/PROCESSED' ), 'ALTER TABLE ll_loading_event_inbox MODIFY COLUMN status VARCHAR(32) NOT NULL DEFAULT ''RECEIVED'' COMMENT ''消费状态:RECEIVED/PROCESSED''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_loading_event_inbox' AND column_name = 'received_at' AND COALESCE ( column_comment , '' ) <> '接收时间' ), 'ALTER TABLE ll_loading_event_inbox MODIFY COLUMN received_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''接收时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_loading_event_inbox' AND column_name = 'processed_at' AND COALESCE ( column_comment , '' ) <> '处理完成时间' ), 'ALTER TABLE ll_loading_event_inbox MODIFY COLUMN processed_at DATETIME(3) NULL COMMENT ''处理完成时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_loading_event_inbox' AND column_name = 'last_error' AND COALESCE ( column_comment , '' ) <> '最近一次处理错误' ), 'ALTER TABLE ll_loading_event_inbox MODIFY COLUMN last_error VARCHAR(1000) NULL COMMENT ''最近一次处理错误''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_order' AND COALESCE ( table_comment , '' ) <> '尾程订单主表' ), 'ALTER TABLE ll_order COMMENT = ''尾程订单主表''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '雪花 ID' ), 'ALTER TABLE ll_order MODIFY COLUMN id BIGINT NOT NULL COMMENT ''雪花 ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'order_no' AND COALESCE ( column_comment , '' ) <> '尾程单号' ), 'ALTER TABLE ll_order MODIFY COLUMN order_no VARCHAR(32) NOT NULL COMMENT ''尾程单号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '租户/客户账号标识' ), 'ALTER TABLE ll_order MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''租户/客户账号标识''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'order_type' AND COALESCE ( column_comment , '' ) <> '订单类型' ), 'ALTER TABLE ll_order MODIFY COLUMN order_type VARCHAR(32) NOT NULL DEFAULT ''FIRST_LEG'' COMMENT ''订单类型''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'inbound_code' AND COALESCE ( column_comment , '' ) <> '入仓码' ), 'ALTER TABLE ll_order MODIFY COLUMN inbound_code VARCHAR(128) NOT NULL COMMENT ''入仓码''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'source_region' AND COALESCE ( column_comment , '' ) <> '来源区域/系统' ), 'ALTER TABLE ll_order MODIFY COLUMN source_region VARCHAR(32) NOT NULL COMMENT ''来源区域/系统''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'source_inbound_id' AND COALESCE ( column_comment , '' ) <> '最终实装 LOADED 分片 ID,建单幂等键' ), 'ALTER TABLE ll_order MODIFY COLUMN source_inbound_id VARCHAR(128) NOT NULL COMMENT ''最终实装 LOADED 分片 ID,建单幂等键''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'root_inbound_id' AND COALESCE ( column_comment , '' ) <> '根入仓单 ID' ), 'ALTER TABLE ll_order MODIFY COLUMN root_inbound_id VARCHAR(128) COMMENT ''根入仓单 ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'source_order_id' AND COALESCE ( column_comment , '' ) <> '来源订单 ID' ), 'ALTER TABLE ll_order MODIFY COLUMN source_order_id VARCHAR(128) COMMENT ''来源订单 ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'source_order_no' AND COALESCE ( column_comment , '' ) <> '来源订单号' ), 'ALTER TABLE ll_order MODIFY COLUMN source_order_no VARCHAR(128) COMMENT ''来源订单号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'root_order_id' AND COALESCE ( column_comment , '' ) <> '根订单 ID' ), 'ALTER TABLE ll_order MODIFY COLUMN root_order_id VARCHAR(128) COMMENT ''根订单 ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'customer_name' AND COALESCE ( column_comment , '' ) <> '货主名称' ), 'ALTER TABLE ll_order MODIFY COLUMN customer_name VARCHAR(255) COMMENT ''货主名称''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'overseas_warehouse_id' AND COALESCE ( column_comment , '' ) <> '海外仓 ID' ), 'ALTER TABLE ll_order MODIFY COLUMN overseas_warehouse_id VARCHAR(128) COMMENT ''海外仓 ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'overseas_warehouse_name' AND COALESCE ( column_comment , '' ) <> '海外仓名称' ), 'ALTER TABLE ll_order MODIFY COLUMN overseas_warehouse_name VARCHAR(255) COMMENT ''海外仓名称''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'transfer_warehouse_id' AND COALESCE ( column_comment , '' ) <> '转入目的仓 ID' ), 'ALTER TABLE ll_order MODIFY COLUMN transfer_warehouse_id VARCHAR(128) COMMENT ''转入目的仓 ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'transfer_warehouse_code' AND COALESCE ( column_comment , '' ) <> '转入目的仓编码' ), 'ALTER TABLE ll_order MODIFY COLUMN transfer_warehouse_code VARCHAR(128) COMMENT ''转入目的仓编码''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'transfer_warehouse_name' AND COALESCE ( column_comment , '' ) <> '转入目的仓名称' ), 'ALTER TABLE ll_order MODIFY COLUMN transfer_warehouse_name VARCHAR(255) COMMENT ''转入目的仓名称''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'fba_warehouse_code' AND COALESCE ( column_comment , '' ) <> 'FBA 仓库编码' ), 'ALTER TABLE ll_order MODIFY COLUMN fba_warehouse_code VARCHAR(128) COMMENT ''FBA 仓库编码''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'container_no' AND COALESCE ( column_comment , '' ) <> '集装箱号' ), 'ALTER TABLE ll_order MODIFY COLUMN container_no VARCHAR(64) COMMENT ''集装箱号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'container_status' AND COALESCE ( column_comment , '' ) <> '货柜状态' ), 'ALTER TABLE ll_order MODIFY COLUMN container_status VARCHAR(32) DEFAULT ''待转柜'' COMMENT ''货柜状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'abnormal' AND COALESCE ( column_comment , '' ) <> '是否异常:0否1是' ), 'ALTER TABLE ll_order MODIFY COLUMN abnormal TINYINT NOT NULL DEFAULT 0 COMMENT ''是否异常:0否1是''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'detained' AND COALESCE ( column_comment , '' ) <> '是否暂扣:0否1是' ), 'ALTER TABLE ll_order MODIFY COLUMN detained TINYINT NOT NULL DEFAULT 0 COMMENT ''是否暂扣:0否1是''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'pallet_count' AND COALESCE ( column_comment , '' ) <> '托数' ), 'ALTER TABLE ll_order MODIFY COLUMN pallet_count INT NOT NULL DEFAULT 0 COMMENT ''托数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'package_count' AND COALESCE ( column_comment , '' ) <> '箱数' ), 'ALTER TABLE ll_order MODIFY COLUMN package_count INT NOT NULL DEFAULT 0 COMMENT ''箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'picked_package_count' AND COALESCE ( column_comment , '' ) <> '累计已拣箱数' ), 'ALTER TABLE ll_order MODIFY COLUMN picked_package_count INT NOT NULL DEFAULT 0 COMMENT ''累计已拣箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'shipped_package_count' AND COALESCE ( column_comment , '' ) <> '累计已出库箱数' ), 'ALTER TABLE ll_order MODIFY COLUMN shipped_package_count INT NOT NULL DEFAULT 0 COMMENT ''累计已出库箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'volume_cbm' AND COALESCE ( column_comment , '' ) <> '体积(立方米)' ), 'ALTER TABLE ll_order MODIFY COLUMN volume_cbm DECIMAL(18,4) COMMENT ''体积(立方米)''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'product_quantity' AND COALESCE ( column_comment , '' ) <> '货物数量' ), 'ALTER TABLE ll_order MODIFY COLUMN product_quantity INT COMMENT ''货物数量''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'volume_weight_kg' AND COALESCE ( column_comment , '' ) <> '体积重量(千克)' ), 'ALTER TABLE ll_order MODIFY COLUMN volume_weight_kg DECIMAL(18,4) COMMENT ''体积重量(千克)''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'estimated_arrival_at' AND COALESCE ( column_comment , '' ) <> '预计到港时间' ), 'ALTER TABLE ll_order MODIFY COLUMN estimated_arrival_at DATETIME(3) COMMENT ''预计到港时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'actual_arrival_at' AND COALESCE ( column_comment , '' ) <> '实际到港时间' ), 'ALTER TABLE ll_order MODIFY COLUMN actual_arrival_at DATETIME(3) COMMENT ''实际到港时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'estimated_warehouse_at' AND COALESCE ( column_comment , '' ) <> '预计到仓时间' ), 'ALTER TABLE ll_order MODIFY COLUMN estimated_warehouse_at DATETIME(3) COMMENT ''预计到仓时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'inbound_order_no' AND COALESCE ( column_comment , '' ) <> '入库单号' ), 'ALTER TABLE ll_order MODIFY COLUMN inbound_order_no VARCHAR(128) COMMENT ''入库单号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'outbound_order_no' AND COALESCE ( column_comment , '' ) <> '出库单号' ), 'ALTER TABLE ll_order MODIFY COLUMN outbound_order_no VARCHAR(128) COMMENT ''出库单号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'delivery_order_no' AND COALESCE ( column_comment , '' ) <> '派送单号' ), 'ALTER TABLE ll_order MODIFY COLUMN delivery_order_no VARCHAR(128) COMMENT ''派送单号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'relabel_order_no' AND COALESCE ( column_comment , '' ) <> '换标单号' ), 'ALTER TABLE ll_order MODIFY COLUMN relabel_order_no VARCHAR(128) COMMENT ''换标单号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'relabel_status' AND COALESCE ( column_comment , '' ) <> '换标状态' ), 'ALTER TABLE ll_order MODIFY COLUMN relabel_status VARCHAR(32) COMMENT ''换标状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'pallet_merge_flag' AND COALESCE ( column_comment , '' ) <> '合托标记' ), 'ALTER TABLE ll_order MODIFY COLUMN pallet_merge_flag VARCHAR(32) COMMENT ''合托标记''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'current_status' AND COALESCE ( column_comment , '' ) <> '当前业务状态' ), 'ALTER TABLE ll_order MODIFY COLUMN current_status VARCHAR(32) NOT NULL DEFAULT ''PENDING_ASSIGNMENT'' COMMENT ''当前业务状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'private_remark' AND COALESCE ( column_comment , '' ) <> '备注(仅自己)' ), 'ALTER TABLE ll_order MODIFY COLUMN private_remark VARCHAR(1000) COMMENT ''备注(仅自己)''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'customer_remark' AND COALESCE ( column_comment , '' ) <> '备注(客户)' ), 'ALTER TABLE ll_order MODIFY COLUMN customer_remark VARCHAR(1000) COMMENT ''备注(客户)''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'warehouse_remark' AND COALESCE ( column_comment , '' ) <> '备注(仓库)' ), 'ALTER TABLE ll_order MODIFY COLUMN warehouse_remark VARCHAR(1000) COMMENT ''备注(仓库)''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'source_event_id' AND COALESCE ( column_comment , '' ) <> '来源事件 ID' ), 'ALTER TABLE ll_order MODIFY COLUMN source_event_id VARCHAR(128) NOT NULL COMMENT ''来源事件 ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'source_loading_plan_id' AND COALESCE ( column_comment , '' ) <> '来源装柜计划 ID' ), 'ALTER TABLE ll_order MODIFY COLUMN source_loading_plan_id VARCHAR(128) NOT NULL COMMENT ''来源装柜计划 ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
2026-08-20 18:02:38 +08:00
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'source_container_booking_id' AND COALESCE ( column_comment , '' ) <> '来源头程货柜预订ID' ), 'ALTER TABLE ll_order MODIFY COLUMN source_container_booking_id VARCHAR(128) NULL COMMENT ''来源头程货柜预订ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_carton' AND COALESCE ( table_comment , '' ) <> '柜次冻结箱唛及海外入库箱级作业账' ), 'ALTER TABLE ll_inbound_plan_carton COMMENT = ''柜次冻结箱唛及海外入库箱级作业账''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_carton' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '箱唛作业主键' ), 'ALTER TABLE ll_inbound_plan_carton MODIFY COLUMN id BIGINT NOT NULL COMMENT ''箱唛作业主键''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_carton' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_inbound_plan_carton MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_carton' AND column_name = 'order_id' AND COALESCE ( column_comment , '' ) <> '海外首扫确权后的尾程订单ID' ), 'ALTER TABLE ll_inbound_plan_carton MODIFY COLUMN order_id BIGINT NULL COMMENT ''海外首扫确权后的尾程订单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_carton' AND column_name = 'source_inbound_detail_id' AND COALESCE ( column_comment , '' ) <> '来源入库明细ID' ), 'ALTER TABLE ll_inbound_plan_carton MODIFY COLUMN source_inbound_detail_id VARCHAR(128) NOT NULL COMMENT ''来源入库明细ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_carton' AND column_name = 'sku_code' AND COALESCE ( column_comment , '' ) <> 'SKU编码快照' ), 'ALTER TABLE ll_inbound_plan_carton MODIFY COLUMN sku_code VARCHAR(128) NULL COMMENT ''SKU编码快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_carton' AND column_name = 'carton_mark' AND COALESCE ( column_comment , '' ) <> '国内冻结箱唛' ), 'ALTER TABLE ll_inbound_plan_carton MODIFY COLUMN carton_mark VARCHAR(128) NOT NULL COMMENT ''国内冻结箱唛''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_carton' AND column_name = 'destination_warehouse_id' AND COALESCE ( column_comment , '' ) <> '目的仓ID快照' ), 'ALTER TABLE ll_inbound_plan_carton MODIFY COLUMN destination_warehouse_id VARCHAR(128) NULL COMMENT ''目的仓ID快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_carton' AND column_name = 'destination_warehouse_code' AND COALESCE ( column_comment , '' ) <> '目的仓编码快照' ), 'ALTER TABLE ll_inbound_plan_carton MODIFY COLUMN destination_warehouse_code VARCHAR(128) NULL COMMENT ''目的仓编码快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_carton' AND column_name = 'destination_warehouse_name' AND COALESCE ( column_comment , '' ) <> '目的仓名称快照' ), 'ALTER TABLE ll_inbound_plan_carton MODIFY COLUMN destination_warehouse_name VARCHAR(255) NULL COMMENT ''目的仓名称快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_carton' AND column_name = 'plan_id' AND COALESCE ( column_comment , '' ) <> '海外入库计划ID' ), 'ALTER TABLE ll_inbound_plan_carton MODIFY COLUMN plan_id BIGINT NULL COMMENT ''海外入库计划ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_carton' AND column_name = 'line_id' AND COALESCE ( column_comment , '' ) <> '入库计划明细ID' ), 'ALTER TABLE ll_inbound_plan_carton MODIFY COLUMN line_id BIGINT NULL COMMENT ''入库计划明细ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_carton' AND column_name = 'plan_pallet_id' AND COALESCE ( column_comment , '' ) <> '海外计划托盘ID' ), 'ALTER TABLE ll_inbound_plan_carton MODIFY COLUMN plan_pallet_id BIGINT NULL COMMENT ''海外计划托盘ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_carton' AND column_name = 'warehouse_pallet_id' AND COALESCE ( column_comment , '' ) <> '海外实物托盘ID' ), 'ALTER TABLE ll_inbound_plan_carton MODIFY COLUMN warehouse_pallet_id BIGINT NULL COMMENT ''海外实物托盘ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_carton' AND column_name = 'warehouse_location_id' AND COALESCE ( column_comment , '' ) <> '海外库位ID' ), 'ALTER TABLE ll_inbound_plan_carton MODIFY COLUMN warehouse_location_id BIGINT NULL COMMENT ''海外库位ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_carton' AND column_name = 'pda_task_id' AND COALESCE ( column_comment , '' ) <> '首次扫码PDA任务ID' ), 'ALTER TABLE ll_inbound_plan_carton MODIFY COLUMN pda_task_id BIGINT NULL COMMENT ''首次扫码PDA任务ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_carton' AND column_name = 'status' AND COALESCE ( column_comment , '' ) <> '箱唛状态:UNASSIGNED、ON_PALLET、AVAILABLE' ), 'ALTER TABLE ll_inbound_plan_carton MODIFY COLUMN status VARCHAR(32) NOT NULL COMMENT ''箱唛状态:UNASSIGNED、ON_PALLET、AVAILABLE''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_carton' AND column_name = 'version' AND COALESCE ( column_comment , '' ) <> '乐观锁版本' ), 'ALTER TABLE ll_inbound_plan_carton MODIFY COLUMN version INT NOT NULL DEFAULT 0 COMMENT ''乐观锁版本''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_carton' AND column_name = 'bound_at' AND COALESCE ( column_comment , '' ) <> '绑定托盘时间' ), 'ALTER TABLE ll_inbound_plan_carton MODIFY COLUMN bound_at DATETIME(3) NULL COMMENT ''绑定托盘时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_carton' AND column_name = 'received_at' AND COALESCE ( column_comment , '' ) <> '完成入库时间' ), 'ALTER TABLE ll_inbound_plan_carton MODIFY COLUMN received_at DATETIME(3) NULL COMMENT ''完成入库时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_carton' AND column_name = 'updated_at' AND COALESCE ( column_comment , '' ) <> '更新时间' ), 'ALTER TABLE ll_inbound_plan_carton MODIFY COLUMN updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT ''更新时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
2026-08-19 16:24:02 +08:00
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'source_loading_plan_version' AND COALESCE ( column_comment , '' ) <> '来源装柜计划版本' ), 'ALTER TABLE ll_order MODIFY COLUMN source_loading_plan_version BIGINT COMMENT ''来源装柜计划版本''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'source_handover_version' AND COALESCE ( column_comment , '' ) <> '交接版本' ), 'ALTER TABLE ll_order MODIFY COLUMN source_handover_version BIGINT COMMENT ''交接版本''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'source_payload_hash' AND COALESCE ( column_comment , '' ) <> '来源事件负载摘要' ), 'ALTER TABLE ll_order MODIFY COLUMN source_payload_hash VARCHAR(71) NOT NULL COMMENT ''来源事件负载摘要''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_order MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'updated_at' AND COALESCE ( column_comment , '' ) <> '更新时间' ), 'ALTER TABLE ll_order MODIFY COLUMN updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT ''更新时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_order_detail' AND COALESCE ( table_comment , '' ) <> '尾程订单实装商品冻结明细' ), 'ALTER TABLE ll_order_detail COMMENT = ''尾程订单实装商品冻结明细''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order_detail' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '订单明细主键' ), 'ALTER TABLE ll_order_detail MODIFY COLUMN id BIGINT NOT NULL AUTO_INCREMENT COMMENT ''订单明细主键''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order_detail' AND column_name = 'order_id' AND COALESCE ( column_comment , '' ) <> '尾程订单 ID' ), 'ALTER TABLE ll_order_detail MODIFY COLUMN order_id BIGINT NOT NULL COMMENT ''尾程订单 ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order_detail' AND column_name = 'source_inbound_detail_id' AND COALESCE ( column_comment , '' ) <> '来源入仓明细 ID' ), 'ALTER TABLE ll_order_detail MODIFY COLUMN source_inbound_detail_id VARCHAR(128) NOT NULL COMMENT ''来源入仓明细 ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order_detail' AND column_name = 'sku_code' AND COALESCE ( column_comment , '' ) <> 'SKU 编码' ), 'ALTER TABLE ll_order_detail MODIFY COLUMN sku_code VARCHAR(128) COMMENT ''SKU 编码''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order_detail' AND column_name = 'product_name_zh' AND COALESCE ( column_comment , '' ) <> '中文品名' ), 'ALTER TABLE ll_order_detail MODIFY COLUMN product_name_zh VARCHAR(255) COMMENT ''中文品名''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order_detail' AND column_name = 'product_name_en' AND COALESCE ( column_comment , '' ) <> '英文品名' ), 'ALTER TABLE ll_order_detail MODIFY COLUMN product_name_en VARCHAR(255) COMMENT ''英文品名''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order_detail' AND column_name = 'package_count' AND COALESCE ( column_comment , '' ) <> '箱数' ), 'ALTER TABLE ll_order_detail MODIFY COLUMN package_count INT NOT NULL DEFAULT 0 COMMENT ''箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order_detail' AND column_name = 'product_quantity' AND COALESCE ( column_comment , '' ) <> '数量' ), 'ALTER TABLE ll_order_detail MODIFY COLUMN product_quantity INT COMMENT ''数量''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order_detail' AND column_name = 'pallet_count' AND COALESCE ( column_comment , '' ) <> '托数' ), 'ALTER TABLE ll_order_detail MODIFY COLUMN pallet_count INT COMMENT ''托数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order_detail' AND column_name = 'gross_weight_kg' AND COALESCE ( column_comment , '' ) <> '毛重(千克)' ), 'ALTER TABLE ll_order_detail MODIFY COLUMN gross_weight_kg DECIMAL(18,4) COMMENT ''毛重(千克)''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order_detail' AND column_name = 'net_weight_kg' AND COALESCE ( column_comment , '' ) <> '净重(千克)' ), 'ALTER TABLE ll_order_detail MODIFY COLUMN net_weight_kg DECIMAL(18,4) COMMENT ''净重(千克)''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order_detail' AND column_name = 'dimensional_weight_kg' AND COALESCE ( column_comment , '' ) <> '体积重量(千克)' ), 'ALTER TABLE ll_order_detail MODIFY COLUMN dimensional_weight_kg DECIMAL(18,4) COMMENT ''体积重量(千克)''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order_detail' AND column_name = 'volume_cbm' AND COALESCE ( column_comment , '' ) <> '体积(立方米)' ), 'ALTER TABLE ll_order_detail MODIFY COLUMN volume_cbm DECIMAL(18,4) COMMENT ''体积(立方米)''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order_detail' AND column_name = 'destination_warehouse_id' AND COALESCE ( column_comment , '' ) <> '目的仓 ID' ), 'ALTER TABLE ll_order_detail MODIFY COLUMN destination_warehouse_id VARCHAR(128) COMMENT ''目的仓 ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order_detail' AND column_name = 'destination_warehouse_code' AND COALESCE ( column_comment , '' ) <> '目的仓编码' ), 'ALTER TABLE ll_order_detail MODIFY COLUMN destination_warehouse_code VARCHAR(128) COMMENT ''目的仓编码''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order_detail' AND column_name = 'destination_warehouse_name' AND COALESCE ( column_comment , '' ) <> '目的仓名称' ), 'ALTER TABLE ll_order_detail MODIFY COLUMN destination_warehouse_name VARCHAR(255) COMMENT ''目的仓名称''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order_detail' AND column_name = 'fba_tracking_no' AND COALESCE ( column_comment , '' ) <> 'FBA跟踪号' ), 'ALTER TABLE ll_order_detail MODIFY COLUMN fba_tracking_no VARCHAR(255) COMMENT ''FBA跟踪号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order_detail' AND column_name = 'shipment_no' AND COALESCE ( column_comment , '' ) <> '货件编号' ), 'ALTER TABLE ll_order_detail MODIFY COLUMN shipment_no VARCHAR(255) COMMENT ''货件编号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order_detail' AND column_name = 'shipping_mark' AND COALESCE ( column_comment , '' ) <> '唛头' ), 'ALTER TABLE ll_order_detail MODIFY COLUMN shipping_mark VARCHAR(255) COMMENT ''唛头''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_loading_order_status_history' AND COALESCE ( table_comment , '' ) <> '尾程订单状态变更历史' ), 'ALTER TABLE ll_loading_order_status_history COMMENT = ''尾程订单状态变更历史''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_loading_order_status_history' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '状态历史主键' ), 'ALTER TABLE ll_loading_order_status_history MODIFY COLUMN id BIGINT NOT NULL AUTO_INCREMENT COMMENT ''状态历史主键''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_loading_order_status_history' AND column_name = 'order_id' AND COALESCE ( column_comment , '' ) <> '尾程订单 ID' ), 'ALTER TABLE ll_loading_order_status_history MODIFY COLUMN order_id BIGINT NOT NULL COMMENT ''尾程订单 ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_loading_order_status_history' AND column_name = 'from_status' AND COALESCE ( column_comment , '' ) <> '变更前状态' ), 'ALTER TABLE ll_loading_order_status_history MODIFY COLUMN from_status VARCHAR(32) COMMENT ''变更前状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_loading_order_status_history' AND column_name = 'to_status' AND COALESCE ( column_comment , '' ) <> '变更后状态' ), 'ALTER TABLE ll_loading_order_status_history MODIFY COLUMN to_status VARCHAR(32) NOT NULL COMMENT ''变更后状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_loading_order_status_history' AND column_name = 'event_id' AND COALESCE ( column_comment , '' ) <> '触发事件 ID' ), 'ALTER TABLE ll_loading_order_status_history MODIFY COLUMN event_id VARCHAR(128) COMMENT ''触发事件 ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_loading_order_status_history' AND column_name = 'remark' AND COALESCE ( column_comment , '' ) <> '状态变更备注' ), 'ALTER TABLE ll_loading_order_status_history MODIFY COLUMN remark VARCHAR(500) COMMENT ''状态变更备注''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_loading_order_status_history' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '记录时间' ), 'ALTER TABLE ll_loading_order_status_history MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''记录时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_event_conflict' AND COALESCE ( table_comment , '' ) <> '事件冲突记录' ), 'ALTER TABLE ll_event_conflict COMMENT = ''事件冲突记录''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_event_conflict' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '冲突记录主键' ), 'ALTER TABLE ll_event_conflict MODIFY COLUMN id BIGINT NOT NULL COMMENT ''冲突记录主键''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_event_conflict' AND column_name = 'event_id' AND COALESCE ( column_comment , '' ) <> '冲突事件 ID' ), 'ALTER TABLE ll_event_conflict MODIFY COLUMN event_id VARCHAR(128) NOT NULL COMMENT ''冲突事件 ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_event_conflict' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '租户 ID' ), 'ALTER TABLE ll_event_conflict MODIFY COLUMN customer_id BIGINT NOT NULL COMMENT ''租户 ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_event_conflict' AND column_name = 'conflict_type' AND COALESCE ( column_comment , '' ) <> '冲突类型' ), 'ALTER TABLE ll_event_conflict MODIFY COLUMN conflict_type VARCHAR(64) NOT NULL COMMENT ''冲突类型''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_event_conflict' AND column_name = 'conflict_message' AND COALESCE ( column_comment , '' ) <> '冲突说明' ), 'ALTER TABLE ll_event_conflict MODIFY COLUMN conflict_message VARCHAR(512) NOT NULL COMMENT ''冲突说明''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_event_conflict' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_event_conflict MODIFY COLUMN created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_event_inbox' AND COALESCE ( table_comment , '' ) <> '通用事件接收幂等箱' ), 'ALTER TABLE ll_event_inbox COMMENT = ''通用事件接收幂等箱''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_event_inbox' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '事件接收记录主键' ), 'ALTER TABLE ll_event_inbox MODIFY COLUMN id BIGINT NOT NULL COMMENT ''事件接收记录主键''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_event_inbox' AND column_name = 'event_id' AND COALESCE ( column_comment , '' ) <> '事件全局唯一 ID' ), 'ALTER TABLE ll_event_inbox MODIFY COLUMN event_id VARCHAR(128) NOT NULL COMMENT ''事件全局唯一 ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_event_inbox' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '租户 ID' ), 'ALTER TABLE ll_event_inbox MODIFY COLUMN customer_id BIGINT NOT NULL COMMENT ''租户 ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_event_inbox' AND column_name = 'event_type' AND COALESCE ( column_comment , '' ) <> '事件类型' ), 'ALTER TABLE ll_event_inbox MODIFY COLUMN event_type VARCHAR(128) NOT NULL COMMENT ''事件类型''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_event_inbox' AND column_name = 'aggregate_type' AND COALESCE ( column_comment , '' ) <> '聚合类型' ), 'ALTER TABLE ll_event_inbox MODIFY COLUMN aggregate_type VARCHAR(64) NOT NULL COMMENT ''聚合类型''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_event_inbox' AND column_name = 'aggregate_id' AND COALESCE ( column_comment , '' ) <> '聚合 ID' ), 'ALTER TABLE ll_event_inbox MODIFY COLUMN aggregate_id VARCHAR(128) NOT NULL COMMENT ''聚合 ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_event_inbox' AND column_name = 'aggregate_version' AND COALESCE ( column_comment , '' ) <> '聚合版本' ), 'ALTER TABLE ll_event_inbox MODIFY COLUMN aggregate_version BIGINT NOT NULL COMMENT ''聚合版本''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_event_inbox' AND column_name = 'payload_hash' AND COALESCE ( column_comment , '' ) <> '负载摘要' ), 'ALTER TABLE ll_event_inbox MODIFY COLUMN payload_hash VARCHAR(71) NOT NULL COMMENT ''负载摘要''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_event_inbox' AND column_name = 'status' AND COALESCE ( column_comment , '' ) <> '消费状态' ), 'ALTER TABLE ll_event_inbox MODIFY COLUMN status VARCHAR(32) NOT NULL COMMENT ''消费状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_event_inbox' AND column_name = 'error_message' AND COALESCE ( column_comment , '' ) <> '错误信息' ), 'ALTER TABLE ll_event_inbox MODIFY COLUMN error_message VARCHAR(512) NULL COMMENT ''错误信息''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_event_inbox' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_event_inbox MODIFY COLUMN created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_event_inbox' AND column_name = 'updated_at' AND COALESCE ( column_comment , '' ) <> '更新时间' ), 'ALTER TABLE ll_event_inbox MODIFY COLUMN updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT ''更新时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order' AND COALESCE ( table_comment , '' ) <> '尾程入仓单快照' ), 'ALTER TABLE ll_inbound_order COMMENT = ''尾程入仓单快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '入仓单主键' ), 'ALTER TABLE ll_inbound_order MODIFY COLUMN id BIGINT NOT NULL COMMENT ''入仓单主键''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '租户 ID' ), 'ALTER TABLE ll_inbound_order MODIFY COLUMN customer_id BIGINT NOT NULL COMMENT ''租户 ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order' AND column_name = 'source_region' AND COALESCE ( column_comment , '' ) <> '来源区域' ), 'ALTER TABLE ll_inbound_order MODIFY COLUMN source_region VARCHAR(32) NOT NULL COMMENT ''来源区域''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order' AND column_name = 'source_inbound_id' AND COALESCE ( column_comment , '' ) <> '来源入仓分片 ID' ), 'ALTER TABLE ll_inbound_order MODIFY COLUMN source_inbound_id VARCHAR(128) NOT NULL COMMENT ''来源入仓分片 ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order' AND column_name = 'root_inbound_id' AND COALESCE ( column_comment , '' ) <> '根入仓单 ID' ), 'ALTER TABLE ll_inbound_order MODIFY COLUMN root_inbound_id VARCHAR(128) NULL COMMENT ''根入仓单 ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order' AND column_name = 'source_order_id' AND COALESCE ( column_comment , '' ) <> '来源订单 ID' ), 'ALTER TABLE ll_inbound_order MODIFY COLUMN source_order_id VARCHAR(128) NULL COMMENT ''来源订单 ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order' AND column_name = 'source_order_no' AND COALESCE ( column_comment , '' ) <> '来源订单号' ), 'ALTER TABLE ll_inbound_order MODIFY COLUMN source_order_no VARCHAR(128) NULL COMMENT ''来源订单号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order' AND column_name = 'root_order_id' AND COALESCE ( column_comment , '' ) <> '根订单 ID' ), 'ALTER TABLE ll_inbound_order MODIFY COLUMN root_order_id VARCHAR(128) NULL COMMENT ''根订单 ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order' AND column_name = 'inbound_code' AND COALESCE ( column_comment , '' ) <> '入仓码' ), 'ALTER TABLE ll_inbound_order MODIFY COLUMN inbound_code VARCHAR(128) NULL COMMENT ''入仓码''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order' AND column_name = 'destination_warehouse_id' AND COALESCE ( column_comment , '' ) <> '目的仓 ID' ), 'ALTER TABLE ll_inbound_order MODIFY COLUMN destination_warehouse_id VARCHAR(128) NULL COMMENT ''目的仓 ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order' AND column_name = 'destination_warehouse_code' AND COALESCE ( column_comment , '' ) <> '目的仓编码' ), 'ALTER TABLE ll_inbound_order MODIFY COLUMN destination_warehouse_code VARCHAR(128) NULL COMMENT ''目的仓编码''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order' AND column_name = 'destination_warehouse_name' AND COALESCE ( column_comment , '' ) <> '目的仓名称' ), 'ALTER TABLE ll_inbound_order MODIFY COLUMN destination_warehouse_name VARCHAR(255) NULL COMMENT ''目的仓名称''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order' AND column_name = 'package_count' AND COALESCE ( column_comment , '' ) <> '箱数' ), 'ALTER TABLE ll_inbound_order MODIFY COLUMN package_count INT NOT NULL DEFAULT 0 COMMENT ''箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order' AND column_name = 'product_quantity' AND COALESCE ( column_comment , '' ) <> '数量' ), 'ALTER TABLE ll_inbound_order MODIFY COLUMN product_quantity INT NULL COMMENT ''数量''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order' AND column_name = 'pallet_count' AND COALESCE ( column_comment , '' ) <> '托数' ), 'ALTER TABLE ll_inbound_order MODIFY COLUMN pallet_count INT NULL COMMENT ''托数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order' AND column_name = 'gross_weight_kg' AND COALESCE ( column_comment , '' ) <> '毛重(千克)' ), 'ALTER TABLE ll_inbound_order MODIFY COLUMN gross_weight_kg DECIMAL(18,3) NULL COMMENT ''毛重(千克)''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order' AND column_name = 'net_weight_kg' AND COALESCE ( column_comment , '' ) <> '净重(千克)' ), 'ALTER TABLE ll_inbound_order MODIFY COLUMN net_weight_kg DECIMAL(18,3) NULL COMMENT ''净重(千克)''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order' AND column_name = 'volume_cbm' AND COALESCE ( column_comment , '' ) <> '体积(立方米)' ), 'ALTER TABLE ll_inbound_order MODIFY COLUMN volume_cbm DECIMAL(18,6) NULL COMMENT ''体积(立方米)''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order' AND column_name = 'source_event_id' AND COALESCE ( column_comment , '' ) <> '来源事件 ID' ), 'ALTER TABLE ll_inbound_order MODIFY COLUMN source_event_id VARCHAR(128) NOT NULL COMMENT ''来源事件 ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order' AND column_name = 'source_loading_plan_id' AND COALESCE ( column_comment , '' ) <> '装柜计划 ID' ), 'ALTER TABLE ll_inbound_order MODIFY COLUMN source_loading_plan_id VARCHAR(128) NOT NULL COMMENT ''装柜计划 ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order' AND column_name = 'source_loading_plan_version' AND COALESCE ( column_comment , '' ) <> '装柜计划版本' ), 'ALTER TABLE ll_inbound_order MODIFY COLUMN source_loading_plan_version BIGINT NOT NULL COMMENT ''装柜计划版本''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order' AND column_name = 'handover_version' AND COALESCE ( column_comment , '' ) <> '交接版本' ), 'ALTER TABLE ll_inbound_order MODIFY COLUMN handover_version BIGINT NOT NULL COMMENT ''交接版本''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order' AND column_name = 'payload_hash' AND COALESCE ( column_comment , '' ) <> '负载摘要' ), 'ALTER TABLE ll_inbound_order MODIFY COLUMN payload_hash VARCHAR(71) NOT NULL COMMENT ''负载摘要''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order' AND column_name = 'status' AND COALESCE ( column_comment , '' ) <> '入仓单状态' ), 'ALTER TABLE ll_inbound_order MODIFY COLUMN status VARCHAR(32) NOT NULL COMMENT ''入仓单状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order' AND column_name = 'exception_flag' AND COALESCE ( column_comment , '' ) <> '异常标记' ), 'ALTER TABLE ll_inbound_order MODIFY COLUMN exception_flag VARCHAR(32) NOT NULL DEFAULT ''NONE'' COMMENT ''异常标记''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_inbound_order MODIFY COLUMN created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order' AND column_name = 'updated_at' AND COALESCE ( column_comment , '' ) <> '更新时间' ), 'ALTER TABLE ll_inbound_order MODIFY COLUMN updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT ''更新时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order_item' AND COALESCE ( table_comment , '' ) <> '尾程入仓商品明细快照' ), 'ALTER TABLE ll_inbound_order_item COMMENT = ''尾程入仓商品明细快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order_item' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '入仓明细主键' ), 'ALTER TABLE ll_inbound_order_item MODIFY COLUMN id BIGINT NOT NULL COMMENT ''入仓明细主键''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order_item' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '租户 ID' ), 'ALTER TABLE ll_inbound_order_item MODIFY COLUMN customer_id BIGINT NOT NULL COMMENT ''租户 ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order_item' AND column_name = 'order_id' AND COALESCE ( column_comment , '' ) <> '入仓单 ID' ), 'ALTER TABLE ll_inbound_order_item MODIFY COLUMN order_id BIGINT NOT NULL COMMENT ''入仓单 ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order_item' AND column_name = 'source_inbound_detail_id' AND COALESCE ( column_comment , '' ) <> '来源入仓明细 ID' ), 'ALTER TABLE ll_inbound_order_item MODIFY COLUMN source_inbound_detail_id VARCHAR(128) NOT NULL COMMENT ''来源入仓明细 ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order_item' AND column_name = 'package_count' AND COALESCE ( column_comment , '' ) <> '箱数' ), 'ALTER TABLE ll_inbound_order_item MODIFY COLUMN package_count INT NOT NULL COMMENT ''箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order_item' AND column_name = 'product_quantity' AND COALESCE ( column_comment , '' ) <> '数量' ), 'ALTER TABLE ll_inbound_order_item MODIFY COLUMN product_quantity INT NULL COMMENT ''数量''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order_item' AND column_name = 'pallet_count' AND COALESCE ( column_comment , '' ) <> '托数' ), 'ALTER TABLE ll_inbound_order_item MODIFY COLUMN pallet_count INT NULL COMMENT ''托数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order_item' AND column_name = 'gross_weight_kg' AND COALESCE ( column_comment , '' ) <> '毛重(千克)' ), 'ALTER TABLE ll_inbound_order_item MODIFY COLUMN gross_weight_kg DECIMAL(18,3) NULL COMMENT ''毛重(千克)''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order_item' AND column_name = 'net_weight_kg' AND COALESCE ( column_comment , '' ) <> '净重(千克)' ), 'ALTER TABLE ll_inbound_order_item MODIFY COLUMN net_weight_kg DECIMAL(18,3) NULL COMMENT ''净重(千克)''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order_item' AND column_name = 'dimensional_weight_kg' AND COALESCE ( column_comment , '' ) <> '体积重量(千克)' ), 'ALTER TABLE ll_inbound_order_item MODIFY COLUMN dimensional_weight_kg DECIMAL(18,3) NULL COMMENT ''体积重量(千克)''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order_item' AND column_name = 'volume_cbm' AND COALESCE ( column_comment , '' ) <> '体积(立方米)' ), 'ALTER TABLE ll_inbound_order_item MODIFY COLUMN volume_cbm DECIMAL(18,6) NULL COMMENT ''体积(立方米)''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order_item' AND column_name = 'destination_warehouse_id' AND COALESCE ( column_comment , '' ) <> '目的仓 ID' ), 'ALTER TABLE ll_inbound_order_item MODIFY COLUMN destination_warehouse_id VARCHAR(128) NULL COMMENT ''目的仓 ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order_item' AND column_name = 'destination_warehouse_code' AND COALESCE ( column_comment , '' ) <> '目的仓编码' ), 'ALTER TABLE ll_inbound_order_item MODIFY COLUMN destination_warehouse_code VARCHAR(128) NULL COMMENT ''目的仓编码''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order_item' AND column_name = 'destination_warehouse_name' AND COALESCE ( column_comment , '' ) <> '目的仓名称' ), 'ALTER TABLE ll_inbound_order_item MODIFY COLUMN destination_warehouse_name VARCHAR(255) NULL COMMENT ''目的仓名称''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order_item' AND column_name = 'fba_tracking_no' AND COALESCE ( column_comment , '' ) <> 'FBA跟踪号' ), 'ALTER TABLE ll_inbound_order_item MODIFY COLUMN fba_tracking_no VARCHAR(128) NULL COMMENT ''FBA跟踪号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order_item' AND column_name = 'shipment_no' AND COALESCE ( column_comment , '' ) <> '货件编号' ), 'ALTER TABLE ll_inbound_order_item MODIFY COLUMN shipment_no VARCHAR(128) NULL COMMENT ''货件编号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order_item' AND column_name = 'shipping_mark' AND COALESCE ( column_comment , '' ) <> '唛头' ), 'ALTER TABLE ll_inbound_order_item MODIFY COLUMN shipping_mark VARCHAR(255) NULL COMMENT ''唛头''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order_item' AND column_name = 'sku_code' AND COALESCE ( column_comment , '' ) <> 'SKU 编码' ), 'ALTER TABLE ll_inbound_order_item MODIFY COLUMN sku_code VARCHAR(128) NULL COMMENT ''SKU 编码''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order_item' AND column_name = 'product_name_zh' AND COALESCE ( column_comment , '' ) <> '中文品名' ), 'ALTER TABLE ll_inbound_order_item MODIFY COLUMN product_name_zh VARCHAR(255) NULL COMMENT ''中文品名''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order_item' AND column_name = 'product_name_en' AND COALESCE ( column_comment , '' ) <> '英文品名' ), 'ALTER TABLE ll_inbound_order_item MODIFY COLUMN product_name_en VARCHAR(255) NULL COMMENT ''英文品名''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_order_item' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_inbound_order_item MODIFY COLUMN created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_order_status_history' AND COALESCE ( table_comment , '' ) <> '尾程订单状态历史' ), 'ALTER TABLE ll_order_status_history COMMENT = ''尾程订单状态历史''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order_status_history' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '订单状态历史主键' ), 'ALTER TABLE ll_order_status_history MODIFY COLUMN id BIGINT NOT NULL COMMENT ''订单状态历史主键''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order_status_history' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '租户 ID' ), 'ALTER TABLE ll_order_status_history MODIFY COLUMN customer_id BIGINT NOT NULL COMMENT ''租户 ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order_status_history' AND column_name = 'order_id' AND COALESCE ( column_comment , '' ) <> '订单 ID' ), 'ALTER TABLE ll_order_status_history MODIFY COLUMN order_id BIGINT NOT NULL COMMENT ''订单 ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order_status_history' AND column_name = 'from_status' AND COALESCE ( column_comment , '' ) <> '变更前状态' ), 'ALTER TABLE ll_order_status_history MODIFY COLUMN from_status VARCHAR(32) NULL COMMENT ''变更前状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order_status_history' AND column_name = 'to_status' AND COALESCE ( column_comment , '' ) <> '变更后状态' ), 'ALTER TABLE ll_order_status_history MODIFY COLUMN to_status VARCHAR(32) NOT NULL COMMENT ''变更后状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order_status_history' AND column_name = 'reason' AND COALESCE ( column_comment , '' ) <> '变更原因' ), 'ALTER TABLE ll_order_status_history MODIFY COLUMN reason VARCHAR(255) NULL COMMENT ''变更原因''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order_status_history' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '记录时间' ), 'ALTER TABLE ll_order_status_history MODIFY COLUMN created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT ''记录时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan' AND COALESCE ( table_comment , '' ) <> '尾程入库计划表:每个租户的每个集装箱生成一张入库单' ), 'ALTER TABLE ll_inbound_plan COMMENT = ''尾程入库计划表:每个租户的每个集装箱生成一张入库单''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '入库计划ID(雪花ID) ' ), 'ALTER TABLE ll_inbound_plan MODIFY COLUMN id BIGINT NOT NULL COMMENT ''入库计划ID(雪花ID) ''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan' AND column_name = 'plan_no' AND COALESCE ( column_comment , '' ) <> '入库单号' ), 'ALTER TABLE ll_inbound_plan MODIFY COLUMN plan_no VARCHAR(32) NOT NULL COMMENT ''入库单号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '租户/客户账号标识' ), 'ALTER TABLE ll_inbound_plan MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''租户/客户账号标识''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan' AND column_name = 'container_no' AND COALESCE ( column_comment , '' ) <> '集装箱号' ), 'ALTER TABLE ll_inbound_plan MODIFY COLUMN container_no VARCHAR(64) NOT NULL COMMENT ''集装箱号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan' AND column_name = 'status' AND COALESCE ( column_comment , '' ) <> '入库计划状态' ), 'ALTER TABLE ll_inbound_plan MODIFY COLUMN status VARCHAR(32) NOT NULL DEFAULT ''PLANNED'' COMMENT ''入库计划状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan' AND column_name = 'line_count' AND COALESCE ( column_comment , '' ) <> '入仓码明细数量' ), 'ALTER TABLE ll_inbound_plan MODIFY COLUMN line_count INT NOT NULL DEFAULT 0 COMMENT ''入仓码明细数量''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan' AND column_name = 'pallet_count' AND COALESCE ( column_comment , '' ) <> '系统自动分配托盘数量' ), 'ALTER TABLE ll_inbound_plan MODIFY COLUMN pallet_count INT NOT NULL DEFAULT 0 COMMENT ''系统自动分配托盘数量''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan' AND column_name = 'total_volume_cbm' AND COALESCE ( column_comment , '' ) <> '集装箱总体积(立方米)' ), 'ALTER TABLE ll_inbound_plan MODIFY COLUMN total_volume_cbm DECIMAL(18,4) NOT NULL DEFAULT 0 COMMENT ''集装箱总体积(立方米)''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_inbound_plan MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan' AND column_name = 'updated_at' AND COALESCE ( column_comment , '' ) <> '更新时间' ), 'ALTER TABLE ll_inbound_plan MODIFY COLUMN updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT ''更新时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_line' AND COALESCE ( table_comment , '' ) <> '尾程入库计划明细表:按入仓码和尾程订单维度记录' ), 'ALTER TABLE ll_inbound_plan_line COMMENT = ''尾程入库计划明细表:按入仓码和尾程订单维度记录''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_line' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '入库计划明细ID(雪花ID) ' ), 'ALTER TABLE ll_inbound_plan_line MODIFY COLUMN id BIGINT NOT NULL COMMENT ''入库计划明细ID(雪花ID) ''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_line' AND column_name = 'plan_id' AND COALESCE ( column_comment , '' ) <> '入库计划ID' ), 'ALTER TABLE ll_inbound_plan_line MODIFY COLUMN plan_id BIGINT NOT NULL COMMENT ''入库计划ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_line' AND column_name = 'order_id' AND COALESCE ( column_comment , '' ) <> '尾程订单ID' ), 'ALTER TABLE ll_inbound_plan_line MODIFY COLUMN order_id BIGINT NOT NULL COMMENT ''尾程订单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_line' AND column_name = 'inbound_code' AND COALESCE ( column_comment , '' ) <> '头程入仓码快照' ), 'ALTER TABLE ll_inbound_plan_line MODIFY COLUMN inbound_code VARCHAR(128) NOT NULL COMMENT ''头程入仓码快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_line' AND column_name = 'destination_warehouse_id' AND COALESCE ( column_comment , '' ) <> '目的仓ID快照' ), 'ALTER TABLE ll_inbound_plan_line MODIFY COLUMN destination_warehouse_id VARCHAR(128) NULL COMMENT ''目的仓ID快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_line' AND column_name = 'destination_warehouse_code' AND COALESCE ( column_comment , '' ) <> '目的仓编码快照' ), 'ALTER TABLE ll_inbound_plan_line MODIFY COLUMN destination_warehouse_code VARCHAR(128) NULL COMMENT ''目的仓编码快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_line' AND column_name = 'destination_warehouse_name' AND COALESCE ( column_comment , '' ) <> '目的仓名称快照' ), 'ALTER TABLE ll_inbound_plan_line MODIFY COLUMN destination_warehouse_name VARCHAR(255) NULL COMMENT ''目的仓名称快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_line' AND column_name = 'volume_cbm' AND COALESCE ( column_comment , '' ) <> '入仓码体积(立方米)' ), 'ALTER TABLE ll_inbound_plan_line MODIFY COLUMN volume_cbm DECIMAL(18,4) NOT NULL DEFAULT 0 COMMENT ''入仓码体积(立方米)''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_line' AND column_name = 'planned_pallet_count' AND COALESCE ( column_comment , '' ) <> '该明细分配的托盘数量' ), 'ALTER TABLE ll_inbound_plan_line MODIFY COLUMN planned_pallet_count INT NOT NULL DEFAULT 0 COMMENT ''该明细分配的托盘数量''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_pallet' AND COALESCE ( table_comment , '' ) <> '尾程入库计划托盘表:按目的仓隔离合托' ), 'ALTER TABLE ll_inbound_plan_pallet COMMENT = ''尾程入库计划托盘表:按目的仓隔离合托''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_pallet' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '计划托盘ID(雪花ID) ' ), 'ALTER TABLE ll_inbound_plan_pallet MODIFY COLUMN id BIGINT NOT NULL COMMENT ''计划托盘ID(雪花ID) ''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_pallet' AND column_name = 'plan_id' AND COALESCE ( column_comment , '' ) <> '入库计划ID' ), 'ALTER TABLE ll_inbound_plan_pallet MODIFY COLUMN plan_id BIGINT NOT NULL COMMENT ''入库计划ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_pallet' AND column_name = 'pallet_no' AND COALESCE ( column_comment , '' ) <> '计划托盘编号' ), 'ALTER TABLE ll_inbound_plan_pallet MODIFY COLUMN pallet_no VARCHAR(64) NOT NULL COMMENT ''计划托盘编号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_pallet' AND column_name = 'destination_warehouse_id' AND COALESCE ( column_comment , '' ) <> '目的仓ID快照' ), 'ALTER TABLE ll_inbound_plan_pallet MODIFY COLUMN destination_warehouse_id VARCHAR(128) NULL COMMENT ''目的仓ID快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_pallet' AND column_name = 'destination_warehouse_code' AND COALESCE ( column_comment , '' ) <> '目的仓编码快照' ), 'ALTER TABLE ll_inbound_plan_pallet MODIFY COLUMN destination_warehouse_code VARCHAR(128) NULL COMMENT ''目的仓编码快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_pallet' AND column_name = 'destination_warehouse_name' AND COALESCE ( column_comment , '' ) <> '目的仓名称快照' ), 'ALTER TABLE ll_inbound_plan_pallet MODIFY COLUMN destination_warehouse_name VARCHAR(255) NULL COMMENT ''目的仓名称快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_pallet' AND column_name = 'capacity_cbm' AND COALESCE ( column_comment , '' ) <> '托盘容量,固定为2立方米' ), 'ALTER TABLE ll_inbound_plan_pallet MODIFY COLUMN capacity_cbm DECIMAL(18,4) NOT NULL DEFAULT 2.0000 COMMENT ''托盘容量,固定为2立方米''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_pallet' AND column_name = 'allocated_volume_cbm' AND COALESCE ( column_comment , '' ) <> '已分配体积(立方米)' ), 'ALTER TABLE ll_inbound_plan_pallet MODIFY COLUMN allocated_volume_cbm DECIMAL(18,4) NOT NULL DEFAULT 0 COMMENT ''已分配体积(立方米)''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_pallet' AND column_name = 'sequence_no' AND COALESCE ( column_comment , '' ) <> '计划内托盘序号' ), 'ALTER TABLE ll_inbound_plan_pallet MODIFY COLUMN sequence_no INT NOT NULL COMMENT ''计划内托盘序号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_pallet_allocation' AND COALESCE ( table_comment , '' ) <> '尾程入库计划托盘分配表:记录入仓码明细与计划托盘的分配关系' ), 'ALTER TABLE ll_inbound_plan_pallet_allocation COMMENT = ''尾程入库计划托盘分配表:记录入仓码明细与计划托盘的分配关系''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_pallet_allocation' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '托盘分配记录ID(雪花ID) ' ), 'ALTER TABLE ll_inbound_plan_pallet_allocation MODIFY COLUMN id BIGINT NOT NULL COMMENT ''托盘分配记录ID(雪花ID) ''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_pallet_allocation' AND column_name = 'plan_id' AND COALESCE ( column_comment , '' ) <> '入库计划ID' ), 'ALTER TABLE ll_inbound_plan_pallet_allocation MODIFY COLUMN plan_id BIGINT NOT NULL COMMENT ''入库计划ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_pallet_allocation' AND column_name = 'line_id' AND COALESCE ( column_comment , '' ) <> '入库计划明细ID' ), 'ALTER TABLE ll_inbound_plan_pallet_allocation MODIFY COLUMN line_id BIGINT NOT NULL COMMENT ''入库计划明细ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_pallet_allocation' AND column_name = 'pallet_id' AND COALESCE ( column_comment , '' ) <> '计划托盘ID' ), 'ALTER TABLE ll_inbound_plan_pallet_allocation MODIFY COLUMN pallet_id BIGINT NOT NULL COMMENT ''计划托盘ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan_pallet_allocation' AND column_name = 'allocated_volume_cbm' AND COALESCE ( column_comment , '' ) <> '该明细分配到托盘的体积(立方米)' ), 'ALTER TABLE ll_inbound_plan_pallet_allocation MODIFY COLUMN allocated_volume_cbm DECIMAL(18,4) NOT NULL COMMENT ''该明细分配到托盘的体积(立方米)''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pda_task' AND COALESCE ( table_comment , '' ) <> '入仓PDA作业任务' ), 'ALTER TABLE ll_inbound_pda_task COMMENT = ''入仓PDA作业任务''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pda_task' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_inbound_pda_task MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pda_task' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_inbound_pda_task MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pda_task' AND column_name = 'plan_id' AND COALESCE ( column_comment , '' ) <> '入仓计划ID' ), 'ALTER TABLE ll_inbound_pda_task MODIFY COLUMN plan_id BIGINT NOT NULL COMMENT ''入仓计划ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pda_task' AND column_name = 'task_no' AND COALESCE ( column_comment , '' ) <> 'PDA任务号' ), 'ALTER TABLE ll_inbound_pda_task MODIFY COLUMN task_no VARCHAR(64) NOT NULL COMMENT ''PDA任务号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pda_task' AND column_name = 'status' AND COALESCE ( column_comment , '' ) <> '业务状态' ), 'ALTER TABLE ll_inbound_pda_task MODIFY COLUMN status VARCHAR(32) NOT NULL DEFAULT ''PENDING'' COMMENT ''业务状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pda_task' AND column_name = 'operator_id' AND COALESCE ( column_comment , '' ) <> '操作人ID' ), 'ALTER TABLE ll_inbound_pda_task MODIFY COLUMN operator_id VARCHAR(128) NULL COMMENT ''操作人ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pda_task' AND column_name = 'operator_name' AND COALESCE ( column_comment , '' ) <> '操作人姓名' ), 'ALTER TABLE ll_inbound_pda_task MODIFY COLUMN operator_name VARCHAR(255) NULL COMMENT ''操作人姓名''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pda_task' AND column_name = 'pushed_at' AND COALESCE ( column_comment , '' ) <> '任务下发时间' ), 'ALTER TABLE ll_inbound_pda_task MODIFY COLUMN pushed_at DATETIME(3) NULL COMMENT ''任务下发时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pda_task' AND column_name = 'started_at' AND COALESCE ( column_comment , '' ) <> '开始时间' ), 'ALTER TABLE ll_inbound_pda_task MODIFY COLUMN started_at DATETIME(3) NULL COMMENT ''开始时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pda_task' AND column_name = 'completed_at' AND COALESCE ( column_comment , '' ) <> '完成时间' ), 'ALTER TABLE ll_inbound_pda_task MODIFY COLUMN completed_at DATETIME(3) NULL COMMENT ''完成时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pda_task' AND column_name = 'version' AND COALESCE ( column_comment , '' ) <> '乐观锁版本' ), 'ALTER TABLE ll_inbound_pda_task MODIFY COLUMN version INT NOT NULL DEFAULT 0 COMMENT ''乐观锁版本''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pda_task' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_inbound_pda_task MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pda_task' AND column_name = 'updated_at' AND COALESCE ( column_comment , '' ) <> '更新时间' ), 'ALTER TABLE ll_inbound_pda_task MODIFY COLUMN updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT ''更新时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pda_operation' AND COALESCE ( table_comment , '' ) <> '入仓PDA操作幂等记录' ), 'ALTER TABLE ll_inbound_pda_operation COMMENT = ''入仓PDA操作幂等记录''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pda_operation' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_inbound_pda_operation MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pda_operation' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_inbound_pda_operation MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pda_operation' AND column_name = 'task_id' AND COALESCE ( column_comment , '' ) <> 'PDA任务ID' ), 'ALTER TABLE ll_inbound_pda_operation MODIFY COLUMN task_id BIGINT NOT NULL COMMENT ''PDA任务ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pda_operation' AND column_name = 'allocation_id' AND COALESCE ( column_comment , '' ) <> '分配记录ID' ), 'ALTER TABLE ll_inbound_pda_operation MODIFY COLUMN allocation_id BIGINT NULL COMMENT ''分配记录ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pda_operation' AND column_name = 'action' AND COALESCE ( column_comment , '' ) <> '操作动作' ), 'ALTER TABLE ll_inbound_pda_operation MODIFY COLUMN action VARCHAR(32) NOT NULL COMMENT ''操作动作''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pda_operation' AND column_name = 'idempotency_key' AND COALESCE ( column_comment , '' ) <> '业务幂等键' ), 'ALTER TABLE ll_inbound_pda_operation MODIFY COLUMN idempotency_key VARCHAR(255) NOT NULL COMMENT ''业务幂等键''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pda_operation' AND column_name = 'request_hash' AND COALESCE ( column_comment , '' ) <> '请求内容哈希' ), 'ALTER TABLE ll_inbound_pda_operation MODIFY COLUMN request_hash VARCHAR(128) NOT NULL COMMENT ''请求内容哈希''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pda_operation' AND column_name = 'request_json' AND COALESCE ( column_comment , '' ) <> '请求内容JSON' ), 'ALTER TABLE ll_inbound_pda_operation MODIFY COLUMN request_json LONGTEXT NOT NULL COMMENT ''请求内容JSON''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pda_operation' AND column_name = 'result_json' AND COALESCE ( column_comment , '' ) <> '处理结果JSON' ), 'ALTER TABLE ll_inbound_pda_operation MODIFY COLUMN result_json LONGTEXT NOT NULL COMMENT ''处理结果JSON''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pda_operation' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_inbound_pda_operation MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pallet_merge' AND COALESCE ( table_comment , '' ) <> '入仓托盘合托记录' ), 'ALTER TABLE ll_inbound_pallet_merge COMMENT = ''入仓托盘合托记录''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pallet_merge' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_inbound_pallet_merge MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pallet_merge' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_inbound_pallet_merge MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pallet_merge' AND column_name = 'task_id' AND COALESCE ( column_comment , '' ) <> 'PDA任务ID' ), 'ALTER TABLE ll_inbound_pallet_merge MODIFY COLUMN task_id BIGINT NOT NULL COMMENT ''PDA任务ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pallet_merge' AND column_name = 'merge_group_no' AND COALESCE ( column_comment , '' ) <> '合托分组号' ), 'ALTER TABLE ll_inbound_pallet_merge MODIFY COLUMN merge_group_no VARCHAR(64) NOT NULL COMMENT ''合托分组号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pallet_merge' AND column_name = 'source_pallet_id' AND COALESCE ( column_comment , '' ) <> '来源托盘ID' ), 'ALTER TABLE ll_inbound_pallet_merge MODIFY COLUMN source_pallet_id BIGINT NOT NULL COMMENT ''来源托盘ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pallet_merge' AND column_name = 'target_pallet_id' AND COALESCE ( column_comment , '' ) <> '目标托盘ID' ), 'ALTER TABLE ll_inbound_pallet_merge MODIFY COLUMN target_pallet_id BIGINT NOT NULL COMMENT ''目标托盘ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pallet_merge' AND column_name = 'source_allocation_id' AND COALESCE ( column_comment , '' ) <> '来源分配记录ID' ), 'ALTER TABLE ll_inbound_pallet_merge MODIFY COLUMN source_allocation_id BIGINT NOT NULL COMMENT ''来源分配记录ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pallet_merge' AND column_name = 'target_allocation_id' AND COALESCE ( column_comment , '' ) <> '目标分配记录ID' ), 'ALTER TABLE ll_inbound_pallet_merge MODIFY COLUMN target_allocation_id BIGINT NOT NULL COMMENT ''目标分配记录ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pallet_merge' AND column_name = 'source_line_id' AND COALESCE ( column_comment , '' ) <> '来源计划明细ID' ), 'ALTER TABLE ll_inbound_pallet_merge MODIFY COLUMN source_line_id BIGINT NOT NULL COMMENT ''来源计划明细ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pallet_merge' AND column_name = 'target_line_id' AND COALESCE ( column_comment , '' ) <> '目标计划明细ID' ), 'ALTER TABLE ll_inbound_pallet_merge MODIFY COLUMN target_line_id BIGINT NOT NULL COMMENT ''目标计划明细ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pallet_merge' AND column_name = 'source_order_id' AND COALESCE ( column_comment , '' ) <> '来源订单ID' ), 'ALTER TABLE ll_inbound_pallet_merge MODIFY COLUMN source_order_id BIGINT NOT NULL COMMENT ''来源订单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pallet_merge' AND column_name = 'target_order_id' AND COALESCE ( column_comment , '' ) <> '目标订单ID' ), 'ALTER TABLE ll_inbound_pallet_merge MODIFY COLUMN target_order_id BIGINT NOT NULL COMMENT ''目标订单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pallet_merge' AND column_name = 'moved_package_count' AND COALESCE ( column_comment , '' ) <> '移动箱数' ), 'ALTER TABLE ll_inbound_pallet_merge MODIFY COLUMN moved_package_count INT NOT NULL COMMENT ''移动箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pallet_merge' AND column_name = 'moved_volume_cbm' AND COALESCE ( column_comment , '' ) <> '移动体积(立方米)' ), 'ALTER TABLE ll_inbound_pallet_merge MODIFY COLUMN moved_volume_cbm DECIMAL(18,4) NOT NULL DEFAULT 0 COMMENT ''移动体积(立方米)''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pallet_merge' AND column_name = 'source_pallet_scrapped' AND COALESCE ( column_comment , '' ) <> '来源托盘是否已报废' ), 'ALTER TABLE ll_inbound_pallet_merge MODIFY COLUMN source_pallet_scrapped TINYINT NOT NULL DEFAULT 0 COMMENT ''来源托盘是否已报废''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pallet_merge' AND column_name = 'status' AND COALESCE ( column_comment , '' ) <> '业务状态' ), 'ALTER TABLE ll_inbound_pallet_merge MODIFY COLUMN status VARCHAR(32) NOT NULL COMMENT ''业务状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pallet_merge' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_inbound_pallet_merge MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_inbound_fba_appointment' AND COALESCE ( table_comment , '' ) <> 'FBA入仓预约单' ), 'ALTER TABLE ll_inbound_fba_appointment COMMENT = ''FBA入仓预约单''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_fba_appointment' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_inbound_fba_appointment MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_fba_appointment' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_inbound_fba_appointment MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_fba_appointment' AND column_name = 'appointment_no' AND COALESCE ( column_comment , '' ) <> '预约单号' ), 'ALTER TABLE ll_inbound_fba_appointment MODIFY COLUMN appointment_no VARCHAR(64) NOT NULL COMMENT ''预约单号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_fba_appointment' AND column_name = 'appointment_at' AND COALESCE ( column_comment , '' ) <> '预约时间' ), 'ALTER TABLE ll_inbound_fba_appointment MODIFY COLUMN appointment_at DATETIME(3) NOT NULL COMMENT ''预约时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_fba_appointment' AND column_name = 'appointment_status' AND COALESCE ( column_comment , '' ) <> '预约状态' ), 'ALTER TABLE ll_inbound_fba_appointment MODIFY COLUMN appointment_status VARCHAR(32) NOT NULL DEFAULT ''PENDING'' COMMENT ''预约状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_fba_appointment' AND column_name = 'appointment_remark' AND COALESCE ( column_comment , '' ) <> '预约备注' ), 'ALTER TABLE ll_inbound_fba_appointment MODIFY COLUMN appointment_remark VARCHAR(1000) NULL COMMENT ''预约备注''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_fba_appointment' AND column_name = 'fba_warehouse_code' AND COALESCE ( column_comment , '' ) <> 'FBA仓库编码' ), 'ALTER TABLE ll_inbound_fba_appointment MODIFY COLUMN fba_warehouse_code VARCHAR(128) NOT NULL COMMENT ''FBA仓库编码''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_fba_appointment' AND column_name = 'selected_count' AND COALESCE ( column_comment , '' ) <> '已选明细数量' ), 'ALTER TABLE ll_inbound_fba_appointment MODIFY COLUMN selected_count INT NOT NULL DEFAULT 0 COMMENT ''已选明细数量''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_fba_appointment' AND column_name = 'created_by' AND COALESCE ( column_comment , '' ) <> '创建人ID' ), 'ALTER TABLE ll_inbound_fba_appointment MODIFY COLUMN created_by VARCHAR(128) NULL COMMENT ''创建人ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_fba_appointment' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_inbound_fba_appointment MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_fba_appointment' AND column_name = 'updated_at' AND COALESCE ( column_comment , '' ) <> '更新时间' ), 'ALTER TABLE ll_inbound_fba_appointment MODIFY COLUMN updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT ''更新时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_inbound_fba_appointment_item' AND COALESCE ( table_comment , '' ) <> 'FBA入仓预约明细' ), 'ALTER TABLE ll_inbound_fba_appointment_item COMMENT = ''FBA入仓预约明细''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_fba_appointment_item' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_inbound_fba_appointment_item MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_fba_appointment_item' AND column_name = 'appointment_id' AND COALESCE ( column_comment , '' ) <> '预约单ID' ), 'ALTER TABLE ll_inbound_fba_appointment_item MODIFY COLUMN appointment_id BIGINT NOT NULL COMMENT ''预约单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_fba_appointment_item' AND column_name = 'plan_id' AND COALESCE ( column_comment , '' ) <> '入仓计划ID' ), 'ALTER TABLE ll_inbound_fba_appointment_item MODIFY COLUMN plan_id BIGINT NOT NULL COMMENT ''入仓计划ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_fba_appointment_item' AND column_name = 'line_id' AND COALESCE ( column_comment , '' ) <> '入仓计划明细ID' ), 'ALTER TABLE ll_inbound_fba_appointment_item MODIFY COLUMN line_id BIGINT NOT NULL COMMENT ''入仓计划明细ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_fba_appointment_item' AND column_name = 'order_id' AND COALESCE ( column_comment , '' ) <> '订单ID' ), 'ALTER TABLE ll_inbound_fba_appointment_item MODIFY COLUMN order_id BIGINT NOT NULL COMMENT ''订单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_fba_appointment_item' AND column_name = 'inbound_code' AND COALESCE ( column_comment , '' ) <> '入仓单号快照' ), 'ALTER TABLE ll_inbound_fba_appointment_item MODIFY COLUMN inbound_code VARCHAR(128) NOT NULL COMMENT ''入仓单号快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_fba_appointment_item' AND column_name = 'fba_warehouse_code' AND COALESCE ( column_comment , '' ) <> 'FBA仓库编码' ), 'ALTER TABLE ll_inbound_fba_appointment_item MODIFY COLUMN fba_warehouse_code VARCHAR(128) NOT NULL COMMENT ''FBA仓库编码''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_fba_appointment_item' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_inbound_fba_appointment_item MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND COALESCE ( table_comment , '' ) <> '入仓单维度实时库存余额' ), 'ALTER TABLE ll_inventory_balance COMMENT = ''入仓单维度实时库存余额''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_inventory_balance MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_inventory_balance MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'customer_name' AND COALESCE ( column_comment , '' ) <> '客户名称快照' ), 'ALTER TABLE ll_inventory_balance MODIFY COLUMN customer_name VARCHAR(255) NULL COMMENT ''客户名称快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'overseas_warehouse_id' AND COALESCE ( column_comment , '' ) <> '海外仓ID' ), 'ALTER TABLE ll_inventory_balance MODIFY COLUMN overseas_warehouse_id VARCHAR(128) NOT NULL COMMENT ''海外仓ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'overseas_warehouse_code' AND COALESCE ( column_comment , '' ) <> '海外仓编码快照' ), 'ALTER TABLE ll_inventory_balance MODIFY COLUMN overseas_warehouse_code VARCHAR(128) NULL COMMENT ''海外仓编码快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'overseas_warehouse_name' AND COALESCE ( column_comment , '' ) <> '海外仓名称快照' ), 'ALTER TABLE ll_inventory_balance MODIFY COLUMN overseas_warehouse_name VARCHAR(255) NULL COMMENT ''海外仓名称快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'destination_warehouse_id' AND COALESCE ( column_comment , '' ) <> '目的仓ID' ), 'ALTER TABLE ll_inventory_balance MODIFY COLUMN destination_warehouse_id VARCHAR(128) NULL COMMENT ''目的仓ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'destination_warehouse_code' AND COALESCE ( column_comment , '' ) <> '目的仓编码快照' ), 'ALTER TABLE ll_inventory_balance MODIFY COLUMN destination_warehouse_code VARCHAR(128) NOT NULL DEFAULT '''' COMMENT ''目的仓编码快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'destination_warehouse_name' AND COALESCE ( column_comment , '' ) <> '目的仓名称快照' ), 'ALTER TABLE ll_inventory_balance MODIFY COLUMN destination_warehouse_name VARCHAR(255) NULL COMMENT ''目的仓名称快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'inbound_order_id' AND COALESCE ( column_comment , '' ) <> '入仓单ID' ), 'ALTER TABLE ll_inventory_balance MODIFY COLUMN inbound_order_id BIGINT NOT NULL COMMENT ''入仓单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'inbound_order_no' AND COALESCE ( column_comment , '' ) <> '入仓单号快照' ), 'ALTER TABLE ll_inventory_balance MODIFY COLUMN inbound_order_no VARCHAR(128) NULL COMMENT ''入仓单号快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'inbound_code' AND COALESCE ( column_comment , '' ) <> '入仓单号快照' ), 'ALTER TABLE ll_inventory_balance MODIFY COLUMN inbound_code VARCHAR(128) NOT NULL COMMENT ''入仓单号快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'available_packages' AND COALESCE ( column_comment , '' ) <> '可用箱数' ), 'ALTER TABLE ll_inventory_balance MODIFY COLUMN available_packages BIGINT NOT NULL DEFAULT 0 COMMENT ''可用箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'hold_packages' AND COALESCE ( column_comment , '' ) <> '冻结箱数' ), 'ALTER TABLE ll_inventory_balance MODIFY COLUMN hold_packages BIGINT NOT NULL DEFAULT 0 COMMENT ''冻结箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'allocated_packages' AND COALESCE ( column_comment , '' ) <> '已分配箱数' ), 'ALTER TABLE ll_inventory_balance MODIFY COLUMN allocated_packages BIGINT NOT NULL DEFAULT 0 COMMENT ''已分配箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'picked_packages' AND COALESCE ( column_comment , '' ) <> '已拣箱数' ), 'ALTER TABLE ll_inventory_balance MODIFY COLUMN picked_packages BIGINT NOT NULL DEFAULT 0 COMMENT ''已拣箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'in_transit_packages' AND COALESCE ( column_comment , '' ) <> '在途箱数' ), 'ALTER TABLE ll_inventory_balance MODIFY COLUMN in_transit_packages BIGINT NOT NULL DEFAULT 0 COMMENT ''在途箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'receiving_packages' AND COALESCE ( column_comment , '' ) <> '收货处理中箱数' ), 'ALTER TABLE ll_inventory_balance MODIFY COLUMN receiving_packages BIGINT NOT NULL DEFAULT 0 COMMENT ''收货处理中箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'procurement_packages' AND COALESCE ( column_comment , '' ) <> '采购业务占用箱数' ), 'ALTER TABLE ll_inventory_balance MODIFY COLUMN procurement_packages BIGINT NOT NULL DEFAULT 0 COMMENT ''采购业务占用箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'version' AND COALESCE ( column_comment , '' ) <> '乐观锁版本' ), 'ALTER TABLE ll_inventory_balance MODIFY COLUMN version BIGINT NOT NULL DEFAULT 0 COMMENT ''乐观锁版本''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_inventory_balance MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'updated_at' AND COALESCE ( column_comment , '' ) <> '更新时间' ), 'ALTER TABLE ll_inventory_balance MODIFY COLUMN updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT ''更新时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_inventory_position' AND COALESCE ( table_comment , '' ) <> '托盘库位批次库存明细' ), 'ALTER TABLE ll_inventory_position COMMENT = ''托盘库位批次库存明细''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_position' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_inventory_position MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_position' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_inventory_position MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_position' AND column_name = 'balance_id' AND COALESCE ( column_comment , '' ) <> '库存余额记录ID' ), 'ALTER TABLE ll_inventory_position MODIFY COLUMN balance_id BIGINT NOT NULL COMMENT ''库存余额记录ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_position' AND column_name = 'overseas_warehouse_id' AND COALESCE ( column_comment , '' ) <> '海外仓ID' ), 'ALTER TABLE ll_inventory_position MODIFY COLUMN overseas_warehouse_id VARCHAR(128) NOT NULL COMMENT ''海外仓ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_position' AND column_name = 'destination_warehouse_code' AND COALESCE ( column_comment , '' ) <> '目的仓编码快照' ), 'ALTER TABLE ll_inventory_position MODIFY COLUMN destination_warehouse_code VARCHAR(128) NOT NULL DEFAULT '''' COMMENT ''目的仓编码快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_position' AND column_name = 'pallet_id' AND COALESCE ( column_comment , '' ) <> '托盘ID' ), 'ALTER TABLE ll_inventory_position MODIFY COLUMN pallet_id BIGINT NOT NULL COMMENT ''托盘ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_position' AND column_name = 'pallet_no' AND COALESCE ( column_comment , '' ) <> '托盘号' ), 'ALTER TABLE ll_inventory_position MODIFY COLUMN pallet_no VARCHAR(64) NOT NULL COMMENT ''托盘号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_position' AND column_name = 'batch_no' AND COALESCE ( column_comment , '' ) <> '库存批次号' ), 'ALTER TABLE ll_inventory_position MODIFY COLUMN batch_no VARCHAR(128) NOT NULL DEFAULT '''' COMMENT ''库存批次号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_position' AND column_name = 'warehouse_location_id' AND COALESCE ( column_comment , '' ) <> '仓库库位ID' ), 'ALTER TABLE ll_inventory_position MODIFY COLUMN warehouse_location_id BIGINT NULL COMMENT ''仓库库位ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_position' AND column_name = 'warehouse_location_code' AND COALESCE ( column_comment , '' ) <> '仓库库位编码' ), 'ALTER TABLE ll_inventory_position MODIFY COLUMN warehouse_location_code VARCHAR(128) NOT NULL COMMENT ''仓库库位编码''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_position' AND column_name = 'available_packages' AND COALESCE ( column_comment , '' ) <> '可用箱数' ), 'ALTER TABLE ll_inventory_position MODIFY COLUMN available_packages BIGINT NOT NULL DEFAULT 0 COMMENT ''可用箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_position' AND column_name = 'hold_packages' AND COALESCE ( column_comment , '' ) <> '冻结箱数' ), 'ALTER TABLE ll_inventory_position MODIFY COLUMN hold_packages BIGINT NOT NULL DEFAULT 0 COMMENT ''冻结箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_position' AND column_name = 'allocated_packages' AND COALESCE ( column_comment , '' ) <> '已分配箱数' ), 'ALTER TABLE ll_inventory_position MODIFY COLUMN allocated_packages BIGINT NOT NULL DEFAULT 0 COMMENT ''已分配箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_position' AND column_name = 'picked_packages' AND COALESCE ( column_comment , '' ) <> '已拣箱数' ), 'ALTER TABLE ll_inventory_position MODIFY COLUMN picked_packages BIGINT NOT NULL DEFAULT 0 COMMENT ''已拣箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_position' AND column_name = 'receiving_packages' AND COALESCE ( column_comment , '' ) <> '收货处理中箱数' ), 'ALTER TABLE ll_inventory_position MODIFY COLUMN receiving_packages BIGINT NOT NULL DEFAULT 0 COMMENT ''收货处理中箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_position' AND column_name = 'status' AND COALESCE ( column_comment , '' ) <> '业务状态' ), 'ALTER TABLE ll_inventory_position MODIFY COLUMN status VARCHAR(32) NOT NULL DEFAULT ''ACTIVE'' COMMENT ''业务状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_position' AND column_name = 'version' AND COALESCE ( column_comment , '' ) <> '乐观锁版本' ), 'ALTER TABLE ll_inventory_position MODIFY COLUMN version BIGINT NOT NULL DEFAULT 0 COMMENT ''乐观锁版本''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_position' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_inventory_position MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_position' AND column_name = 'updated_at' AND COALESCE ( column_comment , '' ) <> '更新时间' ), 'ALTER TABLE ll_inventory_position MODIFY COLUMN updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT ''更新时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND COALESCE ( table_comment , '' ) <> '不可变库存变动流水' ), 'ALTER TABLE ll_inventory_ledger COMMENT = ''不可变库存变动流水''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_inventory_ledger MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_inventory_ledger MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'balance_id' AND COALESCE ( column_comment , '' ) <> '库存余额记录ID' ), 'ALTER TABLE ll_inventory_ledger MODIFY COLUMN balance_id BIGINT NOT NULL COMMENT ''库存余额记录ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'position_id' AND COALESCE ( column_comment , '' ) <> '库存仓位记录ID' ), 'ALTER TABLE ll_inventory_ledger MODIFY COLUMN position_id BIGINT NULL COMMENT ''库存仓位记录ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'overseas_warehouse_id' AND COALESCE ( column_comment , '' ) <> '海外仓ID' ), 'ALTER TABLE ll_inventory_ledger MODIFY COLUMN overseas_warehouse_id VARCHAR(128) NOT NULL COMMENT ''海外仓ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'destination_warehouse_code' AND COALESCE ( column_comment , '' ) <> '目的仓编码快照' ), 'ALTER TABLE ll_inventory_ledger MODIFY COLUMN destination_warehouse_code VARCHAR(128) NOT NULL DEFAULT '''' COMMENT ''目的仓编码快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'inbound_order_id' AND COALESCE ( column_comment , '' ) <> '入仓单ID' ), 'ALTER TABLE ll_inventory_ledger MODIFY COLUMN inbound_order_id BIGINT NOT NULL COMMENT ''入仓单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'pallet_id' AND COALESCE ( column_comment , '' ) <> '托盘ID' ), 'ALTER TABLE ll_inventory_ledger MODIFY COLUMN pallet_id BIGINT NULL COMMENT ''托盘ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'pallet_no' AND COALESCE ( column_comment , '' ) <> '托盘号' ), 'ALTER TABLE ll_inventory_ledger MODIFY COLUMN pallet_no VARCHAR(64) NULL COMMENT ''托盘号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'batch_no' AND COALESCE ( column_comment , '' ) <> '库存批次号' ), 'ALTER TABLE ll_inventory_ledger MODIFY COLUMN batch_no VARCHAR(128) NULL COMMENT ''库存批次号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'warehouse_location_code' AND COALESCE ( column_comment , '' ) <> '仓库库位编码' ), 'ALTER TABLE ll_inventory_ledger MODIFY COLUMN warehouse_location_code VARCHAR(128) NULL COMMENT ''仓库库位编码''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'sku_code' AND COALESCE ( column_comment , '' ) <> 'SKU编码' ), 'ALTER TABLE ll_inventory_ledger MODIFY COLUMN sku_code VARCHAR(128) NULL COMMENT ''SKU编码''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'carton_mark' AND COALESCE ( column_comment , '' ) <> '箱唛' ), 'ALTER TABLE ll_inventory_ledger MODIFY COLUMN carton_mark VARCHAR(128) NULL COMMENT ''箱唛''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'carton_packages' AND COALESCE ( column_comment , '' ) <> '箱内箱数' ), 'ALTER TABLE ll_inventory_ledger MODIFY COLUMN carton_packages BIGINT NULL COMMENT ''箱内箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'business_type' AND COALESCE ( column_comment , '' ) <> '业务类型' ), 'ALTER TABLE ll_inventory_ledger MODIFY COLUMN business_type VARCHAR(32) NOT NULL COMMENT ''业务类型''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'business_order_id' AND COALESCE ( column_comment , '' ) <> '业务单据ID' ), 'ALTER TABLE ll_inventory_ledger MODIFY COLUMN business_order_id BIGINT NULL COMMENT ''业务单据ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'business_order_no' AND COALESCE ( column_comment , '' ) <> '业务单号' ), 'ALTER TABLE ll_inventory_ledger MODIFY COLUMN business_order_no VARCHAR(128) NULL COMMENT ''业务单号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'inbound_code' AND COALESCE ( column_comment , '' ) <> '入仓单号快照' ), 'ALTER TABLE ll_inventory_ledger MODIFY COLUMN inbound_code VARCHAR(128) NULL COMMENT ''入仓单号快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'inbound_order_no' AND COALESCE ( column_comment , '' ) <> '入仓单号快照' ), 'ALTER TABLE ll_inventory_ledger MODIFY COLUMN inbound_order_no VARCHAR(128) NULL COMMENT ''入仓单号快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'outbound_order_no' AND COALESCE ( column_comment , '' ) <> '出库单号' ), 'ALTER TABLE ll_inventory_ledger MODIFY COLUMN outbound_order_no VARCHAR(128) NULL COMMENT ''出库单号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'source_event_id' AND COALESCE ( column_comment , '' ) <> '来源事件ID' ), 'ALTER TABLE ll_inventory_ledger MODIFY COLUMN source_event_id VARCHAR(128) NULL COMMENT ''来源事件ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'idempotency_key' AND COALESCE ( column_comment , '' ) <> '业务幂等键' ), 'ALTER TABLE ll_inventory_ledger MODIFY COLUMN idempotency_key VARCHAR(255) NOT NULL COMMENT ''业务幂等键''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'status_from' AND COALESCE ( column_comment , '' ) <> '操作前状态' ), 'ALTER TABLE ll_inventory_ledger MODIFY COLUMN status_from VARCHAR(32) NULL COMMENT ''操作前状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'status_to' AND COALESCE ( column_comment , '' ) <> '操作后状态' ), 'ALTER TABLE ll_inventory_ledger MODIFY COLUMN status_to VARCHAR(32) NULL COMMENT ''操作后状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'before_packages' AND COALESCE ( column_comment , '' ) <> '变动前箱数' ), 'ALTER TABLE ll_inventory_ledger MODIFY COLUMN before_packages BIGINT NOT NULL COMMENT ''变动前箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'delta_packages' AND COALESCE ( column_comment , '' ) <> '箱数变动量' ), 'ALTER TABLE ll_inventory_ledger MODIFY COLUMN delta_packages BIGINT NOT NULL COMMENT ''箱数变动量''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'after_packages' AND COALESCE ( column_comment , '' ) <> '变动后箱数' ), 'ALTER TABLE ll_inventory_ledger MODIFY COLUMN after_packages BIGINT NOT NULL COMMENT ''变动后箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'operator_id' AND COALESCE ( column_comment , '' ) <> '操作人ID' ), 'ALTER TABLE ll_inventory_ledger MODIFY COLUMN operator_id VARCHAR(128) NULL COMMENT ''操作人ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'remark' AND COALESCE ( column_comment , '' ) <> '备注' ), 'ALTER TABLE ll_inventory_ledger MODIFY COLUMN remark VARCHAR(1000) NULL COMMENT ''备注''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'occurred_at' AND COALESCE ( column_comment , '' ) <> '业务发生时间' ), 'ALTER TABLE ll_inventory_ledger MODIFY COLUMN occurred_at DATETIME(3) NOT NULL COMMENT ''业务发生时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_ledger' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_inventory_ledger MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_inventory_operation' AND COALESCE ( table_comment , '' ) <> '库存命令幂等记录' ), 'ALTER TABLE ll_inventory_operation COMMENT = ''库存命令幂等记录''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_operation' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_inventory_operation MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_operation' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_inventory_operation MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_operation' AND column_name = 'idempotency_key' AND COALESCE ( column_comment , '' ) <> '业务幂等键' ), 'ALTER TABLE ll_inventory_operation MODIFY COLUMN idempotency_key VARCHAR(255) NOT NULL COMMENT ''业务幂等键''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_operation' AND column_name = 'operation_type' AND COALESCE ( column_comment , '' ) <> '操作类型' ), 'ALTER TABLE ll_inventory_operation MODIFY COLUMN operation_type VARCHAR(32) NOT NULL COMMENT ''操作类型''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_operation' AND column_name = 'request_hash' AND COALESCE ( column_comment , '' ) <> '请求内容哈希' ), 'ALTER TABLE ll_inventory_operation MODIFY COLUMN request_hash VARCHAR(128) NOT NULL COMMENT ''请求内容哈希''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_operation' AND column_name = 'status' AND COALESCE ( column_comment , '' ) <> '库存命令处理状态' ), 'ALTER TABLE ll_inventory_operation MODIFY COLUMN status VARCHAR(32) NOT NULL DEFAULT ''PROCESSING'' COMMENT ''库存命令处理状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_operation' AND column_name = 'result_json' AND COALESCE ( column_comment , '' ) <> '处理结果JSON' ), 'ALTER TABLE ll_inventory_operation MODIFY COLUMN result_json LONGTEXT NULL COMMENT ''处理结果JSON''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_operation' AND column_name = 'last_error' AND COALESCE ( column_comment , '' ) <> '最后错误信息' ), 'ALTER TABLE ll_inventory_operation MODIFY COLUMN last_error VARCHAR(2000) NULL COMMENT ''最后错误信息''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_operation' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_inventory_operation MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_operation' AND column_name = 'updated_at' AND COALESCE ( column_comment , '' ) <> '更新时间' ), 'ALTER TABLE ll_inventory_operation MODIFY COLUMN updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT ''更新时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_inbound_stock_receipt' AND COALESCE ( table_comment , '' ) <> '入仓PDA库存实收快照' ), 'ALTER TABLE ll_inbound_stock_receipt COMMENT = ''入仓PDA库存实收快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_stock_receipt' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_inbound_stock_receipt MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_stock_receipt' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_inbound_stock_receipt MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_stock_receipt' AND column_name = 'plan_id' AND COALESCE ( column_comment , '' ) <> '入仓计划ID' ), 'ALTER TABLE ll_inbound_stock_receipt MODIFY COLUMN plan_id BIGINT NOT NULL COMMENT ''入仓计划ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_stock_receipt' AND column_name = 'task_id' AND COALESCE ( column_comment , '' ) <> 'PDA任务ID' ), 'ALTER TABLE ll_inbound_stock_receipt MODIFY COLUMN task_id BIGINT NOT NULL COMMENT ''PDA任务ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_stock_receipt' AND column_name = 'allocation_id' AND COALESCE ( column_comment , '' ) <> '分配记录ID' ), 'ALTER TABLE ll_inbound_stock_receipt MODIFY COLUMN allocation_id BIGINT NOT NULL COMMENT ''分配记录ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_stock_receipt' AND column_name = 'line_id' AND COALESCE ( column_comment , '' ) <> '入仓计划明细ID' ), 'ALTER TABLE ll_inbound_stock_receipt MODIFY COLUMN line_id BIGINT NOT NULL COMMENT ''入仓计划明细ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_stock_receipt' AND column_name = 'order_id' AND COALESCE ( column_comment , '' ) <> '订单ID' ), 'ALTER TABLE ll_inbound_stock_receipt MODIFY COLUMN order_id BIGINT NOT NULL COMMENT ''订单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_stock_receipt' AND column_name = 'inbound_code' AND COALESCE ( column_comment , '' ) <> '入仓单号快照' ), 'ALTER TABLE ll_inbound_stock_receipt MODIFY COLUMN inbound_code VARCHAR(128) NOT NULL COMMENT ''入仓单号快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_stock_receipt' AND column_name = 'warehouse_pallet_id' AND COALESCE ( column_comment , '' ) <> '仓库实物托盘ID' ), 'ALTER TABLE ll_inbound_stock_receipt MODIFY COLUMN warehouse_pallet_id BIGINT NOT NULL COMMENT ''仓库实物托盘ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_stock_receipt' AND column_name = 'pallet_no' AND COALESCE ( column_comment , '' ) <> '托盘号' ), 'ALTER TABLE ll_inbound_stock_receipt MODIFY COLUMN pallet_no VARCHAR(64) NOT NULL COMMENT ''托盘号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_stock_receipt' AND column_name = 'warehouse_location_id' AND COALESCE ( column_comment , '' ) <> '仓库库位ID' ), 'ALTER TABLE ll_inbound_stock_receipt MODIFY COLUMN warehouse_location_id BIGINT NULL COMMENT ''仓库库位ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_stock_receipt' AND column_name = 'warehouse_location_code' AND COALESCE ( column_comment , '' ) <> '仓库库位编码' ), 'ALTER TABLE ll_inbound_stock_receipt MODIFY COLUMN warehouse_location_code VARCHAR(128) NULL COMMENT ''仓库库位编码''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_stock_receipt' AND column_name = 'batch_no' AND COALESCE ( column_comment , '' ) <> '库存批次号' ), 'ALTER TABLE ll_inbound_stock_receipt MODIFY COLUMN batch_no VARCHAR(128) NOT NULL COMMENT ''库存批次号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_stock_receipt' AND column_name = 'received_packages' AND COALESCE ( column_comment , '' ) <> '实收箱数' ), 'ALTER TABLE ll_inbound_stock_receipt MODIFY COLUMN received_packages BIGINT NOT NULL COMMENT ''实收箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_stock_receipt' AND column_name = 'inventory_balance_id' AND COALESCE ( column_comment , '' ) <> '库存余额记录ID' ), 'ALTER TABLE ll_inbound_stock_receipt MODIFY COLUMN inventory_balance_id BIGINT NOT NULL COMMENT ''库存余额记录ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_stock_receipt' AND column_name = 'inventory_position_id' AND COALESCE ( column_comment , '' ) <> '库存仓位记录ID' ), 'ALTER TABLE ll_inbound_stock_receipt MODIFY COLUMN inventory_position_id BIGINT NOT NULL COMMENT ''库存仓位记录ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_stock_receipt' AND column_name = 'inventory_operation_key' AND COALESCE ( column_comment , '' ) <> '库存操作幂等键' ), 'ALTER TABLE ll_inbound_stock_receipt MODIFY COLUMN inventory_operation_key VARCHAR(255) NOT NULL COMMENT ''库存操作幂等键''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_stock_receipt' AND column_name = 'received_at' AND COALESCE ( column_comment , '' ) <> '实收时间' ), 'ALTER TABLE ll_inbound_stock_receipt MODIFY COLUMN received_at DATETIME(3) NOT NULL COMMENT ''实收时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_stock_receipt' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_inbound_stock_receipt MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_order' AND COALESCE ( table_comment , '' ) <> '尾程派车单' ), 'ALTER TABLE ll_dispatch_order COMMENT = ''尾程派车单''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_order' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_dispatch_order MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_order' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_dispatch_order MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_order' AND column_name = 'dispatch_no' AND COALESCE ( column_comment , '' ) <> '派车单号' ), 'ALTER TABLE ll_dispatch_order MODIFY COLUMN dispatch_no VARCHAR(64) NOT NULL COMMENT ''派车单号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_order' AND column_name = 'overseas_warehouse_id' AND COALESCE ( column_comment , '' ) <> '海外仓ID' ), 'ALTER TABLE ll_dispatch_order MODIFY COLUMN overseas_warehouse_id VARCHAR(128) NULL COMMENT ''海外仓ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_order' AND column_name = 'overseas_warehouse_name' AND COALESCE ( column_comment , '' ) <> '海外仓名称快照' ), 'ALTER TABLE ll_dispatch_order MODIFY COLUMN overseas_warehouse_name VARCHAR(255) NULL COMMENT ''海外仓名称快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_order' AND column_name = 'vehicle_plate' AND COALESCE ( column_comment , '' ) <> '车牌号' ), 'ALTER TABLE ll_dispatch_order MODIFY COLUMN vehicle_plate VARCHAR(64) NULL COMMENT ''车牌号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_order' AND column_name = 'driver_name' AND COALESCE ( column_comment , '' ) <> '司机姓名' ), 'ALTER TABLE ll_dispatch_order MODIFY COLUMN driver_name VARCHAR(128) NULL COMMENT ''司机姓名''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_order' AND column_name = 'driver_phone' AND COALESCE ( column_comment , '' ) <> '司机电话' ), 'ALTER TABLE ll_dispatch_order MODIFY COLUMN driver_phone VARCHAR(64) NULL COMMENT ''司机电话''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_order' AND column_name = 'carrier_name' AND COALESCE ( column_comment , '' ) <> '承运商名称' ), 'ALTER TABLE ll_dispatch_order MODIFY COLUMN carrier_name VARCHAR(255) NULL COMMENT ''承运商名称''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_order' AND column_name = 'route' AND COALESCE ( column_comment , '' ) <> '运输路线' ), 'ALTER TABLE ll_dispatch_order MODIFY COLUMN route VARCHAR(255) NULL COMMENT ''运输路线''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_order' AND column_name = 'depart_at' AND COALESCE ( column_comment , '' ) <> '发车时间' ), 'ALTER TABLE ll_dispatch_order MODIFY COLUMN depart_at DATETIME(3) NULL COMMENT ''发车时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_order' AND column_name = 'fba_appointment_no' AND COALESCE ( column_comment , '' ) <> 'FBA预约号' ), 'ALTER TABLE ll_dispatch_order MODIFY COLUMN fba_appointment_no VARCHAR(64) NULL COMMENT ''FBA预约号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_order' AND column_name = 'fba_appointment_status' AND COALESCE ( column_comment , '' ) <> 'FBA预约状态' ), 'ALTER TABLE ll_dispatch_order MODIFY COLUMN fba_appointment_status VARCHAR(32) NOT NULL DEFAULT ''PENDING'' COMMENT ''FBA预约状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_order' AND column_name = 'vehicle_appointment_status' AND COALESCE ( column_comment , '' ) <> '车辆预约状态' ), 'ALTER TABLE ll_dispatch_order MODIFY COLUMN vehicle_appointment_status VARCHAR(32) NOT NULL DEFAULT ''PENDING'' COMMENT ''车辆预约状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_order' AND column_name = 'estimated_arrival_at' AND COALESCE ( column_comment , '' ) <> '预计到达时间' ), 'ALTER TABLE ll_dispatch_order MODIFY COLUMN estimated_arrival_at DATETIME(3) NULL COMMENT ''预计到达时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_order' AND column_name = 'status' AND COALESCE ( column_comment , '' ) <> '业务状态' ), 'ALTER TABLE ll_dispatch_order MODIFY COLUMN status VARCHAR(32) NOT NULL DEFAULT ''PENDING_DEPARTURE'' COMMENT ''业务状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_order' AND column_name = 'item_count' AND COALESCE ( column_comment , '' ) <> '明细数量' ), 'ALTER TABLE ll_dispatch_order MODIFY COLUMN item_count INT NOT NULL DEFAULT 0 COMMENT ''明细数量''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_order' AND column_name = 'pallet_count' AND COALESCE ( column_comment , '' ) <> '托盘数' ), 'ALTER TABLE ll_dispatch_order MODIFY COLUMN pallet_count INT NOT NULL DEFAULT 0 COMMENT ''托盘数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_order' AND column_name = 'package_count' AND COALESCE ( column_comment , '' ) <> '箱数' ), 'ALTER TABLE ll_dispatch_order MODIFY COLUMN package_count INT NOT NULL DEFAULT 0 COMMENT ''箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_order' AND column_name = 'picked_package_count' AND COALESCE ( column_comment , '' ) <> 'PDA累计已拣箱数' ), 'ALTER TABLE ll_dispatch_order MODIFY COLUMN picked_package_count INT NOT NULL DEFAULT 0 COMMENT ''PDA累计已拣箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_order' AND column_name = 'shipped_package_count' AND COALESCE ( column_comment , '' ) <> '累计已出库箱数' ), 'ALTER TABLE ll_dispatch_order MODIFY COLUMN shipped_package_count INT NOT NULL DEFAULT 0 COMMENT ''累计已出库箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_order' AND column_name = 'partial_completion_reason' AND COALESCE ( column_comment , '' ) <> '部分完成原因' ), 'ALTER TABLE ll_dispatch_order MODIFY COLUMN partial_completion_reason VARCHAR(1000) NULL COMMENT ''部分完成原因''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_order' AND column_name = 'created_by' AND COALESCE ( column_comment , '' ) <> '创建人ID' ), 'ALTER TABLE ll_dispatch_order MODIFY COLUMN created_by VARCHAR(128) NULL COMMENT ''创建人ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_order' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_dispatch_order MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_order' AND column_name = 'updated_at' AND COALESCE ( column_comment , '' ) <> '更新时间' ), 'ALTER TABLE ll_dispatch_order MODIFY COLUMN updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT ''更新时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_item' AND COALESCE ( table_comment , '' ) <> '派车货物冻结明细' ), 'ALTER TABLE ll_dispatch_item COMMENT = ''派车货物冻结明细''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_item' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_dispatch_item MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_item' AND column_name = 'dispatch_order_id' AND COALESCE ( column_comment , '' ) <> '派车单ID' ), 'ALTER TABLE ll_dispatch_item MODIFY COLUMN dispatch_order_id BIGINT NOT NULL COMMENT ''派车单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_item' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_dispatch_item MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_item' AND column_name = 'plan_id' AND COALESCE ( column_comment , '' ) <> '入仓计划ID' ), 'ALTER TABLE ll_dispatch_item MODIFY COLUMN plan_id BIGINT NULL COMMENT ''入仓计划ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_item' AND column_name = 'plan_pallet_id' AND COALESCE ( column_comment , '' ) <> '计划托盘ID' ), 'ALTER TABLE ll_dispatch_item MODIFY COLUMN plan_pallet_id BIGINT NULL COMMENT ''计划托盘ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_item' AND column_name = 'warehouse_pallet_id' AND COALESCE ( column_comment , '' ) <> '仓库实物托盘ID' ), 'ALTER TABLE ll_dispatch_item MODIFY COLUMN warehouse_pallet_id BIGINT NULL COMMENT ''仓库实物托盘ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_item' AND column_name = 'order_id' AND COALESCE ( column_comment , '' ) <> '订单ID' ), 'ALTER TABLE ll_dispatch_item MODIFY COLUMN order_id BIGINT NULL COMMENT ''订单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_item' AND column_name = 'order_no' AND COALESCE ( column_comment , '' ) <> '订单号' ), 'ALTER TABLE ll_dispatch_item MODIFY COLUMN order_no VARCHAR(64) NULL COMMENT ''订单号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_item' AND column_name = 'order_refs' AND COALESCE ( column_comment , '' ) <> '关联订单信息' ), 'ALTER TABLE ll_dispatch_item MODIFY COLUMN order_refs VARCHAR(2000) NULL COMMENT ''关联订单信息''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_item' AND column_name = 'inbound_code' AND COALESCE ( column_comment , '' ) <> '入仓单号快照' ), 'ALTER TABLE ll_dispatch_item MODIFY COLUMN inbound_code VARCHAR(128) NULL COMMENT ''入仓单号快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_item' AND column_name = 'pallet_no' AND COALESCE ( column_comment , '' ) <> '托盘号' ), 'ALTER TABLE ll_dispatch_item MODIFY COLUMN pallet_no VARCHAR(128) NOT NULL COMMENT ''托盘号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_item' AND column_name = 'overseas_warehouse_id' AND COALESCE ( column_comment , '' ) <> '海外仓ID' ), 'ALTER TABLE ll_dispatch_item MODIFY COLUMN overseas_warehouse_id VARCHAR(128) NULL COMMENT ''海外仓ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_item' AND column_name = 'overseas_warehouse_name' AND COALESCE ( column_comment , '' ) <> '海外仓名称快照' ), 'ALTER TABLE ll_dispatch_item MODIFY COLUMN overseas_warehouse_name VARCHAR(255) NULL COMMENT ''海外仓名称快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_item' AND column_name = 'destination_warehouse_id' AND COALESCE ( column_comment , '' ) <> '目的仓ID' ), 'ALTER TABLE ll_dispatch_item MODIFY COLUMN destination_warehouse_id VARCHAR(128) NULL COMMENT ''目的仓ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_item' AND column_name = 'destination_warehouse_code' AND COALESCE ( column_comment , '' ) <> '目的仓编码快照' ), 'ALTER TABLE ll_dispatch_item MODIFY COLUMN destination_warehouse_code VARCHAR(128) NULL COMMENT ''目的仓编码快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_item' AND column_name = 'destination_warehouse_name' AND COALESCE ( column_comment , '' ) <> '目的仓名称快照' ), 'ALTER TABLE ll_dispatch_item MODIFY COLUMN destination_warehouse_name VARCHAR(255) NULL COMMENT ''目的仓名称快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_item' AND column_name = 'fba_warehouse_code' AND COALESCE ( column_comment , '' ) <> 'FBA仓库编码' ), 'ALTER TABLE ll_dispatch_item MODIFY COLUMN fba_warehouse_code VARCHAR(128) NULL COMMENT ''FBA仓库编码''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_item' AND column_name = 'package_count' AND COALESCE ( column_comment , '' ) <> '箱数' ), 'ALTER TABLE ll_dispatch_item MODIFY COLUMN package_count INT NOT NULL DEFAULT 0 COMMENT ''箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_item' AND column_name = 'volume_cbm' AND COALESCE ( column_comment , '' ) <> '体积(立方米)' ), 'ALTER TABLE ll_dispatch_item MODIFY COLUMN volume_cbm DECIMAL(18,4) NOT NULL DEFAULT 0 COMMENT ''体积(立方米)''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_item' AND column_name = 'source_stage' AND COALESCE ( column_comment , '' ) <> '数据来源阶段' ), 'ALTER TABLE ll_dispatch_item MODIFY COLUMN source_stage VARCHAR(32) NOT NULL COMMENT ''数据来源阶段''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_item' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_dispatch_item MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pallet_lock' AND COALESCE ( table_comment , '' ) <> '派车托盘排他锁' ), 'ALTER TABLE ll_dispatch_pallet_lock COMMENT = ''派车托盘排他锁''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pallet_lock' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_dispatch_pallet_lock MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pallet_lock' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_dispatch_pallet_lock MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pallet_lock' AND column_name = 'source_pallet_key' AND COALESCE ( column_comment , '' ) <> '来源托盘业务键' ), 'ALTER TABLE ll_dispatch_pallet_lock MODIFY COLUMN source_pallet_key VARCHAR(160) NOT NULL COMMENT ''来源托盘业务键''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pallet_lock' AND column_name = 'active_key' AND COALESCE ( column_comment , '' ) <> '生效中的资源排他键' ), 'ALTER TABLE ll_dispatch_pallet_lock MODIFY COLUMN active_key VARCHAR(160) NULL COMMENT ''生效中的资源排他键''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pallet_lock' AND column_name = 'plan_id' AND COALESCE ( column_comment , '' ) <> '入仓计划ID' ), 'ALTER TABLE ll_dispatch_pallet_lock MODIFY COLUMN plan_id BIGINT NULL COMMENT ''入仓计划ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pallet_lock' AND column_name = 'plan_pallet_id' AND COALESCE ( column_comment , '' ) <> '计划托盘ID' ), 'ALTER TABLE ll_dispatch_pallet_lock MODIFY COLUMN plan_pallet_id BIGINT NULL COMMENT ''计划托盘ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pallet_lock' AND column_name = 'warehouse_pallet_id' AND COALESCE ( column_comment , '' ) <> '仓库实物托盘ID' ), 'ALTER TABLE ll_dispatch_pallet_lock MODIFY COLUMN warehouse_pallet_id BIGINT NULL COMMENT ''仓库实物托盘ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pallet_lock' AND column_name = 'dispatch_order_id' AND COALESCE ( column_comment , '' ) <> '派车单ID' ), 'ALTER TABLE ll_dispatch_pallet_lock MODIFY COLUMN dispatch_order_id BIGINT NOT NULL COMMENT ''派车单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pallet_lock' AND column_name = 'status' AND COALESCE ( column_comment , '' ) <> '业务状态' ), 'ALTER TABLE ll_dispatch_pallet_lock MODIFY COLUMN status VARCHAR(32) NOT NULL DEFAULT ''ACTIVE'' COMMENT ''业务状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pallet_lock' AND column_name = 'locked_at' AND COALESCE ( column_comment , '' ) <> '锁定时间' ), 'ALTER TABLE ll_dispatch_pallet_lock MODIFY COLUMN locked_at DATETIME(3) NOT NULL COMMENT ''锁定时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pallet_lock' AND column_name = 'released_at' AND COALESCE ( column_comment , '' ) <> '释放时间' ), 'ALTER TABLE ll_dispatch_pallet_lock MODIFY COLUMN released_at DATETIME(3) NULL COMMENT ''释放时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pallet_lock' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_dispatch_pallet_lock MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pallet_lock' AND column_name = 'updated_at' AND COALESCE ( column_comment , '' ) <> '更新时间' ), 'ALTER TABLE ll_dispatch_pallet_lock MODIFY COLUMN updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT ''更新时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_task' AND COALESCE ( table_comment , '' ) <> '派车PDA拣货任务' ), 'ALTER TABLE ll_dispatch_pda_task COMMENT = ''派车PDA拣货任务''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_task' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_dispatch_pda_task MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_task' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_dispatch_pda_task MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_task' AND column_name = 'dispatch_order_id' AND COALESCE ( column_comment , '' ) <> '派车单ID' ), 'ALTER TABLE ll_dispatch_pda_task MODIFY COLUMN dispatch_order_id BIGINT NOT NULL COMMENT ''派车单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_task' AND column_name = 'task_no' AND COALESCE ( column_comment , '' ) <> 'PDA任务号' ), 'ALTER TABLE ll_dispatch_pda_task MODIFY COLUMN task_no VARCHAR(64) NOT NULL COMMENT ''PDA任务号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_task' AND column_name = 'status' AND COALESCE ( column_comment , '' ) <> '业务状态' ), 'ALTER TABLE ll_dispatch_pda_task MODIFY COLUMN status VARCHAR(32) NOT NULL COMMENT ''业务状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_task' AND column_name = 'operator_id' AND COALESCE ( column_comment , '' ) <> '操作人ID' ), 'ALTER TABLE ll_dispatch_pda_task MODIFY COLUMN operator_id VARCHAR(128) NULL COMMENT ''操作人ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_task' AND column_name = 'warehouse_id' AND COALESCE ( column_comment , '' ) <> '仓库ID' ), 'ALTER TABLE ll_dispatch_pda_task MODIFY COLUMN warehouse_id VARCHAR(128) NULL COMMENT ''仓库ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_task' AND column_name = 'operator_name' AND COALESCE ( column_comment , '' ) <> '操作人姓名' ), 'ALTER TABLE ll_dispatch_pda_task MODIFY COLUMN operator_name VARCHAR(128) NULL COMMENT ''操作人姓名''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_task' AND column_name = 'pushed_at' AND COALESCE ( column_comment , '' ) <> '任务下发时间' ), 'ALTER TABLE ll_dispatch_pda_task MODIFY COLUMN pushed_at DATETIME(3) NOT NULL COMMENT ''任务下发时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_task' AND column_name = 'completed_at' AND COALESCE ( column_comment , '' ) <> '完成时间' ), 'ALTER TABLE ll_dispatch_pda_task MODIFY COLUMN completed_at DATETIME(3) NULL COMMENT ''完成时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_task' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_dispatch_pda_task MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_task' AND column_name = 'updated_at' AND COALESCE ( column_comment , '' ) <> '更新时间' ), 'ALTER TABLE ll_dispatch_pda_task MODIFY COLUMN updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT ''更新时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_pick' AND COALESCE ( table_comment , '' ) <> '派车PDA拣货记录' ), 'ALTER TABLE ll_dispatch_pda_pick COMMENT = ''派车PDA拣货记录''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_pick' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_dispatch_pda_pick MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_pick' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_dispatch_pda_pick MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_pick' AND column_name = 'task_id' AND COALESCE ( column_comment , '' ) <> 'PDA任务ID' ), 'ALTER TABLE ll_dispatch_pda_pick MODIFY COLUMN task_id BIGINT NOT NULL COMMENT ''PDA任务ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_pick' AND column_name = 'dispatch_item_id' AND COALESCE ( column_comment , '' ) <> '派车明细ID' ), 'ALTER TABLE ll_dispatch_pda_pick MODIFY COLUMN dispatch_item_id BIGINT NOT NULL COMMENT ''派车明细ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_pick' AND column_name = 'inventory_position_id' AND COALESCE ( column_comment , '' ) <> '库存仓位记录ID' ), 'ALTER TABLE ll_dispatch_pda_pick MODIFY COLUMN inventory_position_id BIGINT NOT NULL COMMENT ''库存仓位记录ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_pick' AND column_name = 'packages' AND COALESCE ( column_comment , '' ) <> '本次操作箱数' ), 'ALTER TABLE ll_dispatch_pda_pick MODIFY COLUMN packages BIGINT NOT NULL COMMENT ''本次操作箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_pick' AND column_name = 'product_quantity' AND COALESCE ( column_comment , '' ) <> '产品数量' ), 'ALTER TABLE ll_dispatch_pda_pick MODIFY COLUMN product_quantity BIGINT NOT NULL DEFAULT 0 COMMENT ''产品数量''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_pick' AND column_name = 'idempotency_key' AND COALESCE ( column_comment , '' ) <> '业务幂等键' ), 'ALTER TABLE ll_dispatch_pda_pick MODIFY COLUMN idempotency_key VARCHAR(255) NOT NULL COMMENT ''业务幂等键''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_pick' AND column_name = 'picked_at' AND COALESCE ( column_comment , '' ) <> '拣货时间' ), 'ALTER TABLE ll_dispatch_pda_pick MODIFY COLUMN picked_at DATETIME(3) NOT NULL COMMENT ''拣货时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_pick' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_dispatch_pda_pick MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_operation' AND COALESCE ( table_comment , '' ) <> '派车PDA操作幂等记录' ), 'ALTER TABLE ll_dispatch_pda_operation COMMENT = ''派车PDA操作幂等记录''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_operation' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_dispatch_pda_operation MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_operation' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_dispatch_pda_operation MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_operation' AND column_name = 'task_id' AND COALESCE ( column_comment , '' ) <> 'PDA任务ID' ), 'ALTER TABLE ll_dispatch_pda_operation MODIFY COLUMN task_id BIGINT NULL COMMENT ''PDA任务ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_operation' AND column_name = 'operation_type' AND COALESCE ( column_comment , '' ) <> 'PDA操作类型' ), 'ALTER TABLE ll_dispatch_pda_operation MODIFY COLUMN operation_type VARCHAR(32) NOT NULL COMMENT ''PDA操作类型''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_operation' AND column_name = 'idempotency_key' AND COALESCE ( column_comment , '' ) <> '业务幂等键' ), 'ALTER TABLE ll_dispatch_pda_operation MODIFY COLUMN idempotency_key VARCHAR(255) NOT NULL COMMENT ''业务幂等键''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_operation' AND column_name = 'request_hash' AND COALESCE ( column_comment , '' ) <> '请求内容哈希' ), 'ALTER TABLE ll_dispatch_pda_operation MODIFY COLUMN request_hash CHAR(64) NOT NULL COMMENT ''请求内容哈希''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_operation' AND column_name = 'result_json' AND COALESCE ( column_comment , '' ) <> '处理结果JSON' ), 'ALTER TABLE ll_dispatch_pda_operation MODIFY COLUMN result_json LONGTEXT NULL COMMENT ''处理结果JSON''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_operation' AND column_name = 'status' AND COALESCE ( column_comment , '' ) <> 'PDA操作处理状态' ), 'ALTER TABLE ll_dispatch_pda_operation MODIFY COLUMN status VARCHAR(32) NOT NULL COMMENT ''PDA操作处理状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_operation' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_dispatch_pda_operation MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_operation' AND column_name = 'updated_at' AND COALESCE ( column_comment , '' ) <> '更新时间' ), 'ALTER TABLE ll_dispatch_pda_operation MODIFY COLUMN updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT ''更新时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_pick_order' AND COALESCE ( table_comment , '' ) <> 'PDA拣货订单归属记录' ), 'ALTER TABLE ll_dispatch_pda_pick_order COMMENT = ''PDA拣货订单归属记录''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_pick_order' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_dispatch_pda_pick_order MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_pick_order' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_dispatch_pda_pick_order MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_pick_order' AND column_name = 'pick_id' AND COALESCE ( column_comment , '' ) <> 'PDA拣货记录ID' ), 'ALTER TABLE ll_dispatch_pda_pick_order MODIFY COLUMN pick_id BIGINT NOT NULL COMMENT ''PDA拣货记录ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_pick_order' AND column_name = 'receipt_id' AND COALESCE ( column_comment , '' ) <> '入仓实收记录ID' ), 'ALTER TABLE ll_dispatch_pda_pick_order MODIFY COLUMN receipt_id BIGINT NOT NULL COMMENT ''入仓实收记录ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_pick_order' AND column_name = 'order_id' AND COALESCE ( column_comment , '' ) <> '订单ID' ), 'ALTER TABLE ll_dispatch_pda_pick_order MODIFY COLUMN order_id BIGINT NOT NULL COMMENT ''订单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_pick_order' AND column_name = 'packages' AND COALESCE ( column_comment , '' ) <> '本次操作箱数' ), 'ALTER TABLE ll_dispatch_pda_pick_order MODIFY COLUMN packages BIGINT NOT NULL COMMENT ''本次操作箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_pick_order' AND column_name = 'product_quantity' AND COALESCE ( column_comment , '' ) <> '产品数量' ), 'ALTER TABLE ll_dispatch_pda_pick_order MODIFY COLUMN product_quantity BIGINT NOT NULL DEFAULT 0 COMMENT ''产品数量''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dispatch_pda_pick_order' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_dispatch_pda_pick_order MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_outbound_order' AND COALESCE ( table_comment , '' ) <> '尾程出库单' ), 'ALTER TABLE ll_outbound_order COMMENT = ''尾程出库单''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_outbound_order' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_outbound_order MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_outbound_order' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_outbound_order MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_outbound_order' AND column_name = 'outbound_no' AND COALESCE ( column_comment , '' ) <> '出库单号' ), 'ALTER TABLE ll_outbound_order MODIFY COLUMN outbound_no VARCHAR(64) NOT NULL COMMENT ''出库单号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_outbound_order' AND column_name = 'dispatch_order_id' AND COALESCE ( column_comment , '' ) <> '派车单ID' ), 'ALTER TABLE ll_outbound_order MODIFY COLUMN dispatch_order_id BIGINT NOT NULL COMMENT ''派车单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_outbound_order' AND column_name = 'dispatch_no' AND COALESCE ( column_comment , '' ) <> '派车单号' ), 'ALTER TABLE ll_outbound_order MODIFY COLUMN dispatch_no VARCHAR(64) NOT NULL COMMENT ''派车单号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_outbound_order' AND column_name = 'overseas_warehouse_id' AND COALESCE ( column_comment , '' ) <> '海外仓ID' ), 'ALTER TABLE ll_outbound_order MODIFY COLUMN overseas_warehouse_id VARCHAR(128) NULL COMMENT ''海外仓ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_outbound_order' AND column_name = 'status' AND COALESCE ( column_comment , '' ) <> '业务状态' ), 'ALTER TABLE ll_outbound_order MODIFY COLUMN status VARCHAR(32) NOT NULL DEFAULT ''WAIT_OUTBOUND'' COMMENT ''业务状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_outbound_order' AND column_name = 'package_count' AND COALESCE ( column_comment , '' ) <> '箱数' ), 'ALTER TABLE ll_outbound_order MODIFY COLUMN package_count INT NOT NULL DEFAULT 0 COMMENT ''箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_outbound_order' AND column_name = 'pallet_count' AND COALESCE ( column_comment , '' ) <> '托盘数' ), 'ALTER TABLE ll_outbound_order MODIFY COLUMN pallet_count INT NOT NULL DEFAULT 0 COMMENT ''托盘数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_outbound_order' AND column_name = 'idempotency_key' AND COALESCE ( column_comment , '' ) <> '业务幂等键' ), 'ALTER TABLE ll_outbound_order MODIFY COLUMN idempotency_key VARCHAR(255) NOT NULL COMMENT ''业务幂等键''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_outbound_order' AND column_name = 'created_by' AND COALESCE ( column_comment , '' ) <> '创建人ID' ), 'ALTER TABLE ll_outbound_order MODIFY COLUMN created_by VARCHAR(128) NULL COMMENT ''创建人ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_outbound_order' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_outbound_order MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_outbound_order' AND column_name = 'updated_at' AND COALESCE ( column_comment , '' ) <> '更新时间' ), 'ALTER TABLE ll_outbound_order MODIFY COLUMN updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT ''更新时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_outbound_pallet_item' AND COALESCE ( table_comment , '' ) <> '出库托盘明细' ), 'ALTER TABLE ll_outbound_pallet_item COMMENT = ''出库托盘明细''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_outbound_pallet_item' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_outbound_pallet_item MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_outbound_pallet_item' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_outbound_pallet_item MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_outbound_pallet_item' AND column_name = 'outbound_order_id' AND COALESCE ( column_comment , '' ) <> '出库单ID' ), 'ALTER TABLE ll_outbound_pallet_item MODIFY COLUMN outbound_order_id BIGINT NOT NULL COMMENT ''出库单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_outbound_pallet_item' AND column_name = 'warehouse_pallet_id' AND COALESCE ( column_comment , '' ) <> '仓库实物托盘ID' ), 'ALTER TABLE ll_outbound_pallet_item MODIFY COLUMN warehouse_pallet_id BIGINT NULL COMMENT ''仓库实物托盘ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_outbound_pallet_item' AND column_name = 'pallet_no' AND COALESCE ( column_comment , '' ) <> '托盘号' ), 'ALTER TABLE ll_outbound_pallet_item MODIFY COLUMN pallet_no VARCHAR(128) NULL COMMENT ''托盘号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_outbound_pallet_item' AND column_name = 'destination_warehouse_id' AND COALESCE ( column_comment , '' ) <> '目的仓ID' ), 'ALTER TABLE ll_outbound_pallet_item MODIFY COLUMN destination_warehouse_id VARCHAR(128) NULL COMMENT ''目的仓ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_outbound_pallet_item' AND column_name = 'destination_warehouse_code' AND COALESCE ( column_comment , '' ) <> '目的仓编码快照' ), 'ALTER TABLE ll_outbound_pallet_item MODIFY COLUMN destination_warehouse_code VARCHAR(128) NULL COMMENT ''目的仓编码快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_outbound_pallet_item' AND column_name = 'destination_warehouse_name' AND COALESCE ( column_comment , '' ) <> '目的仓名称快照' ), 'ALTER TABLE ll_outbound_pallet_item MODIFY COLUMN destination_warehouse_name VARCHAR(255) NULL COMMENT ''目的仓名称快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_outbound_pallet_item' AND column_name = 'package_count' AND COALESCE ( column_comment , '' ) <> '箱数' ), 'ALTER TABLE ll_outbound_pallet_item MODIFY COLUMN package_count INT NOT NULL DEFAULT 0 COMMENT ''箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_outbound_pallet_item' AND column_name = 'order_refs' AND COALESCE ( column_comment , '' ) <> '关联订单信息' ), 'ALTER TABLE ll_outbound_pallet_item MODIFY COLUMN order_refs VARCHAR(2000) NULL COMMENT ''关联订单信息''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_outbound_pallet_item' AND column_name = 'inbound_code' AND COALESCE ( column_comment , '' ) <> '入仓单号快照' ), 'ALTER TABLE ll_outbound_pallet_item MODIFY COLUMN inbound_code VARCHAR(128) NULL COMMENT ''入仓单号快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_outbound_pallet_item' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_outbound_pallet_item MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_delivery_order' AND COALESCE ( table_comment , '' ) <> '尾程派送单' ), 'ALTER TABLE ll_delivery_order COMMENT = ''尾程派送单''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_delivery_order' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_delivery_order MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_delivery_order' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_delivery_order MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_delivery_order' AND column_name = 'delivery_no' AND COALESCE ( column_comment , '' ) <> '派送单号' ), 'ALTER TABLE ll_delivery_order MODIFY COLUMN delivery_no VARCHAR(64) NOT NULL COMMENT ''派送单号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_delivery_order' AND column_name = 'outbound_order_id' AND COALESCE ( column_comment , '' ) <> '出库单ID' ), 'ALTER TABLE ll_delivery_order MODIFY COLUMN outbound_order_id BIGINT NOT NULL COMMENT ''出库单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_delivery_order' AND column_name = 'outbound_no' AND COALESCE ( column_comment , '' ) <> '出库单号' ), 'ALTER TABLE ll_delivery_order MODIFY COLUMN outbound_no VARCHAR(64) NOT NULL COMMENT ''出库单号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_delivery_order' AND column_name = 'dispatch_order_id' AND COALESCE ( column_comment , '' ) <> '派车单ID' ), 'ALTER TABLE ll_delivery_order MODIFY COLUMN dispatch_order_id BIGINT NOT NULL COMMENT ''派车单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_delivery_order' AND column_name = 'dispatch_no' AND COALESCE ( column_comment , '' ) <> '派车单号' ), 'ALTER TABLE ll_delivery_order MODIFY COLUMN dispatch_no VARCHAR(64) NOT NULL COMMENT ''派车单号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_delivery_order' AND column_name = 'overseas_warehouse_id' AND COALESCE ( column_comment , '' ) <> '海外仓ID' ), 'ALTER TABLE ll_delivery_order MODIFY COLUMN overseas_warehouse_id VARCHAR(128) NULL COMMENT ''海外仓ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_delivery_order' AND column_name = 'status' AND COALESCE ( column_comment , '' ) <> '业务状态' ), 'ALTER TABLE ll_delivery_order MODIFY COLUMN status VARCHAR(32) NOT NULL DEFAULT ''WAIT_DELIVERY'' COMMENT ''业务状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_delivery_order' AND column_name = 'package_count' AND COALESCE ( column_comment , '' ) <> '箱数' ), 'ALTER TABLE ll_delivery_order MODIFY COLUMN package_count INT NOT NULL DEFAULT 0 COMMENT ''箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_delivery_order' AND column_name = 'pallet_count' AND COALESCE ( column_comment , '' ) <> '托盘数' ), 'ALTER TABLE ll_delivery_order MODIFY COLUMN pallet_count INT NOT NULL DEFAULT 0 COMMENT ''托盘数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_delivery_order' AND column_name = 'idempotency_key' AND COALESCE ( column_comment , '' ) <> '业务幂等键' ), 'ALTER TABLE ll_delivery_order MODIFY COLUMN idempotency_key VARCHAR(255) NOT NULL COMMENT ''业务幂等键''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_delivery_order' AND column_name = 'created_by' AND COALESCE ( column_comment , '' ) <> '创建人ID' ), 'ALTER TABLE ll_delivery_order MODIFY COLUMN created_by VARCHAR(128) NULL COMMENT ''创建人ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_delivery_order' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_delivery_order MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_delivery_order' AND column_name = 'updated_at' AND COALESCE ( column_comment , '' ) <> '更新时间' ), 'ALTER TABLE ll_delivery_order MODIFY COLUMN updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT ''更新时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND COALESCE ( table_comment , '' ) <> '客户转仓单' ), 'ALTER TABLE ll_warehouse_transfer_order COMMENT = ''客户转仓单''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_warehouse_transfer_order MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_warehouse_transfer_order MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND column_name = 'transfer_no' AND COALESCE ( column_comment , '' ) <> '转仓单号' ), 'ALTER TABLE ll_warehouse_transfer_order MODIFY COLUMN transfer_no VARCHAR(64) NOT NULL COMMENT ''转仓单号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND column_name = 'inbound_order_id' AND COALESCE ( column_comment , '' ) <> '入仓单ID' ), 'ALTER TABLE ll_warehouse_transfer_order MODIFY COLUMN inbound_order_id BIGINT NOT NULL COMMENT ''入仓单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND column_name = 'inbound_code' AND COALESCE ( column_comment , '' ) <> '入仓单号快照' ), 'ALTER TABLE ll_warehouse_transfer_order MODIFY COLUMN inbound_code VARCHAR(128) NOT NULL COMMENT ''入仓单号快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND column_name = 'lastleg_order_id' AND COALESCE ( column_comment , '' ) <> '尾程订单ID' ), 'ALTER TABLE ll_warehouse_transfer_order MODIFY COLUMN lastleg_order_id BIGINT NOT NULL COMMENT ''尾程订单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND column_name = 'lastleg_order_no' AND COALESCE ( column_comment , '' ) <> '尾程订单号' ), 'ALTER TABLE ll_warehouse_transfer_order MODIFY COLUMN lastleg_order_no VARCHAR(32) NOT NULL COMMENT ''尾程订单号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND column_name = 'operating_warehouse_id' AND COALESCE ( column_comment , '' ) <> '作业仓库ID' ), 'ALTER TABLE ll_warehouse_transfer_order MODIFY COLUMN operating_warehouse_id VARCHAR(128) NOT NULL COMMENT ''作业仓库ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND column_name = 'fba_warehouse_code' AND COALESCE ( column_comment , '' ) <> 'FBA仓库编码' ), 'ALTER TABLE ll_warehouse_transfer_order MODIFY COLUMN fba_warehouse_code VARCHAR(128) NOT NULL COMMENT ''FBA仓库编码''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND column_name = 'delivery_address' AND COALESCE ( column_comment , '' ) <> '派送地址' ), 'ALTER TABLE ll_warehouse_transfer_order MODIFY COLUMN delivery_address VARCHAR(1000) NOT NULL COMMENT ''派送地址''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND column_name = 'package_count' AND COALESCE ( column_comment , '' ) <> '箱数' ), 'ALTER TABLE ll_warehouse_transfer_order MODIFY COLUMN package_count INT NOT NULL COMMENT ''箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND column_name = 'delivery_method' AND COALESCE ( column_comment , '' ) <> '派送方式' ), 'ALTER TABLE ll_warehouse_transfer_order MODIFY COLUMN delivery_method VARCHAR(64) NOT NULL COMMENT ''派送方式''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND column_name = 'estimated_arrival_at' AND COALESCE ( column_comment , '' ) <> '预计到达时间' ), 'ALTER TABLE ll_warehouse_transfer_order MODIFY COLUMN estimated_arrival_at DATETIME(3) NOT NULL COMMENT ''预计到达时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND column_name = 'fba_shipment_no' AND COALESCE ( column_comment , '' ) <> 'FBA货件编号' ), 'ALTER TABLE ll_warehouse_transfer_order MODIFY COLUMN fba_shipment_no VARCHAR(128) NOT NULL COMMENT ''FBA货件编号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND column_name = 'tracking_no' AND COALESCE ( column_comment , '' ) <> '物流跟踪号' ), 'ALTER TABLE ll_warehouse_transfer_order MODIFY COLUMN tracking_no VARCHAR(255) NULL COMMENT ''物流跟踪号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND column_name = 'fba_box_nos' AND COALESCE ( column_comment , '' ) <> 'FBA箱号集合' ), 'ALTER TABLE ll_warehouse_transfer_order MODIFY COLUMN fba_box_nos VARCHAR(2000) NULL COMMENT ''FBA箱号集合''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND column_name = 'remark' AND COALESCE ( column_comment , '' ) <> '备注' ), 'ALTER TABLE ll_warehouse_transfer_order MODIFY COLUMN remark VARCHAR(1000) NULL COMMENT ''备注''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND column_name = 'need_relabel' AND COALESCE ( column_comment , '' ) <> '是否需要换标' ), 'ALTER TABLE ll_warehouse_transfer_order MODIFY COLUMN need_relabel TINYINT NOT NULL DEFAULT 0 COMMENT ''是否需要换标''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND column_name = 'relabel_application_id' AND COALESCE ( column_comment , '' ) <> '换标申请单ID' ), 'ALTER TABLE ll_warehouse_transfer_order MODIFY COLUMN relabel_application_id BIGINT NULL COMMENT ''换标申请单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND column_name = 'relabel_no' AND COALESCE ( column_comment , '' ) <> '换标申请单号' ), 'ALTER TABLE ll_warehouse_transfer_order MODIFY COLUMN relabel_no VARCHAR(64) NULL COMMENT ''换标申请单号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND column_name = 'status' AND COALESCE ( column_comment , '' ) <> '业务状态' ), 'ALTER TABLE ll_warehouse_transfer_order MODIFY COLUMN status VARCHAR(32) NOT NULL DEFAULT ''PENDING_REVIEW'' COMMENT ''业务状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND column_name = 'idempotency_key' AND COALESCE ( column_comment , '' ) <> '业务幂等键' ), 'ALTER TABLE ll_warehouse_transfer_order MODIFY COLUMN idempotency_key VARCHAR(255) NOT NULL COMMENT ''业务幂等键''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND column_name = 'allocation_idempotency_key' AND COALESCE ( column_comment , '' ) <> '库存分配幂等键' ), 'ALTER TABLE ll_warehouse_transfer_order MODIFY COLUMN allocation_idempotency_key VARCHAR(255) NULL COMMENT ''库存分配幂等键''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND column_name = 'allocation_request_hash' AND COALESCE ( column_comment , '' ) <> '库存分配请求哈希' ), 'ALTER TABLE ll_warehouse_transfer_order MODIFY COLUMN allocation_request_hash CHAR(64) NULL COMMENT ''库存分配请求哈希''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND column_name = 'outbound_idempotency_key' AND COALESCE ( column_comment , '' ) <> '出库幂等键' ), 'ALTER TABLE ll_warehouse_transfer_order MODIFY COLUMN outbound_idempotency_key VARCHAR(255) NULL COMMENT ''出库幂等键''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND column_name = 'outbound_request_hash' AND COALESCE ( column_comment , '' ) <> '出库请求哈希' ), 'ALTER TABLE ll_warehouse_transfer_order MODIFY COLUMN outbound_request_hash CHAR(64) NULL COMMENT ''出库请求哈希''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND column_name = 'outbound_at' AND COALESCE ( column_comment , '' ) <> '出库时间' ), 'ALTER TABLE ll_warehouse_transfer_order MODIFY COLUMN outbound_at DATETIME(3) NULL COMMENT ''出库时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND column_name = 'request_hash' AND COALESCE ( column_comment , '' ) <> '请求内容哈希' ), 'ALTER TABLE ll_warehouse_transfer_order MODIFY COLUMN request_hash CHAR(64) NOT NULL COMMENT ''请求内容哈希''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND column_name = 'created_by' AND COALESCE ( column_comment , '' ) <> '创建人ID' ), 'ALTER TABLE ll_warehouse_transfer_order MODIFY COLUMN created_by VARCHAR(128) NULL COMMENT ''创建人ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_warehouse_transfer_order MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_order' AND column_name = 'updated_at' AND COALESCE ( column_comment , '' ) <> '更新时间' ), 'ALTER TABLE ll_warehouse_transfer_order MODIFY COLUMN updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT ''更新时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_source_order' AND COALESCE ( table_comment , '' ) <> '转仓来源历史订单绑定' ), 'ALTER TABLE ll_warehouse_transfer_source_order COMMENT = ''转仓来源历史订单绑定''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_source_order' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_warehouse_transfer_source_order MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_source_order' AND column_name = 'transfer_order_id' AND COALESCE ( column_comment , '' ) <> '转仓单ID' ), 'ALTER TABLE ll_warehouse_transfer_source_order MODIFY COLUMN transfer_order_id BIGINT NOT NULL COMMENT ''转仓单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_source_order' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_warehouse_transfer_source_order MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_source_order' AND column_name = 'source_lastleg_order_id' AND COALESCE ( column_comment , '' ) <> '来源尾程订单ID' ), 'ALTER TABLE ll_warehouse_transfer_source_order MODIFY COLUMN source_lastleg_order_id BIGINT NOT NULL COMMENT ''来源尾程订单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_source_order' AND column_name = 'source_lastleg_order_no' AND COALESCE ( column_comment , '' ) <> '来源尾程订单号' ), 'ALTER TABLE ll_warehouse_transfer_source_order MODIFY COLUMN source_lastleg_order_no VARCHAR(32) NOT NULL COMMENT ''来源尾程订单号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_source_order' AND column_name = 'inbound_order_id' AND COALESCE ( column_comment , '' ) <> '入仓单ID' ), 'ALTER TABLE ll_warehouse_transfer_source_order MODIFY COLUMN inbound_order_id BIGINT NOT NULL COMMENT ''入仓单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_source_order' AND column_name = 'inbound_code' AND COALESCE ( column_comment , '' ) <> '入仓单号快照' ), 'ALTER TABLE ll_warehouse_transfer_source_order MODIFY COLUMN inbound_code VARCHAR(128) NOT NULL COMMENT ''入仓单号快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_source_order' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_warehouse_transfer_source_order MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_item' AND COALESCE ( table_comment , '' ) <> '转仓货物冻结明细' ), 'ALTER TABLE ll_warehouse_transfer_item COMMENT = ''转仓货物冻结明细''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_item' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_warehouse_transfer_item MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_item' AND column_name = 'transfer_order_id' AND COALESCE ( column_comment , '' ) <> '转仓单ID' ), 'ALTER TABLE ll_warehouse_transfer_item MODIFY COLUMN transfer_order_id BIGINT NOT NULL COMMENT ''转仓单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_item' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_warehouse_transfer_item MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_item' AND column_name = 'sku_code' AND COALESCE ( column_comment , '' ) <> 'SKU编码' ), 'ALTER TABLE ll_warehouse_transfer_item MODIFY COLUMN sku_code VARCHAR(128) NOT NULL COMMENT ''SKU编码''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_item' AND column_name = 'product_name_zh' AND COALESCE ( column_comment , '' ) <> '产品中文名称' ), 'ALTER TABLE ll_warehouse_transfer_item MODIFY COLUMN product_name_zh VARCHAR(255) NOT NULL COMMENT ''产品中文名称''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_item' AND column_name = 'package_count' AND COALESCE ( column_comment , '' ) <> '箱数' ), 'ALTER TABLE ll_warehouse_transfer_item MODIFY COLUMN package_count INT NOT NULL COMMENT ''箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_item' AND column_name = 'shipping_mark' AND COALESCE ( column_comment , '' ) <> '运输唛头' ), 'ALTER TABLE ll_warehouse_transfer_item MODIFY COLUMN shipping_mark VARCHAR(255) NULL COMMENT ''运输唛头''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_item' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_warehouse_transfer_item MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_inventory_allocation' AND COALESCE ( table_comment , '' ) <> '转仓单来源库存分配记录' ), 'ALTER TABLE ll_warehouse_transfer_inventory_allocation COMMENT = ''转仓单来源库存分配记录''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_inventory_allocation' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '雪花主键' ), 'ALTER TABLE ll_warehouse_transfer_inventory_allocation MODIFY COLUMN id BIGINT NOT NULL COMMENT ''雪花主键''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_inventory_allocation' AND column_name = 'transfer_order_id' AND COALESCE ( column_comment , '' ) <> '转仓单ID' ), 'ALTER TABLE ll_warehouse_transfer_inventory_allocation MODIFY COLUMN transfer_order_id BIGINT NOT NULL COMMENT ''转仓单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_inventory_allocation' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_warehouse_transfer_inventory_allocation MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_inventory_allocation' AND column_name = 'inventory_position_id' AND COALESCE ( column_comment , '' ) <> '来源库存仓位记录ID' ), 'ALTER TABLE ll_warehouse_transfer_inventory_allocation MODIFY COLUMN inventory_position_id BIGINT NOT NULL COMMENT ''来源库存仓位记录ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_inventory_allocation' AND column_name = 'inventory_balance_id' AND COALESCE ( column_comment , '' ) <> '来源库存余额记录ID' ), 'ALTER TABLE ll_warehouse_transfer_inventory_allocation MODIFY COLUMN inventory_balance_id BIGINT NOT NULL COMMENT ''来源库存余额记录ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_inventory_allocation' AND column_name = 'inbound_order_id' AND COALESCE ( column_comment , '' ) <> '来源入仓单ID' ), 'ALTER TABLE ll_warehouse_transfer_inventory_allocation MODIFY COLUMN inbound_order_id BIGINT NOT NULL COMMENT ''来源入仓单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_inventory_allocation' AND column_name = 'inbound_code' AND COALESCE ( column_comment , '' ) <> '来源入仓单号快照' ), 'ALTER TABLE ll_warehouse_transfer_inventory_allocation MODIFY COLUMN inbound_code VARCHAR(128) NOT NULL COMMENT ''来源入仓单号快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_inventory_allocation' AND column_name = 'pallet_id' AND COALESCE ( column_comment , '' ) <> '来源托盘ID' ), 'ALTER TABLE ll_warehouse_transfer_inventory_allocation MODIFY COLUMN pallet_id BIGINT NOT NULL COMMENT ''来源托盘ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_inventory_allocation' AND column_name = 'pallet_no' AND COALESCE ( column_comment , '' ) <> '来源托盘号快照' ), 'ALTER TABLE ll_warehouse_transfer_inventory_allocation MODIFY COLUMN pallet_no VARCHAR(128) NOT NULL COMMENT ''来源托盘号快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_inventory_allocation' AND column_name = 'package_count' AND COALESCE ( column_comment , '' ) <> '分配箱数' ), 'ALTER TABLE ll_warehouse_transfer_inventory_allocation MODIFY COLUMN package_count INT NOT NULL COMMENT ''分配箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_inventory_allocation' AND column_name = 'status' AND COALESCE ( column_comment , '' ) <> '分配状态' ), 'ALTER TABLE ll_warehouse_transfer_inventory_allocation MODIFY COLUMN status VARCHAR(32) NOT NULL DEFAULT ''RESERVED'' COMMENT ''分配状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_inventory_allocation' AND column_name = 'active_position_key' AND COALESCE ( column_comment , '' ) <> '生效中的仓位排他键' ), 'ALTER TABLE ll_warehouse_transfer_inventory_allocation MODIFY COLUMN active_position_key VARCHAR(255) NULL COMMENT ''生效中的仓位排他键''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_inventory_allocation' AND column_name = 'allocated_at' AND COALESCE ( column_comment , '' ) <> '分配时间' ), 'ALTER TABLE ll_warehouse_transfer_inventory_allocation MODIFY COLUMN allocated_at DATETIME(3) NOT NULL COMMENT ''分配时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_inventory_allocation' AND column_name = 'shipped_at' AND COALESCE ( column_comment , '' ) <> '出库时间' ), 'ALTER TABLE ll_warehouse_transfer_inventory_allocation MODIFY COLUMN shipped_at DATETIME(3) NULL COMMENT ''出库时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_inventory_allocation' AND column_name = 'received_at' AND COALESCE ( column_comment , '' ) <> '收货时间' ), 'ALTER TABLE ll_warehouse_transfer_inventory_allocation MODIFY COLUMN received_at DATETIME(3) NULL COMMENT ''收货时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_inventory_allocation' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_warehouse_transfer_inventory_allocation MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_inventory_allocation' AND column_name = 'updated_at' AND COALESCE ( column_comment , '' ) <> '更新时间' ), 'ALTER TABLE ll_warehouse_transfer_inventory_allocation MODIFY COLUMN updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT ''更新时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_receipt' AND COALESCE ( table_comment , '' ) <> '转仓来源仓位的目标库存收货记录' ), 'ALTER TABLE ll_warehouse_transfer_receipt COMMENT = ''转仓来源仓位的目标库存收货记录''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_receipt' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '雪花主键' ), 'ALTER TABLE ll_warehouse_transfer_receipt MODIFY COLUMN id BIGINT NOT NULL COMMENT ''雪花主键''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_receipt' AND column_name = 'transfer_order_id' AND COALESCE ( column_comment , '' ) <> '转仓单ID' ), 'ALTER TABLE ll_warehouse_transfer_receipt MODIFY COLUMN transfer_order_id BIGINT NOT NULL COMMENT ''转仓单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_receipt' AND column_name = 'allocation_id' AND COALESCE ( column_comment , '' ) <> '库存分配记录ID' ), 'ALTER TABLE ll_warehouse_transfer_receipt MODIFY COLUMN allocation_id BIGINT NOT NULL COMMENT ''库存分配记录ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_receipt' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_warehouse_transfer_receipt MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_receipt' AND column_name = 'source_inventory_position_id' AND COALESCE ( column_comment , '' ) <> '来源库存仓位记录ID' ), 'ALTER TABLE ll_warehouse_transfer_receipt MODIFY COLUMN source_inventory_position_id BIGINT NOT NULL COMMENT ''来源库存仓位记录ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_receipt' AND column_name = 'destination_inventory_balance_id' AND COALESCE ( column_comment , '' ) <> '目标库存余额记录ID' ), 'ALTER TABLE ll_warehouse_transfer_receipt MODIFY COLUMN destination_inventory_balance_id BIGINT NOT NULL COMMENT ''目标库存余额记录ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_receipt' AND column_name = 'destination_inventory_position_id' AND COALESCE ( column_comment , '' ) <> '目标库存仓位记录ID' ), 'ALTER TABLE ll_warehouse_transfer_receipt MODIFY COLUMN destination_inventory_position_id BIGINT NOT NULL COMMENT ''目标库存仓位记录ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_receipt' AND column_name = 'package_count' AND COALESCE ( column_comment , '' ) <> '收货箱数' ), 'ALTER TABLE ll_warehouse_transfer_receipt MODIFY COLUMN package_count INT NOT NULL COMMENT ''收货箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_receipt' AND column_name = 'idempotency_key' AND COALESCE ( column_comment , '' ) <> '收货幂等键' ), 'ALTER TABLE ll_warehouse_transfer_receipt MODIFY COLUMN idempotency_key VARCHAR(255) NOT NULL COMMENT ''收货幂等键''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_receipt' AND column_name = 'request_hash' AND COALESCE ( column_comment , '' ) <> '收货请求哈希' ), 'ALTER TABLE ll_warehouse_transfer_receipt MODIFY COLUMN request_hash CHAR(64) NOT NULL COMMENT ''收货请求哈希''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_receipt' AND column_name = 'inventory_operation_key' AND COALESCE ( column_comment , '' ) <> '库存操作幂等键' ), 'ALTER TABLE ll_warehouse_transfer_receipt MODIFY COLUMN inventory_operation_key VARCHAR(255) NOT NULL COMMENT ''库存操作幂等键''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_receipt' AND column_name = 'created_by' AND COALESCE ( column_comment , '' ) <> '创建人ID' ), 'ALTER TABLE ll_warehouse_transfer_receipt MODIFY COLUMN created_by VARCHAR(128) NULL COMMENT ''创建人ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_receipt' AND column_name = 'received_at' AND COALESCE ( column_comment , '' ) <> '收货时间' ), 'ALTER TABLE ll_warehouse_transfer_receipt MODIFY COLUMN received_at DATETIME(3) NOT NULL COMMENT ''收货时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_warehouse_transfer_receipt' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_warehouse_transfer_receipt MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_relabel_application' AND COALESCE ( table_comment , '' ) <> '客户换标申请单' ), 'ALTER TABLE ll_relabel_application COMMENT = ''客户换标申请单''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_application' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_relabel_application MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_application' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_relabel_application MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_application' AND column_name = 'relabel_no' AND COALESCE ( column_comment , '' ) <> '换标申请单号' ), 'ALTER TABLE ll_relabel_application MODIFY COLUMN relabel_no VARCHAR(64) NOT NULL COMMENT ''换标申请单号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_application' AND column_name = 'lastleg_order_id' AND COALESCE ( column_comment , '' ) <> '尾程订单ID' ), 'ALTER TABLE ll_relabel_application MODIFY COLUMN lastleg_order_id BIGINT NOT NULL COMMENT ''尾程订单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_application' AND column_name = 'customer_order_no' AND COALESCE ( column_comment , '' ) <> '客户订单号' ), 'ALTER TABLE ll_relabel_application MODIFY COLUMN customer_order_no VARCHAR(128) NOT NULL COMMENT ''客户订单号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_application' AND column_name = 'overseas_warehouse_id' AND COALESCE ( column_comment , '' ) <> '海外仓ID' ), 'ALTER TABLE ll_relabel_application MODIFY COLUMN overseas_warehouse_id VARCHAR(128) NOT NULL COMMENT ''海外仓ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_application' AND column_name = 'label_deadline' AND COALESCE ( column_comment , '' ) <> '换标截止时间' ), 'ALTER TABLE ll_relabel_application MODIFY COLUMN label_deadline DATETIME(3) NOT NULL COMMENT ''换标截止时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_application' AND column_name = 'contact_name' AND COALESCE ( column_comment , '' ) <> '联系人姓名' ), 'ALTER TABLE ll_relabel_application MODIFY COLUMN contact_name VARCHAR(128) NOT NULL COMMENT ''联系人姓名''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_application' AND column_name = 'contact_phone' AND COALESCE ( column_comment , '' ) <> '联系人电话' ), 'ALTER TABLE ll_relabel_application MODIFY COLUMN contact_phone VARCHAR(64) NOT NULL COMMENT ''联系人电话''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_application' AND column_name = 'remark' AND COALESCE ( column_comment , '' ) <> '备注' ), 'ALTER TABLE ll_relabel_application MODIFY COLUMN remark VARCHAR(1000) NULL COMMENT ''备注''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_application' AND column_name = 'status' AND COALESCE ( column_comment , '' ) <> '业务状态' ), 'ALTER TABLE ll_relabel_application MODIFY COLUMN status VARCHAR(32) NOT NULL DEFAULT ''PENDING_PROCESSING'' COMMENT ''业务状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_application' AND column_name = 'item_count' AND COALESCE ( column_comment , '' ) <> '明细数量' ), 'ALTER TABLE ll_relabel_application MODIFY COLUMN item_count INT NOT NULL DEFAULT 0 COMMENT ''明细数量''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_application' AND column_name = 'total_package_count' AND COALESCE ( column_comment , '' ) <> '总箱数' ), 'ALTER TABLE ll_relabel_application MODIFY COLUMN total_package_count INT NOT NULL DEFAULT 0 COMMENT ''总箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_application' AND column_name = 'notified_package_count' AND COALESCE ( column_comment , '' ) <> '已通知箱数' ), 'ALTER TABLE ll_relabel_application MODIFY COLUMN notified_package_count INT NOT NULL DEFAULT 0 COMMENT ''已通知箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_application' AND column_name = 'idempotency_key' AND COALESCE ( column_comment , '' ) <> '业务幂等键' ), 'ALTER TABLE ll_relabel_application MODIFY COLUMN idempotency_key VARCHAR(255) NOT NULL COMMENT ''业务幂等键''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_application' AND column_name = 'request_hash' AND COALESCE ( column_comment , '' ) <> '请求内容哈希' ), 'ALTER TABLE ll_relabel_application MODIFY COLUMN request_hash CHAR(64) NOT NULL COMMENT ''请求内容哈希''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_application' AND column_name = 'created_by' AND COALESCE ( column_comment , '' ) <> '创建人ID' ), 'ALTER TABLE ll_relabel_application MODIFY COLUMN created_by VARCHAR(128) NULL COMMENT ''创建人ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_application' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_relabel_application MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_application' AND column_name = 'updated_at' AND COALESCE ( column_comment , '' ) <> '更新时间' ), 'ALTER TABLE ll_relabel_application MODIFY COLUMN updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT ''更新时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_relabel_item' AND COALESCE ( table_comment , '' ) <> '换标货物冻结明细' ), 'ALTER TABLE ll_relabel_item COMMENT = ''换标货物冻结明细''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_item' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_relabel_item MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_item' AND column_name = 'application_id' AND COALESCE ( column_comment , '' ) <> '申请单ID' ), 'ALTER TABLE ll_relabel_item MODIFY COLUMN application_id BIGINT NOT NULL COMMENT ''申请单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_item' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_relabel_item MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_item' AND column_name = 'sku_code' AND COALESCE ( column_comment , '' ) <> 'SKU编码' ), 'ALTER TABLE ll_relabel_item MODIFY COLUMN sku_code VARCHAR(128) NOT NULL COMMENT ''SKU编码''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_item' AND column_name = 'product_image_file_id' AND COALESCE ( column_comment , '' ) <> '产品图片文件ID' ), 'ALTER TABLE ll_relabel_item MODIFY COLUMN product_image_file_id VARCHAR(128) NULL COMMENT ''产品图片文件ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_item' AND column_name = 'product_image_file_name' AND COALESCE ( column_comment , '' ) <> '产品图片文件名' ), 'ALTER TABLE ll_relabel_item MODIFY COLUMN product_image_file_name VARCHAR(255) NULL COMMENT ''产品图片文件名''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_item' AND column_name = 'product_image_url' AND COALESCE ( column_comment , '' ) <> '产品图片地址' ), 'ALTER TABLE ll_relabel_item MODIFY COLUMN product_image_url VARCHAR(1000) NULL COMMENT ''产品图片地址''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_item' AND column_name = 'product_name_zh' AND COALESCE ( column_comment , '' ) <> '产品中文名称' ), 'ALTER TABLE ll_relabel_item MODIFY COLUMN product_name_zh VARCHAR(255) NOT NULL COMMENT ''产品中文名称''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_item' AND column_name = 'total_package_count' AND COALESCE ( column_comment , '' ) <> '总箱数' ), 'ALTER TABLE ll_relabel_item MODIFY COLUMN total_package_count INT NOT NULL COMMENT ''总箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_item' AND column_name = 'notified_package_count' AND COALESCE ( column_comment , '' ) <> '已通知箱数' ), 'ALTER TABLE ll_relabel_item MODIFY COLUMN notified_package_count INT NOT NULL COMMENT ''已通知箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_item' AND column_name = 'shipment_no' AND COALESCE ( column_comment , '' ) <> '货件编号' ), 'ALTER TABLE ll_relabel_item MODIFY COLUMN shipment_no VARCHAR(128) NOT NULL COMMENT ''货件编号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_item' AND column_name = 'tracking_code' AND COALESCE ( column_comment , '' ) <> '物流跟踪编码' ), 'ALTER TABLE ll_relabel_item MODIFY COLUMN tracking_code VARCHAR(255) NULL COMMENT ''物流跟踪编码''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_item' AND column_name = 'new_sku_code' AND COALESCE ( column_comment , '' ) <> '换标后SKU编码' ), 'ALTER TABLE ll_relabel_item MODIFY COLUMN new_sku_code VARCHAR(128) NOT NULL COMMENT ''换标后SKU编码''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_item' AND column_name = 'label_requirement' AND COALESCE ( column_comment , '' ) <> '换标要求' ), 'ALTER TABLE ll_relabel_item MODIFY COLUMN label_requirement VARCHAR(1000) NULL COMMENT ''换标要求''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_item' AND column_name = 'relabel_file_id' AND COALESCE ( column_comment , '' ) <> '换标文件ID' ), 'ALTER TABLE ll_relabel_item MODIFY COLUMN relabel_file_id VARCHAR(128) NULL COMMENT ''换标文件ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_item' AND column_name = 'relabel_file_name' AND COALESCE ( column_comment , '' ) <> '换标文件名' ), 'ALTER TABLE ll_relabel_item MODIFY COLUMN relabel_file_name VARCHAR(255) NULL COMMENT ''换标文件名''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_item' AND column_name = 'relabel_file_url' AND COALESCE ( column_comment , '' ) <> '换标文件地址' ), 'ALTER TABLE ll_relabel_item MODIFY COLUMN relabel_file_url VARCHAR(1000) NULL COMMENT ''换标文件地址''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_item' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_relabel_item MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_relabel_status_history' AND COALESCE ( table_comment , '' ) <> '换标状态变更历史' ), 'ALTER TABLE ll_relabel_status_history COMMENT = ''换标状态变更历史''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_status_history' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_relabel_status_history MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_status_history' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_relabel_status_history MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_status_history' AND column_name = 'application_id' AND COALESCE ( column_comment , '' ) <> '申请单ID' ), 'ALTER TABLE ll_relabel_status_history MODIFY COLUMN application_id BIGINT NOT NULL COMMENT ''申请单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_status_history' AND column_name = 'from_status' AND COALESCE ( column_comment , '' ) <> '变更前状态' ), 'ALTER TABLE ll_relabel_status_history MODIFY COLUMN from_status VARCHAR(32) NULL COMMENT ''变更前状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_status_history' AND column_name = 'to_status' AND COALESCE ( column_comment , '' ) <> '变更后状态' ), 'ALTER TABLE ll_relabel_status_history MODIFY COLUMN to_status VARCHAR(32) NOT NULL COMMENT ''变更后状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_status_history' AND column_name = 'operator_id' AND COALESCE ( column_comment , '' ) <> '操作人ID' ), 'ALTER TABLE ll_relabel_status_history MODIFY COLUMN operator_id VARCHAR(128) NULL COMMENT ''操作人ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_status_history' AND column_name = 'remark' AND COALESCE ( column_comment , '' ) <> '备注' ), 'ALTER TABLE ll_relabel_status_history MODIFY COLUMN remark VARCHAR(1000) NULL COMMENT ''备注''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_relabel_status_history' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_relabel_status_history MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_dropship_order_profile' AND COALESCE ( table_comment , '' ) <> '一件代发托盘档案' ), 'ALTER TABLE ll_dropship_order_profile COMMENT = ''一件代发托盘档案''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_order_profile' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_dropship_order_profile MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_order_profile' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_dropship_order_profile MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_order_profile' AND column_name = 'order_id' AND COALESCE ( column_comment , '' ) <> '订单ID' ), 'ALTER TABLE ll_dropship_order_profile MODIFY COLUMN order_id BIGINT NOT NULL COMMENT ''订单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_order_profile' AND column_name = 'warehouse_pallet_id' AND COALESCE ( column_comment , '' ) <> '仓库实物托盘ID' ), 'ALTER TABLE ll_dropship_order_profile MODIFY COLUMN warehouse_pallet_id BIGINT NULL COMMENT ''仓库实物托盘ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_order_profile' AND column_name = 'pallet_no' AND COALESCE ( column_comment , '' ) <> '托盘号' ), 'ALTER TABLE ll_dropship_order_profile MODIFY COLUMN pallet_no VARCHAR(128) NULL COMMENT ''托盘号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_order_profile' AND column_name = 'source_pallet_no' AND COALESCE ( column_comment , '' ) <> '来源托盘号快照' ), 'ALTER TABLE ll_dropship_order_profile MODIFY COLUMN source_pallet_no VARCHAR(128) NOT NULL COMMENT ''来源托盘号快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_order_profile' AND column_name = 'inventory_position_id' AND COALESCE ( column_comment , '' ) <> '库存仓位记录ID' ), 'ALTER TABLE ll_dropship_order_profile MODIFY COLUMN inventory_position_id BIGINT NULL COMMENT ''库存仓位记录ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_order_profile' AND column_name = 'status' AND COALESCE ( column_comment , '' ) <> '业务状态' ), 'ALTER TABLE ll_dropship_order_profile MODIFY COLUMN status VARCHAR(32) NOT NULL DEFAULT ''PENDING_INBOUND'' COMMENT ''业务状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_order_profile' AND column_name = 'idempotency_key' AND COALESCE ( column_comment , '' ) <> '业务幂等键' ), 'ALTER TABLE ll_dropship_order_profile MODIFY COLUMN idempotency_key VARCHAR(255) NOT NULL COMMENT ''业务幂等键''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_order_profile' AND column_name = 'version' AND COALESCE ( column_comment , '' ) <> '乐观锁版本' ), 'ALTER TABLE ll_dropship_order_profile MODIFY COLUMN version BIGINT NOT NULL DEFAULT 0 COMMENT ''乐观锁版本''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_order_profile' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_dropship_order_profile MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_order_profile' AND column_name = 'updated_at' AND COALESCE ( column_comment , '' ) <> '更新时间' ), 'ALTER TABLE ll_dropship_order_profile MODIFY COLUMN updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT ''更新时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton' AND COALESCE ( table_comment , '' ) <> '一件代发箱唛明细' ), 'ALTER TABLE ll_dropship_carton COMMENT = ''一件代发箱唛明细''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_dropship_carton MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_dropship_carton MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton' AND column_name = 'order_id' AND COALESCE ( column_comment , '' ) <> '订单ID' ), 'ALTER TABLE ll_dropship_carton MODIFY COLUMN order_id BIGINT NOT NULL COMMENT ''订单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton' AND column_name = 'profile_id' AND COALESCE ( column_comment , '' ) <> '托盘档案ID' ), 'ALTER TABLE ll_dropship_carton MODIFY COLUMN profile_id BIGINT NOT NULL COMMENT ''托盘档案ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton' AND column_name = 'warehouse_pallet_id' AND COALESCE ( column_comment , '' ) <> '仓库实物托盘ID' ), 'ALTER TABLE ll_dropship_carton MODIFY COLUMN warehouse_pallet_id BIGINT NULL COMMENT ''仓库实物托盘ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton' AND column_name = 'pallet_no' AND COALESCE ( column_comment , '' ) <> '托盘号' ), 'ALTER TABLE ll_dropship_carton MODIFY COLUMN pallet_no VARCHAR(128) NULL COMMENT ''托盘号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton' AND column_name = 'sku_code' AND COALESCE ( column_comment , '' ) <> 'SKU编码' ), 'ALTER TABLE ll_dropship_carton MODIFY COLUMN sku_code VARCHAR(128) NOT NULL COMMENT ''SKU编码''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton' AND column_name = 'carton_mark' AND COALESCE ( column_comment , '' ) <> '箱唛' ), 'ALTER TABLE ll_dropship_carton MODIFY COLUMN carton_mark VARCHAR(128) NOT NULL COMMENT ''箱唛''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton' AND column_name = 'carton_sequence' AND COALESCE ( column_comment , '' ) <> '箱唛序号' ), 'ALTER TABLE ll_dropship_carton MODIFY COLUMN carton_sequence INT NOT NULL COMMENT ''箱唛序号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton' AND column_name = 'status' AND COALESCE ( column_comment , '' ) <> '业务状态' ), 'ALTER TABLE ll_dropship_carton MODIFY COLUMN status VARCHAR(32) NOT NULL DEFAULT ''PENDING_INBOUND'' COMMENT ''业务状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton' AND column_name = 'outbound_order_no' AND COALESCE ( column_comment , '' ) <> '出库单号' ), 'ALTER TABLE ll_dropship_carton MODIFY COLUMN outbound_order_no VARCHAR(128) NULL COMMENT ''出库单号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton' AND column_name = 'version' AND COALESCE ( column_comment , '' ) <> '乐观锁版本' ), 'ALTER TABLE ll_dropship_carton MODIFY COLUMN version BIGINT NOT NULL DEFAULT 0 COMMENT ''乐观锁版本''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_dropship_carton MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton' AND column_name = 'updated_at' AND COALESCE ( column_comment , '' ) <> '更新时间' ), 'ALTER TABLE ll_dropship_carton MODIFY COLUMN updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT ''更新时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_dropship_sku_inventory' AND COALESCE ( table_comment , '' ) <> '一件代发SKU库存汇总' ), 'ALTER TABLE ll_dropship_sku_inventory COMMENT = ''一件代发SKU库存汇总''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_sku_inventory' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_dropship_sku_inventory MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_sku_inventory' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_dropship_sku_inventory MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_sku_inventory' AND column_name = 'order_id' AND COALESCE ( column_comment , '' ) <> '订单ID' ), 'ALTER TABLE ll_dropship_sku_inventory MODIFY COLUMN order_id BIGINT NOT NULL COMMENT ''订单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_sku_inventory' AND column_name = 'profile_id' AND COALESCE ( column_comment , '' ) <> '托盘档案ID' ), 'ALTER TABLE ll_dropship_sku_inventory MODIFY COLUMN profile_id BIGINT NOT NULL COMMENT ''托盘档案ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_sku_inventory' AND column_name = 'sku_code' AND COALESCE ( column_comment , '' ) <> 'SKU编码' ), 'ALTER TABLE ll_dropship_sku_inventory MODIFY COLUMN sku_code VARCHAR(128) NOT NULL COMMENT ''SKU编码''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_sku_inventory' AND column_name = 'product_name' AND COALESCE ( column_comment , '' ) <> '产品名称' ), 'ALTER TABLE ll_dropship_sku_inventory MODIFY COLUMN product_name VARCHAR(255) NULL COMMENT ''产品名称''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_sku_inventory' AND column_name = 'package_count' AND COALESCE ( column_comment , '' ) <> '箱数' ), 'ALTER TABLE ll_dropship_sku_inventory MODIFY COLUMN package_count BIGINT NOT NULL COMMENT ''箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_sku_inventory' AND column_name = 'product_quantity' AND COALESCE ( column_comment , '' ) <> '产品数量' ), 'ALTER TABLE ll_dropship_sku_inventory MODIFY COLUMN product_quantity BIGINT NOT NULL COMMENT ''产品数量''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_sku_inventory' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_dropship_sku_inventory MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_sku_inventory' AND column_name = 'updated_at' AND COALESCE ( column_comment , '' ) <> '更新时间' ), 'ALTER TABLE ll_dropship_sku_inventory MODIFY COLUMN updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT ''更新时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton_ledger' AND COALESCE ( table_comment , '' ) <> '一件代发箱唛库存流水' ), 'ALTER TABLE ll_dropship_carton_ledger COMMENT = ''一件代发箱唛库存流水''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton_ledger' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_dropship_carton_ledger MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton_ledger' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_dropship_carton_ledger MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton_ledger' AND column_name = 'order_id' AND COALESCE ( column_comment , '' ) <> '订单ID' ), 'ALTER TABLE ll_dropship_carton_ledger MODIFY COLUMN order_id BIGINT NOT NULL COMMENT ''订单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton_ledger' AND column_name = 'carton_id' AND COALESCE ( column_comment , '' ) <> '箱唛记录ID' ), 'ALTER TABLE ll_dropship_carton_ledger MODIFY COLUMN carton_id BIGINT NOT NULL COMMENT ''箱唛记录ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton_ledger' AND column_name = 'carton_mark' AND COALESCE ( column_comment , '' ) <> '箱唛' ), 'ALTER TABLE ll_dropship_carton_ledger MODIFY COLUMN carton_mark VARCHAR(128) NOT NULL COMMENT ''箱唛''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton_ledger' AND column_name = 'sku_code' AND COALESCE ( column_comment , '' ) <> 'SKU编码' ), 'ALTER TABLE ll_dropship_carton_ledger MODIFY COLUMN sku_code VARCHAR(128) NOT NULL COMMENT ''SKU编码''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton_ledger' AND column_name = 'operation_type' AND COALESCE ( column_comment , '' ) <> '操作类型' ), 'ALTER TABLE ll_dropship_carton_ledger MODIFY COLUMN operation_type VARCHAR(32) NOT NULL COMMENT ''操作类型''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton_ledger' AND column_name = 'before_packages' AND COALESCE ( column_comment , '' ) <> '变动前箱数' ), 'ALTER TABLE ll_dropship_carton_ledger MODIFY COLUMN before_packages BIGINT NOT NULL COMMENT ''变动前箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton_ledger' AND column_name = 'delta_packages' AND COALESCE ( column_comment , '' ) <> '箱数变动量' ), 'ALTER TABLE ll_dropship_carton_ledger MODIFY COLUMN delta_packages BIGINT NOT NULL COMMENT ''箱数变动量''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton_ledger' AND column_name = 'after_packages' AND COALESCE ( column_comment , '' ) <> '变动后箱数' ), 'ALTER TABLE ll_dropship_carton_ledger MODIFY COLUMN after_packages BIGINT NOT NULL COMMENT ''变动后箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton_ledger' AND column_name = 'business_order_no' AND COALESCE ( column_comment , '' ) <> '业务单号' ), 'ALTER TABLE ll_dropship_carton_ledger MODIFY COLUMN business_order_no VARCHAR(128) NULL COMMENT ''业务单号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton_ledger' AND column_name = 'idempotency_key' AND COALESCE ( column_comment , '' ) <> '业务幂等键' ), 'ALTER TABLE ll_dropship_carton_ledger MODIFY COLUMN idempotency_key VARCHAR(255) NOT NULL COMMENT ''业务幂等键''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton_ledger' AND column_name = 'remark' AND COALESCE ( column_comment , '' ) <> '备注' ), 'ALTER TABLE ll_dropship_carton_ledger MODIFY COLUMN remark VARCHAR(1000) NULL COMMENT ''备注''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton_ledger' AND column_name = 'occurred_at' AND COALESCE ( column_comment , '' ) <> '业务发生时间' ), 'ALTER TABLE ll_dropship_carton_ledger MODIFY COLUMN occurred_at DATETIME(3) NOT NULL COMMENT ''业务发生时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_dropship_carton_ledger' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_dropship_carton_ledger MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_application' AND COALESCE ( table_comment , '' ) <> '货物废弃申请单' ), 'ALTER TABLE ll_cargo_discard_application COMMENT = ''货物废弃申请单''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_application' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_cargo_discard_application MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_application' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_cargo_discard_application MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_application' AND column_name = 'discard_no' AND COALESCE ( column_comment , '' ) <> '废弃申请单号' ), 'ALTER TABLE ll_cargo_discard_application MODIFY COLUMN discard_no VARCHAR(64) NOT NULL COMMENT ''废弃申请单号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_application' AND column_name = 'overseas_warehouse_id' AND COALESCE ( column_comment , '' ) <> '海外仓ID' ), 'ALTER TABLE ll_cargo_discard_application MODIFY COLUMN overseas_warehouse_id VARCHAR(128) NOT NULL COMMENT ''海外仓ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_application' AND column_name = 'overseas_warehouse_name' AND COALESCE ( column_comment , '' ) <> '海外仓名称快照' ), 'ALTER TABLE ll_cargo_discard_application MODIFY COLUMN overseas_warehouse_name VARCHAR(255) NULL COMMENT ''海外仓名称快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_application' AND column_name = 'inbound_codes' AND COALESCE ( column_comment , '' ) <> '入仓单号集合' ), 'ALTER TABLE ll_cargo_discard_application MODIFY COLUMN inbound_codes VARCHAR(2000) NOT NULL COMMENT ''入仓单号集合''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_application' AND column_name = 'total_packages' AND COALESCE ( column_comment , '' ) <> '总箱数' ), 'ALTER TABLE ll_cargo_discard_application MODIFY COLUMN total_packages INT NOT NULL COMMENT ''总箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_application' AND column_name = 'fee_per_package' AND COALESCE ( column_comment , '' ) <> '每箱处理费用' ), 'ALTER TABLE ll_cargo_discard_application MODIFY COLUMN fee_per_package DECIMAL(18,2) NOT NULL COMMENT ''每箱处理费用''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_application' AND column_name = 'total_fee' AND COALESCE ( column_comment , '' ) <> '费用合计' ), 'ALTER TABLE ll_cargo_discard_application MODIFY COLUMN total_fee DECIMAL(18,2) NOT NULL COMMENT ''费用合计''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_application' AND column_name = 'currency' AND COALESCE ( column_comment , '' ) <> '币种' ), 'ALTER TABLE ll_cargo_discard_application MODIFY COLUMN currency CHAR(3) NOT NULL DEFAULT ''USD'' COMMENT ''币种''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_application' AND column_name = 'status' AND COALESCE ( column_comment , '' ) <> '业务状态' ), 'ALTER TABLE ll_cargo_discard_application MODIFY COLUMN status VARCHAR(32) NOT NULL DEFAULT ''PENDING_REVIEW'' COMMENT ''业务状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_application' AND column_name = 'remark' AND COALESCE ( column_comment , '' ) <> '备注' ), 'ALTER TABLE ll_cargo_discard_application MODIFY COLUMN remark VARCHAR(1000) NULL COMMENT ''备注''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_application' AND column_name = 'idempotency_key' AND COALESCE ( column_comment , '' ) <> '业务幂等键' ), 'ALTER TABLE ll_cargo_discard_application MODIFY COLUMN idempotency_key VARCHAR(255) NOT NULL COMMENT ''业务幂等键''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_application' AND column_name = 'request_hash' AND COALESCE ( column_comment , '' ) <> '请求内容哈希' ), 'ALTER TABLE ll_cargo_discard_application MODIFY COLUMN request_hash CHAR(64) NOT NULL COMMENT ''请求内容哈希''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_application' AND column_name = 'created_by' AND COALESCE ( column_comment , '' ) <> '创建人ID' ), 'ALTER TABLE ll_cargo_discard_application MODIFY COLUMN created_by VARCHAR(128) NULL COMMENT ''创建人ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_application' AND column_name = 'reviewed_by' AND COALESCE ( column_comment , '' ) <> '审核人ID' ), 'ALTER TABLE ll_cargo_discard_application MODIFY COLUMN reviewed_by VARCHAR(128) NULL COMMENT ''审核人ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_application' AND column_name = 'review_remark' AND COALESCE ( column_comment , '' ) <> '审核备注' ), 'ALTER TABLE ll_cargo_discard_application MODIFY COLUMN review_remark VARCHAR(1000) NULL COMMENT ''审核备注''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_application' AND column_name = 'reviewed_at' AND COALESCE ( column_comment , '' ) <> '审核时间' ), 'ALTER TABLE ll_cargo_discard_application MODIFY COLUMN reviewed_at DATETIME(3) NULL COMMENT ''审核时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_application' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_cargo_discard_application MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_application' AND column_name = 'updated_at' AND COALESCE ( column_comment , '' ) <> '更新时间' ), 'ALTER TABLE ll_cargo_discard_application MODIFY COLUMN updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT ''更新时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_item' AND COALESCE ( table_comment , '' ) <> '货物废弃SKU明细' ), 'ALTER TABLE ll_cargo_discard_item COMMENT = ''货物废弃SKU明细''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_item' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_cargo_discard_item MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_item' AND column_name = 'application_id' AND COALESCE ( column_comment , '' ) <> '申请单ID' ), 'ALTER TABLE ll_cargo_discard_item MODIFY COLUMN application_id BIGINT NOT NULL COMMENT ''申请单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_item' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_cargo_discard_item MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_item' AND column_name = 'order_id' AND COALESCE ( column_comment , '' ) <> '订单ID' ), 'ALTER TABLE ll_cargo_discard_item MODIFY COLUMN order_id BIGINT NOT NULL COMMENT ''订单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_item' AND column_name = 'inbound_code' AND COALESCE ( column_comment , '' ) <> '入仓单号快照' ), 'ALTER TABLE ll_cargo_discard_item MODIFY COLUMN inbound_code VARCHAR(128) NOT NULL COMMENT ''入仓单号快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_item' AND column_name = 'profile_id' AND COALESCE ( column_comment , '' ) <> '托盘档案ID' ), 'ALTER TABLE ll_cargo_discard_item MODIFY COLUMN profile_id BIGINT NOT NULL COMMENT ''托盘档案ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_item' AND column_name = 'sku_inventory_id' AND COALESCE ( column_comment , '' ) <> 'SKU库存记录ID' ), 'ALTER TABLE ll_cargo_discard_item MODIFY COLUMN sku_inventory_id BIGINT NOT NULL COMMENT ''SKU库存记录ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_item' AND column_name = 'sku_code' AND COALESCE ( column_comment , '' ) <> 'SKU编码' ), 'ALTER TABLE ll_cargo_discard_item MODIFY COLUMN sku_code VARCHAR(128) NOT NULL COMMENT ''SKU编码''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_item' AND column_name = 'product_name' AND COALESCE ( column_comment , '' ) <> '产品名称' ), 'ALTER TABLE ll_cargo_discard_item MODIFY COLUMN product_name VARCHAR(255) NULL COMMENT ''产品名称''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_item' AND column_name = 'available_packages_snapshot' AND COALESCE ( column_comment , '' ) <> '可用箱数快照' ), 'ALTER TABLE ll_cargo_discard_item MODIFY COLUMN available_packages_snapshot INT NOT NULL COMMENT ''可用箱数快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_item' AND column_name = 'discard_packages' AND COALESCE ( column_comment , '' ) <> '废弃箱数' ), 'ALTER TABLE ll_cargo_discard_item MODIFY COLUMN discard_packages INT NOT NULL COMMENT ''废弃箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_item' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_cargo_discard_item MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_carton' AND COALESCE ( table_comment , '' ) <> '货物废弃锁定箱明细' ), 'ALTER TABLE ll_cargo_discard_carton COMMENT = ''货物废弃锁定箱明细''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_carton' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_cargo_discard_carton MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_carton' AND column_name = 'application_id' AND COALESCE ( column_comment , '' ) <> '申请单ID' ), 'ALTER TABLE ll_cargo_discard_carton MODIFY COLUMN application_id BIGINT NOT NULL COMMENT ''申请单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_carton' AND column_name = 'item_id' AND COALESCE ( column_comment , '' ) <> '明细ID' ), 'ALTER TABLE ll_cargo_discard_carton MODIFY COLUMN item_id BIGINT NOT NULL COMMENT ''明细ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_carton' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_cargo_discard_carton MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_carton' AND column_name = 'carton_id' AND COALESCE ( column_comment , '' ) <> '箱唛记录ID' ), 'ALTER TABLE ll_cargo_discard_carton MODIFY COLUMN carton_id BIGINT NOT NULL COMMENT ''箱唛记录ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_carton' AND column_name = 'carton_mark' AND COALESCE ( column_comment , '' ) <> '箱唛' ), 'ALTER TABLE ll_cargo_discard_carton MODIFY COLUMN carton_mark VARCHAR(128) NOT NULL COMMENT ''箱唛''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_carton' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_cargo_discard_carton MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_status_history' AND COALESCE ( table_comment , '' ) <> '货物废弃审批历史' ), 'ALTER TABLE ll_cargo_discard_status_history COMMENT = ''货物废弃审批历史''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_status_history' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_cargo_discard_status_history MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_status_history' AND column_name = 'application_id' AND COALESCE ( column_comment , '' ) <> '申请单ID' ), 'ALTER TABLE ll_cargo_discard_status_history MODIFY COLUMN application_id BIGINT NOT NULL COMMENT ''申请单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_status_history' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_cargo_discard_status_history MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_status_history' AND column_name = 'from_status' AND COALESCE ( column_comment , '' ) <> '变更前状态' ), 'ALTER TABLE ll_cargo_discard_status_history MODIFY COLUMN from_status VARCHAR(32) NULL COMMENT ''变更前状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_status_history' AND column_name = 'to_status' AND COALESCE ( column_comment , '' ) <> '变更后状态' ), 'ALTER TABLE ll_cargo_discard_status_history MODIFY COLUMN to_status VARCHAR(32) NOT NULL COMMENT ''变更后状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_status_history' AND column_name = 'operator_id' AND COALESCE ( column_comment , '' ) <> '操作人ID' ), 'ALTER TABLE ll_cargo_discard_status_history MODIFY COLUMN operator_id VARCHAR(128) NULL COMMENT ''操作人ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_status_history' AND column_name = 'remark' AND COALESCE ( column_comment , '' ) <> '备注' ), 'ALTER TABLE ll_cargo_discard_status_history MODIFY COLUMN remark VARCHAR(1000) NULL COMMENT ''备注''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_cargo_discard_status_history' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_cargo_discard_status_history MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_order' AND COALESCE ( table_comment , '' ) <> '海外采购订单' ), 'ALTER TABLE ll_overseas_procurement_order COMMENT = ''海外采购订单''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_order' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_overseas_procurement_order MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_order' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_overseas_procurement_order MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_order' AND column_name = 'customer_name' AND COALESCE ( column_comment , '' ) <> '客户名称快照' ), 'ALTER TABLE ll_overseas_procurement_order MODIFY COLUMN customer_name VARCHAR(255) NULL COMMENT ''客户名称快照''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_order' AND column_name = 'order_no' AND COALESCE ( column_comment , '' ) <> '订单号' ), 'ALTER TABLE ll_overseas_procurement_order MODIFY COLUMN order_no VARCHAR(64) NOT NULL COMMENT ''订单号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_order' AND column_name = 'purchase_category' AND COALESCE ( column_comment , '' ) <> '采购品类' ), 'ALTER TABLE ll_overseas_procurement_order MODIFY COLUMN purchase_category VARCHAR(128) NOT NULL COMMENT ''采购品类''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_order' AND column_name = 'product_name' AND COALESCE ( column_comment , '' ) <> '产品名称' ), 'ALTER TABLE ll_overseas_procurement_order MODIFY COLUMN product_name VARCHAR(255) NOT NULL COMMENT ''产品名称''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_order' AND column_name = 'product_specification' AND COALESCE ( column_comment , '' ) <> '产品规格' ), 'ALTER TABLE ll_overseas_procurement_order MODIFY COLUMN product_specification VARCHAR(500) NULL COMMENT ''产品规格''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_order' AND column_name = 'product_url' AND COALESCE ( column_comment , '' ) <> '产品链接' ), 'ALTER TABLE ll_overseas_procurement_order MODIFY COLUMN product_url VARCHAR(2000) NULL COMMENT ''产品链接''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_order' AND column_name = 'purchase_quantity' AND COALESCE ( column_comment , '' ) <> '采购数量' ), 'ALTER TABLE ll_overseas_procurement_order MODIFY COLUMN purchase_quantity BIGINT NOT NULL COMMENT ''采购数量''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_order' AND column_name = 'budget_unit_price' AND COALESCE ( column_comment , '' ) <> '预算单价' ), 'ALTER TABLE ll_overseas_procurement_order MODIFY COLUMN budget_unit_price DECIMAL(18,2) NULL COMMENT ''预算单价''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_order' AND column_name = 'currency' AND COALESCE ( column_comment , '' ) <> '币种' ), 'ALTER TABLE ll_overseas_procurement_order MODIFY COLUMN currency CHAR(3) NOT NULL DEFAULT ''USD'' COMMENT ''币种''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_order' AND column_name = 'receiving_address' AND COALESCE ( column_comment , '' ) <> '收货地址' ), 'ALTER TABLE ll_overseas_procurement_order MODIFY COLUMN receiving_address VARCHAR(1000) NULL COMMENT ''收货地址''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_order' AND column_name = 'contact_name' AND COALESCE ( column_comment , '' ) <> '联系人姓名' ), 'ALTER TABLE ll_overseas_procurement_order MODIFY COLUMN contact_name VARCHAR(128) NOT NULL COMMENT ''联系人姓名''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_order' AND column_name = 'contact_phone' AND COALESCE ( column_comment , '' ) <> '联系人电话' ), 'ALTER TABLE ll_overseas_procurement_order MODIFY COLUMN contact_phone VARCHAR(64) NOT NULL COMMENT ''联系人电话''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_order' AND column_name = 'purchase_warehouse_id' AND COALESCE ( column_comment , '' ) <> '采购入仓仓库ID' ), 'ALTER TABLE ll_overseas_procurement_order MODIFY COLUMN purchase_warehouse_id VARCHAR(128) NULL COMMENT ''采购入仓仓库ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_order' AND column_name = 'purchase_warehouse_name' AND COALESCE ( column_comment , '' ) <> '采购入仓仓库名称' ), 'ALTER TABLE ll_overseas_procurement_order MODIFY COLUMN purchase_warehouse_name VARCHAR(255) NULL COMMENT ''采购入仓仓库名称''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_order' AND column_name = 'inbound_quantity' AND COALESCE ( column_comment , '' ) <> '累计入库数量' ), 'ALTER TABLE ll_overseas_procurement_order MODIFY COLUMN inbound_quantity BIGINT NOT NULL DEFAULT 0 COMMENT ''累计入库数量''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_order' AND column_name = 'outbound_quantity' AND COALESCE ( column_comment , '' ) <> '累计出库数量' ), 'ALTER TABLE ll_overseas_procurement_order MODIFY COLUMN outbound_quantity BIGINT NOT NULL DEFAULT 0 COMMENT ''累计出库数量''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_order' AND column_name = 'domestic_carrier' AND COALESCE ( column_comment , '' ) <> '境内承运商' ), 'ALTER TABLE ll_overseas_procurement_order MODIFY COLUMN domestic_carrier VARCHAR(128) NULL COMMENT ''境内承运商''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_order' AND column_name = 'domestic_tracking_no' AND COALESCE ( column_comment , '' ) <> '境内物流单号' ), 'ALTER TABLE ll_overseas_procurement_order MODIFY COLUMN domestic_tracking_no VARCHAR(128) NULL COMMENT ''境内物流单号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_order' AND column_name = 'overseas_carrier' AND COALESCE ( column_comment , '' ) <> '海外承运商' ), 'ALTER TABLE ll_overseas_procurement_order MODIFY COLUMN overseas_carrier VARCHAR(128) NULL COMMENT ''海外承运商''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_order' AND column_name = 'overseas_tracking_no' AND COALESCE ( column_comment , '' ) <> '海外物流单号' ), 'ALTER TABLE ll_overseas_procurement_order MODIFY COLUMN overseas_tracking_no VARCHAR(128) NULL COMMENT ''海外物流单号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_order' AND column_name = 'estimated_arrival_at' AND COALESCE ( column_comment , '' ) <> '预计到达时间' ), 'ALTER TABLE ll_overseas_procurement_order MODIFY COLUMN estimated_arrival_at DATETIME(3) NULL COMMENT ''预计到达时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_order' AND column_name = 'status' AND COALESCE ( column_comment , '' ) <> '业务状态' ), 'ALTER TABLE ll_overseas_procurement_order MODIFY COLUMN status VARCHAR(32) NOT NULL DEFAULT ''PENDING_REVIEW'' COMMENT ''业务状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_order' AND column_name = 'remark' AND COALESCE ( column_comment , '' ) <> '备注' ), 'ALTER TABLE ll_overseas_procurement_order MODIFY COLUMN remark VARCHAR(1000) NULL COMMENT ''备注''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_order' AND column_name = 'idempotency_key' AND COALESCE ( column_comment , '' ) <> '业务幂等键' ), 'ALTER TABLE ll_overseas_procurement_order MODIFY COLUMN idempotency_key VARCHAR(255) NOT NULL COMMENT ''业务幂等键''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_order' AND column_name = 'request_hash' AND COALESCE ( column_comment , '' ) <> '请求内容哈希' ), 'ALTER TABLE ll_overseas_procurement_order MODIFY COLUMN request_hash CHAR(64) NOT NULL COMMENT ''请求内容哈希''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_order' AND column_name = 'created_by' AND COALESCE ( column_comment , '' ) <> '创建人ID' ), 'ALTER TABLE ll_overseas_procurement_order MODIFY COLUMN created_by VARCHAR(128) NULL COMMENT ''创建人ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_order' AND column_name = 'reviewed_by' AND COALESCE ( column_comment , '' ) <> '审核人ID' ), 'ALTER TABLE ll_overseas_procurement_order MODIFY COLUMN reviewed_by VARCHAR(128) NULL COMMENT ''审核人ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_order' AND column_name = 'review_remark' AND COALESCE ( column_comment , '' ) <> '审核备注' ), 'ALTER TABLE ll_overseas_procurement_order MODIFY COLUMN review_remark VARCHAR(1000) NULL COMMENT ''审核备注''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_order' AND column_name = 'reviewed_at' AND COALESCE ( column_comment , '' ) <> '审核时间' ), 'ALTER TABLE ll_overseas_procurement_order MODIFY COLUMN reviewed_at DATETIME(3) NULL COMMENT ''审核时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_order' AND column_name = 'version' AND COALESCE ( column_comment , '' ) <> '乐观锁版本' ), 'ALTER TABLE ll_overseas_procurement_order MODIFY COLUMN version BIGINT NOT NULL DEFAULT 0 COMMENT ''乐观锁版本''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_order' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_overseas_procurement_order MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_order' AND column_name = 'updated_at' AND COALESCE ( column_comment , '' ) <> '更新时间' ), 'ALTER TABLE ll_overseas_procurement_order MODIFY COLUMN updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT ''更新时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_outbound' AND COALESCE ( table_comment , '' ) <> '海外采购出库记录' ), 'ALTER TABLE ll_overseas_procurement_outbound COMMENT = ''海外采购出库记录''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_outbound' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_overseas_procurement_outbound MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_outbound' AND column_name = 'order_id' AND COALESCE ( column_comment , '' ) <> '订单ID' ), 'ALTER TABLE ll_overseas_procurement_outbound MODIFY COLUMN order_id BIGINT NOT NULL COMMENT ''订单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_outbound' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_overseas_procurement_outbound MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_outbound' AND column_name = 'quantity' AND COALESCE ( column_comment , '' ) <> '数量' ), 'ALTER TABLE ll_overseas_procurement_outbound MODIFY COLUMN quantity BIGINT NOT NULL COMMENT ''数量''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_outbound' AND column_name = 'outbound_no' AND COALESCE ( column_comment , '' ) <> '出库单号' ), 'ALTER TABLE ll_overseas_procurement_outbound MODIFY COLUMN outbound_no VARCHAR(128) NOT NULL COMMENT ''出库单号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_outbound' AND column_name = 'carrier' AND COALESCE ( column_comment , '' ) <> '承运商' ), 'ALTER TABLE ll_overseas_procurement_outbound MODIFY COLUMN carrier VARCHAR(128) NULL COMMENT ''承运商''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_outbound' AND column_name = 'tracking_no' AND COALESCE ( column_comment , '' ) <> '物流跟踪号' ), 'ALTER TABLE ll_overseas_procurement_outbound MODIFY COLUMN tracking_no VARCHAR(128) NULL COMMENT ''物流跟踪号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_outbound' AND column_name = 'outbound_at' AND COALESCE ( column_comment , '' ) <> '出库时间' ), 'ALTER TABLE ll_overseas_procurement_outbound MODIFY COLUMN outbound_at DATETIME(3) NOT NULL COMMENT ''出库时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_outbound' AND column_name = 'remark' AND COALESCE ( column_comment , '' ) <> '备注' ), 'ALTER TABLE ll_overseas_procurement_outbound MODIFY COLUMN remark VARCHAR(1000) NULL COMMENT ''备注''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_outbound' AND column_name = 'created_by' AND COALESCE ( column_comment , '' ) <> '创建人ID' ), 'ALTER TABLE ll_overseas_procurement_outbound MODIFY COLUMN created_by VARCHAR(128) NULL COMMENT ''创建人ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_outbound' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_overseas_procurement_outbound MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_status_history' AND COALESCE ( table_comment , '' ) <> '海外采购审核历史' ), 'ALTER TABLE ll_overseas_procurement_status_history COMMENT = ''海外采购审核历史''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_status_history' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_overseas_procurement_status_history MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_status_history' AND column_name = 'order_id' AND COALESCE ( column_comment , '' ) <> '订单ID' ), 'ALTER TABLE ll_overseas_procurement_status_history MODIFY COLUMN order_id BIGINT NOT NULL COMMENT ''订单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_status_history' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_overseas_procurement_status_history MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_status_history' AND column_name = 'from_status' AND COALESCE ( column_comment , '' ) <> '变更前状态' ), 'ALTER TABLE ll_overseas_procurement_status_history MODIFY COLUMN from_status VARCHAR(32) NULL COMMENT ''变更前状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_status_history' AND column_name = 'to_status' AND COALESCE ( column_comment , '' ) <> '变更后状态' ), 'ALTER TABLE ll_overseas_procurement_status_history MODIFY COLUMN to_status VARCHAR(32) NOT NULL COMMENT ''变更后状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_status_history' AND column_name = 'operator_id' AND COALESCE ( column_comment , '' ) <> '操作人ID' ), 'ALTER TABLE ll_overseas_procurement_status_history MODIFY COLUMN operator_id VARCHAR(128) NULL COMMENT ''操作人ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_status_history' AND column_name = 'remark' AND COALESCE ( column_comment , '' ) <> '备注' ), 'ALTER TABLE ll_overseas_procurement_status_history MODIFY COLUMN remark VARCHAR(1000) NULL COMMENT ''备注''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_status_history' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_overseas_procurement_status_history MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND COALESCE ( table_comment , '' ) <> '美国卡车运输订单' ), 'ALTER TABLE ll_us_truck_order COMMENT = ''美国卡车运输订单''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_us_truck_order MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_us_truck_order MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'order_no' AND COALESCE ( column_comment , '' ) <> '订单号' ), 'ALTER TABLE ll_us_truck_order MODIFY COLUMN order_no VARCHAR(64) NOT NULL COMMENT ''订单号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'transport_type' AND COALESCE ( column_comment , '' ) <> '运输类型' ), 'ALTER TABLE ll_us_truck_order MODIFY COLUMN transport_type VARCHAR(32) NOT NULL COMMENT ''运输类型''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'origin' AND COALESCE ( column_comment , '' ) <> '起运地' ), 'ALTER TABLE ll_us_truck_order MODIFY COLUMN origin VARCHAR(255) NOT NULL COMMENT ''起运地''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'origin_address' AND COALESCE ( column_comment , '' ) <> '起运地址' ), 'ALTER TABLE ll_us_truck_order MODIFY COLUMN origin_address VARCHAR(500) NULL COMMENT ''起运地址''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'destination' AND COALESCE ( column_comment , '' ) <> '目的地' ), 'ALTER TABLE ll_us_truck_order MODIFY COLUMN destination VARCHAR(255) NOT NULL COMMENT ''目的地''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'destination_address' AND COALESCE ( column_comment , '' ) <> '目的地址' ), 'ALTER TABLE ll_us_truck_order MODIFY COLUMN destination_address VARCHAR(500) NULL COMMENT ''目的地址''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'container_type' AND COALESCE ( column_comment , '' ) <> '历史兼容设备类型,零担托盘业务不采集' ), 'ALTER TABLE ll_us_truck_order MODIFY COLUMN container_type VARCHAR(32) NULL COMMENT ''历史兼容设备类型,零担托盘业务不采集''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'pallet_count' AND COALESCE ( column_comment , '' ) <> '客户申报托盘数' ), 'ALTER TABLE ll_us_truck_order MODIFY COLUMN pallet_count INT NOT NULL DEFAULT 1 COMMENT ''客户申报托盘数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'package_count' AND COALESCE ( column_comment , '' ) <> '可选箱数,零或空值均有效' ), 'ALTER TABLE ll_us_truck_order MODIFY COLUMN package_count INT NULL COMMENT ''可选箱数,零或空值均有效''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'received_pallet_count' AND COALESCE ( column_comment , '' ) <> 'PDA实收托盘数' ), 'ALTER TABLE ll_us_truck_order MODIFY COLUMN received_pallet_count INT NOT NULL DEFAULT 0 COMMENT ''PDA实收托盘数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'allocated_pallet_count' AND COALESCE ( column_comment , '' ) <> '已分配到合车行程的托盘数' ), 'ALTER TABLE ll_us_truck_order MODIFY COLUMN allocated_pallet_count INT NOT NULL DEFAULT 0 COMMENT ''已分配到合车行程的托盘数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'shipped_pallet_count' AND COALESCE ( column_comment , '' ) <> '已出库托盘数' ), 'ALTER TABLE ll_us_truck_order MODIFY COLUMN shipped_pallet_count INT NOT NULL DEFAULT 0 COMMENT ''已出库托盘数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'total_weight_kg' AND COALESCE ( column_comment , '' ) <> '总重量(千克)' ), 'ALTER TABLE ll_us_truck_order MODIFY COLUMN total_weight_kg DECIMAL(18,3) NOT NULL DEFAULT 0 COMMENT ''总重量(千克)''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'total_volume_cbm' AND COALESCE ( column_comment , '' ) <> '总体积(立方米)' ), 'ALTER TABLE ll_us_truck_order MODIFY COLUMN total_volume_cbm DECIMAL(18,6) NOT NULL DEFAULT 0 COMMENT ''总体积(立方米)''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'budget_amount' AND COALESCE ( column_comment , '' ) <> '预算金额' ), 'ALTER TABLE ll_us_truck_order MODIFY COLUMN budget_amount DECIMAL(18,2) NULL COMMENT ''预算金额''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'currency' AND COALESCE ( column_comment , '' ) <> '币种' ), 'ALTER TABLE ll_us_truck_order MODIFY COLUMN currency VARCHAR(3) NOT NULL DEFAULT ''USD'' COMMENT ''币种''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'contact_name' AND COALESCE ( column_comment , '' ) <> '联系人姓名' ), 'ALTER TABLE ll_us_truck_order MODIFY COLUMN contact_name VARCHAR(128) NOT NULL COMMENT ''联系人姓名''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'contact_info' AND COALESCE ( column_comment , '' ) <> '联系人联系方式' ), 'ALTER TABLE ll_us_truck_order MODIFY COLUMN contact_info VARCHAR(128) NOT NULL COMMENT ''联系人联系方式''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'requested_date' AND COALESCE ( column_comment , '' ) <> '要求服务日期' ), 'ALTER TABLE ll_us_truck_order MODIFY COLUMN requested_date DATE NOT NULL COMMENT ''要求服务日期''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'status' AND COALESCE ( column_comment , '' ) <> '美国卡车订单状态' ), 'ALTER TABLE ll_us_truck_order MODIFY COLUMN status VARCHAR(32) NOT NULL COMMENT ''美国卡车订单状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'remark' AND COALESCE ( column_comment , '' ) <> '备注' ), 'ALTER TABLE ll_us_truck_order MODIFY COLUMN remark VARCHAR(1000) NULL COMMENT ''备注''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'receipt_idempotency_key' AND COALESCE ( column_comment , '' ) <> '实物收货幂等键' ), 'ALTER TABLE ll_us_truck_order MODIFY COLUMN receipt_idempotency_key VARCHAR(255) NULL COMMENT ''实物收货幂等键''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'receipt_request_hash' AND COALESCE ( column_comment , '' ) <> '实物收货请求哈希' ), 'ALTER TABLE ll_us_truck_order MODIFY COLUMN receipt_request_hash CHAR(64) NULL COMMENT ''实物收货请求哈希''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'idempotency_key' AND COALESCE ( column_comment , '' ) <> '业务幂等键' ), 'ALTER TABLE ll_us_truck_order MODIFY COLUMN idempotency_key VARCHAR(255) NOT NULL COMMENT ''业务幂等键''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'request_hash' AND COALESCE ( column_comment , '' ) <> '请求内容哈希' ), 'ALTER TABLE ll_us_truck_order MODIFY COLUMN request_hash CHAR(64) NOT NULL COMMENT ''请求内容哈希''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'created_by' AND COALESCE ( column_comment , '' ) <> '创建人ID' ), 'ALTER TABLE ll_us_truck_order MODIFY COLUMN created_by VARCHAR(128) NULL COMMENT ''创建人ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'version' AND COALESCE ( column_comment , '' ) <> '乐观锁版本' ), 'ALTER TABLE ll_us_truck_order MODIFY COLUMN version BIGINT NOT NULL DEFAULT 0 COMMENT ''乐观锁版本''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_us_truck_order MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order' AND column_name = 'updated_at' AND COALESCE ( column_comment , '' ) <> '更新时间' ), 'ALTER TABLE ll_us_truck_order MODIFY COLUMN updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''更新时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order_pallet' AND COALESCE ( table_comment , '' ) <> '美国卡车订单托盘实收记录' ), 'ALTER TABLE ll_us_truck_order_pallet COMMENT = ''美国卡车订单托盘实收记录''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order_pallet' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '托盘记录ID' ), 'ALTER TABLE ll_us_truck_order_pallet MODIFY COLUMN id BIGINT NOT NULL COMMENT ''托盘记录ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order_pallet' AND column_name = 'order_id' AND COALESCE ( column_comment , '' ) <> '美国卡车订单ID' ), 'ALTER TABLE ll_us_truck_order_pallet MODIFY COLUMN order_id BIGINT NOT NULL COMMENT ''美国卡车订单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order_pallet' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_us_truck_order_pallet MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order_pallet' AND column_name = 'pallet_no' AND COALESCE ( column_comment , '' ) <> '业务托盘号' ), 'ALTER TABLE ll_us_truck_order_pallet MODIFY COLUMN pallet_no VARCHAR(128) NOT NULL COMMENT ''业务托盘号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order_pallet' AND column_name = 'sequence_no' AND COALESCE ( column_comment , '' ) <> '订单内托盘序号' ), 'ALTER TABLE ll_us_truck_order_pallet MODIFY COLUMN sequence_no INT NOT NULL COMMENT ''订单内托盘序号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order_pallet' AND column_name = 'source' AND COALESCE ( column_comment , '' ) <> '托盘来源:订单计划或PDA超收' ), 'ALTER TABLE ll_us_truck_order_pallet MODIFY COLUMN source VARCHAR(32) NOT NULL COMMENT ''托盘来源:订单计划或PDA超收''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order_pallet' AND column_name = 'status' AND COALESCE ( column_comment , '' ) <> '托盘状态:待收、已收或超收待审核' ), 'ALTER TABLE ll_us_truck_order_pallet MODIFY COLUMN status VARCHAR(32) NOT NULL COMMENT ''托盘状态:待收、已收或超收待审核''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order_pallet' AND column_name = 'warehouse_pallet_id' AND COALESCE ( column_comment , '' ) <> '仓库实物托盘资源ID' ), 'ALTER TABLE ll_us_truck_order_pallet MODIFY COLUMN warehouse_pallet_id BIGINT NULL COMMENT ''仓库实物托盘资源ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order_pallet' AND column_name = 'package_count' AND COALESCE ( column_comment , '' ) <> '托盘箱数' ), 'ALTER TABLE ll_us_truck_order_pallet MODIFY COLUMN package_count INT NULL COMMENT ''托盘箱数''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order_pallet' AND column_name = 'received_at' AND COALESCE ( column_comment , '' ) <> '实收时间' ), 'ALTER TABLE ll_us_truck_order_pallet MODIFY COLUMN received_at DATETIME(3) NULL COMMENT ''实收时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order_pallet' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_us_truck_order_pallet MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order_pallet' AND column_name = 'updated_at' AND COALESCE ( column_comment , '' ) <> '更新时间' ), 'ALTER TABLE ll_us_truck_order_pallet MODIFY COLUMN updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT ''更新时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order_status_history' AND COALESCE ( table_comment , '' ) <> '美国卡车订单状态历史' ), 'ALTER TABLE ll_us_truck_order_status_history COMMENT = ''美国卡车订单状态历史''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order_status_history' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE ll_us_truck_order_status_history MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order_status_history' AND column_name = 'order_id' AND COALESCE ( column_comment , '' ) <> '订单ID' ), 'ALTER TABLE ll_us_truck_order_status_history MODIFY COLUMN order_id BIGINT NOT NULL COMMENT ''订单ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order_status_history' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE ll_us_truck_order_status_history MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order_status_history' AND column_name = 'from_status' AND COALESCE ( column_comment , '' ) <> '变更前状态' ), 'ALTER TABLE ll_us_truck_order_status_history MODIFY COLUMN from_status VARCHAR(32) NULL COMMENT ''变更前状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order_status_history' AND column_name = 'to_status' AND COALESCE ( column_comment , '' ) <> '变更后状态' ), 'ALTER TABLE ll_us_truck_order_status_history MODIFY COLUMN to_status VARCHAR(32) NOT NULL COMMENT ''变更后状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order_status_history' AND column_name = 'operator_id' AND COALESCE ( column_comment , '' ) <> '操作人ID' ), 'ALTER TABLE ll_us_truck_order_status_history MODIFY COLUMN operator_id VARCHAR(128) NULL COMMENT ''操作人ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order_status_history' AND column_name = 'remark' AND COALESCE ( column_comment , '' ) <> '备注' ), 'ALTER TABLE ll_us_truck_order_status_history MODIFY COLUMN remark VARCHAR(1000) NULL COMMENT ''备注''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_us_truck_order_status_history' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE ll_us_truck_order_status_history MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
2026-08-19 16:49:41 +08:00
USE baiyue_lastlag_warehouse ;
2026-08-19 16:24:02 +08:00
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'wh_location' AND COALESCE ( table_comment , '' ) <> '仓库库位表:按租户和仓库维护库位及承重信息' ), 'ALTER TABLE wh_location COMMENT = ''仓库库位表:按租户和仓库维护库位及承重信息''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_location' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '库位ID(雪花ID) ' ), 'ALTER TABLE wh_location MODIFY COLUMN id BIGINT UNSIGNED NOT NULL COMMENT ''库位ID(雪花ID) ''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_location' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '数据所属租户ID' ), 'ALTER TABLE wh_location MODIFY COLUMN customer_id BIGINT UNSIGNED NOT NULL COMMENT ''数据所属租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_location' AND column_name = 'warehouse_id' AND COALESCE ( column_comment , '' ) <> '所属仓库ID' ), 'ALTER TABLE wh_location MODIFY COLUMN warehouse_id BIGINT UNSIGNED NOT NULL COMMENT ''所属仓库ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_location' AND column_name = 'zone_code' AND COALESCE ( column_comment , '' ) <> '仓库分区编码' ), 'ALTER TABLE wh_location MODIFY COLUMN zone_code VARCHAR(50) NOT NULL COMMENT ''仓库分区编码''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_location' AND column_name = 'location_code' AND COALESCE ( column_comment , '' ) <> '仓库内唯一库位编码' ), 'ALTER TABLE wh_location MODIFY COLUMN location_code VARCHAR(64) NOT NULL COMMENT ''仓库内唯一库位编码''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_location' AND column_name = 'location_type' AND COALESCE ( column_comment , '' ) <> '库位类型' ), 'ALTER TABLE wh_location MODIFY COLUMN location_type VARCHAR(32) NOT NULL COMMENT ''库位类型''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_location' AND column_name = 'max_load_kg' AND COALESCE ( column_comment , '' ) <> '最大承重(千克)' ), 'ALTER TABLE wh_location MODIFY COLUMN max_load_kg DECIMAL(18,3) NOT NULL COMMENT ''最大承重(千克)''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_location' AND column_name = 'status' AND COALESCE ( column_comment , '' ) <> '库位状态:ACTIVE启用、INACTIVE停用' ), 'ALTER TABLE wh_location MODIFY COLUMN status VARCHAR(20) NOT NULL DEFAULT ''ACTIVE'' COMMENT ''库位状态:ACTIVE启用、INACTIVE停用''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_location' AND column_name = 'remark' AND COALESCE ( column_comment , '' ) <> '备注' ), 'ALTER TABLE wh_location MODIFY COLUMN remark VARCHAR(500) DEFAULT NULL COMMENT ''备注''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_location' AND column_name = 'created_by' AND COALESCE ( column_comment , '' ) <> '创建人ID' ), 'ALTER TABLE wh_location MODIFY COLUMN created_by BIGINT UNSIGNED DEFAULT NULL COMMENT ''创建人ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_location' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE wh_location MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_location' AND column_name = 'updated_by' AND COALESCE ( column_comment , '' ) <> '最后修改人ID' ), 'ALTER TABLE wh_location MODIFY COLUMN updated_by BIGINT UNSIGNED DEFAULT NULL COMMENT ''最后修改人ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_location' AND column_name = 'updated_at' AND COALESCE ( column_comment , '' ) <> '更新时间' ), 'ALTER TABLE wh_location MODIFY COLUMN updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT ''更新时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_location' AND column_name = 'deleted' AND COALESCE ( column_comment , '' ) <> '逻辑删除标记' ), 'ALTER TABLE wh_location MODIFY COLUMN deleted TINYINT(1) NOT NULL DEFAULT 0 COMMENT ''逻辑删除标记''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_location' AND column_name = 'version' AND COALESCE ( column_comment , '' ) <> '乐观锁版本号' ), 'ALTER TABLE wh_location MODIFY COLUMN version INT NOT NULL DEFAULT 0 COMMENT ''乐观锁版本号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'wh_pallet' AND COALESCE ( table_comment , '' ) <> '仓库托盘表:按租户和仓库维护托盘、容量、单价及状态' ), 'ALTER TABLE wh_pallet COMMENT = ''仓库托盘表:按租户和仓库维护托盘、容量、单价及状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_pallet' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '托盘ID(雪花ID) ' ), 'ALTER TABLE wh_pallet MODIFY COLUMN id BIGINT UNSIGNED NOT NULL COMMENT ''托盘ID(雪花ID) ''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_pallet' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '数据所属租户ID' ), 'ALTER TABLE wh_pallet MODIFY COLUMN customer_id BIGINT UNSIGNED NOT NULL COMMENT ''数据所属租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_pallet' AND column_name = 'warehouse_id' AND COALESCE ( column_comment , '' ) <> '所属仓库ID' ), 'ALTER TABLE wh_pallet MODIFY COLUMN warehouse_id BIGINT UNSIGNED NOT NULL COMMENT ''所属仓库ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_pallet' AND column_name = 'location_id' AND COALESCE ( column_comment , '' ) <> '同仓库内绑定的库位ID,可为空' ), 'ALTER TABLE wh_pallet MODIFY COLUMN location_id BIGINT UNSIGNED DEFAULT NULL COMMENT ''同仓库内绑定的库位ID,可为空''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_pallet' AND column_name = 'pallet_code' AND COALESCE ( column_comment , '' ) <> '仓库内唯一托盘编码' ), 'ALTER TABLE wh_pallet MODIFY COLUMN pallet_code VARCHAR(128) NOT NULL COMMENT ''仓库内唯一托盘编码''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_pallet' AND column_name = 'pallet_type' AND COALESCE ( column_comment , '' ) <> '托盘类型' ), 'ALTER TABLE wh_pallet MODIFY COLUMN pallet_type VARCHAR(32) NOT NULL COMMENT ''托盘类型''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_pallet' AND column_name = 'capacity_cbm' AND COALESCE ( column_comment , '' ) <> '托盘容量(立方米)' ), 'ALTER TABLE wh_pallet MODIFY COLUMN capacity_cbm DECIMAL(18,4) NOT NULL DEFAULT 2.0000 COMMENT ''托盘容量(立方米)''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_pallet' AND column_name = 'unit_price' AND COALESCE ( column_comment , '' ) <> '托盘单价' ), 'ALTER TABLE wh_pallet MODIFY COLUMN unit_price DECIMAL(18,2) NOT NULL DEFAULT 0.00 COMMENT ''托盘单价''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_pallet' AND column_name = 'status' AND COALESCE ( column_comment , '' ) <> '托盘状态:IDLE闲置、OCCUPIED占用、SCRAPPED废弃' ), 'ALTER TABLE wh_pallet MODIFY COLUMN status VARCHAR(20) NOT NULL DEFAULT ''IDLE'' COMMENT ''托盘状态:IDLE闲置、OCCUPIED占用、SCRAPPED废弃''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_pallet' AND column_name = 'remark' AND COALESCE ( column_comment , '' ) <> '备注' ), 'ALTER TABLE wh_pallet MODIFY COLUMN remark VARCHAR(500) DEFAULT NULL COMMENT ''备注''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
2026-08-21 17:19:49 +08:00
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_pallet' AND column_name = 'fba_warehouse_code' AND COALESCE ( column_comment , '' ) <> '所属FBA仓编码' ), 'ALTER TABLE wh_pallet MODIFY COLUMN fba_warehouse_code VARCHAR(128) DEFAULT NULL COMMENT ''所属FBA仓编码''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
2026-08-19 16:24:02 +08:00
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_pallet' AND column_name = 'created_by' AND COALESCE ( column_comment , '' ) <> '创建人ID' ), 'ALTER TABLE wh_pallet MODIFY COLUMN created_by BIGINT UNSIGNED DEFAULT NULL COMMENT ''创建人ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_pallet' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE wh_pallet MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_pallet' AND column_name = 'updated_by' AND COALESCE ( column_comment , '' ) <> '最后修改人ID' ), 'ALTER TABLE wh_pallet MODIFY COLUMN updated_by BIGINT UNSIGNED DEFAULT NULL COMMENT ''最后修改人ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_pallet' AND column_name = 'updated_at' AND COALESCE ( column_comment , '' ) <> '更新时间' ), 'ALTER TABLE wh_pallet MODIFY COLUMN updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT ''更新时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_pallet' AND column_name = 'deleted' AND COALESCE ( column_comment , '' ) <> '逻辑删除标记' ), 'ALTER TABLE wh_pallet MODIFY COLUMN deleted TINYINT(1) NOT NULL DEFAULT 0 COMMENT ''逻辑删除标记''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_pallet' AND column_name = 'version' AND COALESCE ( column_comment , '' ) <> '乐观锁版本号' ), 'ALTER TABLE wh_pallet MODIFY COLUMN version INT NOT NULL DEFAULT 0 COMMENT ''乐观锁版本号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'wh_resource_lock' AND COALESCE ( table_comment , '' ) <> '仓储资源锁定记录' ), 'ALTER TABLE wh_resource_lock COMMENT = ''仓储资源锁定记录''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_resource_lock' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE wh_resource_lock MODIFY COLUMN id BIGINT UNSIGNED NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_resource_lock' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE wh_resource_lock MODIFY COLUMN customer_id BIGINT UNSIGNED NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_resource_lock' AND column_name = 'warehouse_id' AND COALESCE ( column_comment , '' ) <> '仓库ID' ), 'ALTER TABLE wh_resource_lock MODIFY COLUMN warehouse_id BIGINT UNSIGNED NOT NULL COMMENT ''仓库ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_resource_lock' AND column_name = 'pallet_id' AND COALESCE ( column_comment , '' ) <> '托盘ID' ), 'ALTER TABLE wh_resource_lock MODIFY COLUMN pallet_id BIGINT UNSIGNED NOT NULL COMMENT ''托盘ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_resource_lock' AND column_name = 'location_id' AND COALESCE ( column_comment , '' ) <> '库位ID' ), 'ALTER TABLE wh_resource_lock MODIFY COLUMN location_id BIGINT UNSIGNED NOT NULL COMMENT ''库位ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_resource_lock' AND column_name = 'business_type' AND COALESCE ( column_comment , '' ) <> '业务类型' ), 'ALTER TABLE wh_resource_lock MODIFY COLUMN business_type VARCHAR(50) NOT NULL COMMENT ''业务类型''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_resource_lock' AND column_name = 'business_id' AND COALESCE ( column_comment , '' ) <> '业务记录ID' ), 'ALTER TABLE wh_resource_lock MODIFY COLUMN business_id VARCHAR(100) NOT NULL COMMENT ''业务记录ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_resource_lock' AND column_name = 'reservation_key' AND COALESCE ( column_comment , '' ) <> '资源预留幂等键' ), 'ALTER TABLE wh_resource_lock MODIFY COLUMN reservation_key VARCHAR(160) NOT NULL COMMENT ''资源预留幂等键''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_resource_lock' AND column_name = 'status' AND COALESCE ( column_comment , '' ) <> '资源锁状态' ), 'ALTER TABLE wh_resource_lock MODIFY COLUMN status VARCHAR(20) NOT NULL DEFAULT ''ACTIVE'' COMMENT ''资源锁状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_resource_lock' AND column_name = 'locked_at' AND COALESCE ( column_comment , '' ) <> '锁定时间' ), 'ALTER TABLE wh_resource_lock MODIFY COLUMN locked_at DATETIME(3) NOT NULL COMMENT ''锁定时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_resource_lock' AND column_name = 'released_at' AND COALESCE ( column_comment , '' ) <> '释放时间' ), 'ALTER TABLE wh_resource_lock MODIFY COLUMN released_at DATETIME(3) DEFAULT NULL COMMENT ''释放时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_resource_lock' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE wh_resource_lock MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_resource_lock' AND column_name = 'updated_at' AND COALESCE ( column_comment , '' ) <> '更新时间' ), 'ALTER TABLE wh_resource_lock MODIFY COLUMN updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT ''更新时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse' AND COALESCE ( table_comment , '' ) <> '仓库主数据表:以租户为边界维护仓库编码、名称、国家、时区和启停状态' ), 'ALTER TABLE wh_warehouse COMMENT = ''仓库主数据表:以租户为边界维护仓库编码、名称、国家、时区和启停状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '仓库ID(雪花ID) ' ), 'ALTER TABLE wh_warehouse MODIFY COLUMN id BIGINT UNSIGNED NOT NULL COMMENT ''仓库ID(雪花ID) ''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '仓库所属租户ID' ), 'ALTER TABLE wh_warehouse MODIFY COLUMN customer_id BIGINT UNSIGNED NOT NULL COMMENT ''仓库所属租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse' AND column_name = 'warehouse_code' AND COALESCE ( column_comment , '' ) <> '租户内唯一仓库编码' ), 'ALTER TABLE wh_warehouse MODIFY COLUMN warehouse_code VARCHAR(50) NOT NULL COMMENT ''租户内唯一仓库编码''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse' AND column_name = 'warehouse_name' AND COALESCE ( column_comment , '' ) <> '仓库名称' ), 'ALTER TABLE wh_warehouse MODIFY COLUMN warehouse_name VARCHAR(120) NOT NULL COMMENT ''仓库名称''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse' AND column_name = 'warehouse_type' AND COALESCE ( column_comment , '' ) <> '仓库类型' ), 'ALTER TABLE wh_warehouse MODIFY COLUMN warehouse_type VARCHAR(32) NOT NULL DEFAULT ''OVERSEAS'' COMMENT ''仓库类型''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse' AND column_name = 'country_code' AND COALESCE ( column_comment , '' ) <> '所在国家二字码' ), 'ALTER TABLE wh_warehouse MODIFY COLUMN country_code CHAR(2) NOT NULL COMMENT ''所在国家二字码''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse' AND column_name = 'timezone' AND COALESCE ( column_comment , '' ) <> '仓库所在地IANA时区' ), 'ALTER TABLE wh_warehouse MODIFY COLUMN timezone VARCHAR(64) NOT NULL COMMENT ''仓库所在地IANA时区''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse' AND column_name = 'contact_name' AND COALESCE ( column_comment , '' ) <> '仓库联系人' ), 'ALTER TABLE wh_warehouse MODIFY COLUMN contact_name VARCHAR(64) DEFAULT NULL COMMENT ''仓库联系人''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse' AND column_name = 'contact_phone' AND COALESCE ( column_comment , '' ) <> '联系电话' ), 'ALTER TABLE wh_warehouse MODIFY COLUMN contact_phone VARCHAR(32) DEFAULT NULL COMMENT ''联系电话''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse' AND column_name = 'contact_email' AND COALESCE ( column_comment , '' ) <> '联系邮箱' ), 'ALTER TABLE wh_warehouse MODIFY COLUMN contact_email VARCHAR(128) DEFAULT NULL COMMENT ''联系邮箱''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse' AND column_name = 'status' AND COALESCE ( column_comment , '' ) <> '仓库状态' ), 'ALTER TABLE wh_warehouse MODIFY COLUMN status VARCHAR(20) NOT NULL DEFAULT ''ACTIVE'' COMMENT ''仓库状态''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse' AND column_name = 'remark' AND COALESCE ( column_comment , '' ) <> '仓库备注' ), 'ALTER TABLE wh_warehouse MODIFY COLUMN remark VARCHAR(500) DEFAULT NULL COMMENT ''仓库备注''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse' AND column_name = 'created_by' AND COALESCE ( column_comment , '' ) <> '创建人ID' ), 'ALTER TABLE wh_warehouse MODIFY COLUMN created_by BIGINT UNSIGNED DEFAULT NULL COMMENT ''创建人ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE wh_warehouse MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse' AND column_name = 'updated_by' AND COALESCE ( column_comment , '' ) <> '最后修改人ID' ), 'ALTER TABLE wh_warehouse MODIFY COLUMN updated_by BIGINT UNSIGNED DEFAULT NULL COMMENT ''最后修改人ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse' AND column_name = 'updated_at' AND COALESCE ( column_comment , '' ) <> '更新时间' ), 'ALTER TABLE wh_warehouse MODIFY COLUMN updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT ''更新时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse' AND column_name = 'deleted' AND COALESCE ( column_comment , '' ) <> '逻辑删除标记' ), 'ALTER TABLE wh_warehouse MODIFY COLUMN deleted TINYINT(1) NOT NULL DEFAULT 0 COMMENT ''逻辑删除标记''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse' AND column_name = 'version' AND COALESCE ( column_comment , '' ) <> '乐观锁版本号' ), 'ALTER TABLE wh_warehouse MODIFY COLUMN version INT NOT NULL DEFAULT 0 COMMENT ''乐观锁版本号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse_address' AND COALESCE ( table_comment , '' ) <> '仓库地址表:保存运营、退货等不同用途的地址及可选经纬度' ), 'ALTER TABLE wh_warehouse_address COMMENT = ''仓库地址表:保存运营、退货等不同用途的地址及可选经纬度''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse_address' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '仓库地址ID' ), 'ALTER TABLE wh_warehouse_address MODIFY COLUMN id BIGINT UNSIGNED NOT NULL COMMENT ''仓库地址ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse_address' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '数据所属租户ID' ), 'ALTER TABLE wh_warehouse_address MODIFY COLUMN customer_id BIGINT UNSIGNED NOT NULL COMMENT ''数据所属租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse_address' AND column_name = 'warehouse_id' AND COALESCE ( column_comment , '' ) <> '所属仓库ID' ), 'ALTER TABLE wh_warehouse_address MODIFY COLUMN warehouse_id BIGINT UNSIGNED NOT NULL COMMENT ''所属仓库ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse_address' AND column_name = 'address_type' AND COALESCE ( column_comment , '' ) <> '地址类型,例如OPERATING或RETURN' ), 'ALTER TABLE wh_warehouse_address MODIFY COLUMN address_type VARCHAR(20) NOT NULL DEFAULT ''OPERATING'' COMMENT ''地址类型,例如OPERATING或RETURN''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse_address' AND column_name = 'country_code' AND COALESCE ( column_comment , '' ) <> '国家二字码' ), 'ALTER TABLE wh_warehouse_address MODIFY COLUMN country_code CHAR(2) NOT NULL COMMENT ''国家二字码''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse_address' AND column_name = 'state_province' AND COALESCE ( column_comment , '' ) <> '省或州' ), 'ALTER TABLE wh_warehouse_address MODIFY COLUMN state_province VARCHAR(100) DEFAULT NULL COMMENT ''省或州''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse_address' AND column_name = 'city' AND COALESCE ( column_comment , '' ) <> '城市' ), 'ALTER TABLE wh_warehouse_address MODIFY COLUMN city VARCHAR(100) NOT NULL COMMENT ''城市''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse_address' AND column_name = 'district' AND COALESCE ( column_comment , '' ) <> '区县' ), 'ALTER TABLE wh_warehouse_address MODIFY COLUMN district VARCHAR(100) DEFAULT NULL COMMENT ''区县''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse_address' AND column_name = 'postal_code' AND COALESCE ( column_comment , '' ) <> '邮政编码' ), 'ALTER TABLE wh_warehouse_address MODIFY COLUMN postal_code VARCHAR(20) DEFAULT NULL COMMENT ''邮政编码''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse_address' AND column_name = 'address_line1' AND COALESCE ( column_comment , '' ) <> '主地址行' ), 'ALTER TABLE wh_warehouse_address MODIFY COLUMN address_line1 VARCHAR(255) NOT NULL COMMENT ''主地址行''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse_address' AND column_name = 'address_line2' AND COALESCE ( column_comment , '' ) <> '补充地址行' ), 'ALTER TABLE wh_warehouse_address MODIFY COLUMN address_line2 VARCHAR(255) DEFAULT NULL COMMENT ''补充地址行''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse_address' AND column_name = 'latitude' AND COALESCE ( column_comment , '' ) <> '纬度' ), 'ALTER TABLE wh_warehouse_address MODIFY COLUMN latitude DECIMAL(10,7) DEFAULT NULL COMMENT ''纬度''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse_address' AND column_name = 'longitude' AND COALESCE ( column_comment , '' ) <> '经度' ), 'ALTER TABLE wh_warehouse_address MODIFY COLUMN longitude DECIMAL(10,7) DEFAULT NULL COMMENT ''经度''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse_address' AND column_name = 'created_by' AND COALESCE ( column_comment , '' ) <> '创建人ID' ), 'ALTER TABLE wh_warehouse_address MODIFY COLUMN created_by BIGINT UNSIGNED DEFAULT NULL COMMENT ''创建人ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse_address' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE wh_warehouse_address MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse_address' AND column_name = 'updated_by' AND COALESCE ( column_comment , '' ) <> '最后修改人ID' ), 'ALTER TABLE wh_warehouse_address MODIFY COLUMN updated_by BIGINT UNSIGNED DEFAULT NULL COMMENT ''最后修改人ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse_address' AND column_name = 'updated_at' AND COALESCE ( column_comment , '' ) <> '更新时间' ), 'ALTER TABLE wh_warehouse_address MODIFY COLUMN updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT ''更新时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse_address' AND column_name = 'deleted' AND COALESCE ( column_comment , '' ) <> '逻辑删除标记' ), 'ALTER TABLE wh_warehouse_address MODIFY COLUMN deleted TINYINT(1) NOT NULL DEFAULT 0 COMMENT ''逻辑删除标记''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_warehouse_address' AND column_name = 'version' AND COALESCE ( column_comment , '' ) <> '乐观锁版本号' ), 'ALTER TABLE wh_warehouse_address MODIFY COLUMN version INT NOT NULL DEFAULT 0 COMMENT ''乐观锁版本号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'wh_service_capability' AND COALESCE ( table_comment , '' ) <> '仓库服务能力表:声明仓库可提供的收货、仓储、拣包、退货等能力及截单时间' ), 'ALTER TABLE wh_service_capability COMMENT = ''仓库服务能力表:声明仓库可提供的收货、仓储、拣包、退货等能力及截单时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_service_capability' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '服务能力ID' ), 'ALTER TABLE wh_service_capability MODIFY COLUMN id BIGINT UNSIGNED NOT NULL COMMENT ''服务能力ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_service_capability' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '数据所属租户ID' ), 'ALTER TABLE wh_service_capability MODIFY COLUMN customer_id BIGINT UNSIGNED NOT NULL COMMENT ''数据所属租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_service_capability' AND column_name = 'warehouse_id' AND COALESCE ( column_comment , '' ) <> '所属仓库ID' ), 'ALTER TABLE wh_service_capability MODIFY COLUMN warehouse_id BIGINT UNSIGNED NOT NULL COMMENT ''所属仓库ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_service_capability' AND column_name = 'capability_code' AND COALESCE ( column_comment , '' ) <> '能力编码:RECEIVING、STORAGE、PICK_PACK、RETURN等' ), 'ALTER TABLE wh_service_capability MODIFY COLUMN capability_code VARCHAR(50) NOT NULL COMMENT ''能力编码:RECEIVING、STORAGE、PICK_PACK、RETURN等''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_service_capability' AND column_name = 'capability_name' AND COALESCE ( column_comment , '' ) <> '能力名称' ), 'ALTER TABLE wh_service_capability MODIFY COLUMN capability_name VARCHAR(100) NOT NULL COMMENT ''能力名称''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_service_capability' AND column_name = 'enabled' AND COALESCE ( column_comment , '' ) <> '是否启用' ), 'ALTER TABLE wh_service_capability MODIFY COLUMN enabled TINYINT(1) NOT NULL DEFAULT 1 COMMENT ''是否启用''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_service_capability' AND column_name = 'cutoff_time' AND COALESCE ( column_comment , '' ) <> '当日作业截单时间' ), 'ALTER TABLE wh_service_capability MODIFY COLUMN cutoff_time TIME DEFAULT NULL COMMENT ''当日作业截单时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_service_capability' AND column_name = 'description' AND COALESCE ( column_comment , '' ) <> '能力说明' ), 'ALTER TABLE wh_service_capability MODIFY COLUMN description VARCHAR(500) DEFAULT NULL COMMENT ''能力说明''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_service_capability' AND column_name = 'created_by' AND COALESCE ( column_comment , '' ) <> '创建人ID' ), 'ALTER TABLE wh_service_capability MODIFY COLUMN created_by BIGINT UNSIGNED DEFAULT NULL COMMENT ''创建人ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_service_capability' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE wh_service_capability MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_service_capability' AND column_name = 'updated_by' AND COALESCE ( column_comment , '' ) <> '最后修改人ID' ), 'ALTER TABLE wh_service_capability MODIFY COLUMN updated_by BIGINT UNSIGNED DEFAULT NULL COMMENT ''最后修改人ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_service_capability' AND column_name = 'updated_at' AND COALESCE ( column_comment , '' ) <> '更新时间' ), 'ALTER TABLE wh_service_capability MODIFY COLUMN updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT ''更新时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_service_capability' AND column_name = 'deleted' AND COALESCE ( column_comment , '' ) <> '逻辑删除标记' ), 'ALTER TABLE wh_service_capability MODIFY COLUMN deleted TINYINT(1) NOT NULL DEFAULT 0 COMMENT ''逻辑删除标记''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_service_capability' AND column_name = 'version' AND COALESCE ( column_comment , '' ) <> '乐观锁版本号' ), 'ALTER TABLE wh_service_capability MODIFY COLUMN version INT NOT NULL DEFAULT 0 COMMENT ''乐观锁版本号''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . tables WHERE table_schema = DATABASE () AND table_name = 'wh_pallet_business_binding' AND COALESCE ( table_comment , '' ) <> '托盘业务绑定关系' ), 'ALTER TABLE wh_pallet_business_binding COMMENT = ''托盘业务绑定关系''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_pallet_business_binding' AND column_name = 'id' AND COALESCE ( column_comment , '' ) <> '主键ID' ), 'ALTER TABLE wh_pallet_business_binding MODIFY COLUMN id BIGINT NOT NULL COMMENT ''主键ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_pallet_business_binding' AND column_name = 'customer_id' AND COALESCE ( column_comment , '' ) <> '客户租户ID' ), 'ALTER TABLE wh_pallet_business_binding MODIFY COLUMN customer_id BIGINT NOT NULL COMMENT ''客户租户ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_pallet_business_binding' AND column_name = 'warehouse_id' AND COALESCE ( column_comment , '' ) <> '仓库ID' ), 'ALTER TABLE wh_pallet_business_binding MODIFY COLUMN warehouse_id BIGINT NOT NULL COMMENT ''仓库ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_pallet_business_binding' AND column_name = 'business_type' AND COALESCE ( column_comment , '' ) <> '业务类型' ), 'ALTER TABLE wh_pallet_business_binding MODIFY COLUMN business_type VARCHAR(32) NOT NULL COMMENT ''业务类型''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_pallet_business_binding' AND column_name = 'business_id' AND COALESCE ( column_comment , '' ) <> '绑定业务记录ID' ), 'ALTER TABLE wh_pallet_business_binding MODIFY COLUMN business_id VARCHAR(128) NOT NULL COMMENT ''绑定业务记录ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_pallet_business_binding' AND column_name = 'pallet_id' AND COALESCE ( column_comment , '' ) <> '托盘ID' ), 'ALTER TABLE wh_pallet_business_binding MODIFY COLUMN pallet_id BIGINT NOT NULL COMMENT ''托盘ID''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'wh_pallet_business_binding' AND column_name = 'created_at' AND COALESCE ( column_comment , '' ) <> '创建时间' ), 'ALTER TABLE wh_pallet_business_binding MODIFY COLUMN created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT ''创建时间''' , 'SELECT 1' ));
PREPARE schema_comments_025 FROM @ ddl ; EXECUTE schema_comments_025 ; DEALLOCATE PREPARE schema_comments_025 ;
-- ============================================================================
-- 2026-08-19 / 026
-- Separate tail-leg main workflow status from child-document status
-- ============================================================================
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'sub_order_status' ), 'SELECT 1' , 'ALTER TABLE ll_order ADD COLUMN sub_order_status VARCHAR(255) NULL COMMENT ''子单据状态汇总'' AFTER current_status' ));
PREPARE ll_order_sub_status_026 FROM @ ddl ; EXECUTE ll_order_sub_status_026 ; DEALLOCATE PREPARE ll_order_sub_status_026 ;
2026-08-20 15:20:05 +08:00
-- ============================================================================
-- 2026-08-20 / 027
-- One tail-leg inbound plan per source tail-leg order; one container may carry many plans.
-- ============================================================================
USE baiyue_lastleg ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns
WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan' AND column_name = 'source_order_id' ),
'SELECT 1' ,
'ALTER TABLE ll_inbound_plan ADD COLUMN source_order_id BIGINT NULL COMMENT ''来源尾程订单ID,一张入仓单对应一张入库计划'' AFTER customer_id' ));
PREPARE ll_inbound_plan_source_order_027 FROM @ ddl ; EXECUTE ll_inbound_plan_source_order_027 ; DEALLOCATE PREPARE ll_inbound_plan_source_order_027 ;
-- Legacy plans were created per container and cannot be inferred back to a source order.
UPDATE ll_inbound_plan SET source_order_id = NULL WHERE source_order_id = 0 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics
WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan' AND index_name = 'uk_ll_inbound_plan_container' ),
'ALTER TABLE ll_inbound_plan DROP INDEX uk_ll_inbound_plan_container' , 'SELECT 1' ));
PREPARE ll_inbound_plan_drop_container_unique_027 FROM @ ddl ; EXECUTE ll_inbound_plan_drop_container_unique_027 ; DEALLOCATE PREPARE ll_inbound_plan_drop_container_unique_027 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics
WHERE table_schema = DATABASE () AND table_name = 'll_inbound_plan' AND index_name = 'uk_ll_inbound_plan_source_order' ),
'SELECT 1' ,
'ALTER TABLE ll_inbound_plan ADD UNIQUE KEY uk_ll_inbound_plan_source_order (customer_id,source_order_id)' ));
PREPARE ll_inbound_plan_source_order_unique_027 FROM @ ddl ; EXECUTE ll_inbound_plan_source_order_unique_027 ; DEALLOCATE PREPARE ll_inbound_plan_source_order_unique_027 ;
2026-08-20 18:02:38 +08:00
-- ============================================================================
-- 2026-08-20 / 028
-- Phase-4 reverse event identity, unload evidence and SKU/history snapshots.
-- ============================================================================
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_order' AND column_name = 'source_container_booking_id' ),
'ALTER TABLE ll_order MODIFY COLUMN source_container_booking_id VARCHAR(128) NULL COMMENT ''来源头程货柜预订ID''' ,
'ALTER TABLE ll_order ADD COLUMN source_container_booking_id VARCHAR(128) NULL COMMENT ''来源头程货柜预订ID'' AFTER source_loading_plan_id' ));
PREPARE phase4_schema_028 FROM @ ddl ; EXECUTE phase4_schema_028 ; DEALLOCATE PREPARE phase4_schema_028 ;
2026-08-22 10:16:45 +08:00
-- ============================================================================
-- 2026-08-22 / 030
-- Inventory balances aggregate packages by customer inbound and destination;
-- SKU remains a snapshot and no longer participates in the unique dimension.
-- Existing duplicate dimensions intentionally fail the unique-index rebuild so
-- operators can reconcile pallet and location balances before retrying.
-- ============================================================================
SET @ ddl = ( SELECT CASE
WHEN EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE ()
AND table_name = 'll_inventory_balance' AND index_name = 'uk_ll_inventory_dimension' AND column_name = 'sku_code' )
THEN 'ALTER TABLE ll_inventory_balance DROP INDEX uk_ll_inventory_dimension, ADD UNIQUE KEY uk_ll_inventory_dimension (customer_id,overseas_warehouse_id,destination_warehouse_code,inbound_order_id,inbound_code)'
WHEN NOT EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE ()
AND table_name = 'll_inventory_balance' AND index_name = 'uk_ll_inventory_dimension' )
THEN 'ALTER TABLE ll_inventory_balance ADD UNIQUE KEY uk_ll_inventory_dimension (customer_id,overseas_warehouse_id,destination_warehouse_code,inbound_order_id,inbound_code)'
ELSE 'SELECT 1' END );
PREPARE phase4_inventory_dimension_030 FROM @ ddl ; EXECUTE phase4_inventory_dimension_030 ; DEALLOCATE PREPARE phase4_inventory_dimension_030 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE ()
AND table_name = 'll_inventory_balance' AND column_name = 'sku_code' ),
'ALTER TABLE ll_inventory_balance MODIFY COLUMN sku_code VARCHAR(128) NOT NULL DEFAULT ''UNSPECIFIED'' COMMENT ''SKU快照;多SKU汇总时为MIXED,不参与当前库存唯一维度''' ,
'SELECT 1' ));
PREPARE phase4_inventory_dimension_030 FROM @ ddl ; EXECUTE phase4_inventory_dimension_030 ; DEALLOCATE PREPARE phase4_inventory_dimension_030 ;
ALTER TABLE ll_inventory_balance COMMENT = '客户入仓单与海外目的仓维度实时库存余额' ;
2026-08-22 12:35:32 +08:00
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE ()
AND table_name = 'll_local_looseboard_order' AND column_name = 'lastleg_order_id' ), 'SELECT 1' ,
'ALTER TABLE ll_local_looseboard_order ADD COLUMN lastleg_order_id BIGINT NULL COMMENT ''关联尾程主订单ID'' AFTER customer_id' ));
PREPARE phase4_looseboard_tail_030 FROM @ ddl ; EXECUTE phase4_looseboard_tail_030 ; DEALLOCATE PREPARE phase4_looseboard_tail_030 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . statistics WHERE table_schema = DATABASE ()
AND table_name = 'll_local_looseboard_order' AND index_name = 'uk_ll_local_looseboard_lastleg' ), 'SELECT 1' ,
'ALTER TABLE ll_local_looseboard_order ADD UNIQUE KEY uk_ll_local_looseboard_lastleg(lastleg_order_id)' ));
PREPARE phase4_looseboard_tail_030 FROM @ ddl ; EXECUTE phase4_looseboard_tail_030 ; DEALLOCATE PREPARE phase4_looseboard_tail_030 ;
2026-08-22 10:16:45 +08:00
2026-08-20 15:58:25 +08:00
-- ============================================================================
-- 2026-08-20 / 029
2026-08-20 18:22:20 +08:00
-- FBA appointment expected loading time used by the platform appointment editor.
2026-08-20 15:58:25 +08:00
-- ============================================================================
2026-08-20 18:22:20 +08:00
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_fba_appointment' AND column_name = 'expected_loading_at' ),
'ALTER TABLE ll_inbound_fba_appointment MODIFY COLUMN expected_loading_at DATETIME(3) NOT NULL COMMENT ''预计装车时间''' ,
'ALTER TABLE ll_inbound_fba_appointment ADD COLUMN expected_loading_at DATETIME(3) NULL COMMENT ''预计装车时间'' AFTER appointment_at' ));
PREPARE phase4_fba_appointment_029 FROM @ ddl ; EXECUTE phase4_fba_appointment_029 ; DEALLOCATE PREPARE phase4_fba_appointment_029 ;
2026-08-20 18:06:07 +08:00
2026-08-20 18:02:38 +08:00
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pda_task' AND column_name = 'unload_photo_file_ids' ),
'ALTER TABLE ll_inbound_pda_task MODIFY COLUMN unload_photo_file_ids JSON NULL COMMENT ''卸柜照片文件ID列表''' ,
'ALTER TABLE ll_inbound_pda_task ADD COLUMN unload_photo_file_ids JSON NULL COMMENT ''卸柜照片文件ID列表'' AFTER completed_at' ));
PREPARE phase4_schema_028 FROM @ ddl ; EXECUTE phase4_schema_028 ; DEALLOCATE PREPARE phase4_schema_028 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pda_task' AND column_name = 'unload_photo_uploaded_at' ),
'ALTER TABLE ll_inbound_pda_task MODIFY COLUMN unload_photo_uploaded_at DATETIME(3) NULL COMMENT ''卸柜照片上传成功时间''' ,
'ALTER TABLE ll_inbound_pda_task ADD COLUMN unload_photo_uploaded_at DATETIME(3) NULL COMMENT ''卸柜照片上传成功时间'' AFTER unload_photo_file_ids' ));
PREPARE phase4_schema_028 FROM @ ddl ; EXECUTE phase4_schema_028 ; DEALLOCATE PREPARE phase4_schema_028 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_pda_task' AND column_name = 'estimated_empty_return_at' ),
'ALTER TABLE ll_inbound_pda_task MODIFY COLUMN estimated_empty_return_at DATETIME(3) NULL COMMENT ''预计报空时间(卸柜照片上传成功后两天)''' ,
'ALTER TABLE ll_inbound_pda_task ADD COLUMN estimated_empty_return_at DATETIME(3) NULL COMMENT ''预计报空时间(卸柜照片上传成功后两天)'' AFTER unload_photo_uploaded_at' ));
PREPARE phase4_schema_028 FROM @ ddl ; EXECUTE phase4_schema_028 ; DEALLOCATE PREPARE phase4_schema_028 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'sku_code' ),
'ALTER TABLE ll_inventory_balance MODIFY COLUMN sku_code VARCHAR(128) NOT NULL DEFAULT ''UNSPECIFIED'' COMMENT ''SKU编码;无SKU使用UNSPECIFIED''' ,
'ALTER TABLE ll_inventory_balance ADD COLUMN sku_code VARCHAR(128) NOT NULL DEFAULT ''UNSPECIFIED'' COMMENT ''SKU编码;无SKU使用UNSPECIFIED'' AFTER inbound_code' ));
PREPARE phase4_schema_028 FROM @ ddl ; EXECUTE phase4_schema_028 ; DEALLOCATE PREPARE phase4_schema_028 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'product_name_zh' ),
'ALTER TABLE ll_inventory_balance MODIFY COLUMN product_name_zh VARCHAR(255) NULL COMMENT ''中文品名快照''' ,
'ALTER TABLE ll_inventory_balance ADD COLUMN product_name_zh VARCHAR(255) NULL COMMENT ''中文品名快照'' AFTER sku_code' ));
PREPARE phase4_schema_028 FROM @ ddl ; EXECUTE phase4_schema_028 ; DEALLOCATE PREPARE phase4_schema_028 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'product_name_en' ),
'ALTER TABLE ll_inventory_balance MODIFY COLUMN product_name_en VARCHAR(255) NULL COMMENT ''英文品名快照''' ,
'ALTER TABLE ll_inventory_balance ADD COLUMN product_name_en VARCHAR(255) NULL COMMENT ''英文品名快照'' AFTER product_name_zh' ));
PREPARE phase4_schema_028 FROM @ ddl ; EXECUTE phase4_schema_028 ; DEALLOCATE PREPARE phase4_schema_028 ;
2026-08-21 10:43:25 +08:00
-- 旧版本库存余额使用 sku_name_zh;升级时保留名称快照并兼容新查询字段。
SET @ ddl = ( SELECT IF (
EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'sku_name_zh' )
AND EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inventory_balance' AND column_name = 'product_name_zh' ),
'UPDATE ll_inventory_balance SET product_name_zh = COALESCE(NULLIF(product_name_zh, ''''), sku_name_zh) WHERE sku_name_zh IS NOT NULL' ,
'SELECT 1' ));
PREPARE phase4_inventory_legacy_name_028 FROM @ ddl ; EXECUTE phase4_inventory_legacy_name_028 ; DEALLOCATE PREPARE phase4_inventory_legacy_name_028 ;
2026-08-20 18:02:38 +08:00
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_stock_receipt' AND column_name = 'sku_code' ),
'ALTER TABLE ll_inbound_stock_receipt MODIFY COLUMN sku_code VARCHAR(128) NOT NULL DEFAULT ''UNSPECIFIED'' COMMENT ''SKU编码快照''' ,
'ALTER TABLE ll_inbound_stock_receipt ADD COLUMN sku_code VARCHAR(128) NOT NULL DEFAULT ''UNSPECIFIED'' COMMENT ''SKU编码快照'' AFTER inbound_code' ));
PREPARE phase4_schema_028 FROM @ ddl ; EXECUTE phase4_schema_028 ; DEALLOCATE PREPARE phase4_schema_028 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_stock_receipt' AND column_name = 'product_name_zh' ),
'ALTER TABLE ll_inbound_stock_receipt MODIFY COLUMN product_name_zh VARCHAR(255) NULL COMMENT ''中文品名快照''' ,
'ALTER TABLE ll_inbound_stock_receipt ADD COLUMN product_name_zh VARCHAR(255) NULL COMMENT ''中文品名快照'' AFTER sku_code' ));
PREPARE phase4_schema_028 FROM @ ddl ; EXECUTE phase4_schema_028 ; DEALLOCATE PREPARE phase4_schema_028 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_inbound_stock_receipt' AND column_name = 'product_name_en' ),
'ALTER TABLE ll_inbound_stock_receipt MODIFY COLUMN product_name_en VARCHAR(255) NULL COMMENT ''英文品名快照''' ,
'ALTER TABLE ll_inbound_stock_receipt ADD COLUMN product_name_en VARCHAR(255) NULL COMMENT ''英文品名快照'' AFTER product_name_zh' ));
PREPARE phase4_schema_028 FROM @ ddl ; EXECUTE phase4_schema_028 ; DEALLOCATE PREPARE phase4_schema_028 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_status_history' AND column_name = 'operation_type' ),
'ALTER TABLE ll_overseas_procurement_status_history MODIFY COLUMN operation_type VARCHAR(32) NOT NULL COMMENT ''操作类型:CREATE、REVIEW或UPDATE''' ,
'ALTER TABLE ll_overseas_procurement_status_history ADD COLUMN operation_type VARCHAR(32) NOT NULL DEFAULT ''UPDATE'' COMMENT ''操作类型:CREATE、REVIEW或UPDATE'' AFTER customer_id' ));
PREPARE phase4_schema_028 FROM @ ddl ; EXECUTE phase4_schema_028 ; DEALLOCATE PREPARE phase4_schema_028 ;
SET @ ddl = ( SELECT IF ( EXISTS ( SELECT 1 FROM information_schema . columns WHERE table_schema = DATABASE () AND table_name = 'll_overseas_procurement_status_history' AND column_name = 'change_detail' ),
'ALTER TABLE ll_overseas_procurement_status_history MODIFY COLUMN change_detail JSON NULL COMMENT ''字段变更前后值JSON''' ,
'ALTER TABLE ll_overseas_procurement_status_history ADD COLUMN change_detail JSON NULL COMMENT ''字段变更前后值JSON'' AFTER operator_id' ));
PREPARE phase4_schema_028 FROM @ ddl ; EXECUTE phase4_schema_028 ; DEALLOCATE PREPARE phase4_schema_028 ;