From 1aa2a55a55d071ba4aa50c42fc7c675760863f39 Mon Sep 17 00:00:00 2001 From: sjm <2431685932@qq.com> Date: Sat, 8 Jul 2023 13:49:26 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E8=BF=94=E5=9B=9Egithubinfo=E7=9A=84?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/hellogithub/dao/githubDao.java | 19 +++++++++ .../hellogithub/service/githubService.java | 16 +++++++ .../githubinfo/ret_Github_infoServlet.java | 42 +++++++++++++++++++ 3 files changed, 77 insertions(+) create mode 100644 src/com/hellogithub/servlet/githubinfo/ret_Github_infoServlet.java diff --git a/src/com/hellogithub/dao/githubDao.java b/src/com/hellogithub/dao/githubDao.java index bf0666c..a064615 100644 --- a/src/com/hellogithub/dao/githubDao.java +++ b/src/com/hellogithub/dao/githubDao.java @@ -1,12 +1,17 @@ package com.hellogithub.dao; import com.hellogithub.entity.githubEntity; +import com.hellogithub.entity.projectEntity; import com.hellogithub.entity.userEntity; import com.hellogithub.utils.JdbcUtils; +import org.apache.commons.dbutils.QueryRunner; +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.util.List; public class githubDao { githubEntity githubentity = new githubEntity(); @@ -45,4 +50,18 @@ public class githubDao { return rs; } + public List ret_Github_info(int projectid){ + List githubEntityList; + 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); + conn.close(); + } catch (SQLException e) { + throw new RuntimeException(e); + } + return githubEntityList; + } + } diff --git a/src/com/hellogithub/service/githubService.java b/src/com/hellogithub/service/githubService.java index c71d0d9..caed02b 100644 --- a/src/com/hellogithub/service/githubService.java +++ b/src/com/hellogithub/service/githubService.java @@ -1,6 +1,12 @@ package com.hellogithub.service; +import com.alibaba.fastjson.JSONObject; import com.hellogithub.dao.githubDao; +import com.hellogithub.entity.githubEntity; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; public class githubService { private githubDao githubDao = new githubDao(); @@ -8,4 +14,14 @@ public class githubService { public int ins_Github_info(int projectId, String name, String starImgUrl, int starCount, String mainLanguage, String isActive, int subscriber, int issues, String isOrganization, String defaultBranch, int forks, String protocol, String version){ return githubDao.ins_Github_info(projectId, name,starImgUrl,starCount, mainLanguage,isActive, subscriber, issues, isOrganization,defaultBranch, forks, protocol, version); } + + public String ret_Github_info(int projectId){ + List githubEntityList = githubDao.ret_Github_info(projectId); + Map dataMap = new HashMap<>(); + for(int i=1;i Date: Sat, 8 Jul 2023 14:25:27 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/hellogithub.sql | 17 +++++++++-------- .../githubinfo/ins_Github_infoServlet.java | 8 ++++---- .../githubinfo/ret_Github_infoServlet.java | 8 ++++---- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/sql/hellogithub.sql b/sql/hellogithub.sql index 9d9b20d..cc5a9a9 100644 --- a/sql/hellogithub.sql +++ b/sql/hellogithub.sql @@ -11,7 +11,7 @@ Target Server Version : 80031 (8.0.31) File Encoding : 65001 - Date: 08/07/2023 00:56:24 + Date: 08/07/2023 14:24:38 */ SET NAMES utf8mb4; @@ -56,7 +56,7 @@ CREATE TABLE `article` ( -- ---------------------------- INSERT INTO `article` VALUES (1, 1, '

随便写随便写随便写

', '2023-7-4', 1, 61, 'Git 的奇技淫巧🙈', 'https://pic.imgdb.cn/item/6495df131ddac507cc80689f.png'); INSERT INTO `article` VALUES (2, 2, 'Git 是一个分布式版本管理工具,版本管理工具就是大家在写东西的时候都用过 回撤这个功能,但是回撤只能回撤几步,假如想要找回我三天之前的修改,光用回撤是找不回来的。而版本管理工具能记录每次的修改,只要提交到版本仓库,就可以找到之前任何时刻的状态(文本状态)。\r\n\r\n下面的内容就是列举了常用的 Git 命令和一些小技巧,可以通过页面内查找的方式 Ctrl/Command+f 进行快速查找。\r\n\r\n开卷必读\r\n如果之前未使用过 Git,可以学习 Git 小白教程入门\r\n\r\n一定要先测试命令的效果后,再用于工作环境中,以防造成不能弥补的后果!到时候别拿着砍刀来找我\r\n所有的命令都在 git version 2.7.4 (Apple Git-66) 下测试通过\r\n统一概念:\r\n工作区:改动(增删文件和内容)\r\n暂存区:输入命令:git add 改动的文件名,此次改动就放到了 ‘暂存区’\r\n本地仓库(简称:本地):输入命令:git commit 此次修改的描述,此次改动就放到了本地仓库,每个 commit,我叫它为一个版本。\r\n远程仓库(简称:远程):输入命令:git push 远程仓库,此次改动就放到了远程仓库(GitHub 等)\r\ncommit-id:输出命令:git log,最上面那行 commit xxxxxx,后面的字符串就是 commit-id\r\n如果喜欢这个项目,欢迎 Star、提交 Pr、反馈问题😊\r\n下面,就是你在找的 Git 命令速查表。\r\n\r\n展示帮助信息', '2023-7-4', 1, 30, '666666', 'https://pic.imgdb.cn/item/6450e1b10d2dde5777f2fdbc.jpg'); -INSERT INTO `article` VALUES (3, 1, 'Git 是一个分布式版本管理工具,版本管理工具就是大家在写东西的时候都用过 回撤这个功能,但是回撤只能回撤几步,假如想要找回我三天之前的修改,光用回撤是找不回来的。而版本管理工具能记录每次的修改,只要提交到版本仓库,就可以找到之前任何时刻的状态(文本状态)。\r\n\r\n下面的内容就是列举了常用的 Git 命令和一些小技巧,可以通过页面内查找的方式 Ctrl/Command+f 进行快速查找。\r\n\r\n开卷必读\r\n如果之前未使用过 Git,可以学习 Git 小白教程入门\r\n\r\n一定要先测试命令的效果后,再用于工作环境中,以防造成不能弥补的后果!到时候别拿着砍刀来找我\r\n所有的命令都在 git version 2.7.4 (Apple Git-66) 下测试通过\r\n统一概念:\r\n工作区:改动(增删文件和内容)\r\n暂存区:输入命令:git add 改动的文件名,此次改动就放到了 ‘暂存区’\r\n本地仓库(简称:本地):输入命令:git commit 此次修改的描述,此次改动就放到了本地仓库,每个 commit,我叫它为一个版本。\r\n远程仓库(简称:远程):输入命令:git push 远程仓库,此次改动就放到了远程仓库(GitHub 等)\r\ncommit-id:输出命令:git log,最上面那行 commit xxxxxx,后面的字符串就是 commit-id\r\n如果喜欢这个项目,欢迎 Star、提交 Pr、反馈问题😊\r\n下面,就是你在找的 Git 命令速查表。\r\n\r\n展示帮助信息', '2023-7-7', 1, 86, 'Git 的奇技淫巧🙈', 'https://pic.imgdb.cn/item/6495df131ddac507cc80689f.png'); +INSERT INTO `article` VALUES (3, 1, 'Git 是一个分布式版本管理工具,版本管理工具就是大家在写东西的时候都用过 回撤这个功能,但是回撤只能回撤几步,假如想要找回我三天之前的修改,光用回撤是找不回来的。而版本管理工具能记录每次的修改,只要提交到版本仓库,就可以找到之前任何时刻的状态(文本状态)。\r\n\r\n下面的内容就是列举了常用的 Git 命令和一些小技巧,可以通过页面内查找的方式 Ctrl/Command+f 进行快速查找。\r\n\r\n开卷必读\r\n如果之前未使用过 Git,可以学习 Git 小白教程入门\r\n\r\n一定要先测试命令的效果后,再用于工作环境中,以防造成不能弥补的后果!到时候别拿着砍刀来找我\r\n所有的命令都在 git version 2.7.4 (Apple Git-66) 下测试通过\r\n统一概念:\r\n工作区:改动(增删文件和内容)\r\n暂存区:输入命令:git add 改动的文件名,此次改动就放到了 ‘暂存区’\r\n本地仓库(简称:本地):输入命令:git commit 此次修改的描述,此次改动就放到了本地仓库,每个 commit,我叫它为一个版本。\r\n远程仓库(简称:远程):输入命令:git push 远程仓库,此次改动就放到了远程仓库(GitHub 等)\r\ncommit-id:输出命令:git log,最上面那行 commit xxxxxx,后面的字符串就是 commit-id\r\n如果喜欢这个项目,欢迎 Star、提交 Pr、反馈问题😊\r\n下面,就是你在找的 Git 命令速查表。\r\n\r\n展示帮助信息', '2023-7-7', 1, 87, 'Git 的奇技淫巧🙈', 'https://pic.imgdb.cn/item/6495df131ddac507cc80689f.png'); INSERT INTO `article` VALUES (4, 1, 'Git 是一个分布式版本管理工具,版本管理工具就是大家在写东西的时候都用过 回撤这个功能,但是回撤只能回撤几步,假如想要找回我三天之前的修改,光用回撤是找不回来的。而版本管理工具能记录每次的修改,只要提交到版本仓库,就可以找到之前任何时刻的状态(文本状态)。\r\n\r\n下面的内容就是列举了常用的 Git 命令和一些小技巧,可以通过页面内查找的方式 Ctrl/Command+f 进行快速查找。\r\n\r\n开卷必读\r\n如果之前未使用过 Git,可以学习 Git 小白教程入门\r\n\r\n一定要先测试命令的效果后,再用于工作环境中,以防造成不能弥补的后果!到时候别拿着砍刀来找我\r\n所有的命令都在 git version 2.7.4 (Apple Git-66) 下测试通过\r\n统一概念:\r\n工作区:改动(增删文件和内容)\r\n暂存区:输入命令:git add 改动的文件名,此次改动就放到了 ‘暂存区’\r\n本地仓库(简称:本地):输入命令:git commit 此次修改的描述,此次改动就放到了本地仓库,每个 commit,我叫它为一个版本。\r\n远程仓库(简称:远程):输入命令:git push 远程仓库,此次改动就放到了远程仓库(GitHub 等)\r\ncommit-id:输出命令:git log,最上面那行 commit xxxxxx,后面的字符串就是 commit-id\r\n如果喜欢这个项目,欢迎 Star、提交 Pr、反馈问题😊\r\n下面,就是你在找的 Git 命令速查表。\r\n\r\n展示帮助信息', '2023-7-4', 1, 2341, '行不行啊,测试', 'https://pic.imgdb.cn/item/6450e1b10d2dde5777f2fdbc.jpg'); INSERT INTO `article` VALUES (5, 6, 'Git 是一个分布式版本管理工具,版本管理工具就是大家在写东西的时候都用过 回撤这个功能,但是回撤只能回撤几步,假如想要找回我三天之前的修改,光用回撤是找不回来的。而版本管理工具能记录每次的修改,只要提交到版本仓库,就可以找到之前任何时刻的状态(文本状态)。\r\n\r\n下面的内容就是列举了常用的 Git 命令和一些小技巧,可以通过页面内查找的方式 Ctrl/Command+f 进行快速查找。\r\n\r\n开卷必读\r\n如果之前未使用过 Git,可以学习 Git 小白教程入门\r\n\r\n一定要先测试命令的效果后,再用于工作环境中,以防造成不能弥补的后果!到时候别拿着砍刀来找我\r\n所有的命令都在 git version 2.7.4 (Apple Git-66) 下测试通过\r\n统一概念:\r\n工作区:改动(增删文件和内容)\r\n暂存区:输入命令:git add 改动的文件名,此次改动就放到了 ‘暂存区’\r\n本地仓库(简称:本地):输入命令:git commit 此次修改的描述,此次改动就放到了本地仓库,每个 commit,我叫它为一个版本。\r\n远程仓库(简称:远程):输入命令:git push 远程仓库,此次改动就放到了远程仓库(GitHub 等)\r\ncommit-id:输出命令:git log,最上面那行 commit xxxxxx,后面的字符串就是 commit-id\r\n如果喜欢这个项目,欢迎 Star、提交 Pr、反馈问题😊\r\n下面,就是你在找的 Git 命令速查表。\r\n\r\n展示帮助信息', '2023-7-4', 1, 18, 'Git 的奇技淫巧🙈', 'https://pic.imgdb.cn/item/6495df131ddac507cc80689f.png'); INSERT INTO `article` VALUES (6, 5, 'Git 是一个分布式版本管理工具,版本管理工具就是大家在写东西的时候都用过 回撤这个功能,但是回撤只能回撤几步,假如想要找回我三天之前的修改,光用回撤是找不回来的。而版本管理工具能记录每次的修改,只要提交到版本仓库,就可以找到之前任何时刻的状态(文本状态)。\r\n\r\n下面的内容就是列举了常用的 Git 命令和一些小技巧,可以通过页面内查找的方式 Ctrl/Command+f 进行快速查找。\r\n\r\n开卷必读\r\n如果之前未使用过 Git,可以学习 Git 小白教程入门\r\n\r\n一定要先测试命令的效果后,再用于工作环境中,以防造成不能弥补的后果!到时候别拿着砍刀来找我\r\n所有的命令都在 git version 2.7.4 (Apple Git-66) 下测试通过\r\n统一概念:\r\n工作区:改动(增删文件和内容)\r\n暂存区:输入命令:git add 改动的文件名,此次改动就放到了 ‘暂存区’\r\n本地仓库(简称:本地):输入命令:git commit 此次修改的描述,此次改动就放到了本地仓库,每个 commit,我叫它为一个版本。\r\n远程仓库(简称:远程):输入命令:git push 远程仓库,此次改动就放到了远程仓库(GitHub 等)\r\ncommit-id:输出命令:git log,最上面那行 commit xxxxxx,后面的字符串就是 commit-id\r\n如果喜欢这个项目,欢迎 Star、提交 Pr、反馈问题😊\r\n下面,就是你在找的 Git 命令速查表。\r\n\r\n展示帮助信息', '2023-7-6', 1, 464, 'Git 的奇技淫巧🙈', 'https://pic.imgdb.cn/item/6450e1b10d2dde5777f2fdbc.jpg'); @@ -146,6 +146,7 @@ DROP TABLE IF EXISTS `githubinfo`; CREATE TABLE `githubinfo` ( `id` int NOT NULL AUTO_INCREMENT COMMENT 'ID', `projectId` int NULL DEFAULT NULL COMMENT '项目Id', + `avatar` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '项目头像', `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '项目名称', `starImgUrl` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '星数曲线图url', `starCount` int NULL DEFAULT NULL COMMENT '星数', @@ -197,11 +198,11 @@ CREATE TABLE `project` ( -- ---------------------------- -- 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, 1054); -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, 188); -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, 426); -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, 4491); -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, 612); +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); @@ -280,7 +281,7 @@ CREATE TABLE `user` ( -- ---------------------------- -- 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\\f4e98a7b-39f8-4605-9a94-3abb818d2cd3_3.jpg', 5); +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); diff --git a/src/com/hellogithub/servlet/githubinfo/ins_Github_infoServlet.java b/src/com/hellogithub/servlet/githubinfo/ins_Github_infoServlet.java index 7e838b6..f680bbc 100644 --- a/src/com/hellogithub/servlet/githubinfo/ins_Github_infoServlet.java +++ b/src/com/hellogithub/servlet/githubinfo/ins_Github_infoServlet.java @@ -2,10 +2,10 @@ package com.hellogithub.servlet.githubinfo; import com.alibaba.fastjson.JSONObject; import com.hellogithub.service.githubService; -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; diff --git a/src/com/hellogithub/servlet/githubinfo/ret_Github_infoServlet.java b/src/com/hellogithub/servlet/githubinfo/ret_Github_infoServlet.java index ff342e5..69e1e17 100644 --- a/src/com/hellogithub/servlet/githubinfo/ret_Github_infoServlet.java +++ b/src/com/hellogithub/servlet/githubinfo/ret_Github_infoServlet.java @@ -2,10 +2,10 @@ package com.hellogithub.servlet.githubinfo; import com.alibaba.fastjson.JSONObject; import com.hellogithub.service.githubService; -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; From 87e528dd171385efda196d273e7c0fd29a344d81 Mon Sep 17 00:00:00 2001 From: sjm <2431685932@qq.com> Date: Sat, 8 Jul 2023 14:38:46 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E6=9B=B4=E6=96=B0avatar=E5=AD=97=E6=AE=B5g?= =?UTF-8?q?ithubinfo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/hellogithub/dao/githubDao.java | 29 ++++++++++--------- src/com/hellogithub/entity/githubEntity.java | 14 ++++++++- .../hellogithub/service/githubService.java | 4 +-- .../githubinfo/ins_Github_infoServlet.java | 3 +- 4 files changed, 32 insertions(+), 18 deletions(-) diff --git a/src/com/hellogithub/dao/githubDao.java b/src/com/hellogithub/dao/githubDao.java index a064615..8d0e399 100644 --- a/src/com/hellogithub/dao/githubDao.java +++ b/src/com/hellogithub/dao/githubDao.java @@ -16,29 +16,30 @@ import java.util.List; public class githubDao { githubEntity githubentity = new githubEntity(); - public int ins_Github_info (int projectId, String name, String starImgUrl, int starCount, String mainLanguage, String isActive, int subscriber, int issues, String isOrganization, String defaultBranch, int forks, String protocol, String version){ + public int ins_Github_info (int projectId, String avatar,String name, String starImgUrl, int starCount, String mainLanguage, String isActive, int subscriber, int issues, String isOrganization, String defaultBranch, int forks, String protocol, String version){ PreparedStatement preparedStatement = null; Connection connection = null; int rs = 0 ; try { connection = JdbcUtils.getConnection(); - String Sql = "INSERT INTO githubinfo(id,projectId,name,starImgUrl,starCount,mainLanguage,isActive,subscriber,issues,isOrganization,defaultBranch,forks,protocol,version,isVaild) VALUES(null,?,?,?,?,?,?,?,?,?,?,?,?,?,0);"; + 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); preparedStatement.setInt(1, projectId); - preparedStatement.setString(2, name); - preparedStatement.setString(3, starImgUrl); - preparedStatement.setInt(4, starCount); - preparedStatement.setString(5, mainLanguage); + preparedStatement.setString(2, avatar); + preparedStatement.setString(3, name); + preparedStatement.setString(4, starImgUrl); + preparedStatement.setInt(5, starCount); + preparedStatement.setString(6, mainLanguage); - preparedStatement.setString(6, isActive); - preparedStatement.setInt(7, subscriber); - preparedStatement.setInt(8, issues); - preparedStatement.setString(9, isOrganization); - preparedStatement.setString(10, defaultBranch); + preparedStatement.setString(7, isActive); + preparedStatement.setInt(8, subscriber); + preparedStatement.setInt(9, issues); + preparedStatement.setString(10, isOrganization); + preparedStatement.setString(11, defaultBranch); - preparedStatement.setInt(11, forks); - preparedStatement.setString(12, protocol); - preparedStatement.setString(13, version); + preparedStatement.setInt(12, forks); + preparedStatement.setString(13, protocol); + preparedStatement.setString(14, version); rs = preparedStatement.executeUpdate(); return rs; } catch (Exception e) { diff --git a/src/com/hellogithub/entity/githubEntity.java b/src/com/hellogithub/entity/githubEntity.java index 3868345..fbc90da 100644 --- a/src/com/hellogithub/entity/githubEntity.java +++ b/src/com/hellogithub/entity/githubEntity.java @@ -9,6 +9,17 @@ public class githubEntity { private int starCount; private String mainLanguage; private String isActive; + + public String getAvatar() { + return avatar; + } + + public void setAvatar(String avatar) { + this.avatar = avatar; + } + + private String avatar; + private int subscriber; private int issues; private String isOrganization; @@ -138,7 +149,7 @@ public class githubEntity { this.isVaild = isVaild; } - public githubEntity(int id, int projectId, String name, String starImgUrl, int starCount, String mainLanguage, String isActive, int subscriber, int issues, String isOrganization, String defaultBranch, int forks, String protocol, String version, int isVaild) { + public githubEntity(int id, int projectId, String name, String starImgUrl, int starCount, String avatar,String mainLanguage, String isActive, int subscriber, int issues, String isOrganization, String defaultBranch, int forks, String protocol, String version, int isVaild) { this.id = id; this.projectId = projectId; @@ -155,6 +166,7 @@ public class githubEntity { this.protocol = protocol; this.version = version; this.isVaild = isVaild; + this.avatar = avatar; } public githubEntity(){} diff --git a/src/com/hellogithub/service/githubService.java b/src/com/hellogithub/service/githubService.java index caed02b..5d61b31 100644 --- a/src/com/hellogithub/service/githubService.java +++ b/src/com/hellogithub/service/githubService.java @@ -11,8 +11,8 @@ import java.util.Map; public class githubService { private githubDao githubDao = new githubDao(); - public int ins_Github_info(int projectId, String name, String starImgUrl, int starCount, String mainLanguage, String isActive, int subscriber, int issues, String isOrganization, String defaultBranch, int forks, String protocol, String version){ - return githubDao.ins_Github_info(projectId, name,starImgUrl,starCount, mainLanguage,isActive, subscriber, issues, isOrganization,defaultBranch, forks, protocol, version); + public int ins_Github_info(int projectId, String avatar,String name, String starImgUrl, int starCount, String mainLanguage, String isActive, int subscriber, int issues, String isOrganization, String defaultBranch, int forks, String protocol, String version){ + return githubDao.ins_Github_info(projectId,avatar, name,starImgUrl,starCount, mainLanguage,isActive, subscriber, issues, isOrganization,defaultBranch, forks, protocol, version); } public String ret_Github_info(int projectId){ diff --git a/src/com/hellogithub/servlet/githubinfo/ins_Github_infoServlet.java b/src/com/hellogithub/servlet/githubinfo/ins_Github_infoServlet.java index f680bbc..5da14e7 100644 --- a/src/com/hellogithub/servlet/githubinfo/ins_Github_infoServlet.java +++ b/src/com/hellogithub/servlet/githubinfo/ins_Github_infoServlet.java @@ -36,6 +36,7 @@ public class ins_Github_infoServlet extends HttpServlet { PrintWriter writer = resp.getWriter(); int projectid = Integer.parseInt(req.getParameter("projectId ")); + String avatar = req.getParameter("avatar"); String name = req.getParameter("name "); String starImgUrl = req.getParameter("starImgUrl "); int starCount = Integer.parseInt(req.getParameter("starCount ")); @@ -50,7 +51,7 @@ public class ins_Github_infoServlet extends HttpServlet { String protocol = req.getParameter("protocol "); String version = req.getParameter("version "); - int rs = githubservice.ins_Github_info(projectid,name,starImgUrl,starCount, mainLanguage, isActive, subscriber, issues,isOrganization,defaultBranch,forks,protocol,version); + int rs = githubservice.ins_Github_info(projectid,avatar,name,starImgUrl,starCount, mainLanguage, isActive, subscriber, issues,isOrganization,defaultBranch,forks,protocol,version); if(rs == 1){ setResultOK("插入成功", writer); }else{ From a77460d28e0becfa482dd5547e4443ab895e3027 Mon Sep 17 00:00:00 2001 From: sjm <2431685932@qq.com> Date: Sat, 8 Jul 2023 15:07:15 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E8=A7=A3=E5=86=B3cannot=20parse=20null=20s?= =?UTF-8?q?tring=20=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../githubinfo/ins_Github_infoServlet.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/com/hellogithub/servlet/githubinfo/ins_Github_infoServlet.java b/src/com/hellogithub/servlet/githubinfo/ins_Github_infoServlet.java index 5da14e7..c18c418 100644 --- a/src/com/hellogithub/servlet/githubinfo/ins_Github_infoServlet.java +++ b/src/com/hellogithub/servlet/githubinfo/ins_Github_infoServlet.java @@ -35,21 +35,21 @@ public class ins_Github_infoServlet extends HttpServlet { resp.setContentType("application/json;charset=UTF-8"); PrintWriter writer = resp.getWriter(); - int projectid = Integer.parseInt(req.getParameter("projectId ")); + int projectid = Integer.parseInt(req.getParameter("projectId")); String avatar = req.getParameter("avatar"); - String name = req.getParameter("name "); - String starImgUrl = req.getParameter("starImgUrl "); - int starCount = Integer.parseInt(req.getParameter("starCount ")); - String mainLanguage = req.getParameter("mainLanguage "); - String isActive = req.getParameter("isActive "); + String name = req.getParameter("name"); + String starImgUrl = req.getParameter("starImgUrl"); + int starCount = Integer.parseInt(req.getParameter("starCount")); + String mainLanguage = req.getParameter("mainLanguage"); + String isActive = req.getParameter("isActive"); - int subscriber = Integer.parseInt(req.getParameter("subscriber ")); - int issues = Integer.parseInt(req.getParameter("issues ")); - String isOrganization = req.getParameter("isOrganization "); - String defaultBranch = req.getParameter("defaultBranch "); - int forks = Integer.parseInt(req.getParameter("forks ")); - String protocol = req.getParameter("protocol "); - String version = req.getParameter("version "); + int subscriber = Integer.parseInt(req.getParameter("subscriber")); + int issues = Integer.parseInt(req.getParameter("issues")); + String isOrganization = req.getParameter("isOrganization"); + String defaultBranch = req.getParameter("defaultBranch"); + int forks = Integer.parseInt(req.getParameter("forks")); + String protocol = req.getParameter("protocol"); + String version = req.getParameter("version"); int rs = githubservice.ins_Github_info(projectid,avatar,name,starImgUrl,starCount, mainLanguage, isActive, subscriber, issues,isOrganization,defaultBranch,forks,protocol,version); if(rs == 1){ From 6e8fb74eec9487bfe211eb05a566f2d7e935ef05 Mon Sep 17 00:00:00 2001 From: sjm <2431685932@qq.com> Date: Sat, 8 Jul 2023 15:14:51 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=8F=8D=E5=A4=8D?= =?UTF-8?q?=E6=8F=92=E5=85=A5info=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/hellogithub/dao/githubDao.java | 53 ++++++++++++++++---------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/src/com/hellogithub/dao/githubDao.java b/src/com/hellogithub/dao/githubDao.java index 8d0e399..d675684 100644 --- a/src/com/hellogithub/dao/githubDao.java +++ b/src/com/hellogithub/dao/githubDao.java @@ -4,6 +4,7 @@ import com.hellogithub.entity.githubEntity; import com.hellogithub.entity.projectEntity; 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.BeanListHandler; @@ -19,36 +20,46 @@ public class githubDao { public int ins_Github_info (int projectId, String avatar,String name, String starImgUrl, int starCount, String mainLanguage, String isActive, int subscriber, int issues, String isOrganization, String defaultBranch, int forks, String protocol, String version){ PreparedStatement preparedStatement = null; Connection connection = null; - int rs = 0 ; + ResultSet rs = null; + String sql1 = "SELECT * FROM githubinfo WHERE projectId = ?;"; + int back = 0 ; try { - 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); - preparedStatement.setInt(1, projectId); - preparedStatement.setString(2, avatar); - preparedStatement.setString(3, name); - preparedStatement.setString(4, starImgUrl); - preparedStatement.setInt(5, starCount); - preparedStatement.setString(6, mainLanguage); + Connection conn = JdbcUtils.getConnection(); + PreparedStatement prep = conn.prepareStatement(sql1); + prep.setInt(1,projectId); + rs = prep.executeQuery(); + if(rs == null){ + 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); + preparedStatement.setInt(1, projectId); + preparedStatement.setString(2, avatar); + preparedStatement.setString(3, name); + preparedStatement.setString(4, starImgUrl); + preparedStatement.setInt(5, starCount); + preparedStatement.setString(6, mainLanguage); - preparedStatement.setString(7, isActive); - preparedStatement.setInt(8, subscriber); - preparedStatement.setInt(9, issues); - preparedStatement.setString(10, isOrganization); - preparedStatement.setString(11, defaultBranch); + preparedStatement.setString(7, isActive); + preparedStatement.setInt(8, subscriber); + preparedStatement.setInt(9, issues); + preparedStatement.setString(10, isOrganization); + preparedStatement.setString(11, defaultBranch); - preparedStatement.setInt(12, forks); - preparedStatement.setString(13, protocol); - preparedStatement.setString(14, version); - rs = preparedStatement.executeUpdate(); - return rs; + preparedStatement.setInt(12, forks); + preparedStatement.setString(13, protocol); + preparedStatement.setString(14, version); + back = preparedStatement.executeUpdate(); + }else{ + return back; + } + return back; } catch (Exception e) { e.printStackTrace(); } finally { JdbcUtils.closeConnection(preparedStatement, connection); } - return rs; + return back; } public List ret_Github_info(int projectid){ From a3216f3e2130e109b71c695cc02997f1de1d70f7 Mon Sep 17 00:00:00 2001 From: sjm <2431685932@qq.com> Date: Sat, 8 Jul 2023 15:16:21 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=8F=8D=E5=A4=8D?= =?UTF-8?q?=E6=8F=92=E5=85=A5info=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/hellogithub/dao/githubDao.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/hellogithub/dao/githubDao.java b/src/com/hellogithub/dao/githubDao.java index d675684..322e3c8 100644 --- a/src/com/hellogithub/dao/githubDao.java +++ b/src/com/hellogithub/dao/githubDao.java @@ -52,10 +52,10 @@ public class githubDao { }else{ return back; } + JdbcUtils.closeConnection(rs,prep,conn); return back; } catch (Exception e) { e.printStackTrace(); - } finally { JdbcUtils.closeConnection(preparedStatement, connection); }