From 1321daa2a521a7ad75ebd7b36b79f7e3261d7dab Mon Sep 17 00:00:00 2001 From: Qing Date: Sat, 8 Jul 2023 18:09:18 +0800 Subject: [PATCH 01/13] =?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 | 16 +++++++++------- .../servlet/commitProjectServlet.java | 2 +- .../githubinfo/ret_Github_infoServlet.java | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/sql/hellogithub.sql b/sql/hellogithub.sql index cc5a9a9..01d87f7 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 14:24:38 + Date: 08/07/2023 18:08:24 */ 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; @@ -135,7 +136,7 @@ INSERT INTO `comment` VALUES (36, 1, 7, '还不错哦', 1, '2023-07-06 21:17:24' 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 (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 (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); @@ -163,11 +164,12 @@ 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 = 4 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); -- ---------------------------- -- Table structure for project @@ -198,12 +200,12 @@ 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, 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 (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', 8, 1, '1111', 1, 1065); +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, 197); 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 (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, 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, '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 (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, 697); 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); diff --git a/src/com/hellogithub/servlet/commitProjectServlet.java b/src/com/hellogithub/servlet/commitProjectServlet.java index 6399ef5..bb511a3 100644 --- a/src/com/hellogithub/servlet/commitProjectServlet.java +++ b/src/com/hellogithub/servlet/commitProjectServlet.java @@ -52,7 +52,7 @@ 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.getParameterValues("categoryIdList"); List integers = new ArrayList<>(); for (String s : categoryIdList) { integers.add(Integer.parseInt(s)); diff --git a/src/com/hellogithub/servlet/githubinfo/ret_Github_infoServlet.java b/src/com/hellogithub/servlet/githubinfo/ret_Github_infoServlet.java index 69e1e17..212bc71 100644 --- a/src/com/hellogithub/servlet/githubinfo/ret_Github_infoServlet.java +++ b/src/com/hellogithub/servlet/githubinfo/ret_Github_infoServlet.java @@ -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 From 00c1a2efb97bc0565262478e4e3ebf910c962d6b Mon Sep 17 00:00:00 2001 From: Qing Date: Sat, 8 Jul 2023 19:39:28 +0800 Subject: [PATCH 02/13] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hellogithub/servlet/retUserAvServlet.java | 19 +------------------ .../servlet/selectProjectByPname.java | 8 ++++---- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/src/com/hellogithub/servlet/retUserAvServlet.java b/src/com/hellogithub/servlet/retUserAvServlet.java index 54f0aa4..96a56cc 100644 --- a/src/com/hellogithub/servlet/retUserAvServlet.java +++ b/src/com/hellogithub/servlet/retUserAvServlet.java @@ -37,11 +37,8 @@ public class retUserAvServlet extends HttpServlet { if(userEntity != null) { String uri = userEntity.getUserAvatar(); - if(!uri.startsWith("https")) - { FileInputStream fis = new FileInputStream (uri); String type = userEntity.getUserAvatar().substring(userEntity.getUserAvatar().lastIndexOf(".")+1); - int size = fis.available(); if(size != 0) { @@ -54,21 +51,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(); + } diff --git a/src/com/hellogithub/servlet/selectProjectByPname.java b/src/com/hellogithub/servlet/selectProjectByPname.java index cae260c..6719d08 100644 --- a/src/com/hellogithub/servlet/selectProjectByPname.java +++ b/src/com/hellogithub/servlet/selectProjectByPname.java @@ -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; From 0bae9fe90483ec60baf774aa5163f1eed6eb3765 Mon Sep 17 00:00:00 2001 From: Qing Date: Sat, 8 Jul 2023 19:42:49 +0800 Subject: [PATCH 03/13] =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/hellogithub/dao/UserDao.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/hellogithub/dao/UserDao.java b/src/com/hellogithub/dao/UserDao.java index 26163f3..96a9a11 100644 --- a/src/com/hellogithub/dao/UserDao.java +++ b/src/com/hellogithub/dao/UserDao.java @@ -63,7 +63,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); From 24d3fe72b809e6e3c35e178a9135741b544ff6c2 Mon Sep 17 00:00:00 2001 From: Qing Date: Sat, 8 Jul 2023 19:43:26 +0800 Subject: [PATCH 04/13] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=A4=B4=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...56c15-20d5-43a4-916b-1d6230a33b8e_default.png | Bin 0 -> 4097 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 web/uploadFile/69e56c15-20d5-43a4-916b-1d6230a33b8e_default.png diff --git a/web/uploadFile/69e56c15-20d5-43a4-916b-1d6230a33b8e_default.png b/web/uploadFile/69e56c15-20d5-43a4-916b-1d6230a33b8e_default.png new file mode 100644 index 0000000000000000000000000000000000000000..e16488e4534d25626ac002e04ce9c64cd834ade2 GIT binary patch literal 4097 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 Date: Sat, 8 Jul 2023 20:27:23 +0800 Subject: [PATCH 05/13] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/hellogithub/dao/UserDao.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/hellogithub/dao/UserDao.java b/src/com/hellogithub/dao/UserDao.java index 96a9a11..ff24310 100644 --- a/src/com/hellogithub/dao/UserDao.java +++ b/src/com/hellogithub/dao/UserDao.java @@ -63,7 +63,7 @@ public class UserDao { connection = JdbcUtils.getConnection(); // sql语句写的操作 ----加上事务 JdbcUtils.beginTransaction(connection); // 开启事务 - 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');"; + 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); From 2f1b8d646dddaa6f803ce74e30556fad93324cff Mon Sep 17 00:00:00 2001 From: Qing Date: Sat, 8 Jul 2023 23:29:16 +0800 Subject: [PATCH 06/13] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/hellogithub/dao/githubDao.java | 2 +- .../hellogithub/dao/projectCategoryDao.java | 2 +- src/com/hellogithub/dao/projectDao.java | 4 +-- .../hellogithub/service/projectService.java | 21 ++++++------ .../hellogithub/servlet/DownLoadServlet.java | 32 +++++++++++-------- .../servlet/commitProjectServlet.java | 15 +++++++-- .../servlet/selectProjectByPname.java | 2 +- 7 files changed, 47 insertions(+), 31 deletions(-) diff --git a/src/com/hellogithub/dao/githubDao.java b/src/com/hellogithub/dao/githubDao.java index 322e3c8..f19b853 100644 --- a/src/com/hellogithub/dao/githubDao.java +++ b/src/com/hellogithub/dao/githubDao.java @@ -28,7 +28,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); diff --git a/src/com/hellogithub/dao/projectCategoryDao.java b/src/com/hellogithub/dao/projectCategoryDao.java index 652f135..5057312 100644 --- a/src/com/hellogithub/dao/projectCategoryDao.java +++ b/src/com/hellogithub/dao/projectCategoryDao.java @@ -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) { diff --git a/src/com/hellogithub/dao/projectDao.java b/src/com/hellogithub/dao/projectDao.java index 1dcd77b..4be9f6d 100644 --- a/src/com/hellogithub/dao/projectDao.java +++ b/src/com/hellogithub/dao/projectDao.java @@ -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; diff --git a/src/com/hellogithub/service/projectService.java b/src/com/hellogithub/service/projectService.java index aa74756..5b90e17 100644 --- a/src/com/hellogithub/service/projectService.java +++ b/src/com/hellogithub/service/projectService.java @@ -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;i0){ + while ((len = in.read(buffer)) > 0) { //输出缓冲区的内容到浏览器,实现文件下载 out.write(buffer, 0, len); } @@ -72,21 +76,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(); } diff --git a/src/com/hellogithub/servlet/commitProjectServlet.java b/src/com/hellogithub/servlet/commitProjectServlet.java index bb511a3..76940f3 100644 --- a/src/com/hellogithub/servlet/commitProjectServlet.java +++ b/src/com/hellogithub/servlet/commitProjectServlet.java @@ -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,19 @@ public class commitProjectServlet extends HttpServlet { String projectUrl = req.getParameter("projectUrl"); String projectTitle = req.getParameter("projectTitle"); String projectDescription = req.getParameter("projectDescription"); - String [] categoryIdList = req.getParameterValues("categoryIdList"); + String categoryIdList = req.getParameter("categoryIdList"); + String []categoryIdList1 = categoryIdList.split(","); + List categoryIdList2 = Arrays.asList(categoryIdList1); + + System.out.println(username); + System.out.println(projectName); + System.out.println(projectIco); + System.out.println(projectUrl); + System.out.println(projectTitle); + System.out.println(projectDescription); + System.out.println(categoryIdList); List 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); diff --git a/src/com/hellogithub/servlet/selectProjectByPname.java b/src/com/hellogithub/servlet/selectProjectByPname.java index 6719d08..629df6e 100644 --- a/src/com/hellogithub/servlet/selectProjectByPname.java +++ b/src/com/hellogithub/servlet/selectProjectByPname.java @@ -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); } From 58bf7e8533fb2c7d75a0f46a8e0be5b45f430a7d Mon Sep 17 00:00:00 2001 From: Qing Date: Sat, 8 Jul 2023 23:56:17 +0800 Subject: [PATCH 07/13] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/hellogithub.sql | 67 ++++++++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 28 deletions(-) diff --git a/sql/hellogithub.sql b/sql/hellogithub.sql index 01d87f7..7364462 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 18:08:24 + Date: 08/07/2023 23:55:47 */ SET NAMES utf8mb4; @@ -50,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 @@ -64,8 +64,7 @@ INSERT INTO `article` VALUES (6, 5, 'Git 是一个分布式版本管理工具, INSERT INTO `article` VALUES (19, 1, '

https://pic.imgdb.cn/item/640f1b9df144a01007db08a4.jpg

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);

测试文章


都是固定工会打发发的观点和方法啊哈哈的方法的风格啊哈哈动画噶反对法地方和

  1. gDG

  2. 和施工方

  • 1111

  • 2222

爱德华给

', '2023-07-06', 1, 2, '测试文章', 'https://pic.imgdb.cn/item/640f1b9df144a01007db08a4.jpg'); INSERT INTO `article` VALUES (23, 6, '

https://pic.imgdb.cn/item/646b2803e03e90d874c45f3f.gif

\"\"

', '2023-07-07', 1, 1, '文章功能测试', 'https://pic.imgdb.cn/item/646b2803e03e90d874c45f3f.gif'); INSERT INTO `article` VALUES (24, 6, '

\"\"https://pic.imgdb.cn/item/646b24b0e03e90d874bf7075.png

https://pic.imgdb.cn/item/646b24b0e03e90d874bf7075.png

', '2023-07-07', 1, 1, '发布贡献值增加测试', 'https://pic.imgdb.cn/item/646b24b0e03e90d874bf7075.png'); -INSERT INTO `article` VALUES (25, 6, '

111111111111111

', '2023-07-07', 1, 0, '111111111', '11111111111'); -INSERT INTO `article` VALUES (26, 1, '

https://pic.imgdb.cn/item/648493281ddac507cc60db7c.jpg\"\"

', '2023-07-08', 1, 0, '777777777777777', 'https://pic.imgdb.cn/item/648493281ddac507cc60db7c.jpg'); +INSERT INTO `article` VALUES (27, 11, '

https://pic.imgdb.cn/item/6484889d1ddac507cc4fa95f.jpg\"\"

行不行啊

https://pic.imgdb.cn/item/6484889d1ddac507cc4fa95f.jpg

测试测试车hi是车hi此时的0i是德国【iahs【 阿达【uvba【9SUV吧【90氺【0 返回【0ihd【i噶地方【爱的时候v【阿斯顿

', '2023-07-08', 1, 1, '用户000', 'https://pic.imgdb.cn/item/6484889d1ddac507cc4fa95f.jpg'); -- ---------------------------- -- Table structure for category @@ -121,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 @@ -129,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 (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 @@ -164,12 +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 AUTO_INCREMENT = 4 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 @@ -195,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', 8, 1, '1111', 1, 1065); -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, 197); -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, 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, '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, 697); -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', '

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.

', 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 @@ -222,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 @@ -236,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 @@ -251,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 @@ -278,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; From 82344c3b8517c539e7f40fe5f4d4d371e72fc04d Mon Sep 17 00:00:00 2001 From: Qing Date: Sun, 9 Jul 2023 00:37:28 +0800 Subject: [PATCH 08/13] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E6=96=87=E4=BB=B6=E5=9C=B0=E5=9D=80=E5=AD=98=E5=82=A8?= =?UTF-8?q?=E7=9B=B8=E5=AF=B9=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/hellogithub/servlet/DownLoadServlet.java | 5 +---- src/com/hellogithub/servlet/UploadHandleServlet.java | 6 +++++- .../hellogithub/servlet/commitProjectFileServlet.java | 5 +++-- src/com/hellogithub/servlet/commitProjectServlet.java | 7 ------- src/com/hellogithub/servlet/retUserAvServlet.java | 11 ++++++----- 5 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/com/hellogithub/servlet/DownLoadServlet.java b/src/com/hellogithub/servlet/DownLoadServlet.java index 97f0134..b10c31a 100644 --- a/src/com/hellogithub/servlet/DownLoadServlet.java +++ b/src/com/hellogithub/servlet/DownLoadServlet.java @@ -26,7 +26,6 @@ public class DownLoadServlet extends HttpServlet { String address = projectService.selectProById(projectId).getFileAddress(); String[] liss = address.split("\\\\"); String fileName = liss[liss.length - 1]; - System.out.println(fileName); //本地需要进行转码,linux服务器使用就会出现下载乱码 //fileName = new String(fileName.getBytes("iso8859-1"),"UTF-8"); // System.out.print("转码后"+fileName); @@ -38,8 +37,6 @@ public class DownLoadServlet extends HttpServlet { //得到要下载的文件 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"); @@ -51,7 +48,7 @@ public class DownLoadServlet extends HttpServlet { } //处理文件名 String realname = fileName.substring(fileName.indexOf("_") + 1); - System.out.println(realname); +// System.out.println(realname); //设置响应头,控制浏览器下载该文件 response.setHeader("content-disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8")); //读取要下载的文件,保存到文件输入流 diff --git a/src/com/hellogithub/servlet/UploadHandleServlet.java b/src/com/hellogithub/servlet/UploadHandleServlet.java index d4895d8..026a6f7 100644 --- a/src/com/hellogithub/servlet/UploadHandleServlet.java +++ b/src/com/hellogithub/servlet/UploadHandleServlet.java @@ -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"); } diff --git a/src/com/hellogithub/servlet/commitProjectFileServlet.java b/src/com/hellogithub/servlet/commitProjectFileServlet.java index 7671e27..22ac965 100644 --- a/src/com/hellogithub/servlet/commitProjectFileServlet.java +++ b/src/com/hellogithub/servlet/commitProjectFileServlet.java @@ -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); } } diff --git a/src/com/hellogithub/servlet/commitProjectServlet.java b/src/com/hellogithub/servlet/commitProjectServlet.java index 76940f3..7969e66 100644 --- a/src/com/hellogithub/servlet/commitProjectServlet.java +++ b/src/com/hellogithub/servlet/commitProjectServlet.java @@ -57,13 +57,6 @@ public class commitProjectServlet extends HttpServlet { String []categoryIdList1 = categoryIdList.split(","); List categoryIdList2 = Arrays.asList(categoryIdList1); - System.out.println(username); - System.out.println(projectName); - System.out.println(projectIco); - System.out.println(projectUrl); - System.out.println(projectTitle); - System.out.println(projectDescription); - System.out.println(categoryIdList); List integers = new ArrayList<>(); for (String s : categoryIdList2) { integers.add(Integer.parseInt(s)); diff --git a/src/com/hellogithub/servlet/retUserAvServlet.java b/src/com/hellogithub/servlet/retUserAvServlet.java index 96a56cc..040217d 100644 --- a/src/com/hellogithub/servlet/retUserAvServlet.java +++ b/src/com/hellogithub/servlet/retUserAvServlet.java @@ -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,8 +32,13 @@ 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(); - 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) From c49f4c748bf458486994e1c6f84e14abca70b537 Mon Sep 17 00:00:00 2001 From: sjm <2431685932@qq.com> Date: Sun, 9 Jul 2023 10:37:13 +0800 Subject: [PATCH 09/13] =?UTF-8?q?=E5=8F=91=E5=B8=83=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=97=B6=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/hellogithub/dao/githubDao.java | 20 +++++++++++-------- .../hellogithub/service/githubService.java | 10 +++------- .../githubinfo/ret_Github_infoServlet.java | 3 +-- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/com/hellogithub/dao/githubDao.java b/src/com/hellogithub/dao/githubDao.java index f19b853..5ac7215 100644 --- a/src/com/hellogithub/dao/githubDao.java +++ b/src/com/hellogithub/dao/githubDao.java @@ -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 { @@ -62,18 +60,24 @@ public class githubDao { return back; } - public List ret_Github_info(int projectid){ + public ResultSetMetaData ret_Github_info(int projectid) { List githubEntityList; + ResultSetMetaData rsmd = null; try { Connection conn = JdbcUtils.getConnection(); - QueryRunner runner = new QueryRunner(); + PreparedStatement prep = null; + ResultSet rs = null; String sql = "select * from githubinfo where projectId = ? and isValid = 1"; - githubEntityList = runner.query(conn, sql, new BeanListHandler<>(githubEntity.class), projectid); + prep = conn.prepareStatement(sql); + prep.setInt(1, projectid); + while (rs.next()) { + rsmd = rs.getMetaData(); + } conn.close(); } catch (SQLException e) { throw new RuntimeException(e); } - return githubEntityList; + return rsmd; } } diff --git a/src/com/hellogithub/service/githubService.java b/src/com/hellogithub/service/githubService.java index 5d61b31..8469496 100644 --- a/src/com/hellogithub/service/githubService.java +++ b/src/com/hellogithub/service/githubService.java @@ -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 githubEntityList = githubDao.ret_Github_info(projectId); - Map dataMap = new HashMap<>(); - for(int i=1;i Date: Sun, 9 Jul 2023 10:37:38 +0800 Subject: [PATCH 10/13] =?UTF-8?q?=E5=8F=91=E5=B8=83=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=97=B6=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hellogithub/servlet/githubinfo/ret_Github_infoServlet.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/hellogithub/servlet/githubinfo/ret_Github_infoServlet.java b/src/com/hellogithub/servlet/githubinfo/ret_Github_infoServlet.java index 6339c9d..01a333d 100644 --- a/src/com/hellogithub/servlet/githubinfo/ret_Github_infoServlet.java +++ b/src/com/hellogithub/servlet/githubinfo/ret_Github_infoServlet.java @@ -35,7 +35,7 @@ public class ret_Github_infoServlet extends HttpServlet { PrintWriter writer = resp.getWriter(); String projectid = req.getParameter("projectId"); - writer.println(githubservice.ret_Github_info(Integer.parseInt(projectid));); + writer.println(githubservice.ret_Github_info(Integer.parseInt(projectid))); writer.close(); } } From 2658676a5a5b63eb72d4fc2f5014cf9296769440 Mon Sep 17 00:00:00 2001 From: sjm <2431685932@qq.com> Date: Sun, 9 Jul 2023 10:43:26 +0800 Subject: [PATCH 11/13] =?UTF-8?q?=E5=8F=91=E5=B8=83=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=97=B6=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/hellogithub/dao/githubDao.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/com/hellogithub/dao/githubDao.java b/src/com/hellogithub/dao/githubDao.java index 5ac7215..da3500a 100644 --- a/src/com/hellogithub/dao/githubDao.java +++ b/src/com/hellogithub/dao/githubDao.java @@ -70,6 +70,7 @@ public class githubDao { String sql = "select * from githubinfo where projectId = ? and isValid = 1"; prep = conn.prepareStatement(sql); prep.setInt(1, projectid); + rs = prep.executeQuery(sql); while (rs.next()) { rsmd = rs.getMetaData(); } From 9b10789c0b82fde6dcc8e9b820e1a85a6cb45f78 Mon Sep 17 00:00:00 2001 From: sjm <2431685932@qq.com> Date: Sun, 9 Jul 2023 10:46:35 +0800 Subject: [PATCH 12/13] =?UTF-8?q?=E5=8F=91=E5=B8=83=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=97=B6=E6=9F=A5=E8=AF=A2?= 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 da3500a..9850cfe 100644 --- a/src/com/hellogithub/dao/githubDao.java +++ b/src/com/hellogithub/dao/githubDao.java @@ -67,7 +67,7 @@ public class githubDao { Connection conn = JdbcUtils.getConnection(); PreparedStatement prep = null; ResultSet rs = null; - String sql = "select * from githubinfo where projectId = ? and isValid = 1"; + String sql = "select * from githubinfo WHERE projectId = ? AND isVaild = 0;"; prep = conn.prepareStatement(sql); prep.setInt(1, projectid); rs = prep.executeQuery(sql); From ac64988809508eadf00b0f6af6655703a09860bf Mon Sep 17 00:00:00 2001 From: sjm <2431685932@qq.com> Date: Sun, 9 Jul 2023 10:50:48 +0800 Subject: [PATCH 13/13] =?UTF-8?q?=E5=8F=91=E5=B8=83=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=97=B6=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/hellogithub/dao/githubDao.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/com/hellogithub/dao/githubDao.java b/src/com/hellogithub/dao/githubDao.java index 9850cfe..0a94188 100644 --- a/src/com/hellogithub/dao/githubDao.java +++ b/src/com/hellogithub/dao/githubDao.java @@ -63,14 +63,13 @@ public class githubDao { public ResultSetMetaData ret_Github_info(int projectid) { List githubEntityList; ResultSetMetaData rsmd = null; + String sql = "select * from githubinfo WHERE projectId = ?;"; try { Connection conn = JdbcUtils.getConnection(); - PreparedStatement prep = null; + PreparedStatement prep = conn.prepareStatement(sql); ResultSet rs = null; - String sql = "select * from githubinfo WHERE projectId = ? AND isVaild = 0;"; - prep = conn.prepareStatement(sql); prep.setInt(1, projectid); - rs = prep.executeQuery(sql); + rs = prep.executeQuery(); while (rs.next()) { rsmd = rs.getMetaData(); }