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

📄 selectsomethingserviceimp.java

📁 基本分数查询功能,自己的毕业设计作品!希望能给大家一点帮助!
💻 JAVA
字号:
package org.xk.service.imp;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;

import org.xk.dbutil.Opendb;
import org.xk.domain.Condition;
import org.xk.service.interfaces.SelectSomethingService;

public class SelectSomethingServiceImp implements SelectSomethingService {
	static Opendb db = null;

	public static Opendb getDB() {
		if (db == null) {
			db = new Opendb();
		}
		return db;
	}

	public List getClassInfo(int teacher_id) throws SQLException {
		String sql = "select * from class where teacher_id = '" + teacher_id
				+ "'";
		ResultSet rs = getDB().executeQuery(sql);
		List ls = Condition.getListByResultSet(rs);
		getDB().Close();
		return ls;
	}

	public List getYearsInfo() {
		// TODO Auto-generated method stub
		String sql = "select * from years ";
		ResultSet rs = getDB().executeQuery(sql);
		List ls = Condition.getListByResultSet(rs);
		getDB().Close();
		return ls;
	}

	public List getStudentInfo(int class_id) throws SQLException {
		// TODO Auto-generated method stub
		String sql = "select * from  student where class_id = '" + class_id
				+ "'";
		ResultSet rs = getDB().executeQuery(sql);
		List ls = Condition.getListByResultSet(rs);
		getDB().Close();
		return ls;

	}

	public List getStudentInfo1(String stu_number) throws SQLException {
		// TODO Auto-generated method stub
		String sql = "select * from  student where stu_number = '" + stu_number
				+ "'";
		ResultSet rs = getDB().executeQuery(sql);
		List ls = Condition.getListByResultSet(rs);
		getDB().Close();
		return ls;

	}

	public List getSubjectInfo(int year_id, int class_id, int port_id)
			throws SQLException {
		String sql = "select * from  subject where year_id=" + year_id
				+ " and class_id = " + class_id + " and port_id =" + port_id;
		ResultSet rs = getDB().executeQuery(sql);
		List ls = Condition.getListByResultSet(rs);
		getDB().Close();
		return ls;

	}

	public HashMap getScoreInfo(String score_number, int year_id, int class_id,
			int port_id) throws SQLException {
		// TODO Auto-generated method stub
		String sql = "select * from  score where score_number ='"
				+ score_number + "' and year_id=" + year_id
				+ " and class_id = " + class_id + " and port_id =" + port_id;
		ResultSet rs = getDB().executeQuery(sql);
		HashMap hm = Condition.getHashMapByResultSet(rs);
		getDB().Close();
		return hm;
	}

	public HashMap getTeacherInfo(int teacher_id) throws SQLException {
		// TODO Auto-generated method stub
		String sql = "select * from teacher where teacher_id = '" + teacher_id
				+ "'";
		ResultSet rs = getDB().executeQuery(sql);
		HashMap hm = Condition.getHashMapByResultSet(rs);
		getDB().Close();
		return hm;
	}

	public HashMap getClass(int class_id) throws SQLException {
		// TODO Auto-generated method stub
		String sql = "select * from class where class_id = '" + class_id + "'";
		ResultSet rs = getDB().executeQuery(sql);
		HashMap hm = Condition.getHashMapByResultSet(rs);
		getDB().Close();
		return hm;
	}

	public HashMap getPort(int port_id) throws SQLException {
		// TODO Auto-generated method stub
		String sql = "select * from port where port_id = '" + port_id + "'";
		ResultSet rs = getDB().executeQuery(sql);
		HashMap hm = Condition.getHashMapByResultSet(rs);
		getDB().Close();
		return hm;
	}

	public List getScore(String score_number, int year_id, int class_id,
			int port_id) throws SQLException {
		// TODO Auto-generated method stub
		String sql = "select * from score where score_number = '"
				+ score_number + "' and year_id='" + year_id
				+ "' and class_id='" + class_id + "' and port_id = '" + port_id
				+ "'";
		ResultSet rs = getDB().executeQuery(sql);
		List ls = Condition.getListByResultSet(rs);
		getDB().Close();
		return ls;
	}

	public HashMap getStudentMessageInfo(int stu_id) throws SQLException {
		// TODO Auto-generated method stub
		String sql = "select * from student where stu_id = '" + stu_id + "'";
		ResultSet rs = getDB().executeQuery(sql);
		HashMap hm = Condition.getHashMapByResultSet(rs);
		getDB().Close();
		return hm;
	}

	public List getPortInfo() throws SQLException {
		// TODO Auto-generated method stub
		String sql = "select * from port ";
		ResultSet rs = getDB().executeQuery(sql);
		List ls = Condition.getListByResultSet(rs);
		getDB().Close();
		return ls;
	}

	public List getTeacherByDp(int port_id) throws SQLException {
		// TODO Auto-generated method stub
		String sql = "select * from teacher where port_id =" + port_id;
		ResultSet rs = getDB().executeQuery(sql);
		List ls = Condition.getListByResultSet(rs);
		getDB().Close();
		return ls;
	}

	public List getAdminInfo() throws SQLException {

		String sql = "select * from admin";
		ResultSet rs = getDB().executeQuery(sql);
		List ls = Condition.getListByResultSet(rs);
		getDB().Close();
		return ls;
	}

	public HashMap getAdmin(int admin_id) throws SQLException {
		// TODO Auto-generated method stub
		String sql = "select * from admin where admin_id = '" + admin_id + "'";
		ResultSet rs = getDB().executeQuery(sql);
		HashMap hm = Condition.getHashMapByResultSet(rs);
		getDB().Close();
		return hm;	}

}

⌨️ 快捷键说明

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