@Override
  public int doUpdate(int id, Student student) throws Exception {

    String sql =
        "update student set stuNumber=?,stuPassword=?,stuName=?,stuSex=?,stuIdentification=?,stuIsGat=?,stuPhone=?,departmentId=?,majorId=?,gradeNow=?,nationMark=?,birthday=?,address=?,politics=? where id=?";

    try {
      pstmt = conn.prepareStatement(sql);
      pstmt.setString(1, student.getStuNumber());
      pstmt.setString(2, student.getStuPassword());
      pstmt.setString(3, student.getStuName());
      pstmt.setString(4, student.getStuSex());
      pstmt.setString(5, student.getStuIdentification());
      pstmt.setString(6, student.getStuIsGat());
      pstmt.setString(7, student.getStuPhone());
      pstmt.setInt(8, student.getDepartmentId());
      pstmt.setInt(9, student.getMajorId());
      pstmt.setString(10, student.getGradeNow());
      pstmt.setInt(11, student.getNationMark());
      pstmt.setString(12, student.getBithday());
      pstmt.setString(13, student.getAddress());
      pstmt.setString(14, student.getPolitics());
      pstmt.setInt(15, id);
      result = pstmt.executeUpdate();
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      DatabaseConnection.closePreparedStatement(pstmt);
      DatabaseConnection.closeConnection(conn);
    }
    return result;
  }
  @Override
  public int doCreate(Student student) throws Exception {

    String sql =
        "insert into student(stuNumber,stuPassword,stuName,stuSex,stuIdentification,stuIsGat,stuPhone,departmentId,majorId,gradeNow,nationMark,birthday,address,politics) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)";

    try {
      pstmt = conn.prepareStatement(sql);
      pstmt.setString(1, student.getStuNumber());
      pstmt.setString(2, student.getStuPassword());
      pstmt.setString(3, student.getStuName());
      pstmt.setString(4, student.getStuSex());
      pstmt.setString(5, student.getStuIdentification());
      pstmt.setString(6, student.getStuIsGat());
      pstmt.setString(7, student.getStuPhone());
      pstmt.setInt(8, student.getDepartmentId());
      pstmt.setInt(9, student.getMajorId());
      pstmt.setString(10, student.getGradeNow());
      pstmt.setInt(11, student.getNationMark());
      pstmt.setString(12, student.getBithday());
      pstmt.setString(13, student.getAddress());
      pstmt.setString(14, student.getPolitics());
      result = pstmt.executeUpdate();
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      DatabaseConnection.closePreparedStatement(pstmt);
      DatabaseConnection.closeConnection(conn);
    }
    return result;
  }
  @Override
  public List<Student> findByThreeCondition(String stuNumber, String stuName, String stuGradeNow)
      throws Exception {
    List<Student> studentList = new ArrayList<Student>();
    Student student = null;
    String sql = "select * from student where stuNumber like ? and stuName like ? and gradeNow=?";

    try {
      pstmt = conn.prepareStatement(sql);
      pstmt.setString(1, "%" + stuNumber + "%");
      pstmt.setString(2, "%" + stuName + "%");
      pstmt.setString(3, stuGradeNow);
      rs = pstmt.executeQuery();
      while (rs.next()) {
        student = new Student();
        student.setId(rs.getInt(1));
        student.setStuNumber(rs.getString(2));
        student.setStuPassword(rs.getString(3));
        student.setStuName(rs.getString(4));
        student.setStuSex(rs.getString(5));
        student.setStuIdentification(rs.getString(6));
        student.setStuIsGat(rs.getString(7));
        student.setStuPhone(rs.getString(8));
        student.setDepartmentId(rs.getInt(9));
        student.setMajorId(rs.getInt(10));
        student.setGradeNow(rs.getString(11));
        student.setNationMark(rs.getInt(12));
        student.setBithday(rs.getString(13));
        student.setAddress(rs.getString(14));
        student.setPolitics(rs.getString(15));
        studentList.add(student);
      }
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      DatabaseConnection.closeResultSet(rs);
      DatabaseConnection.closePreparedStatement(pstmt);
      DatabaseConnection.closeConnection(conn);
    }
    return studentList;
  }
  @Override
  public Student findByStuNumber(String stuNumber) throws Exception {

    Student student = null;
    String sql = "select * from student where stuNumber=?";

    try {
      pstmt = conn.prepareStatement(sql);
      pstmt.setString(1, stuNumber);
      rs = pstmt.executeQuery();
      while (rs.next()) {
        student = new Student();
        student.setId(rs.getInt(1));
        student.setStuNumber(rs.getString(2));
        student.setStuPassword(rs.getString(3));
        student.setStuName(rs.getString(4));
        student.setStuSex(rs.getString(5));
        student.setStuIdentification(rs.getString(6));
        student.setStuIsGat(rs.getString(7));
        student.setStuPhone(rs.getString(8));
        student.setDepartmentId(rs.getInt(9));
        student.setMajorId(rs.getInt(10));
        student.setGradeNow(rs.getString(11));
        student.setNationMark(rs.getInt(12));
        student.setBithday(rs.getString(13));
        student.setAddress(rs.getString(14));
        student.setPolitics(rs.getString(15));
      }
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      DatabaseConnection.closeResultSet(rs);
      DatabaseConnection.closePreparedStatement(pstmt);
      DatabaseConnection.closeConnection(conn);
    }
    return student;
  }