Files
GEAR-OA/script/sql/mysql/item/gear_contract_detail.sql
2026-06-04 14:45:26 +08:00

33 lines
2.1 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- ================================
-- 订单明细列表(用于“销售管理 -> 合同管理 -> 订单明细列表”)
-- 目标:按合同维度维护订单/合同的产品明细(可行内编辑并保存)
-- 说明:
-- 1) 明细表通过 contract_id 关联 gear_contract
-- 2) 逻辑删除使用 del_flag0存在 2删除
-- ================================
DROP TABLE IF EXISTS gear_contract_detail;
CREATE TABLE gear_contract_detail (
detail_id bigint(20) NOT NULL COMMENT '明细ID',
contract_id bigint(20) NOT NULL COMMENT '合同ID gear_contract.contract_id',
line_no int NOT NULL DEFAULT 1 COMMENT '序号',
product_name varchar(255) DEFAULT '' COMMENT '产品名称(快照/可编辑)',
spec varchar(255) DEFAULT '' COMMENT '规格(快照/可编辑)',
material varchar(255) DEFAULT '' COMMENT '材质(可编辑)',
width_mm decimal(18,4) DEFAULT 0 COMMENT '宽度(mm)',
thickness_mm decimal(18,4) DEFAULT 0 COMMENT '厚度(mm)',
surface_treatment varchar(255) DEFAULT '' COMMENT '表面处理(可编辑)',
packaging_requirement varchar(500) DEFAULT '' COMMENT '包装要求(可编辑)',
remark varchar(500) DEFAULT NULL COMMENT '备注',
del_flag char(1) NOT NULL DEFAULT '0' COMMENT '删除标志0存在 2删除',
create_by varchar(64) DEFAULT '' COMMENT '创建者',
create_time datetime COMMENT '创建时间',
update_by varchar(64) DEFAULT '' COMMENT '更新者',
update_time datetime COMMENT '更新时间',
PRIMARY KEY (detail_id),
KEY idx_contract_id (contract_id),
KEY idx_line_no (line_no),
KEY idx_product_name (product_name(32))
) ENGINE=InnoDB COMMENT='合同订单明细表(订单明细列表)';