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

📄 resultdao.java

📁 采用STRUTS+HIBERNATE做的一个学生成绩管理系统.用的ORACLE9I数据库.
💻 JAVA
字号:
package org.yangyang.dao;

import java.util.Date;
import java.util.List;

import org.yangyang.bean.Course;
import org.yangyang.bean.Result;
import org.yangyang.bean.Student;
import org.yangyang.db.DbCon;

public class ResultDao extends MainDao {
	
    public ResultDao(){
        super.sio = new DbCon().getSession();
    }

	@Override
	public int getPage(int count, Object obj) {
		// TODO 自动生成方法存根
		return 0;
	}

	@Override
	public void del(String id, String tablename) {
    	//开启事务
        trans = sio.beginTransaction();
        //查找要删除的学生
        String sql = "from org.yangyang.bean.result tab where tab.id=" + id;
        Course cou = (Course) sio.createQuery(sql).list().get(0);
        //输入删除时间
        cou.setDeldate(new Date());
        //进行删除
        sio.saveOrUpdate(cou);
        //提交事务
        trans.commit();

	}

	/** 
	 * Method getCoursebyStuid 通过学员编号得到成绩
	 * @param id           学员编号
	 * @return List<Result>
	 */
    public List<Result> getCoursebyStuid(Student stu){
    	List<Result> result;
        String sql = "from org.yangyang.bean.Result res where res.student.id=" + stu.getId();
        trans = sio.beginTransaction();
        result = sio.createQuery(sql).list();
        trans.commit();
        return result;
    }
    
	/** 
	 * Method getCoursebyStuid 通过课程编号得到成绩
	 * @param id           课程编号
	 * @return List<Result>
	 */
    public List<Result> getCoursebyCoiid(Course co){
    	List<Result> result;
        String sql = "from org.yangyang.bean.Result res where res.course.id=" + co.getId();
        trans = sio.beginTransaction();
        result = sio.createQuery(sql).list();
        trans.commit();
        return result;
    }
}

⌨️ 快捷键说明

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