Files
zt-dsc/zt-module-rule/zt-module-rule-server/src/main/resources/sql/rule_rule.sql
2025-09-22 11:55:27 +08:00

31 lines
3.2 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.
-- ----------------------------
-- Table structure for rule_rule
-- ----------------------------
DROP TABLE IF EXISTS `rule_rule`;
CREATE TABLE `rule_rule` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '规则ID',
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '规则名称',
`description` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '规则描述',
`type` tinyint NOT NULL COMMENT '规则类型1-原子规则 2-链式规则',
`status` tinyint NOT NULL DEFAULT '1' COMMENT '规则状态0-禁用 1-启用',
`config` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '规则配置JSON格式',
`chain_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'LiteFlow规则链ID',
`version` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '1.0.0' COMMENT '规则版本',
`sort` int DEFAULT '1' COMMENT '排序',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `uk_chain_id` (`chain_id`,`deleted`,`tenant_id`) USING BTREE COMMENT '规则链ID唯一索引',
KEY `idx_name` (`name`) USING BTREE COMMENT '规则名称索引',
KEY `idx_status` (`status`) USING BTREE COMMENT '规则状态索引',
KEY `idx_type` (`type`) USING BTREE COMMENT '规则类型索引'
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='规则表';
-- ----------------------------
-- Records of rule_rule
-- ----------------------------
INSERT INTO `rule_rule` VALUES (1, '用户积分计算规则', '根据用户行为计算积分奖励', 2, 1, '{"chain":{"chainId":"userPointsChain","chainName":"用户积分计算链","expression":"THEN(numberCompareNode, mathCalculateNode, dataSetNode)","enable":true},"nodes":[{"nodeId":"numberCompareNode","nodeName":"数值比较","nodeType":"common","clazz":"com.zt.plat.module.rule.framework.liteflow.component.common.NumberCompareComponent","properties":{"leftValue":"100","operator":">","rightValue":"50"},"enable":true},{"nodeId":"mathCalculateNode","nodeName":"积分计算","nodeType":"common","clazz":"com.zt.plat.module.rule.framework.liteflow.component.action.MathCalculateComponent","properties":{"leftValue":"100","operator":"*","rightValue":"1.5","resultKey":"finalPoints","scale":"0"},"enable":true},{"nodeId":"dataSetNode","nodeName":"设置结果","nodeType":"common","clazz":"com.zt.plat.module.rule.framework.liteflow.component.action.DataSetComponent","properties":{"dataKey":"userPoints","dataValue":"150","valueType":"integer"},"enable":true}]}', 'userPointsChain', '1.0.0', 1, '', '2024-01-01 00:00:00', '', '2024-01-01 00:00:00', b'0', 1);