Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
Target Server Version : 80031 (8.0.31)
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 08/07/2023 14:24:38
|
||||
Date: 08/07/2023 23:55:47
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
@@ -26,6 +26,7 @@ CREATE TABLE `admin` (
|
||||
`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)',
|
||||
`loginTime` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '登录时间',
|
||||
PRIMARY KEY (`adminId`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '管理员表' ROW_FORMAT = DYNAMIC;
|
||||
|
||||
@@ -49,7 +50,7 @@ CREATE TABLE `article` (
|
||||
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 = 27 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '文章表' ROW_FORMAT = DYNAMIC;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 28 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '文章表' ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of article
|
||||
@@ -63,8 +64,7 @@ INSERT INTO `article` VALUES (6, 5, 'Git 是一个分布式版本管理工具,
|
||||
INSERT INTO `article` VALUES (19, 1, '<p><a href=\"https://pic.imgdb.cn/item/640f1b9df144a01007db08a4.jpg\" target=\"_blank\" ref=\"nofollow noopener noreferrer\">https://pic.imgdb.cn/item/640f1b9df144a01007db08a4.jpg</a></p><pre><code>conn = JdbcUtils.getConnection();\n conn1 = JdbcUtils.getConnection();\n preparedStatement = conn.prepareStatement(sql);\n preparedStatement.setInt(1, id);\n preparedStatement1 = conn1.prepareStatement(sql1);\n preparedStatement1.setInt(1, id);</code></pre><blockquote><p><span style=\"color: #4caf50;\">测试文章</span></p></blockquote><hr><p><span style=\"background-color: #ffeb3b;\">都是固定工会打发发的观点和方法啊哈哈的方法的风格啊哈哈动画噶反对法地方和</span></p><ol><li><p>gDG</p></li><li><p>和施工方</p></li></ol><ul><li><p>1111</p></li><li><p>2222</p></li></ul><p></p><table><tbody><tr><th data-colwidth=\"144\"><iframe frameborder=\"0\" allowfullscreen=\"true\"></iframe></th><th><iframe frameborder=\"0\" allowfullscreen=\"true\"></iframe></th><th data-colwidth=\"136\"><iframe frameborder=\"0\" allowfullscreen=\"true\"></iframe></th><th><iframe frameborder=\"0\" allowfullscreen=\"true\"></iframe></th><th><iframe frameborder=\"0\" allowfullscreen=\"true\"></iframe></th></tr><tr><td data-colwidth=\"144\"><iframe frameborder=\"0\" allowfullscreen=\"true\"></iframe></td><td><iframe frameborder=\"0\" allowfullscreen=\"true\"></iframe></td><td data-colwidth=\"136\"><iframe frameborder=\"0\" allowfullscreen=\"true\"></iframe></td><td><iframe frameborder=\"0\" allowfullscreen=\"true\"></iframe></td><td><iframe frameborder=\"0\" allowfullscreen=\"true\"></iframe></td></tr></tbody></table><p>爱德华给</p>', '2023-07-06', 1, 2, '测试文章', 'https://pic.imgdb.cn/item/640f1b9df144a01007db08a4.jpg');
|
||||
INSERT INTO `article` VALUES (23, 6, '<p><a href=\"https://pic.imgdb.cn/item/646b2803e03e90d874c45f3f.gif\" target=\"_blank\" ref=\"nofollow noopener noreferrer\">https://pic.imgdb.cn/item/646b2803e03e90d874c45f3f.gif</a></p><p><img src=\"https://pic.imgdb.cn/item/646b2803e03e90d874c45f3f.gif\" alt=\"\" title=\"\" width=\"200\" data-display=\"inline\"></p><iframe src=\"https://pic.imgdb.cn/item/646b2803e03e90d874c45f3f.gif\" frameborder=\"0\" allowfullscreen=\"true\"></iframe><p></p>', '2023-07-07', 1, 1, '文章功能测试', 'https://pic.imgdb.cn/item/646b2803e03e90d874c45f3f.gif');
|
||||
INSERT INTO `article` VALUES (24, 6, '<p><img src=\"https://pic.imgdb.cn/item/646b24b0e03e90d874bf7075.png\" alt=\"\" title=\"\" width=\"200\" data-display=\"inline\"><a href=\"https://pic.imgdb.cn/item/646b24b0e03e90d874bf7075.png\" target=\"_blank\" ref=\"nofollow noopener noreferrer\">https://pic.imgdb.cn/item/646b24b0e03e90d874bf7075.png</a></p><pre><code>https://pic.imgdb.cn/item/646b24b0e03e90d874bf7075.png</code></pre><p></p>', '2023-07-07', 1, 1, '发布贡献值增加测试', 'https://pic.imgdb.cn/item/646b24b0e03e90d874bf7075.png');
|
||||
INSERT INTO `article` VALUES (25, 6, '<p>111111111111111</p>', '2023-07-07', 1, 0, '111111111', '11111111111');
|
||||
INSERT INTO `article` VALUES (26, 1, '<p><a href=\"https://pic.imgdb.cn/item/648493281ddac507cc60db7c.jpg\" target=\"_blank\" ref=\"nofollow noopener noreferrer\">https://pic.imgdb.cn/item/648493281ddac507cc60db7c.jpg</a><img src=\"https://pic.imgdb.cn/item/648493281ddac507cc60db7c.jpg\" alt=\"\" title=\"\" width=\"200\" data-display=\"inline\"></p>', '2023-07-08', 1, 0, '777777777777777', 'https://pic.imgdb.cn/item/648493281ddac507cc60db7c.jpg');
|
||||
INSERT INTO `article` VALUES (27, 11, '<p><a href=\"https://pic.imgdb.cn/item/6484889d1ddac507cc4fa95f.jpg\" target=\"_blank\" ref=\"nofollow noopener noreferrer\">https://pic.imgdb.cn/item/6484889d1ddac507cc4fa95f.jpg</a><img src=\"https://pic.imgdb.cn/item/6484889d1ddac507cc4fa95f.jpg\" alt=\"\" title=\"\" width=\"200\" data-display=\"inline\"></p><blockquote><p>行不行啊</p><pre><code>https://pic.imgdb.cn/item/6484889d1ddac507cc4fa95f.jpg</code></pre></blockquote><h1><strong>测试</strong><u>测试车</u>hi是<span style=\"background-color: #ff9800;\">车hi此时的</span>【<s>0i是德国</s>【iahs【 阿达【uvba【9SUV吧<span style=\"color: #673ab7;\">【90氺【</span>0 返回<span style=\"color: #03a9f4;\">【0ihd【i噶</span>地方【爱的时候v【<span style=\"color: #cddc39;\">阿斯顿</span></h1><p></p>', '2023-07-08', 1, 1, '用户000', 'https://pic.imgdb.cn/item/6484889d1ddac507cc4fa95f.jpg');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for category
|
||||
@@ -120,7 +120,7 @@ CREATE TABLE `comment` (
|
||||
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 `user` (`userId`) ON DELETE RESTRICT ON UPDATE RESTRICT
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 43 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '评论表' ROW_FORMAT = DYNAMIC;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 44 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '评论表' ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of comment
|
||||
@@ -128,16 +128,17 @@ CREATE TABLE `comment` (
|
||||
INSERT INTO `comment` VALUES (20, 1, 1, '6666666666666666666666666666666666', 1, '2023-07-05 13:26:29', 1, 5, '2023-07-05 13:26:29', 215);
|
||||
INSERT INTO `comment` VALUES (25, 1, 1, '0000000', 1, '2023-07-05 13:52:45', 1, 2, '2023-07-05 13:52:45', 61);
|
||||
INSERT INTO `comment` VALUES (32, 1, 7, '888888888', 1, '2023-07-06 10:21:08', 1, 3, '2023-07-06 10:21:08', 6);
|
||||
INSERT INTO `comment` VALUES (33, 1, 2, '1234567890', 1, '2023-07-06 12:32:29', 1, 5, '2023-07-06 12:32:29', 2);
|
||||
INSERT INTO `comment` VALUES (33, 7, 2, '1234567890', 1, '2023-07-06 12:32:29', 1, 5, '2023-07-06 12:32:29', 2);
|
||||
INSERT INTO `comment` VALUES (34, 1, 3, '111111111111', 0, '2023-07-06 13:47:41', 1, 0, '2023-07-06 13:47:41', 3);
|
||||
INSERT INTO `comment` VALUES (35, 1, 5, '88888', 1, '2023-07-06 20:07:51', 1, 5, '2023-07-06 20:07:51', 1);
|
||||
INSERT INTO `comment` VALUES (36, 1, 7, '还不错哦', 1, '2023-07-06 21:17:24', 1, 5, '2023-07-06 21:17:24', 2);
|
||||
INSERT INTO `comment` VALUES (37, 1, 2, '666666', 0, '2023-07-06 23:44:20', 1, 3, '2023-07-06 23:44:20', 0);
|
||||
INSERT INTO `comment` VALUES (37, 7, 2, '666666', 0, '2023-07-06 23:44:20', 1, 3, '2023-07-06 23:44:20', 0);
|
||||
INSERT INTO `comment` VALUES (38, 1, 3, '挺好的,能用,完美', 1, '2023-07-07 15:41:02', 1, 5, '2023-07-07 15:41:02', 2);
|
||||
INSERT INTO `comment` VALUES (39, 1, 3, '6666', 0, '2023-07-07 15:42:02', 1, 3, '2023-07-07 15:42:02', 0);
|
||||
INSERT INTO `comment` VALUES (40, 1, 1, '6666', 1, '2023-07-07 21:49:58', 1, 3, '2023-07-07 21:49:58', 4);
|
||||
INSERT INTO `comment` VALUES (39, 7, 3, '6666', 0, '2023-07-07 15:42:02', 1, 3, '2023-07-07 15:42:02', 0);
|
||||
INSERT INTO `comment` VALUES (40, 1, 1, '6666', 1, '2023-07-07 21:49:58', 1, 3, '2023-07-07 21:49:58', 5);
|
||||
INSERT INTO `comment` VALUES (41, 2, 2, '11111111', 1, '2023-07-07 23:33:47', 1, 4, '2023-07-07 23:33:47', 0);
|
||||
INSERT INTO `comment` VALUES (42, 2, 6, 'e44444444444444', 1, '2023-07-07 23:34:28', 1, 5, '2023-07-07 23:34:28', 0);
|
||||
INSERT INTO `comment` VALUES (43, 11, 1, '可以啊', 1, '2023-07-08 20:25:38', 1, 5, '2023-07-08 20:25:38', 0);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for githubinfo
|
||||
@@ -163,11 +164,15 @@ CREATE TABLE `githubinfo` (
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `projectId_info`(`projectId` ASC) USING BTREE,
|
||||
CONSTRAINT `projectId_info` FOREIGN KEY (`projectId`) REFERENCES `project` (`projectId`) ON DELETE RESTRICT ON UPDATE RESTRICT
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of githubinfo
|
||||
-- ----------------------------
|
||||
INSERT INTO `githubinfo` VALUES (1, 2, 'https://avatars.githubusercontent.com/u/62598626?v=4', 'winsw', 'https://starchart.cc/winsw/winsw.svg', 9648, 'C#', 'true', 223, 186, 'Organization', 'v3', 1392, 'MIT', '0', 0);
|
||||
INSERT INTO `githubinfo` VALUES (4, 19, 'https://avatars.githubusercontent.com/u/69631?v=4', 'redex', 'https://starchart.cc/facebook/redex.svg', 5844, 'C++', 'true', 229, 70, 'Organization', 'main', 671, 'MIT', '0', 0);
|
||||
INSERT INTO `githubinfo` VALUES (5, 8, 'https://avatars.githubusercontent.com/u/6154722?v=4', 'AI-For-Beginners', 'https://starchart.cc/microsoft/AI-For-Beginners.svg', 15399, 'Jupyter Notebook', 'true', 191, 22, 'Organization', 'main', 2522, 'MIT', '0', 0);
|
||||
INSERT INTO `githubinfo` VALUES (6, 1, 'https://avatars.githubusercontent.com/u/62598626?v=4', 'winsw', 'https://starchart.cc/winsw/winsw.svg', 9652, 'C#', 'true', 224, 186, 'Organization', 'v3', 1392, 'MIT', '0', 0);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for project
|
||||
@@ -193,19 +198,20 @@ CREATE TABLE `project` (
|
||||
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 = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '项目表' ROW_FORMAT = DYNAMIC;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 20 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '项目表' ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of project
|
||||
-- ----------------------------
|
||||
INSERT INTO `project` VALUES (1, 1, 'winsw/winsw', 'https://github.com/winsw/winsw', 'https://pic.imgdb.cn/item/6495df131ddac507cc80689f.png', '由密码学专家团队打造的开源隐私计算平台\r\nHelloGitHub 评分\r\n', '随着《数据安全法》和《个人信息保护法》的相继颁布,隐私计算技术在近两年迎来了前所未有的热度。该项目是由密码学专家团队打造的隐私计算平台,它开箱即用、安全可靠,支持隐匿查询、隐私求交、联合统计、数据资源管理等功能,实现了“数据可用不可见”,为数据安全流通保驾护航。', 2, '2023-06-30 18:58:01', 1, 1, '1111', 1, 1061);
|
||||
INSERT INTO `project` VALUES (2, 2, 'winsw/winsw', 'https://github.com/winsw/winsw', 'https://pic.imgdb.cn/item/6450e1b10d2dde5777f2fdbc.jpg', '由密码学专家团队打造的开源隐私计算平台\r\nHelloGitHub 评分\r\n', '随着《数据安全法》和《个人信息保护法》的相继颁布,隐私计算技术在近两年迎来了前所未有的热度。该项目是由密码学专家团队打造的隐私计算平台,它开箱即用、安全可靠,支持隐匿查询、隐私求交、联合统计、数据资源管理等功能,实现了“数据可用不可见”,为数据安全流通保驾护航。', 1, '2023-06-30 18:58:01', 2, 1, '1111', 1, 189);
|
||||
INSERT INTO `project` VALUES (3, 4, 'primihub/primihub', 'https://github.com/winsw/winsw', 'https://pic.imgdb.cn/item/6495df131ddac507cc80689f.png', '由密码学专家团队打造的开源隐私计算平台\r\nHelloGitHub 评分\r\n', '随着《数据安全法》和《个人信息保护法》的相继颁布,隐私计算技术在近两年迎来了前所未有的热度。该项目是由密码学专家团队打造的隐私计算平台,它开箱即用、安全可靠,支持隐匿查询、隐私求交、联合统计、数据资源管理等功能,实现了“数据可用不可见”,为数据安全流通保驾护航。', 1, '2023-06-30 18:58:01', 3, 1, '1111', 1, 429);
|
||||
INSERT INTO `project` VALUES (4, 1, 'primihub/primihub', 'https://github.com/winsw/winsw', 'https://pic.imgdb.cn/item/6450e1b10d2dde5777f2fdbc.jpg', '由密码学专家团队打造的开源隐私计算平台\r\nHelloGitHub 评分\r\n', '随着《数据安全法》和《个人信息保护法》的相继颁布,隐私计算技术在近两年迎来了前所未有的热度。该项目是由密码学专家团队打造的隐私计算平台,它开箱即用、安全可靠,支持隐匿查询、隐私求交、联合统计、数据资源管理等功能,实现了“数据可用不可见”,为数据安全流通保驾护航。', 1, '2023-06-30 18:58:01', 4, 1, '1111', 2, 4492);
|
||||
INSERT INTO `project` VALUES (5, 5, 'gotenberg/gotenberg', 'https://github.com/winsw/winsw', 'https://pic.imgdb.cn/item/6495df131ddac507cc80689f.png', '由密码学专家团队打造的开源隐私计算平台\r\nHelloGitHub 评分\r\n', '随着《数据安全法》和《个人信息保护法》的相继颁布,隐私计算技术在近两年迎来了前所未有的热度。该项目是由密码学专家团队打造的隐私计算平台,它开箱即用、安全可靠,支持隐匿查询、隐私求交、联合统计、数据资源管理等功能,实现了“数据可用不可见”,为数据安全流通保驾护航。', 0, '2023-06-30 18:58:01', 5, 1, '1111', 4, 614);
|
||||
INSERT INTO `project` VALUES (6, 2, 'gotenberg/gotenberg', 'https://github.com/winsw/winsw', 'https://pic.imgdb.cn/item/6450e1b10d2dde5777f2fdbc.jpg', '由密码学专家团队打造的开源隐私计算平台\r\nHelloGitHub 评分\r\n', '随着《数据安全法》和《个人信息保护法》的相继颁布,隐私计算技术在近两年迎来了前所未有的热度。该项目是由密码学专家团队打造的隐私计算平台,它开箱即用、安全可靠,支持隐匿查询、隐私求交、联合统计、数据资源管理等功能,实现了“数据可用不可见”,为数据安全流通保驾护航。', 0, '2023-06-30 18:58:01', 6, 1, '1111', 1, 696);
|
||||
INSERT INTO `project` VALUES (7, 6, 'microsoft/AI-For-Beginners', 'https://github.com/winsw/winsw', 'https://pic.imgdb.cn/item/6495df131ddac507cc80689f.png', '由密码学专家团队打造的开源隐私计算平台\r\nHelloGitHub 评分\r\n', '随着《数据安全法》和《个人信息保护法》的相继颁布,隐私计算技术在近两年迎来了前所未有的热度。该项目是由密码学专家团队打造的隐私计算平台,它开箱即用、安全可靠,支持隐匿查询、隐私求交、联合统计、数据资源管理等功能,实现了“数据可用不可见”,为数据安全流通保驾护航。', 1, '2023-06-30 18:58:01', 7, 1, '1111', 3, 7866);
|
||||
INSERT INTO `project` VALUES (8, 7, 'microsoft/AI-For-Beginners', 'https://github.com/winsw/winsw', 'https://pic.imgdb.cn/item/646870fce03e90d874c39515.png', '666', '随着《数据安全法》和《个人信息保护法》', 0, '2023-06-30 18:58:01', 8, 1, '1111', 1, 8965);
|
||||
INSERT INTO `project` VALUES (1, 1, 'winsw/winsw', 'https://github.com/winsw/winsw', 'https://pic.imgdb.cn/item/6495df131ddac507cc80689f.png', '由密码学专家团队打造的开源隐私计算平台\r\nHelloGitHub 评分\r\n', '随着《数据安全法》和《个人信息保护法》的相继颁布,隐私计算技术在近两年迎来了前所未有的热度。该项目是由密码学专家团队打造的隐私计算平台,它开箱即用、安全可靠,支持隐匿查询、隐私求交、联合统计、数据资源管理等功能,实现了“数据可用不可见”,为数据安全流通保驾护航。', 3, '2023-06-30 18:58:01', 8, 1, 'E:\\Desktop\\helloGithub\\web\\projectFile\\42f7b08d-59db-4083-8a59-ac2ad473a49b_general-background-master.zip', 1, 1127);
|
||||
INSERT INTO `project` VALUES (2, 2, 'winsw/winsw', 'https://github.com/winsw/winsw', 'https://pic.imgdb.cn/item/6450e1b10d2dde5777f2fdbc.jpg', '由密码学专家团队打造的开源隐私计算平台\r\nHelloGitHub 评分\r\n', '随着《数据安全法》和《个人信息保护法》的相继颁布,隐私计算技术在近两年迎来了前所未有的热度。该项目是由密码学专家团队打造的隐私计算平台,它开箱即用、安全可靠,支持隐匿查询、隐私求交、联合统计、数据资源管理等功能,实现了“数据可用不可见”,为数据安全流通保驾护航。', 1, '2023-06-30 18:58:01', 2, 1, 'E:\\Desktop\\helloGithub\\web\\projectFile\\42f7b08d-59db-4083-8a59-ac2ad473a49b_general-background-master.zip', 1, 222);
|
||||
INSERT INTO `project` VALUES (3, 4, 'primihub/primihub', 'https://github.com/winsw/winsw', 'https://pic.imgdb.cn/item/6495df131ddac507cc80689f.png', '由密码学专家团队打造的开源隐私计算平台\r\nHelloGitHub 评分\r\n', '随着《数据安全法》和《个人信息保护法》的相继颁布,隐私计算技术在近两年迎来了前所未有的热度。该项目是由密码学专家团队打造的隐私计算平台,它开箱即用、安全可靠,支持隐匿查询、隐私求交、联合统计、数据资源管理等功能,实现了“数据可用不可见”,为数据安全流通保驾护航。', 1, '2023-06-30 18:58:01', 3, 1, 'E:\\Desktop\\helloGithub\\web\\projectFile\\42f7b08d-59db-4083-8a59-ac2ad473a49b_general-background-master.zip', 1, 440);
|
||||
INSERT INTO `project` VALUES (4, 1, 'primihub/primihub', 'https://github.com/winsw/winsw', 'https://pic.imgdb.cn/item/6450e1b10d2dde5777f2fdbc.jpg', '由密码学专家团队打造的开源隐私计算平台\r\nHelloGitHub 评分\r\n', '随着《数据安全法》和《个人信息保护法》的相继颁布,隐私计算技术在近两年迎来了前所未有的热度。该项目是由密码学专家团队打造的隐私计算平台,它开箱即用、安全可靠,支持隐匿查询、隐私求交、联合统计、数据资源管理等功能,实现了“数据可用不可见”,为数据安全流通保驾护航。', 1, '2023-06-30 18:58:01', 4, 1, '', 2, 4494);
|
||||
INSERT INTO `project` VALUES (5, 5, 'gotenberg/gotenberg', 'https://github.com/winsw/winsw', 'https://pic.imgdb.cn/item/6495df131ddac507cc80689f.png', '由密码学专家团队打造的开源隐私计算平台\r\nHelloGitHub 评分\r\n', '随着《数据安全法》和《个人信息保护法》的相继颁布,隐私计算技术在近两年迎来了前所未有的热度。该项目是由密码学专家团队打造的隐私计算平台,它开箱即用、安全可靠,支持隐匿查询、隐私求交、联合统计、数据资源管理等功能,实现了“数据可用不可见”,为数据安全流通保驾护航。', 0, '2023-06-30 18:58:01', 5, 1, '', 4, 628);
|
||||
INSERT INTO `project` VALUES (6, 2, 'gotenberg/gotenberg', 'https://github.com/winsw/winsw', 'https://pic.imgdb.cn/item/6450e1b10d2dde5777f2fdbc.jpg', '由密码学专家团队打造的开源隐私计算平台\r\nHelloGitHub 评分\r\n', '随着《数据安全法》和《个人信息保护法》的相继颁布,隐私计算技术在近两年迎来了前所未有的热度。该项目是由密码学专家团队打造的隐私计算平台,它开箱即用、安全可靠,支持隐匿查询、隐私求交、联合统计、数据资源管理等功能,实现了“数据可用不可见”,为数据安全流通保驾护航。', 0, '2023-06-30 18:58:01', 6, 1, '', 1, 703);
|
||||
INSERT INTO `project` VALUES (7, 6, 'microsoft/AI-For-Beginners', 'https://github.com/winsw/winsw', 'https://pic.imgdb.cn/item/6495df131ddac507cc80689f.png', '由密码学专家团队打造的开源隐私计算平台\r\nHelloGitHub 评分\r\n', '随着《数据安全法》和《个人信息保护法》的相继颁布,隐私计算技术在近两年迎来了前所未有的热度。该项目是由密码学专家团队打造的隐私计算平台,它开箱即用、安全可靠,支持隐匿查询、隐私求交、联合统计、数据资源管理等功能,实现了“数据可用不可见”,为数据安全流通保驾护航。', 1, '2023-06-30 18:58:01', 7, 1, '', 3, 7868);
|
||||
INSERT INTO `project` VALUES (8, 7, 'microsoft/AI-For-Beginners', 'https://github.com/winsw/winsw', 'https://pic.imgdb.cn/item/646870fce03e90d874c39515.png', '666', '随着《数据安全法》和《个人信息保护法》', 0, '2023-06-30 18:58:01', 8, 1, '', 1, 8968);
|
||||
INSERT INTO `project` VALUES (19, 1, 'facebook/redex', 'https://github.com/facebook/redex', 'https://avatars.githubusercontent.com/u/69631?v=4', 'ReDex: An Android Bytecod', '<p><span style=\"color: rgb(230, 237, 243);\"><span style=\"background-color: rgb(13, 17, 23);\"><span style=\"font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Noto Sans, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji\"><span style=\"font-size: 16px\">ReDex is an Android bytecode (dex) optimizer originally developed at Facebook. It provides a framework for reading, writing, and analyzing .dex files, and a set of optimization passes that use this framework to improve the bytecode. An APK optimized by ReDex should be smaller and faster than its source.</span></span></span></span></p>', 0, '2023-07-08 22:58:39', 3, 1, 'E:\\Desktop\\helloGithub\\web\\projectFile\\88ad2539-b401-4ba7-b131-7a6163738ba7_general-background-master.zip', 0, 14);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for project_category
|
||||
@@ -220,7 +226,7 @@ CREATE TABLE `project_category` (
|
||||
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 = 10 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '项目标签中间表' ROW_FORMAT = DYNAMIC;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 34 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '项目标签中间表' ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of project_category
|
||||
@@ -234,6 +240,9 @@ INSERT INTO `project_category` VALUES (6, 6, 6);
|
||||
INSERT INTO `project_category` VALUES (7, 7, 7);
|
||||
INSERT INTO `project_category` VALUES (8, 8, 8);
|
||||
INSERT INTO `project_category` VALUES (9, 2, 1);
|
||||
INSERT INTO `project_category` VALUES (31, 3, 19);
|
||||
INSERT INTO `project_category` VALUES (32, 6, 19);
|
||||
INSERT INTO `project_category` VALUES (33, 11, 19);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for support
|
||||
@@ -249,16 +258,17 @@ CREATE TABLE `support` (
|
||||
INDEX `projectId_support`(`projectId` ASC) USING BTREE,
|
||||
CONSTRAINT `projectId_support` FOREIGN KEY (`projectId`) REFERENCES `project` (`projectId`) ON DELETE RESTRICT ON UPDATE RESTRICT,
|
||||
CONSTRAINT `userId_support` FOREIGN KEY (`userId`) REFERENCES `user` (`userId`) ON DELETE RESTRICT ON UPDATE RESTRICT
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 66 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 68 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of support
|
||||
-- ----------------------------
|
||||
INSERT INTO `support` VALUES (44, 1, 7, 1);
|
||||
INSERT INTO `support` VALUES (60, 1, 3, 1);
|
||||
INSERT INTO `support` VALUES (61, 1, 4, 1);
|
||||
INSERT INTO `support` VALUES (63, 1, 2, 1);
|
||||
INSERT INTO `support` VALUES (65, 1, 1, 1);
|
||||
INSERT INTO `support` VALUES (66, 11, 1, 1);
|
||||
INSERT INTO `support` VALUES (67, 1, 3, 1);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for user
|
||||
@@ -276,16 +286,19 @@ CREATE TABLE `user` (
|
||||
`userAvatar` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户头像',
|
||||
`userLevel` int NULL DEFAULT NULL COMMENT '用户等级',
|
||||
PRIMARY KEY (`userId`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户表' ROW_FORMAT = DYNAMIC;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 12 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, 5, '666;666;', 0, 'E:\\Desktop\\helloGithub\\web\\uploadFile\\06137262-725b-42cf-bbf4-1c1873c52171_3.jpg', 5);
|
||||
INSERT INTO `user` VALUES (2, '111', '111', '2023-06-29 22:43:22', 1, 1, '', 0, 'https://pic.imgdb.cn/item/642828f3a682492fccdb680e.jpg', 1);
|
||||
INSERT INTO `user` VALUES (4, '222', '222', '2023-07-03', 1, NULL, NULL, 0, 'https://pic.imgdb.cn/item/642828f3a682492fccdb680e.jpg', 1);
|
||||
INSERT INTO `user` VALUES (5, '333', '333', '2023-07-03', 1, NULL, NULL, 0, 'https://pic.imgdb.cn/item/640f1e5ef144a01007dfb60c.jpg', 1);
|
||||
INSERT INTO `user` VALUES (6, '999', '999', '2023-07-03', 1, NULL, NULL, 0, 'https://pic.imgdb.cn/item/640f1e5ef144a01007dfb60c.jpg', 1);
|
||||
INSERT INTO `user` VALUES (7, '777', '777', '2023-07-07', 1, 0, NULL, 0, 'E:\\Desktop\\helloGithub\\web\\uploadFile\\06137262-725b-42cf-bbf4-1c1873c52171_3.jpg', 1);
|
||||
INSERT INTO `user` VALUES (1, '666', '666', '2023-06-29 22:43:22', 1, 5, '666;666;', 0, 'E:\\Desktop\\helloGithub\\web\\uploadFile\\8115684e-9b48-4ff7-a75a-93fdb62a8eec_10.jpg', 5);
|
||||
INSERT INTO `user` VALUES (2, '111', '111', '2023-06-29 22:43:22', 1, 1, '', 5, 'E:\\Desktop\\helloGithub\\web\\uploadFile\\69e56c15-20d5-43a4-916b-1d6230a33b8e_default.png', 1);
|
||||
INSERT INTO `user` VALUES (4, '222', '222', '2023-07-03', 1, NULL, NULL, 0, 'E:\\Desktop\\helloGithub\\web\\uploadFile\\69e56c15-20d5-43a4-916b-1d6230a33b8e_default.png', 1);
|
||||
INSERT INTO `user` VALUES (5, '333', '333', '2023-07-03', 1, NULL, NULL, 0, 'E:\\Desktop\\helloGithub\\web\\uploadFile\\69e56c15-20d5-43a4-916b-1d6230a33b8e_default.png', 1);
|
||||
INSERT INTO `user` VALUES (6, '999', '999', '2023-07-03', 1, NULL, NULL, 0, 'E:\\Desktop\\helloGithub\\web\\uploadFile\\69e56c15-20d5-43a4-916b-1d6230a33b8e_default.png', 1);
|
||||
INSERT INTO `user` VALUES (7, '777', '777', '2023-07-07', 1, 0, NULL, 0, 'E:\\Desktop\\helloGithub\\web\\uploadFile\\69e56c15-20d5-43a4-916b-1d6230a33b8e_default.png', 1);
|
||||
INSERT INTO `user` VALUES (9, 'zhy', 'zhy', '2023-07-08', 1, 0, NULL, 0, 'E:\\Desktop\\helloGithub\\web\\uploadFile\\69e56c15-20d5-43a4-916b-1d6230a33b8e_default.png', 1);
|
||||
INSERT INTO `user` VALUES (10, 'test', 'test', '2023-07-08', 1, 0, NULL, 0, 'E:\\Desktop\\helloGithub\\web\\uploadFile\\69e56c15-20d5-43a4-916b-1d6230a33b8e_default.png', 1);
|
||||
INSERT INTO `user` VALUES (11, '000', '000', '2023-07-08', 1, 0, '', 5, 'E:\\Desktop\\helloGithub\\web\\uploadFile\\0b98a856-8f9f-4c16-911a-c04fdcfcc908_git.png', 1);
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
@@ -64,7 +64,7 @@ public class UserDao {
|
||||
connection = JdbcUtils.getConnection();
|
||||
// sql语句写的操作 ----加上事务
|
||||
JdbcUtils.beginTransaction(connection); // 开启事务
|
||||
String insertSql = "INSERT INTO `user` (`userId`, `userName`, `userPassword`,`creatTime`,`isValid`,projectNum) VALUES (null, ?, ?,?,1,0);";
|
||||
String insertSql = "INSERT INTO `user` (`userId`, `userName`, `userPassword`,`creatTime`,`isValid`,projectNum,contributionValue,userLevel,userAvatar) VALUES (null, ?, ?,?,1,0,0,1,'E://Desktop//helloGithub//web//uploadFile//69e56c15-20d5-43a4-916b-1d6230a33b8e_default.png');";
|
||||
preparedStatement = connection.prepareStatement(insertSql);
|
||||
preparedStatement.setString(1, userName);
|
||||
preparedStatement.setString(2, userPwd);
|
||||
|
@@ -6,12 +6,10 @@ import com.hellogithub.entity.userEntity;
|
||||
import com.hellogithub.utils.JdbcUtils;
|
||||
import com.mysql.cj.jdbc.JdbcConnection;
|
||||
import org.apache.commons.dbutils.QueryRunner;
|
||||
import org.apache.commons.dbutils.handlers.BeanHandler;
|
||||
import org.apache.commons.dbutils.handlers.BeanListHandler;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.*;
|
||||
import java.util.List;
|
||||
|
||||
public class githubDao {
|
||||
@@ -28,7 +26,7 @@ public class githubDao {
|
||||
PreparedStatement prep = conn.prepareStatement(sql1);
|
||||
prep.setInt(1,projectId);
|
||||
rs = prep.executeQuery();
|
||||
if(rs == null){
|
||||
if(!rs.next()){
|
||||
connection = JdbcUtils.getConnection();
|
||||
String Sql = "INSERT INTO githubinfo(id,projectId,avatar,name,starImgUrl,starCount,mainLanguage,isActive,subscriber,issues,isOrganization,defaultBranch,forks,protocol,version,isVaild) VALUES(null,?,?,?,?,?,?,?,?,?,?,?,?,?,?,0);";
|
||||
preparedStatement = connection.prepareStatement(Sql);
|
||||
@@ -62,18 +60,24 @@ public class githubDao {
|
||||
return back;
|
||||
}
|
||||
|
||||
public List<githubEntity> ret_Github_info(int projectid){
|
||||
public ResultSetMetaData ret_Github_info(int projectid) {
|
||||
List<githubEntity> githubEntityList;
|
||||
ResultSetMetaData rsmd = null;
|
||||
String sql = "select * from githubinfo WHERE projectId = ?;";
|
||||
try {
|
||||
Connection conn = JdbcUtils.getConnection();
|
||||
QueryRunner runner = new QueryRunner();
|
||||
String sql = "select * from githubinfo where projectId = ? and isValid = 1";
|
||||
githubEntityList = runner.query(conn, sql, new BeanListHandler<>(githubEntity.class), projectid);
|
||||
PreparedStatement prep = conn.prepareStatement(sql);
|
||||
ResultSet rs = null;
|
||||
prep.setInt(1, projectid);
|
||||
rs = prep.executeQuery();
|
||||
while (rs.next()) {
|
||||
rsmd = rs.getMetaData();
|
||||
}
|
||||
conn.close();
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return githubEntityList;
|
||||
return rsmd;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -14,7 +14,7 @@ public class projectCategoryDao {
|
||||
try {
|
||||
Connection conn = JdbcUtils.getConnection();
|
||||
QueryRunner runner = new QueryRunner();
|
||||
String sql ="INSERT into project_category (userId,projectId) VALUES (?,?)";
|
||||
String sql ="INSERT into project_category (categoryId,projectId) VALUES (?,?)";
|
||||
num = runner.update(conn, sql,userId,projectId);
|
||||
conn.close();
|
||||
} catch (SQLException e) {
|
||||
|
@@ -290,7 +290,7 @@ public class projectDao {
|
||||
Connection conn = JdbcUtils.getConnection();
|
||||
QueryRunner runner = new QueryRunner();
|
||||
String sql ="update project set fileAddress = ? where projectName = ? and isValid = 1";
|
||||
num = runner.update(conn, sql,projectName,fileAddress);
|
||||
num = runner.update(conn, sql,fileAddress,projectName);
|
||||
conn.close();
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
@@ -320,7 +320,7 @@ public class projectDao {
|
||||
PreparedStatement prep = conn.prepareStatement(sql);
|
||||
prep.setString(1, projectName);
|
||||
rs = prep.executeQuery();
|
||||
if(rs.wasNull())
|
||||
if(rs.next())
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.hellogithub.dao.githubDao;
|
||||
import com.hellogithub.entity.githubEntity;
|
||||
|
||||
import java.sql.ResultSetMetaData;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -16,12 +17,7 @@ public class githubService {
|
||||
}
|
||||
|
||||
public String ret_Github_info(int projectId){
|
||||
List<githubEntity> githubEntityList = githubDao.ret_Github_info(projectId);
|
||||
Map<Integer, githubEntity> dataMap = new HashMap<>();
|
||||
for(int i=1;i<githubEntityList.size()+1;i++){
|
||||
githubEntity githubEntity = githubEntityList.get(i);
|
||||
dataMap.put(i,githubEntity);
|
||||
}
|
||||
return JSONObject.toJSONString(dataMap);
|
||||
ResultSetMetaData rsmd = githubDao.ret_Github_info(projectId);
|
||||
return JSONObject.toJSONString(rsmd);
|
||||
}
|
||||
}
|
||||
|
@@ -252,22 +252,23 @@ public class projectService {
|
||||
String submitTime = format.format(time).toString();
|
||||
int categoryId = categoryIdList.get(0);
|
||||
int userId = userDao.selectIdByName(username);
|
||||
for(int i=0;i<categoryIdList.size();i++)
|
||||
{
|
||||
int id = categoryIdList.get(i);
|
||||
int num = projectCategoryDao.insertProject(userId,id);
|
||||
if(num == 0 )
|
||||
{
|
||||
flag=0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
pnum = projectDao.insertProject(userId,projectName,projectUrl,projectIco,projectTitle,projectDescription,submitTime,categoryId);
|
||||
if(pnum == 0 )
|
||||
{
|
||||
flag=0;
|
||||
}
|
||||
int proId = projectDao.selectProByProName(projectName).getProjectId();
|
||||
for(int i=0;i<categoryIdList.size();i++)
|
||||
{
|
||||
int id = categoryIdList.get(i);
|
||||
int num = projectCategoryDao.insertProject(id,proId);
|
||||
if(num == 0 )
|
||||
{
|
||||
flag=0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return flag ;
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package com.hellogithub.servlet;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hellogithub.service.projectService;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
@@ -14,44 +15,44 @@ import java.util.UUID;
|
||||
|
||||
@WebServlet("/DownLoad")
|
||||
public class DownLoadServlet extends HttpServlet {
|
||||
|
||||
private projectService projectService = new projectService();
|
||||
|
||||
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
response.reset();
|
||||
response.setContentType("application/x-msdownload;charset=utf-8");
|
||||
//得到要下载的文件名
|
||||
String fileName = request.getParameter("filename");
|
||||
System.out.println(fileName);
|
||||
String projectId = request.getParameter("id");
|
||||
String address = projectService.selectProById(projectId).getFileAddress();
|
||||
String[] liss = address.split("\\\\");
|
||||
String fileName = liss[liss.length - 1];
|
||||
//本地需要进行转码,linux服务器使用就会出现下载乱码
|
||||
//fileName = new String(fileName.getBytes("iso8859-1"),"UTF-8");
|
||||
// System.out.print("转码后"+fileName);
|
||||
//上传的文件都是保存在/WEB-INF/upload目录下的子目录当中
|
||||
String fileSaveRootPath=this.getServletContext().getRealPath(File.separator+"WEB-INF"+File.separator+"upload");
|
||||
String fileSaveRootPath = this.getServletContext().getRealPath(File.separator+"WEB-INF"+File.separator+"upload").replace("\\out\\artifacts\\helloGithub_war_exploded\\WEB-INF\\upload","\\web\\projectFile");;
|
||||
//通过文件名找出文件的所在目录
|
||||
//String path = findFileSavePathByFileName(fileName,fileSaveRootPath);
|
||||
// String path = "/WEB-INF/upload";
|
||||
//得到要下载的文件
|
||||
File file = new File(fileSaveRootPath + File.separator + fileName);
|
||||
//File file = new File(fileName);
|
||||
System.out.println(file);
|
||||
System.out.print("\n");
|
||||
// 浏览器请求响应转码防止乱码
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
request.setCharacterEncoding("UTF-8");
|
||||
//如果文件不存在
|
||||
if(!file.exists()){
|
||||
request.setAttribute("message","wrong");
|
||||
request.getRequestDispatcher("/message.jsp").forward(request,response);
|
||||
if (!file.exists()) {
|
||||
request.setAttribute("message", "wrong");
|
||||
request.getRequestDispatcher("/message.jsp").forward(request, response);
|
||||
return;
|
||||
}
|
||||
//处理文件名
|
||||
String realname = fileName.substring(fileName.indexOf("_")+1);
|
||||
System.out.println(realname);
|
||||
String realname = fileName.substring(fileName.indexOf("_") + 1);
|
||||
// System.out.println(realname);
|
||||
//设置响应头,控制浏览器下载该文件
|
||||
response.setHeader("content-disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
|
||||
//读取要下载的文件,保存到文件输入流
|
||||
FileInputStream in = new FileInputStream(fileSaveRootPath +File.separator+ fileName);
|
||||
FileInputStream in = new FileInputStream(fileSaveRootPath + File.separator + fileName);
|
||||
|
||||
//创建输出流
|
||||
OutputStream out = response.getOutputStream();
|
||||
@@ -60,7 +61,7 @@ public class DownLoadServlet extends HttpServlet {
|
||||
byte buffer[] = new byte[1024];
|
||||
int len = 100;
|
||||
//循环将输入流中的内容读取到缓冲区当中
|
||||
while((len=in.read(buffer))>0){
|
||||
while ((len = in.read(buffer)) > 0) {
|
||||
//输出缓冲区的内容到浏览器,实现文件下载
|
||||
out.write(buffer, 0, len);
|
||||
}
|
||||
@@ -72,21 +73,21 @@ public class DownLoadServlet extends HttpServlet {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param filename 要下载的文件名
|
||||
* @param saveRootPath 上传文件保存的根目录,也就是/WEB-INF/upload目录
|
||||
* @return 要下载的文件的存储目录
|
||||
* @Method: findFileSavePathByFileName
|
||||
* @Description: 通过文件名和存储上传文件根目录找出要下载的文件的所在路径
|
||||
* @Anthor:
|
||||
* @param filename 要下载的文件名
|
||||
* @param saveRootPath 上传文件保存的根目录,也就是/WEB-INF/upload目录
|
||||
* @return 要下载的文件的存储目录
|
||||
*/
|
||||
public String findFileSavePathByFileName(String filename,String saveRootPath){
|
||||
public String findFileSavePathByFileName(String filename, String saveRootPath) {
|
||||
// int hashcode = filename.hashCode();
|
||||
// int dir1 = hashcode&0xf; //0--15
|
||||
// int dir2 = (hashcode&0xf0)>>4; //0-15
|
||||
//String dir = saveRootPath + "\\" + dir1 + "\\" + dir2; //upload\2\3 upload\3\5
|
||||
String dir = saveRootPath;
|
||||
File file = new File(dir);
|
||||
if(!file.exists()){
|
||||
if (!file.exists()) {
|
||||
//创建目录
|
||||
file.mkdirs();
|
||||
}
|
||||
|
@@ -45,6 +45,10 @@ public class UploadHandleServlet extends HttpServlet {
|
||||
String savePath = this.getServletContext().getRealPath(File.separator+"WEB-INF"+File.separator+"upload");
|
||||
savePath= this.getServletContext().getRealPath(File.separator+"WEB-INF"+File.separator+"upload").replace("\\out\\artifacts\\helloGithub_war_exploded\\WEB-INF\\upload","\\web\\uploadFile");
|
||||
System.out.println(savePath);
|
||||
String needPath = "\\helloGithub\\web\\uploadFile";
|
||||
String relPath = savePath.substring(savePath.length()-needPath.length(),savePath.length());
|
||||
|
||||
System.out.println(relPath);
|
||||
//上传时生成的临时文件保存目录
|
||||
String tempPath = this.getServletContext().getRealPath(File.separator+"WEB-INF"+File.separator+"tmp");
|
||||
File tmpFile = new File(tempPath);
|
||||
@@ -164,7 +168,7 @@ public class UploadHandleServlet extends HttpServlet {
|
||||
message = "文件上传成功!";
|
||||
if(userName != null)
|
||||
{
|
||||
userService.updateUserAv(userName,realSavePath+"\\"+saveFilename);
|
||||
userService.updateUserAv(userName,relPath+"\\"+saveFilename);
|
||||
System.out.println("123");
|
||||
}
|
||||
|
||||
|
@@ -46,7 +46,8 @@ public class commitProjectFileServlet extends HttpServlet {
|
||||
//得到上传文件的保存目录,将上传的文件存放于WEB-INF目录下,不允许外界直接访问,保证上传文件的安全
|
||||
String savePath = this.getServletContext().getRealPath(File.separator+"WEB-INF"+File.separator+"upload");
|
||||
savePath= this.getServletContext().getRealPath(File.separator+"WEB-INF"+File.separator+"upload").replace("\\out\\artifacts\\helloGithub_war_exploded\\WEB-INF\\upload","\\web\\projectFile");
|
||||
System.out.println(savePath);
|
||||
String needPath = "\\helloGithub\\web\\uploadFile";
|
||||
String relPath = savePath.substring(savePath.length()-needPath.length(),savePath.length());
|
||||
//上传时生成的临时文件保存目录
|
||||
String tempPath = this.getServletContext().getRealPath(File.separator+"WEB-INF"+File.separator+"tmp");
|
||||
File tmpFile = new File(tempPath);
|
||||
@@ -164,7 +165,7 @@ public class commitProjectFileServlet extends HttpServlet {
|
||||
//删除处理文件上传时生成的临时文件
|
||||
item.delete();
|
||||
message = "文件上传成功!";
|
||||
num = projectService.updateProject(projectName,realSavePath+"\\"+saveFilename);
|
||||
num = projectService.updateProject(projectName,relPath+"\\"+saveFilename);
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -13,6 +13,7 @@ import javax.servlet.http.HttpSession;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@WebServlet("/commitProject")
|
||||
@@ -52,9 +53,12 @@ public class commitProjectServlet extends HttpServlet {
|
||||
String projectUrl = req.getParameter("projectUrl");
|
||||
String projectTitle = req.getParameter("projectTitle");
|
||||
String projectDescription = req.getParameter("projectDescription");
|
||||
String [] categoryIdList = req.getParameterValues("projectDescription");
|
||||
String categoryIdList = req.getParameter("categoryIdList");
|
||||
String []categoryIdList1 = categoryIdList.split(",");
|
||||
List<String> categoryIdList2 = Arrays.asList(categoryIdList1);
|
||||
|
||||
List<Integer> integers = new ArrayList<>();
|
||||
for (String s : categoryIdList) {
|
||||
for (String s : categoryIdList2) {
|
||||
integers.add(Integer.parseInt(s));
|
||||
}
|
||||
int flag = projectService.insertProject(username,projectName,projectUrl,projectIco,projectTitle,projectDescription,integers);
|
||||
|
@@ -12,7 +12,7 @@ import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.HashMap;
|
||||
|
||||
@WebServlet("returnGithubInfo")
|
||||
@WebServlet("/returnGithubInfo")
|
||||
public class ret_Github_infoServlet extends HttpServlet {
|
||||
private githubService githubservice = new githubService();
|
||||
@Override
|
||||
@@ -35,8 +35,7 @@ public class ret_Github_infoServlet extends HttpServlet {
|
||||
|
||||
PrintWriter writer = resp.getWriter();
|
||||
String projectid = req.getParameter("projectId");
|
||||
String jsonString = githubservice.ret_Github_info(Integer.parseInt(projectid));
|
||||
writer.println(jsonString);
|
||||
writer.println(githubservice.ret_Github_info(Integer.parseInt(projectid)));
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
|
@@ -17,10 +17,6 @@ import java.nio.channels.Channels;
|
||||
@WebServlet("/retUserAv")
|
||||
public class retUserAvServlet extends HttpServlet {
|
||||
private UserService userService = new UserService();
|
||||
@Override
|
||||
public void init(ServletConfig config) throws ServletException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
@@ -36,12 +32,14 @@ public class retUserAvServlet extends HttpServlet {
|
||||
userEntity=userService.selectUserByName(username);
|
||||
if(userEntity != null)
|
||||
{
|
||||
String savePath = this.getServletContext().getRealPath(File.separator+"WEB-INF"+File.separator+"upload");
|
||||
savePath= this.getServletContext().getRealPath(File.separator+"WEB-INF"+File.separator+"upload").replace("\\out\\artifacts\\helloGithub_war_exploded\\WEB-INF\\upload","\\web\\projectFile");
|
||||
String needPath = "\\helloGithub\\web\\uploadFile";
|
||||
String relPath = savePath.substring(0,savePath.length()-needPath.length());
|
||||
String uri = userEntity.getUserAvatar();
|
||||
if(!uri.startsWith("https"))
|
||||
{
|
||||
FileInputStream fis = new FileInputStream (uri);
|
||||
relPath = relPath+uri;
|
||||
FileInputStream fis = new FileInputStream (relPath);
|
||||
String type = userEntity.getUserAvatar().substring(userEntity.getUserAvatar().lastIndexOf(".")+1);
|
||||
|
||||
int size = fis.available();
|
||||
if(size != 0)
|
||||
{
|
||||
@@ -54,21 +52,7 @@ public class retUserAvServlet extends HttpServlet {
|
||||
os.write(data);
|
||||
os.flush();
|
||||
os.close();
|
||||
}
|
||||
}else{
|
||||
PrintWriter writer = resp.getWriter();
|
||||
resp.setCharacterEncoding("UTF-8");
|
||||
resp.setContentType("text/html; charset=utf-8");
|
||||
// 设置响应头允许ajax跨域访问
|
||||
String curOrigin = req.getHeader("Origin");
|
||||
resp.setHeader("Access-Control-Allow-Origin", curOrigin == null ? "true" : curOrigin);
|
||||
resp.setHeader("Access-Control-Allow-Credentials", "true");
|
||||
resp.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE, HEAD");
|
||||
resp.setHeader("Access-Control-Max-Age", "3600");
|
||||
resp.setHeader("Access-Control-Allow-Headers", "access-control-allow-origin, authority, content-type, version-info, X-Requested-With");
|
||||
resp.setContentType("application/json;charset=UTF-8");
|
||||
writer.println(uri);
|
||||
writer.close();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@@ -2,10 +2,10 @@ package com.hellogithub.servlet;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hellogithub.service.projectService;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.http.HttpServlet;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import java.io.IOException;
|
||||
@@ -35,7 +35,7 @@ public class selectProjectByPname extends HttpServlet {
|
||||
|
||||
PrintWriter writer = resp.getWriter();
|
||||
String projectName = req.getParameter("projectName");
|
||||
int bool = projectservice.selectProjectByPname("projectName");
|
||||
int bool = projectservice.selectProjectByPname(projectName);
|
||||
if(bool == 1){
|
||||
setResultError("项目已存在", writer);
|
||||
}
|
||||
|
BIN
web/uploadFile/69e56c15-20d5-43a4-916b-1d6230a33b8e_default.png
Normal file
BIN
web/uploadFile/69e56c15-20d5-43a4-916b-1d6230a33b8e_default.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.0 KiB |
Reference in New Issue
Block a user