diff --git a/models/mysql.ddl.sql b/models/mysql.ddl.sql index d1af7bc..6da3eec 100644 --- a/models/mysql.ddl.sql +++ b/models/mysql.ddl.sql @@ -304,6 +304,7 @@ CREATE TABLE sub_distributors `id` VARCHAR(32) NOT NULL comment '主键ID', `resellerid` VARCHAR(32) NOT NULL comment '所属主分销商机构ID', + `sub_distributorid` VARCHAR(32) NOT NULL comment '二级分销商机构ID', `sub_dist_name` VARCHAR(255) NOT NULL comment '二级分销商名称', `contact_person` VARCHAR(100) comment '联系人', `contact_phone` VARCHAR(50) comment '联系电话', @@ -330,6 +331,7 @@ comment '二级分销商表' ; CREATE INDEX sub_distributors_idx_sd_reseller ON sub_distributors(resellerid); +CREATE UNIQUE INDEX sub_distributors_idx_sd_sub_distributorid ON sub_distributors(resellerid,sub_distributorid); CREATE INDEX sub_distributors_idx_sd_manager ON sub_distributors(managed_by); -- ./platform_supply_relations.json diff --git a/models/sub_distributors.json b/models/sub_distributors.json index 21f9b43..fdac8c2 100644 --- a/models/sub_distributors.json +++ b/models/sub_distributors.json @@ -18,18 +18,26 @@ "nullable": "no" }, { - "name": "resellerid", - "title": "所属主分销商机构ID", - "type": "str", - "length": 32, - "nullable": "no" + "name": "resellerid", + "title": "所属主分销商机构ID", + "type": "str", + "length": 32, + "nullable": "no" }, { - "name": "sub_dist_name", - "title": "二级分销商名称", - "type": "str", - "length": 255, - "nullable": "no" + "name": "sub_distributorid", + "title": "二级分销商机构ID", + "type": "str", + "length": 32, + "nullable": "no", + "default": "" + }, + { + "name": "sub_dist_name", + "title": "二级分销商名称", + "type": "str", + "length": 255, + "nullable": "no" }, { "name": "contact_person", @@ -121,6 +129,14 @@ "resellerid" ] }, + { + "name": "idx_sd_sub_distributorid", + "idxtype": "unique", + "idxfields": [ + "resellerid", + "sub_distributorid" + ] + }, { "name": "idx_sd_manager", "idxtype": "index", @@ -136,6 +152,12 @@ "valuefield": "id", "textfield": "orgname" }, + { + "field": "sub_distributorid", + "table": "organization", + "valuefield": "id", + "textfield": "orgname" + }, { "field": "status", "table": "appcodes_kv",