go-platform/docs/sql/yz_complaint.sql
2026-04-08 20:33:02 +08:00

46 lines
2.4 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.

-- 投诉建议「产品分类」:区分用户针对哪类产品提建议
-- 请在目标库手动执行utf8mb4
CREATE TABLE IF NOT EXISTS `yz_system_complaint_category` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(64) NOT NULL COMMENT '分类名称,如:官网、租户后台、小程序',
`code` varchar(32) DEFAULT NULL COMMENT '可选编码,便于程序识别',
`sort` int NOT NULL DEFAULT 0 COMMENT '排序,越小越靠前',
`status` tinyint NOT NULL DEFAULT 1 COMMENT '1启用 0禁用',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`delete_time` datetime DEFAULT NULL COMMENT '软删',
PRIMARY KEY (`id`),
KEY `idx_delete_time` (`delete_time`),
KEY `idx_status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='投诉建议-产品分类';
CREATE TABLE IF NOT EXISTS `yz_system_platform_complaint` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`category_id` bigint unsigned NOT NULL COMMENT '产品分类ID',
`title` varchar(200) NOT NULL COMMENT '标题',
`content` text NOT NULL COMMENT '建议/投诉内容',
`contact_name` varchar(64) DEFAULT NULL COMMENT '联系人',
`contact_phone` varchar(32) DEFAULT NULL COMMENT '联系电话',
`contact_email` varchar(128) DEFAULT NULL COMMENT '联系邮箱',
`status` tinyint NOT NULL DEFAULT 0 COMMENT '0待处理 1处理中 2已回复 3已关闭',
`reply_content` text COMMENT '平台回复内容',
`reply_time` datetime DEFAULT NULL COMMENT '回复时间',
`tid` bigint unsigned DEFAULT NULL COMMENT '可选关联租户ID',
`remark` varchar(512) DEFAULT NULL COMMENT '管理员内部备注',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`delete_time` datetime DEFAULT NULL COMMENT '软删',
PRIMARY KEY (`id`),
KEY `idx_category_id` (`category_id`),
KEY `idx_status` (`status`),
KEY `idx_delete_time` (`delete_time`),
KEY `idx_tid` (`tid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='平台端-投诉建议';
-- 可选:示例分类(执行完建表后按需取消注释)
-- INSERT INTO `yz_system_complaint_category` (`name`,`code`,`sort`,`status`) VALUES
-- ('官网','site',0,1),
-- ('租户后台','tenant_admin',10,1),
-- ('小程序','miniapp',20,1);