• 大小: 5.71MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-11-18
  • 语言: Java
  • 标签: MVC框架  MySQL  

资源简介

本系统运用了MVC框架,采用JDBC实现增删查改,含有数据库,Tomcat服务器,eclipse开发环境,含有登录,注册

资源截图

代码片段和文件信息

package com.edu.lingnan.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

import com.edu.lingnan.dto.Grade;
import com.edu.lingnan.dto.PageBean;
import com.edu.lingnan.util.StringUtil;

public class GradeDao {

public ResultSet gradeList(Connection conPageBean pageBeanGrade grade)throws Exception{

//建立一条查询语句头
StringBuffer sb=new StringBuffer(“select * from t_grade“);
if(grade!=null && StringUtil.isNotEmpty(grade.getGradeName())){
sb.append(“ and gradeName like ‘%“+grade.getGradeName()+“%‘“);
}
if(pageBean!=null){
sb.append(“ limit “+pageBean.getStart()+““+pageBean.getRows());
}
//根据查询条件拼接所须部分
PreparedStatement pstmt=con.prepareStatement(sb.toString().replaceFirst(“and“ “where“));
return pstmt.executeQuery();//执行SQL语句
}

public int gradeSelect(Connection conGrade grade)throws Exception{
//获得的记录数,赋值给一个给count
StringBuffer sb=new StringBuffer(“select count(*) as total from t_grade“);
if(StringUtil.isNotEmpty(grade.getGradeName())){
sb.append(“ and gradeName like ‘%“+grade.getGradeName()+“%‘“);
}
PreparedStatement pstmt=con.prepareStatement(sb.toString().replaceFirst(“and“ “where“));
ResultSet rs=pstmt.executeQuery();
if(rs.next()){
return rs.getInt(“total“);
}else{
return 0;
}
}
public int gradeDelete(Connection conString delIds)throws Exception{
//实现批量删除,删除指定行, id 的值符合括号中的值的话都会被删除
String sql=“delete from t_grade where id in(“+delIds+“)“;
PreparedStatement pstmt=con.prepareStatement(sql);
System.out.println(“---5--“+delIds);
return pstmt.executeUpdate();
}

public int gradeAdd(Connection conGrade grade)throws Exception{
//添加班级信息
String sql=“insert into t_grade values(null???)“;
PreparedStatement pstmt=con.prepareStatement(sql);
pstmt.setString(1 grade.getGradeName());
pstmt.setString(2 grade.getGradeDesc());
pstmt.setString(3 grade.getGradeflag());
System.out.println(“---6---“);
return pstmt.executeUpdate();
}
//班级的修改的实现
public int gradeModify(Connection conGrade grade)throws Exception{
String sql=“update t_grade set gradeName=?gradeDesc=?gradeflag=? where id=?“;
PreparedStatement pstmt=con.prepareStatement(sql);
pstmt.setString(1 grade.getGradeName());
pstmt.setString(2 grade.getGradeDesc());
pstmt.setString(3 grade.getGradeflag());
pstmt.setInt(4 grade.getId());
System.out.println(“---1---“);
return pstmt.executeUpdate();
}

}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件        3864  2018-06-08 15:27  db_studentinfo.sql
     目录           0  2018-06-07 23:34  StudentInfoManage\
     文件         836  2018-06-01 10:27  StudentInfoManage\.classpath
     文件        1050  2013-05-24 10:08  StudentInfoManage\.project
     目录           0  2018-06-07 23:34  StudentInfoManage\.settings\
     文件         503  2013-05-24 10:08  StudentInfoManage\.settings\.jsdtscope
     文件         395  2013-05-24 10:08  StudentInfoManage\.settings\org.eclipse.jdt.core.prefs
     文件         481  2013-05-24 10:08  StudentInfoManage\.settings\org.eclipse.wst.common.component
     文件         345  2013-05-24 10:08  StudentInfoManage\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2013-05-24 10:08  StudentInfoManage\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2013-05-24 10:08  StudentInfoManage\.settings\org.eclipse.wst.jsdt.ui.superType.name
     目录           0  2018-06-07 23:34  StudentInfoManage\build\
     目录           0  2018-06-07 23:34  StudentInfoManage\build\classes\
     目录           0  2018-06-07 23:34  StudentInfoManage\build\classes\com\
     目录           0  2018-06-07 23:34  StudentInfoManage\build\classes\com\edu\
     目录           0  2018-06-07 23:34  StudentInfoManage\build\classes\com\edu\lingnan\
     目录           0  2018-06-07 23:34  StudentInfoManage\build\classes\com\edu\lingnan\dao\
     文件        3529  2018-06-07 23:34  StudentInfoManage\build\classes\com\edu\lingnan\dao\GradeDao.class
     文件        4454  2018-06-07 23:34  StudentInfoManage\build\classes\com\edu\lingnan\dao\StudentDao.class
     文件        5972  2018-06-08 10:11  StudentInfoManage\build\classes\com\edu\lingnan\dao\UserDao.class
     目录           0  2018-06-07 23:34  StudentInfoManage\build\classes\com\edu\lingnan\dto\
     文件        1318  2018-06-07 23:34  StudentInfoManage\build\classes\com\edu\lingnan\dto\Grade.class
     文件         815  2018-06-07 23:34  StudentInfoManage\build\classes\com\edu\lingnan\dto\PageBean.class
     文件        2405  2018-06-07 23:34  StudentInfoManage\build\classes\com\edu\lingnan\dto\Student.class
     文件        1524  2018-06-07 23:34  StudentInfoManage\build\classes\com\edu\lingnan\dto\User.class
     目录           0  2018-06-07 23:34  StudentInfoManage\build\classes\com\edu\lingnan\filter\
     文件        2513  2018-06-07 23:34  StudentInfoManage\build\classes\com\edu\lingnan\filter\AuthorityFilter.class
     目录           0  2018-06-07 23:34  StudentInfoManage\build\classes\com\edu\lingnan\servlet\
     文件         835  2018-06-07 23:34  StudentInfoManage\build\classes\com\edu\lingnan\servlet\FindAllUser.class
     文件        2456  2018-06-07 23:34  StudentInfoManage\build\classes\com\edu\lingnan\servlet\GradeComboListServlet.class
     文件        3336  2018-06-08 09:38  StudentInfoManage\build\classes\com\edu\lingnan\servlet\GradeDeleteServlet.class
............此处省略1242个文件信息

评论

共有 条评论