⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 require_attendance.java~11~

📁 javaGUI编写的人事管理系统(毕业学生答辩可参考)
💻 JAVA~11~
字号:
package project;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import java.sql.ResultSet;
import java.sql.*;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2006</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class Require_attendance {
  JFrame mainframe = null;
  JPanel require_attendance_panel = null;
  public Require_attendance(JFrame mainframe, JPanel require_attendance_panel) {
    this.mainframe = mainframe;
    this.require_attendance_panel = require_attendance_panel;
  }

  public void show_record(String str, JLabel[][] label){

    try{
      int id = Integer.parseInt(str);
      DataBase db = new DataBase();
      String sql = "select * from employee_table where employee_id="+id+" and useful=1";
      ResultSet rs = db.executeQuery(sql);
      try {
        if (!rs.next()) {
          JOptionPane.showMessageDialog(this.mainframe,"工号输入有误,没有该条记录或则该记录已被删除!","提示",JOptionPane.INFORMATION_MESSAGE);
          rs.close();
          db.close();
          return;
        }else{
          rs.close();
          String newsql = "select * from attendance_table where id="+id;
          rs = db.executeQuery(newsql);

          if(!rs.next()){
            JOptionPane.showMessageDialog(this.mainframe,"该员工的考勤记录不存在!","提示",JOptionPane.INFORMATION_MESSAGE);
            rs.close();
            db.close();
            return;

          }else{
            rs.close();
            String sql2 = "select * from attendance_table where id="+id;
            rs = db.executeQuery(newsql);
            DataMap dm = new DataMap(rs);
            rs.close();
            db.close();
            Object[][] obj = dm.get_DataMap_Array();
            for(int i = 0; i< label.length; i++){
              for(int j = 0; j < label[i].length; j++){
                label[i][j].setText("0");
              }
            }

            for(int i = 0; i < obj.length; i++){
              label[0][Integer.parseInt(obj[i][1].toString())-1].setText(obj[i][2].toString());
              label[1][Integer.parseInt(obj[i][1].toString())-1].setText(obj[i][3].toString());
              label[2][Integer.parseInt(obj[i][1].toString())-1].setText(obj[i][4].toString());
              label[3][Integer.parseInt(obj[i][1].toString())-1].setText(obj[i][5].toString());
            }



          }
        }
      }
      catch (SQLException ex) {
        JOptionPane.showMessageDialog(this.mainframe,"数据集有错误!","提示",JOptionPane.INFORMATION_MESSAGE);
      }



    }
    catch(NumberFormatException e){
      e.printStackTrace();
      JOptionPane.showMessageDialog(this.mainframe,"工号输入有误!","提示",JOptionPane.INFORMATION_MESSAGE);
      ((Require_attendance_panel)require_attendance_panel).requestFocus();
    }

  }




}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -