oubo 4 жил өмнө
parent
commit
bb70957f0f

+ 68 - 7
data/sql/structure.sql

@@ -524,13 +524,36 @@ CREATE TABLE `t_customer_group`  (
   `deleteAt` datetime(0) NULL DEFAULT NULL,
   `permission`  tinyint(1) NULL DEFAULT 1,
   `user_ids`  text NULL,
+  `customer_category_id` int(11) NULL DEFAULT NULL,
   PRIMARY KEY (`id`) USING BTREE,
   INDEX `companyId`(`companyId`) USING BTREE,
   INDEX `userId`(`userId`) USING BTREE,
   CONSTRAINT `t_customer_group_ibfk_1` FOREIGN KEY (`companyId`) REFERENCES `t_company` (`company_id`) ON DELETE CASCADE ON UPDATE CASCADE,
   CONSTRAINT `t_customer_group_ibfk_2` FOREIGN KEY (`userId`) REFERENCES `t_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
 ) ENGINE = InnoDB AUTO_INCREMENT = 1 ROW_FORMAT = Dynamic;
-
+-- ----------------------------
+-- Table structure for t_customer_group
+-- ----------------------------
+DROP TABLE IF EXISTS `t_customer_category`;
+CREATE TABLE IF NOT EXISTS `t_customer_category` (
+    `customer_category_id` int(11) NOT NULL AUTO_INCREMENT,
+    `companyId` int(11) NOT NULL,
+    `userId` int(11) NOT NULL,
+    `customer_category_title` varchar(50) CHARACTER SET utf8mb4 NOT NULL,
+    `customer_category_notes` varchar(255) CHARACTER SET utf8mb4 DEFAULT '',
+    `usedCount` int(11) DEFAULT 0,
+    `status` int(11) DEFAULT 99,
+    `createAt` datetime DEFAULT NULL,
+    `updateAt` datetime DEFAULT NULL,
+    `deleteAt` datetime DEFAULT NULL,
+    `permission` tinyint(1) DEFAULT 1,
+    `user_ids` text CHARACTER SET utf8mb4 DEFAULT NULL,
+    PRIMARY KEY (`customer_category_id`) USING BTREE,
+    KEY `companyId` (`companyId`) USING BTREE,
+    KEY `userId` (`userId`) USING BTREE,
+    CONSTRAINT `t_customer_category_ibfk_1` FOREIGN KEY (`companyId`) REFERENCES `t_company` (`company_id`) ON DELETE CASCADE ON UPDATE CASCADE,
+    CONSTRAINT `t_customer_category_ibfk_2` FOREIGN KEY (`userId`) REFERENCES `t_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
+    ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
 -- ----------------------------
 -- Table structure for t_department
 -- ----------------------------
@@ -620,7 +643,7 @@ CREATE TABLE `t_group_position`  (
   `utime` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
   `position_type` tinyint(1) NULL DEFAULT 0,
   PRIMARY KEY (`position_id`) USING BTREE,
-  INDEX `user_id`(`user_id`) USING BTREE,
+  INDEX `user_id` (`user_id`, `position_type`) USING BTREE,
   CONSTRAINT `t_group_position_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `t_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
 ) ENGINE = InnoDB AUTO_INCREMENT = 1 ROW_FORMAT = Compact;
 
@@ -672,11 +695,12 @@ CREATE TABLE `t_inventory_calculation`  (
   `self_built_source`  varchar(255) NOT NULL,
   `tag_numbers`  tinyint(1) NULL DEFAULT 0,
   `from_data_id`  varchar(25) NULL DEFAULT '',
-  `offer_price`  decimal(22,3) NULL DEFAULT -1,
+  `offer_price`  decimal(22,6) NULL DEFAULT -1,
   `offer_product_total_cost`  decimal(22,6) NULL,
   `calculation_ctime`  datetime NULL DEFAULT NULL,
   PRIMARY KEY (`calculation_id`, `data_id`) USING BTREE,
   INDEX `call_time`(`call_time`) USING BTREE,
+  UNIQUE INDEX `data_id` (`data_id`) USING BTREE,
   INDEX `calculation_value`(`calculation_key`, `calculation_time`, `calculation_value`, `calculation_value2`, `calculation_condition`, `tagIds`) USING BTREE
 ) ENGINE = InnoDB AUTO_INCREMENT = 1 ROW_FORMAT = Dynamic;
 
@@ -1019,6 +1043,9 @@ CREATE TABLE `t_product_share`  (
   `share_type` varchar(25) NULL DEFAULT NULL,
   `share_password` varchar(50) NULL DEFAULT NULL,
   `hits` int(11) NULL DEFAULT 0,
+  `permission`  int(1) NULL DEFAULT 2,
+  `permission_view`  int(1) NULL DEFAULT 2,
+  INDEX `share_id`(`share_id`),
   PRIMARY KEY (`share_id`) USING BTREE
 ) ENGINE = InnoDB ROW_FORMAT = Compact;
 -- ----------------------------
@@ -1172,6 +1199,7 @@ CREATE TABLE `t_rule_new`  (
   `product_confidential_set`  tinyint(1) NULL DEFAULT 0,
   `product_confidential_use`  tinyint(1) NULL DEFAULT 0,
   `customer_modular_group_secrecy`  tinyint(1) NULL DEFAULT 0,
+  `customer_modular_group` tinyint(1) NULL DEFAULT 0,
   `product_watermark`  tinyint(1) NULL DEFAULT 0,
   `customer_modular` tinyint(1) NULL DEFAULT 0,
   `customer_modular_delete` tinyint(1) NULL DEFAULT 0,
@@ -1321,10 +1349,27 @@ CREATE TABLE `t_statement_calculation`  (
   INDEX `bill_order_number`(`bill_order_number`) USING BTREE,
   INDEX `bill_order_id`(`bill_order_id`) USING BTREE,
   INDEX `call_time`(`call_time`) USING BTREE,
+  UNIQUE INDEX `data_id` (`data_id`) USING BTREE,
   INDEX `calculation_value`(`calculation_key`, `affair_id`, `calculation_time`, `calculation_value`, `calculation_condition`, `tagIds`) USING BTREE,
   INDEX `calculation_time`(`calculation_time`, `affair_id`, `calculation_condition`, `tagIds`) USING BTREE
 ) ENGINE = InnoDB AUTO_INCREMENT = 1 ROW_FORMAT = Dynamic;
 
+-- ----------------------------
+-- Table structure for t_statement_calculation
+-- ----------------------------
+DROP TABLE IF EXISTS `t_product_share_permission`;
+CREATE TABLE IF NOT EXISTS `t_product_share_permission` (
+    `per_id` int(11) NOT NULL AUTO_INCREMENT,
+    `share_id` varchar(50) NOT NULL,
+    `user_id` int(11) NOT NULL DEFAULT 0,
+    `allow` int(1) DEFAULT 1,
+    PRIMARY KEY (`per_id`) USING BTREE,
+    KEY `per_id` (`per_id`) USING BTREE,
+    KEY `user_id` (`user_id`,`share_id`) USING BTREE,
+    KEY `share_id` (`share_id`,`user_id`),
+    CONSTRAINT `t_product_share_permission_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `t_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
+    CONSTRAINT `t_product_share_permission_ibfk_3` FOREIGN KEY (`share_id`) REFERENCES `t_product_share` (`share_id`) ON DELETE CASCADE ON UPDATE CASCADE
+    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;
 -- ----------------------------
 -- Table structure for t_tag_frequently
 -- ----------------------------
@@ -1455,6 +1500,7 @@ CREATE TABLE `t_user`  (
   `report_header`  varchar(255) NULL,
   `report_password` varchar(32) NULL,
   `report_password_type` tinyint(1) NULL DEFAULT 0,
+  `second_token` varchar(50) CHARACTER SET utf8mb4 NULL DEFAULT '',
   PRIMARY KEY (`user_id`) USING BTREE,
   INDEX `role_id`(`role_id`) USING BTREE,
   INDEX `company_id`(`company_id`) USING BTREE,
@@ -1597,7 +1643,7 @@ CREATE TABLE `t_process_in_calculation`  (
   `user_id`  int(11) NOT NULL,
   PRIMARY KEY (`calculation_id`, `data_id`) USING BTREE,
   INDEX `call_time`(`call_time`) USING BTREE,
-  INDEX `data_id`(`data_id`) USING BTREE,
+  UNIQUE INDEX `data_id` (`data_id`) USING BTREE,
   INDEX `affair_id`(`affair_id`, `calculation_time`, `calculation_condition`, `tagIds`, `calculation_key`, `product_id`, `product_color`, `sale_object`) USING BTREE
 ) ENGINE = InnoDB ROW_FORMAT = Dynamic;
 -- ----------------------------
@@ -1623,6 +1669,7 @@ CREATE TABLE `t_process_out_calculation`  (
   `user_id`  int(11) NOT NULL,
   PRIMARY KEY (`calculation_id`, `data_id`, `from_data_id`) USING BTREE,
   INDEX `call_time`(`call_time`) USING BTREE,
+  UNIQUE INDEX `data_id` (`data_id`) USING BTREE,
   INDEX `affair_id`(`affair_id`, `calculation_time`, `calculation_condition`, `tagIds`, `from_data_id`) USING BTREE
 ) ENGINE = InnoDB ROW_FORMAT = Dynamic;
 -- ----------------------------
@@ -1654,6 +1701,7 @@ CREATE TABLE `t_machine_calculation`  (
   `machine_production_state`  tinyint(1) NULL DEFAULT 0,
   PRIMARY KEY (`calculation_id`, `data_id`) USING BTREE,
   INDEX `call_time`(`call_time`) USING BTREE,
+  UNIQUE INDEX `data_id` (`data_id`) USING BTREE,
   INDEX `calculation_value`(`affair_id`, `calculation_key`, `calculation_condition`, `calculation_time`, `product_id`, `tagIds`, `calculation_time2`) USING BTREE
 ) ENGINE = InnoDB ROW_FORMAT = Dynamic;
 -- ----------------------------
@@ -1676,6 +1724,7 @@ CREATE TABLE `t_ticket_calculation`  (
   `ticket_time` datetime(0) NOT NULL ,
   PRIMARY KEY (`calculation_id`, `data_id`) USING BTREE,
   INDEX `call_time`(`call_time`) USING BTREE,
+  UNIQUE INDEX `data_id` (`data_id`) USING BTREE,
   INDEX `calculation_value`(`affair_id`, `calculation_key`, `calculation_condition`, `calculation_time`, `tagIds`, `ticket_key`, `ticket_time`) USING BTREE
 ) ENGINE = InnoDB ROW_FORMAT = Dynamic;
 -- ----------------------------
@@ -1918,12 +1967,14 @@ CREATE TABLE `t_fast_input` (
   `fast_input_state` tinyint(1) DEFAULT 0,
   `fast_input_data_ids` text NOT NULL,
   `fast_input_content` text DEFAULT NULL,
+  `fast_input_other` longtext NULL,
   `ctime` datetime DEFAULT NULL,
   `utime` datetime DEFAULT NULL,
   `company_id` int(11) DEFAULT NULL,
   `user_id` int(11) DEFAULT NULL,
   `status` int(2) NULL DEFAULT 99,
-  PRIMARY KEY (`fast_input_id`)
+  PRIMARY KEY (`fast_input_id`),
+  INDEX `user_id`(`status`, `customized_id`, `user_id`)
 ) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
 
 -- ----------------------------
@@ -1934,7 +1985,7 @@ CREATE TABLE `t_inventory_price_record` (
   `inventory_price_record_id` int(11) NOT NULL AUTO_INCREMENT,
   `inventory_id` int(11) NOT NULL,
   `record_time` datetime NOT NULL,
-  `inventory_price` double(22,2) NOT NULL,
+  `inventory_price` double(22,6) NOT NULL,
   `notes` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
   `status` int(2) DEFAULT 99,
   `ctime` datetime DEFAULT NULL,
@@ -2060,7 +2111,17 @@ CREATE TABLE `t_tag_group` (
   `dtime` datetime DEFAULT NULL,
   PRIMARY KEY (`tag_group_id`) USING BTREE
 ) ENGINE=InnoDB AUTO_INCREMENT=1 ROW_FORMAT=DYNAMIC;
-
+-- ----------------------------
+-- Table structure for t_tag_group
+-- ----------------------------
+DROP TABLE IF EXISTS `t_home`;
+CREATE TABLE  IF NOT EXISTS `t_home` (
+    `id` int(11) NOT NULL AUTO_INCREMENT,
+    `home_type_ids` longtext NOT NULL,
+    `user_id` int(11) DEFAULT 99,
+    `utime` datetime DEFAULT NULL,
+    PRIMARY KEY (`id`) USING BTREE
+    ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;
 -- ----------------------------
 -- Function structure for Fun_GetPY
 -- ----------------------------

+ 2 - 2
data/upgrade/v3.0.0/v3.0.0.sql

@@ -800,8 +800,8 @@ MODIFY COLUMN IF EXISTS `user_ids` text CHARACTER SET utf8mb4 COLLATE utf8mb4_ge
 ADD COLUMN IF NOT EXISTS `customer_category_id` int(11) NULL DEFAULT NULL AFTER `user_ids`;
 
 ALTER TABLE `t_group_position`
-MODIFY COLUMN  IF EXISTS `groupIds`  text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL AFTER `user_id`,
-ADD COLUMN  IF NOT EXISTS `categoryIds`  text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL AFTER `groupIds`,
+MODIFY COLUMN  IF EXISTS `groupIds` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL AFTER `user_id`,
+ADD COLUMN  IF NOT EXISTS `categoryIds` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL AFTER `groupIds`,
 DROP INDEX IF EXISTS `user_id`,
 ADD INDEX `user_id` (`user_id`, `position_type`) USING BTREE;