package po;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import dao.user_thesis;
public class thesis_dao {
// 查找所有论文名称
public static ArrayList<String> findAllThnames() {
ArrayList<String> thnames = new ArrayList<>();
Connection connection = link_db.getcon();
String sql = "select thname from user_thesis ";
try {
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(sql);
if (resultSet != null) {
// 如果查询到用户的论文信息
while (resultSet.next()) {
thnames.add(resultSet.getString("thname"));
}
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
link_db.close_db(connection);
return thnames;
}
// 根据论文名称查出此篇论文信息
public static user_thesis findInfoByThname(String thname) {
user_thesis ut = new user_thesis();
Connection connection = link_db.getcon();
String sql = "select *from thesis,user_thesis where user_thesis.thno=thesis.thesisno and user_thesis.thname='"
+ thname + "'";
try {
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(sql);
if (resultSet != null) {
// 如果查询到用户的论文信息
while (resultSet.next()) {
ut.setThid(resultSet.getString("thid"));// 论文编号
ut.setThname(resultSet.getString("thname"));// 论文名称
ut.setThusername(resultSet.getString("thusername"));// 第一作者
ut.setThtime(resultSet.getString("thtime"));// 发表时间
ut.setThno(resultSet.getString("thno") + " " + resultSet.getString("thesisname"));// 论文等级
}
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
link_db.close_db(connection);
// System.out.println(ut.getThid() + ut.getThname());
return ut;
}
// 根据作者名字查出所有论文信息
public static ArrayList<user_thesis> findThesisInfoByUsername(String username) {
ArrayList<user_thesis> thesisArray = new ArrayList<>();
Connection connection = link_db.getcon();
String sql = "select *from thesis,user_thesis where user_thesis.thno=thesis.thesisno and user_thesis.thusername='"
+ username + "'";
try {
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(sql);
if (resultSet != null) {
// 如果查询到用户的论文信息
while (resultSet.next()) {
user_thesis ut = new user_thesis();
ut.setThid(resultSet.getString("thid"));// 论文编号
ut.setThname(resultSet.getString("thname"));// 论文名称
ut.setThusername(resultSet.getString("thusername"));// 第一作者
ut.setThtime(resultSet.getString("thtime"));// 发表时间
ut.setThno(resultSet.getString("thno") + " " + resultSet.getString("thesisname"));// 论文等级
thesisArray.add(ut);
}
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
link_db.close_db(connection);
return thesisArray;
}
// 通过输入任意的关键字来查询论文的信息
public static ArrayList<user_thesis> findAllInfoByInput(String input) {
ArrayList<user_thesis> thesisArray = new ArrayList<>();
Connection connection = link_db.getcon();
Statement statement;
// 三表查询,接入shenbaouser表格。所以获得的数据为三表联合查询的结果
try {
statement = connection.createStatement();
ResultSet resultSet = null;
if (input.length() == 0) {
/* String sql = resultSet = statement.executeQuery(sql); */
// 需要更改
String sql = "select distinct *from thesis,user_thesis where user_thesis.thno=thesis.thesisno ";
if ((resultSet = statement.executeQuery(sql)) != null) {
while (resultSet.next()) {
user_thesis ut = new user_thesis();
ut.setThid(resultSet.getString("thid"));
ut.setThusername(resultSet.getString("thusername"));
ut.setThname(resultSet.getString("thname"));
ut.setThtime(resultSet.getString("thtime"));
ut.setThno(resultSet.getString("thno") + " " + resultSet.getString("thesisname"));// 把等级幻化成等级名
thesisArray.add(ut);
}
}
} else {
String propertys[] = { "thid", "thname", "thusername", "thtime", "thno" };
for (String property : propertys) {
String sql = "select distinct *from thesis,user_thesis where thesis.thesisno=user_thesis.thno and user_thesis."
+ property + " like '%" + input + "%'";
if ((resultSet = statement.executeQuery(sql)) != null) {
while (resultSet.next()) {
user_thesis ut = new user_thesis();
ut.setThid(resultSet.getString("thid"));
ut.setThusername(resultSet.getString("thusername"));
ut.setThname(resultSet.getString("thname"));
ut.setThtime(resultSet.getString("thtime"));
ut.setThno(resultSet.getString("thno") + " " + resultSet.getString("thesisname"));// 把等级幻化成等级名
thesisArray.add(ut);
}
}
}
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
link_db.close_db(connection);
return thesisArray;
}
// 根据某个论文去更新该论文的信息
public boolean updateThesis(user_thesis uThesis) {
boolean flag = false;
Connection connection = link_db.getcon();
String sql = "update user_thesis set thname=?,thusername=?,thtime=?,thno=? where thid=?";
try {
PreparedStatement preparedStatement = connection.prepareStatement(sql);
preparedStatement.setString(1, uThesis.getThname());
preparedStatement.setString(2, uThesis.getThusername());
preparedStatement.setString(3, uThesis.getThtime());
String thno = "";
thno = uThesis.getThno().charAt(0) + "";
preparedStatement.setString(4, thno);
preparedStatement.setString(5, uThesis.getThid());
if (preparedStatement.executeUpdate() > 0) {
flag = true;
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
link_db.close_db(connection);
return flag;
}
// 发现所有论文的信息
public static ArrayList<user_thesis> findAllThesis() {
ArrayList<user_thesis> result = new ArrayList<>();
Connection connection = link_db.getcon();
String sql = "select *from user_thesis";
PreparedStatement preparedStatement;
try {
preparedStatement = connection.prepareStatement(sql);
ResultSet resultSet = preparedStatement.executeQuery();
if (resultSet != null) {
while (resultSet.next()) {
user_thesis uThesis = new user_thesis();
uThesis.setThid(resultSet.getString(1));
uThesis.setThname(resultSet.getString(2));
uThesis.setThusername(resultSet.getString(3));
uThesis.setThtime(resultSet.getString(4));
uThesis.setThno(resultSet.getString(5));
result.add(uThesis);
}
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
link_db.close_db(connection);
return result;
}
// 根据thid删除论文
public static boolean delTheById(String thid) {
boolean flag = false;
Connection connection = link_db.getcon();
String sql = "delete from user_thesis where thid=?";
PreparedStatement preparedStatement;
try {
preparedStatement = connection.prepareStatement(sql);
preparedStatement.setString(1, thid);
if (preparedStatement.executeUpdate() > 0) {
flag = true;
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
link_db.close_db(connection);
return flag;
}
// 根据thid 获得该论文
public static user_the
没有合适的资源?快使用搜索试试~ 我知道了~
基于Java web的科研管理系统(源码+数据库).zip
共197个文件
java:56个
class:56个
jsp:50个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 35 浏览量
2023-08-15
14:39:16
上传
评论
收藏 5.57MB ZIP 举报
温馨提示
使用说明:将源码导入Java ee工具,导入mysql数据库脚本,修改数据库连接语句,调试运行。
资源推荐
资源详情
资源评论
收起资源包目录
基于Java web的科研管理系统(源码+数据库).zip (197个子文件)
thesis_dao.class 8KB
PatentDao.class 6KB
user_dao.class 6KB
projectapply_dao.class 5KB
check_person.class 4KB
search_dao.class 4KB
reg_user_servlet.class 3KB
reg_manager_servlet.class 3KB
manager_dao.class 3KB
ProjectDao.class 3KB
delete_project_servlet.class 3KB
search_project.class 3KB
use_sure_change.class 3KB
apply_project_servlet.class 2KB
thesis_input_servlet.class 2KB
delPatentById.class 2KB
userthesis_input_servlet.class 2KB
Project.class 2KB
update_manager_servlet.class 2KB
doUserPatentUpdate.class 2KB
InsertUserPatentServlet.class 2KB
user.class 2KB
patent_search_servlet.class 2KB
showProjectById.class 2KB
thesis_search_servlet.class 2KB
patent_input_servlet.class 2KB
result.class 2KB
doThesisUpdate.class 2KB
doPatentUpdate.class 2KB
thesis_update_servlet.class 2KB
Patent.class 2KB
showPatent.class 2KB
shenpi_delete.class 2KB
shenpi_apply.class 2KB
ShowThesis.class 2KB
manager.class 2KB
manager_show_servlet.class 2KB
projectapply.class 2KB
UpdatePatent.class 2KB
UpdateThe.class 2KB
ShowThesisServlet1.class 2KB
ShowThesisServlet.class 2KB
InsertUserPatent.class 2KB
project_show.class 2KB
UpdatePatentById.class 2KB
user_thesis.class 2KB
InsertThesis.class 2KB
Deluserthe.class 2KB
user_show_servlet.class 2KB
delPatent.class 1KB
deluserthe.class 1KB
delThe.class 1KB
link_db.class 1KB
doapply.class 1KB
update_project_servlet.class 1KB
test.class 965B
.classpath 1KB
org.eclipse.wst.common.component 476B
org.eclipse.wst.jsdt.ui.superType.container 49B
iconfont.css 8KB
iconfont.css 5KB
iconfont.eot 7KB
iconfont.eot 4KB
ojdbc6.jar 2.61MB
standard.jar 384KB
jstl.jar 20KB
thesis_dao.java 11KB
PatentDao.java 8KB
user_dao.java 6KB
projectapply_dao.java 6KB
check_person.java 5KB
reg_user_servlet.java 4KB
search_dao.java 3KB
reg_manager_servlet.java 3KB
manager_dao.java 3KB
search_project.java 3KB
userthesis_input_servlet.java 3KB
use_sure_change.java 3KB
apply_project_servlet.java 3KB
delete_project_servlet.java 3KB
thesis_input_servlet.java 3KB
InsertUserPatentServlet.java 2KB
doUserPatentUpdate.java 2KB
ProjectDao.java 2KB
update_manager_servlet.java 2KB
patent_input_servlet.java 2KB
delPatentById.java 2KB
thesis_update_servlet.java 2KB
doThesisUpdate.java 2KB
doPatentUpdate.java 2KB
shenpi_delete.java 2KB
shenpi_apply.java 2KB
patent_search_servlet.java 2KB
thesis_search_servlet.java 2KB
showPatent.java 2KB
Project.java 2KB
ShowThesis.java 2KB
showProjectById.java 2KB
ShowThesisServlet1.java 2KB
InsertUserPatent.java 2KB
共 197 条
- 1
- 2
资源评论
等天晴i
- 粉丝: 3521
- 资源: 10万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 适用于tensorflow-2.11.0 CUDA版本11.2的cuDNN8.1版本
- 5Y study学习平台2016计算机基础-综合测试(8)_哔哩哔哩_bilibili_2580252704.mp4
- (大赛作品)STM32实现的F072RB NUCLEO智能家居控制.zip
- STM32实现的数字示波器源码+数字信号处理教程、配套实例.zip
- 【cookie续续】【cookie续续】【cookie续续】
- 低功耗STM32实现的F411开发板(原理图+PCB源文件+官方例程+驱动等).zip
- 基于stm32实现的 nucleo-L476的智能灯(操作说明+源码).zip
- 基于STM32实现的 NUCLEO板设计彩色LED照明灯(纯cubeMX开发).zip
- 基于STM32实现的 的联合调试侦听设备解决方案(原理图、PCB源文件、调试工具、视频).zip
- 基于STM32实现的 人群定位、调速智能风扇设计(程序、设计报告、视频演示).zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功