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

📄 myclass.java

📁 采用基于B/S结构进行开发学生管理信息系统,本系统采用Servlet+Jsp+JavaBean+MySQL 的设计方式
💻 JAVA
字号:
package myBean;
import java.sql.*;
import myBeans.SQLBean;

public class MyClass {
  private String id;
  private String dep_id;
  private String monitor;
  private int count;
  private int entry;
  private int leave;
  
  public String getId() {return id;}
  public void setId(String id) {this.id = id;}
  public void setDep_id(String s){dep_id=s;}
  public String getDep_id(){return dep_id;}
  public void setMonitor(String s){monitor=s;}
  public String getMonitor(){return monitor;}
  
  public void setEntry(int year){entry=year;}
  public int getEntry(){return entry;} 
  public void setCount(int count){this.count=count;}
  public int getCount(){return count;}
  public void setLeave(int leave){this.leave=leave;}
  public int getLeave(){return leave;}
                                                                    
  public boolean hasLogin(String id){   //检查该班级是否已经注册
  	boolean f=true;
   String sql="select * from class where ID ='"+id+"'";
  	SQLBean db =new SQLBean();
  	try{
  	ResultSet rs=db.executeQuery(sql);
  	if(rs.next()){ f=false;}
  	else{ f=true;}
  	}catch(Exception e){ e.getMessage();}
  	return f;
  }
  	                       
  public ResultSet  getClass(String dep){
  	String sql = "";
  	if(dep.equals("0000")){
  	   sql="select class.*,department.NAME from class,department where class.DEPARTMENT=department.ID";
  	   }
  	else{
		   sql="select class.*,department.NAME from class,department where class.DEPARTMENT=department.ID and DEPARTMENT='"+dep+"'";
		   }
		SQLBean db= new SQLBean();
		ResultSet rs = db.executeQuery(sql);
		 return rs;
	} 
		                         
		                         
	public void updateClass(){
    	
      String sql="update class "+
                 " set MONITOR='"+monitor+"'"+" where ID='"+id+"' ";
      SQLBean db= new SQLBean();
      db.executeInsert(sql);
  }	      			                         		                                                 	                       	                               
  	       
  public int deleteClass(String id){
    	int num=0;
    	SQLBean db = new SQLBean();
    	String sql="select DEPARTMENT from class where ID='"+id+"'",s="";
    	try{
    	   ResultSet rs = db.executeQuery(sql);
    	   if(rs.next()){
    	     s = rs.getString(1);
    	    }
    	  }catch(SQLException e){e.getMessage();}
    	sql="delete from class where ID = '"+id+"' and COUNT = 0";
    	num=db.executeDelete(sql);
    	sql="update department set CLA_COUNT=CLA_COUNT-1 where ID='"+s+"'";
      db.executeInsert(sql);
    	return num;
    	}  
    	                      	                       
  public int addClass()  {
  	int num = 0;
    String sql="insert into class(ID,DATE,DEPARTMENT)  "+	
            "values('"+id+"','"+entry+"','"+dep_id+"') ";
    SQLBean db =new SQLBean();
    num=db.executeInsert(sql);
    sql="update department set CLA_COUNT=CLA_COUNT+1 where ID='"+dep_id+"'";
    SQLBean db1=new SQLBean();
    db1.executeInsert(sql);
    return num;
 }
                                                   
}

⌨️ 快捷键说明

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