package dao;
import java.sql.*;
import bean.Customer;
import bean.GradeDesign;
import bean.Score;
import conn.Conn;
public class StudentSql {
//查询是否有该学号密码的学生
public static boolean isStudent(String ID, String Password){
Connection conn = Conn.getConnection();
Statement stmt = null;
ResultSet rs = null;
String type = null;
try {
stmt = conn.createStatement();
String sql = "select * from customer where ID =" + "'" + ID+ "'" + " and Password=" + "'" + Password + "'";
rs = stmt.executeQuery(sql);
if(rs.next()) {
type = rs.getString("Type");
return type.equals("student");
}
return false;
}catch(SQLException e){
e.printStackTrace();
}finally {
Conn.release(conn, stmt, rs);
}
return false;
}
//根据学生的学号查询学生姓名
public static String getName(String ID) {
Connection conn = Conn.getConnection();
Statement stmt = null;
ResultSet rs = null;
try {
stmt = conn.createStatement();
String sql = "select Name from customer where ID = " + "'" + ID +"'";
rs = stmt.executeQuery(sql);
if(rs.next()) {
return rs.getString("Name");
}
return null;
}catch(SQLException e){
e.printStackTrace();
}finally {
Conn.release(conn, stmt, rs);
}
return null;
}
//查询个人信息
public static Customer getCustomerByID(String ID) {
Connection conn = Conn.getConnection();
Statement stmt = null;
ResultSet rs = null;
try {
stmt = conn.createStatement();
String sql = "select * from customer where ID = "+"'" + ID + "'";
rs = stmt.executeQuery(sql);
Customer customer = null;
if(rs.next()) {
String Name = rs.getString("Name");
String Email = rs.getString("Email");
String Sex = rs.getString("Sex");
String Phone = rs.getString("Phone");
String Type = rs.getString("Type");
customer = new Customer(Name, ID);
customer.setSex(Sex);
customer.setEmail(Email);
customer.setPhone(Phone);
customer.setType(Type);
return customer;
}
}catch(SQLException e) {
e.printStackTrace();
}finally {
Conn.release(conn, stmt, rs);
}
return null;
}
//更新个人信息
public static boolean updateCustomer(String ID, String Email,String Sex,String Phone){
Connection conn = Conn.getConnection();
Statement stmt = null;
try {
stmt = conn.createStatement();
String sql = "update customer set Email = '" + Email + "',Sex = '" + Sex + "',Phone = '" + Phone + "'where ID = '" + ID + "'";
stmt.executeUpdate(sql);
return true;
}catch(SQLException e){
e.printStackTrace();
}finally {
Conn.release(conn, stmt);
}
return false;
}
//更新密码
public static boolean updatePassword(String ID, String Password){
Connection conn = Conn.getConnection();
Statement stmt = null;
int a = 0;
try {
stmt = conn.createStatement();
String sql = "update customer set password = " + "'" + Password + "'" + " where ID = " + "'" + ID + "'";
a = stmt.executeUpdate(sql);
return a > 0;
}catch(SQLException e){
e.printStackTrace();
}finally {
Conn.release(conn, stmt);
}
return false;
}
//学生查询成绩
public static Score selectGrade(String ID) {
Connection conn = Conn.getConnection();
Statement stmt = null;
ResultSet rs = null;
try {
stmt = conn.createStatement();
String sql = "select * from dbo.score where ID = " + "'" + ID +"'";
rs = stmt.executeQuery(sql);
if(rs.next()) {
String Name = rs.getString("Name");
String Title = rs.getString("Title");
String T_Nmae = rs.getString("T_Name");
String Score = rs.getString("Score");
String Grade = rs.getString("Grade");
return new Score(ID,Name,Title,T_Nmae,Score,Grade);
}
}catch(SQLException e){
e.printStackTrace();
}finally {
Conn.release(conn, stmt, rs);
}
return null;
}
//学生查询毕业设计相关信息是否存在
public static boolean isDesign(String ID) {
Connection conn = Conn.getConnection();
Statement stmt = null;
ResultSet rs = null;
try {
stmt = conn.createStatement();
String sql = "select * from dbo.grade_design where ID = " + "'" + ID + "'";
rs = stmt.executeQuery(sql);
if (rs.next()) {
return true;
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
Conn.release(conn, stmt, rs);
}
return false;
}
//学生查询毕业设计相关信息
public static GradeDesign selectDesign(String ID) {
Connection conn = Conn.getConnection();
Statement stmt = null;
ResultSet rs = null;
GradeDesign gradeDesign = new GradeDesign();
try {
stmt = conn.createStatement();
String sql = "select * from dbo.grade_design where ID = " + "'" + ID + "'";
rs = stmt.executeQuery(sql);
if (rs.next()) {
gradeDesign.setID(rs.getString("ID"));
gradeDesign.setName(rs.getString("Name"));
gradeDesign.setTitle(rs.getString("Title"));
gradeDesign.setT_Name(rs.getString("T_Name"));
gradeDesign.setDepart(rs.getString("Depart"));
gradeDesign.setMajor(rs.getString("Major"));
gradeDesign.setPhone(rs.getString("Phone"));
gradeDesign.setRWS(rs.getString("RWS"));
gradeDesign.setKTBG(rs.getString("KTBG"));
gradeDesign.setBYLW(rs.getString("BYLW"));
gradeDesign.setCODE(rs.getString("CODE"));
return gradeDesign;
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
Conn.release(conn, stmt, rs);
}
return null;
}
//学生查询毕业设计相关信息
public static GradeDesign selectDesignInCustomer(String ID) {
Connection conn = Conn.getConnection();
Statement stmt = null;
ResultSet rs = null;
GradeDesign gradeDesign = new GradeDesign();
try {
stmt = conn.createStatement();
String sql = "select * from dbo.customer where ID = " + "'" + ID + "'";
rs = stmt.executeQuery(sql);
if (rs.next()) {
String Name = rs.getString("Name");
gradeDesign.setID(ID);
gradeDesign.setName(Name);
return gradeDesign;
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
Conn.release(conn, stmt, rs);
}
return null;
}
//更新毕业设计相关信息
public static boolean updataDesign(String ID,String Depart,String Major,String Phone,String RWS,String KTBG,String BYLW,String CODE) {
Connection conn = Conn.getConnection();
Statement stmt = null;
int a = 0;
try {
stmt = conn.createStatement();
String sql = "update grade_design set Depart = '" + Depart + "',Major = '" + Major + "',Phone = '" + Phone + "'where ID = '" + ID + "'";
if(RWS != null){
stmt.executeUpdate("update grade_design set RWS = '" + RWS + "'where ID = '" + ID + "'");
}else if (KTBG != null){
stmt.executeUpdate("update grade_design set KTBG = '" + KTBG + "'where ID = '" + ID + "'");
}else if (BYLW != null){
stmt.executeUpdate("update grade_design set BYLW = '" + BYLW + "'where ID = '" + ID + "'");
}else if (CODE != null){
stmt.executeUpdate("update grade_design set CODE = '" + CODE + "'where ID = '" + ID + "'");
}
a = stmt.executeUpdate(sql);
return a > 0;
} catch (SQLException e) {
e.printStackTrace();
} finally {
Conn.release(conn, stmt);
}
return false;
}
//插入毕业设计相关信息
public static boolean inseDesign(String ID,String Name,String Depart,String Major,String Title,String Phone,String RWS,String KTBG,String BYLW,String CODE) {
Connection conn = Conn.getConnection();
Statement stmt = null;
int a = 0;
try {
stmt = conn.createStatement();
String sql = "insert into grade_design(ID, Name, Depart,Major,Title, Phone, RWS,KTBG ,BYLW,CODE ) values (" + "'" + ID + "'" + "," + " '" + Name + "'" + "," + " '" + Depart + "'" + "," + " '" + Major + "'" + "," + " '" + Title + "'" + "," + " '" + Phone + "'" + "," + " '" + RWS + "'" + "," + " '" + KTBG + "'" + "," + " '" + BYLW + "'" + "," + " '" + CODE + "'" + ")";
a = stmt.executeUpdate(sql);
return a > 0;
} catch (SQLException e) {
e.printStackTrace();
} finally
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
JavaWeb课程设计的毕业设计与代码管理系统源码,采用标准MVC模式开发 毕业设计与代码管理系统。JavaWeb课程设计的毕业设计与代码管理系统源码,采用标准MVC模式开发 毕业设计与代码管理系统JavaWeb课程设计的毕业设计与代码管理系统源码,采用标准MVC模式开发 毕业设计与代码管理系统JavaWeb课程设计的毕业设计与代码管理系统源码,采用标准MVC模式开发 毕业设计与代码管理系统JavaWeb课程设计的毕业设计与代码管理系统源码,采用标准MVC模式开发 毕业设计与代码管理系统JavaWeb课程设计的毕业设计与代码管理系统源码,采用标准MVC模式开发 毕业设计与代码管理系统JavaWeb课程设计的毕业设计与代码管理系统源码,采用标准MVC模式开发 毕业设计与代码管理系统JavaWeb课程设计的毕业设计与代码管理系统源码,采用标准MVC模式开发 毕业设计与代码管理系统
资源推荐
资源详情
资源评论
收起资源包目录
JavaWeb课程设计的毕业设计与代码管理系统.zip (61个子文件)
Graduate-master
Graduate.iml 2KB
src
dao
TeacherSql.java 6KB
AdminSql.java 6KB
StudentSql.java 8KB
conn
Conn.java 1KB
bean
GradeDesign.java 2KB
Score.java 2KB
Customer.java 2KB
servlet
RemoveServlet.java 1KB
AlterPasswordServlet.java 3KB
AlterInfoServlet.java 2KB
InsertServlet.java 2KB
AlterServlet.java 2KB
AlterScoreServlet.java 2KB
UploadServlet.java 5KB
DownloadServlet.java 2KB
LoginServlet.java 3KB
web
css
bootstrap.min.css 147KB
login.css 2KB
index.css 2KB
Alter_Pwd.jsp 2KB
Alter_Score.jsp 3KB
Student_Info.jsp 3KB
image
YSUlogo.png 543KB
background.png 750KB
WEB-INF
web.xml 3KB
classes
dao
StudentSql.class 9KB
AdminSql.class 7KB
TeacherSql.class 7KB
conn
Conn.class 2KB
bean
Customer.class 3KB
GradeDesign.class 3KB
Score.class 3KB
servlet
InsertServlet.class 2KB
LoginServlet.class 3KB
UploadServlet.class 5KB
RemoveServlet.class 1KB
AlterScoreServlet.class 2KB
DownloadServlet.class 2KB
AlterServlet.class 2KB
AlterInfoServlet.class 2KB
AlterPasswordServlet.class 3KB
lib
commons-fileupload-1.4.jar 71KB
commons-io-2.8.0.jar 279KB
mysql-connector-java-8.0.16.jar 2.19MB
mssql-jdbc-6.4.0.jre8.jar 1.06MB
Teacher_Info.jsp 3KB
Select_Customer.jsp 3KB
MyGrade.jsp 2KB
UploadPaper.jsp 5KB
Insert_Customer.jsp 3KB
index_Admin.jsp 2KB
index_Student.jsp 3KB
Manage_Teachers.jsp 3KB
index.jsp 2KB
index_Teacher.jsp 2KB
Not_Login.jsp 467B
Student_Data.jsp 3KB
Manage_Grades.jsp 2KB
Manage_Students.jsp 3KB
Alter_Customer.jsp 3KB
共 61 条
- 1
程序员张小妍
- 粉丝: 1w+
- 资源: 3140
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- python-leetcode题解之202-Happy-Number.py
- python-leetcode题解之200-Number-of-Islands.py
- python-leetcode题解之198-House-Robber.py
- python-leetcode题解之191-Number-of-1-Bits.py
- python-leetcode题解之186-Reverse-Words-in-a-String-II.py
- python-leetcode题解之179-Largest-Number.py
- python-leetcode题解之170-Two-Sum-III-Data-structure-design.py
- python-leetcode题解之168-Excel-Sheet-Column-Title.py
- python-leetcode题解之167-Two-Sum-II-Input-array-is-sorted.py
- 625860606046292哔哩哔哩HD.apk
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
前往页