/*
 Navicat Premium Data Transfer

 Source Server         : MySQL
 Source Server Type    : MySQL
 Source Server Version : 80031 (8.0.31)
 Source Host           : localhost:3306
 Source Schema         : hellogithub

 Target Server Type    : MySQL
 Target Server Version : 80031 (8.0.31)
 File Encoding         : 65001

 Date: 02/07/2023 22:50:04
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for admin
-- ----------------------------
DROP TABLE IF EXISTS `admin`;
CREATE TABLE `admin`  (
  `adminId` int NOT NULL AUTO_INCREMENT COMMENT '管理员ID',
  `adminName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '管理员名',
  `adminPassword` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '管理员密码',
  `isValid` int NULL DEFAULT NULL COMMENT '是否有效(0/1)',
  PRIMARY KEY (`adminId`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '管理员表' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of admin
-- ----------------------------

-- ----------------------------
-- Table structure for article
-- ----------------------------
DROP TABLE IF EXISTS `article`;
CREATE TABLE `article`  (
  `articleId` int NOT NULL AUTO_INCREMENT COMMENT '文章ID',
  `userId` int NULL DEFAULT NULL COMMENT '用户ID',
  `articleContent` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '文章内容',
  `publishTime` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '发布时间',
  `isValid` int NULL DEFAULT NULL COMMENT '是否有效',
  `readCount` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '阅读次数',
  PRIMARY KEY (`articleId`) USING BTREE,
  INDEX `userId_article`(`userId` ASC) USING BTREE,
  CONSTRAINT `userId_article` FOREIGN KEY (`userId`) REFERENCES `user` (`userId`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '文章表' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of article
-- ----------------------------

-- ----------------------------
-- Table structure for category
-- ----------------------------
DROP TABLE IF EXISTS `category`;
CREATE TABLE `category`  (
  `categoryId` int NOT NULL AUTO_INCREMENT COMMENT '标签ID',
  `category` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签内容（包含图标）',
  `categoryName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签名称',
  `isValid` int NULL DEFAULT NULL COMMENT '是否有效（0/1）',
  PRIMARY KEY (`categoryId`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '标签表' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of category
-- ----------------------------
INSERT INTO `category` VALUES (0, '<i class=\"el-icon-discover\" style=\"margin-right: 10px\"></i> 综合', '综合', 1);
INSERT INTO `category` VALUES (1, '<i class=\"el-ico-alicyuyan\" style=\"margin-right: 10px\"></i> C', 'C', 1);
INSERT INTO `category` VALUES (2, '<i class=\"el-ico-aliCyuyan\" style=\"margin-right: 10px\"></i> C#', 'C#', 1);
INSERT INTO `category` VALUES (3, '<i class=\"el-ico-alicyuyan\" style=\"margin-right: 10px\"></i> C++', 'C++', 1);
INSERT INTO `category` VALUES (4, '<i class=\"el-ico-alicss3\" style=\"margin-right: 10px\"></i> CSS', 'CSS', 1);
INSERT INTO `category` VALUES (5, '<i class=\"el-ico-aliGoyuyan\" style=\"margin-right: 10px\"></i> Go', 'Go', 1);
INSERT INTO `category` VALUES (6, '<i class=\"el-ico-alijava\" style=\"margin-right: 10px\"></i> Java', 'Java', 1);
INSERT INTO `category` VALUES (7, '<i class=\"el-ico-alioutline-java-script\" style=\"margin-right: 10px\"></i> JavaScript', 'JavaScript', 1);
INSERT INTO `category` VALUES (8, '<i class=\"el-ico-alikotlin\" style=\"margin-right: 10px\"></i> Kotlin', 'Kotlin', 1);
INSERT INTO `category` VALUES (9, '<i class=\"el-ico-alicyuyan\" style=\"margin-right: 10px\"></i> ObjectiveC', 'Objective-C', 1);
INSERT INTO `category` VALUES (10, '<i class=\"el-ico-aliphp\" style=\"margin-right: 10px\"></i> PHP', 'PHP', 1);
INSERT INTO `category` VALUES (11, '<i class=\"el-ico-aliPython\" style=\"margin-right: 10px\"></i> python', 'python', 1);
INSERT INTO `category` VALUES (12, '<i class=\"el-ico-aliRubyyuyan\" style=\"margin-right: 10px\"></i> Ruby', 'Ruby', 1);
INSERT INTO `category` VALUES (13, '<i class=\"el-ico-alirust\" style=\"margin-right: 10px\"></i> Rust', 'Rust', 1);
INSERT INTO `category` VALUES (14, '<i class=\"el-ico-aliswift\" style=\"margin-right: 10px\"></i> Swift', 'Swift', 1);
INSERT INTO `category` VALUES (15, '<i class=\"el-icon-s-help\" style=\"margin-right: 10px\"></i> Other', 'Other', 1);
INSERT INTO `category` VALUES (16, '<i class=\"el-ico-alitushu\" style=\"margin-right: 10px\"></i> 开源书籍', '开源书籍', 1);
INSERT INTO `category` VALUES (17, '<i class=\"el-ico-alijiqixuexi___\" style=\"margin-right: 10px\"></i> 机器学习', '机器学习', 1);

-- ----------------------------
-- Table structure for comment
-- ----------------------------
DROP TABLE IF EXISTS `comment`;
CREATE TABLE `comment`  (
  `commentId` int NOT NULL AUTO_INCREMENT COMMENT '评论ID',
  `userId` int NULL DEFAULT NULL COMMENT '用户ID',
  `projectId` int NULL DEFAULT NULL COMMENT '项目ID',
  `content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '评论内容',
  `isUsed` int NULL DEFAULT NULL COMMENT '是否使用过',
  `commentTime` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '评论时间',
  `isValid` int NULL DEFAULT NULL COMMENT '是否有效',
  PRIMARY KEY (`commentId`) USING BTREE,
  INDEX `userId_comment`(`userId` ASC) USING BTREE,
  INDEX `projectId_comment`(`projectId` ASC) USING BTREE,
  CONSTRAINT `projectId_comment` FOREIGN KEY (`projectId`) REFERENCES `project` (`projectId`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `userId_comment` FOREIGN KEY (`userId`) REFERENCES `project` (`userId`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '评论表' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of comment
-- ----------------------------

-- ----------------------------
-- Table structure for project
-- ----------------------------
DROP TABLE IF EXISTS `project`;
CREATE TABLE `project`  (
  `projectId` int NOT NULL AUTO_INCREMENT COMMENT '项目ID',
  `userId` int NULL DEFAULT NULL COMMENT '用户ID',
  `projectName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '项目名称',
  `projectUrl` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '项目地址',
  `projectIco` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '项目图标',
  `projectTitle` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '项目标题',
  `projectDescription` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '项目描述',
  `startNum` int NULL DEFAULT NULL COMMENT '点赞数',
  `submitTime` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '提交时间',
  `categoryId` int NULL DEFAULT NULL COMMENT '分类ID',
  `isValid` int NULL DEFAULT NULL COMMENT '是否有效(0/1)',
  `fileAddress` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '项目文件地址',
  `periodicals` int NULL DEFAULT NULL COMMENT '期刊',
  `lookCount` int NULL DEFAULT NULL COMMENT '阅读次数',
  PRIMARY KEY (`projectId`) USING BTREE,
  INDEX `userId`(`userId` ASC) USING BTREE,
  INDEX `categoryId_project`(`categoryId` ASC) USING BTREE,
  CONSTRAINT `categoryId_project` FOREIGN KEY (`categoryId`) REFERENCES `category` (`categoryId`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `userId` FOREIGN KEY (`userId`) REFERENCES `user` (`userId`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '项目表' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of project
-- ----------------------------
INSERT INTO `project` VALUES (1, 1, 'primihub', '11111', 'https://pic.imgdb.cn/item/6495df131ddac507cc80689f.png', '由密码学专家团队打造的开源隐私计算平台\r\nHelloGitHub 评分\r\n', '随着《数据安全法》和《个人信息保护法》的相继颁布，隐私计算技术在近两年迎来了前所未有的热度。该项目是由密码学专家团队打造的隐私计算平台，它开箱即用、安全可靠，支持隐匿查询、隐私求交、联合统计、数据资源管理等功能，实现了“数据可用不可见”，为数据安全流通保驾护航。', 1, '2023-06-30 18:58:01', 1, 1, '1111', 1, 111);
INSERT INTO `project` VALUES (2, 1, 'primihub', '11111', 'https://pic.imgdb.cn/item/6495df131ddac507cc80689f.png', '由密码学专家团队打造的开源隐私计算平台\r\nHelloGitHub 评分\r\n', '随着《数据安全法》和《个人信息保护法》的相继颁布，隐私计算技术在近两年迎来了前所未有的热度。该项目是由密码学专家团队打造的隐私计算平台，它开箱即用、安全可靠，支持隐匿查询、隐私求交、联合统计、数据资源管理等功能，实现了“数据可用不可见”，为数据安全流通保驾护航。', 1, '2023-06-30 18:58:01', 1, 1, '1111', 1, 222);
INSERT INTO `project` VALUES (3, 1, 'primihub', '11111', 'https://pic.imgdb.cn/item/6495df131ddac507cc80689f.png', '由密码学专家团队打造的开源隐私计算平台\r\nHelloGitHub 评分\r\n', '随着《数据安全法》和《个人信息保护法》的相继颁布，隐私计算技术在近两年迎来了前所未有的热度。该项目是由密码学专家团队打造的隐私计算平台，它开箱即用、安全可靠，支持隐匿查询、隐私求交、联合统计、数据资源管理等功能，实现了“数据可用不可见”，为数据安全流通保驾护航。', 1, '2023-06-30 18:58:01', 2, 1, '1111', 1, 3333);

-- ----------------------------
-- Table structure for project_category
-- ----------------------------
DROP TABLE IF EXISTS `project_category`;
CREATE TABLE `project_category`  (
  `id` int NOT NULL AUTO_INCREMENT COMMENT 'id',
  `categoryId` int NULL DEFAULT NULL COMMENT '标签ID',
  `projectId` int NULL DEFAULT NULL COMMENT '项目ID',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `categoryId`(`categoryId` ASC) USING BTREE,
  INDEX `projectId`(`projectId` ASC) USING BTREE,
  CONSTRAINT `categoryId` FOREIGN KEY (`categoryId`) REFERENCES `category` (`categoryId`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `projectId` FOREIGN KEY (`projectId`) REFERENCES `project` (`projectId`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '项目标签中间表' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of project_category
-- ----------------------------
INSERT INTO `project_category` VALUES (1, 1, 1);
INSERT INTO `project_category` VALUES (2, 2, 1);
INSERT INTO `project_category` VALUES (3, 3, 3);
INSERT INTO `project_category` VALUES (4, 1, 2);

-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user`  (
  `userId` int NOT NULL AUTO_INCREMENT COMMENT '用户ID',
  `userName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户名',
  `userPassword` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '密码',
  `creatTime` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建时间',
  `isValid` int NULL DEFAULT NULL COMMENT '是否有效(0/1)',
  `projectNum` int NULL DEFAULT NULL COMMENT '提交的项目总数',
  `searchHistory` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '搜索历史',
  `contributionValue` int NULL DEFAULT NULL COMMENT '贡献值',
  PRIMARY KEY (`userId`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户表' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of user
-- ----------------------------
INSERT INTO `user` VALUES (1, '666', '666', '2023-06-29 22:43:22', 1, 1, '666;777;33;测试;hhh;rrr;12e;', NULL);

SET FOREIGN_KEY_CHECKS = 1;
