<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12
      package com.example.ourhomework1.dao;

      import com.example.ourhomework1.pojo.*;
      import com.example.ourhomework1.utils.DbOpenHelper;

      import java.lang.Record;
      import java.util.ArrayList;
      import java.util.List;

      public class UserDao extends DbOpenHelper {
      public int addStudent(Student student) {

      int iRow = 0;
      try {
      getConnection();
      String sql = "insert into student values(?,?,?,?,?)";
      preparedStatement = connection.prepareStatement(sql);
      preparedStatement.setInt(1, student.getId());
      preparedStatement.setString(2, student.getName());
      preparedStatement.setString(3, student.getPhone());
      preparedStatement.setString(4, student.getStudentClass());
      preparedStatement.setString(5, student.getPassword());
      iRow = preparedStatement.executeUpdate();


      } catch (Exception e) {
      e.printStackTrace();
      } finally {
      closeAll();
      }
      return iRow;
      }

      public int addRecord(Records records) {
      int iRow = 0;
      try {
      getConnection();
      String sql = "insert into records values(?,?,?,?,?)";
      preparedStatement = connection.prepareStatement(sql);
      preparedStatement.setInt(1, records.getId());
      preparedStatement.setString(2, records.getDate());
      preparedStatement.setString(3, records.getStartTime());
      preparedStatement.setString(4, records.getEndTime());
      preparedStatement.setString(5, records.getRecord());
      iRow = preparedStatement.executeUpdate();

      } catch (Exception e) {
      e.printStackTrace();
      } finally {
      closeAll();
      }
      return iRow;

      }

      public String login(int id) {
      String password = "";
      try {
      getConnection();
      String sql = "select password from student where id=?";
      preparedStatement = connection.prepareStatement(sql);
      preparedStatement.setInt(1, id);
      resultSet = preparedStatement.executeQuery();
      if (resultSet.next()) {
      password = resultSet.getString("password");
      }
      } catch (Exception e) {
      e.printStackTrace();
      } finally {
      closeAll();
      }
      return password;
      }

      public String teacherLogin(int id) {
      String password = "";
      try {
      getConnection();
      String sql = "select password from teacher where id=?";
      preparedStatement = connection.prepareStatement(sql);
      preparedStatement.setInt(1, id);
      resultSet = preparedStatement.executeQuery();
      if (resultSet.next()) {
      password = resultSet.getString("password");
      }
      } catch (Exception e) {
      e.printStackTrace();
      } finally {
      closeAll();
      }
      return password;
      }

      public String dailyRecord(int id) {
      String password = "";
      try {
      getConnection();
      String sql = "select password from teacher where id=?";
      preparedStatement = connection.prepareStatement(sql);
      preparedStatement.setInt(1, id);
      resultSet = preparedStatement.executeQuery();
      if (resultSet.next()) {
      password = resultSet.getString("password");
      }
      } catch (Exception e) {
      e.printStackTrace();
      } finally {
      closeAll();
      }
      return password;
      }

      public int addObject(Objectives objectives) {

      int iRow = 0;
      try {
      getConnection();
      String sql = "insert into objectives(id,objective,isFinished) values(?,?,?)";
      preparedStatement = connection.prepareStatement(sql);
      preparedStatement.setInt(1, objectives.getId());
      preparedStatement.setString(2, objectives.getObjective());
      preparedStatement.setInt(3, objectives.getIsFinished());
      iRow = preparedStatement.executeUpdate();


      } catch (Exception e) {
      e.printStackTrace();
      } finally {
      closeAll();
      }
      return iRow;
      }

      public int analysis(Analysis analysis) {

      int iRow = 0;
      try {
      getConnection();
      String sql = "insert into analysis(id,analysis,nextWeek) values(?,?,?)";
      preparedStatement = connection.prepareStatement(sql);
      preparedStatement.setInt(1, analysis.getId());
      preparedStatement.setString(2, analysis.getAnalysis());
      preparedStatement.setString(3, analysis.getNextWeek());
      iRow = preparedStatement.executeUpdate();


      } catch (Exception e) {
      e.printStackTrace();
      } finally {
      closeAll();
      }
      return iRow;
      }

      public int getCount(int id) {
      int count = 0;

      try {
      getConnection();
      String sql = "select count(*) as count from objectives where id = ?";
      preparedStatement = connection.prepareStatement(sql);
      preparedStatement.setInt(1, id);

      resultSet = preparedStatement.executeQuery();
      if (resultSet.next()) {
      count = resultSet.getInt("count");
      }

      } catch (Exception e) {
      e.printStackTrace();
      } finally {
      closeAll();
      }
      return count;
      }

      public int getIsFinished(int id) {
      int isFinished = 0;
      int num = 0;
      int average = 0;
      try {
      getConnection();
      String sql = "select isFinished from objectives where id = ?";
      preparedStatement = connection.prepareStatement(sql);
      preparedStatement.setInt(1, id);

      resultSet = preparedStatement.executeQuery();
      while (resultSet.next()) {
      int temp = resultSet.getInt("isFinished");
      num++;
      isFinished += temp;
      }
      average = isFinished / num;

      } catch (Exception e) {
      e.printStackTrace();
      } finally {
      closeAll();
      }
      return average;
      }

      public int getDays(int id) {
      int days = 0;

      try {
      getConnection();
      String sql = "select count(*) as count from records where id = ?";
      preparedStatement = connection.prepareStatement(sql);
      preparedStatement.setInt(1, id);

      resultSet = preparedStatement.executeQuery();
      if (resultSet.next()) {
      days = resultSet.getInt("count");
      }

      } catch (Exception e) {
      e.printStackTrace();
      } finally {
      closeAll();
      }
      return days;
      }

      public List<Records> getAllRecords() {
      List<Records> allRecords = new ArrayList<>();
      try {
      getConnection();
      String sql = "select * from records ";
      preparedStatement = connection.prepareStatement(sql);

      resultSet = preparedStatement.executeQuery();

      while (resultSet.next()) {
      Records record = new Records();
      record.setId(resultSet.getInt("id"));
      record.setDate(resultSet.getString("date"));
      record.setStartTime(resultSet.getString("startTime"));
      record.setEndTime(resultSet.getString("endTime"));
      record.setRecord(resultSet.getString("record"));

      allRecords.add(record);
      }

      } catch (Exception e) {
      e.printStackTrace();
      } finally {
      closeAll();
      }
      return allRecords;
      }


      public List<Records> getDailyRecords(String search) {
      List<Records> allRecords = new ArrayList<>();
      try {
      getConnection();
      String sql = "select * from records where record like concat('%',?,'%')";
      preparedStatement = connection.prepareStatement(sql);
      preparedStatement.setString(1, search);

      resultSet = preparedStatement.executeQuery();

      while (resultSet.next()) {
      Records record = new Records();
      record.setId(resultSet.getInt("id"));
      record.setDate(resultSet.getString("date"));
      record.setStartTime(resultSet.getString("startTime"));
      record.setEndTime(resultSet.getString("endTime"));
      record.setRecord(resultSet.getString("record"));

      allRecords.add(record);
      }

      } catch (Exception e) {
      e.printStackTrace();
      } finally {
      closeAll();
      }
      return allRecords;
      }


      public List<Information> getInformation() {


      List<Information> allRecords = new ArrayList<>();
      try {
      getConnection();
      String sql = "select " +
      "student.*,count(records.id) as count " +
      "from student left join records " +
      "on student.id = records.id " +
      "group by student.id";
      preparedStatement = connection.prepareStatement(sql);

      resultSet = preparedStatement.executeQuery();

      while (resultSet.next()) {
      Information information = new Information();
      information.setId(resultSet.getInt("student.id"));
      information.setName(resultSet.getString("student.name"));
      information.setStudentClass(resultSet.getString("student.studentClass"));
      information.setCount(resultSet.getInt("count"));
      allRecords.add(information);
      }

      } catch (Exception e) {
      e.printStackTrace();
      } finally {
      closeAll();
      }
      return allRecords;
      }

      /*public AllAnalysis getAllAnalysis(int id) {
      AllAnalysis allAnalysis = new AllAnalysis();
      allAnalysis.setId(id);
      allAnalysis.setRecordsNumber(getCount(id));
      allAnalysis.setAverage(getIsFinished(id));
      allAnalysis.setDayNumber(getDays(id));
      return allAnalysis;
      }*/
      }
      posted on 2025-01-07 23:41    閱讀(10)  評論(0)    收藏  舉報



      主站蜘蛛池模板: 久久香蕉国产线看观看猫咪av| 精品国产一区二区三区大| 亚洲成色精品一二三区| 国产a网站| 国产精品99中文字幕| 亚洲国产精品色一区二区| 国产乱色熟女一二三四区| 中国国产一级毛片| 国产精品激情| 国内自拍视频一区二区三区| 亚洲国产成人精品女久久| 亚洲理论在线A中文字幕| 2021最新国产精品网站| 人妻系列中文字幕精品| 亚洲一区二区av观看| 一区二区三区午夜无码视频| 乌审旗| 久久精品青青大伊人av| 日韩高清在线亚洲专区国产| 深夜在线观看免费av| 午夜精品久久久久久久久| 国产精品无码v在线观看| 亚洲老熟女一区二区三区| 亚洲av中文乱码一区二| 国产99在线 | 免费| 日韩在线视频线观看一区| 久久人人97超碰精品| 午夜三级成人在线观看| 亚洲精品久久婷婷丁香51| 国内少妇人妻丰满av| 国产精品成人无码久久久| 人妻少妇偷人无码视频| 香港日本三级亚洲三级| 亚洲精品在线二区三区| 国产精一区二区黑人巨大| 亚洲国产精品色一区二区| 亚洲综合日韩av在线| 影音先锋AV成人资源站在线播放| 亚洲精品国产福利一区二区| 亚洲精品国精品久久99热| 欧美videosdesexo吹潮|