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

📄 c422noticedao.java

📁 使用spring ,hibernate 框架的稽查管理系统
💻 JAVA
字号:
package com.je.ims.dao;

import java.util.List;
import java.util.*;
import com.je.ims.hibernate.Notice;
import com.je.ims.hibernate.Notion;

public class C422NoticeDAO extends CommonDAO {

	public Object[] getCount(int start, int size) {
        List list=getAll();
    	
    	Notice[] app = new Notice[size];
		
		for (int i=0;i<size;i++)
		{
			app[i]=new Notice();
			app[i]=(Notice)list.get(i+start);
		}
		return app;
	}
	
	public Object[] getCount(int start, int size,List l){

    	List list=l;
    	
    	Notice[] app = new Notice[size];
		
		for (int i=0;i<size;i++)
		{
		    app[i]=new Notice();
			app[i]=(Notice)list.get(i+start);
		}
		return app;
    }
	
	public List getAll() {
    	
		   String hql="from Notice";
		   List list=this.getHibernateTemplate().find(hql);
		   return list;
		
	}
	
	public Notice getNoticeById(String sid){
		try{
		Long l=new Long(sid);
		Notice notice=(Notice)this.getHibernateTemplate().get(Notice.class,l);
		return notice;
		
	}catch(Exception e){
		return null;
	}
	}
	
	public List queryNotice(String year,String month){		 		
		 Long i=new Long(year);
		 long m=i.longValue();
		 long tempYear=m+1911;
		 Long yearL=new Long(tempYear);
		 Long monthL=new Long(month);
		 String hql="from Notice where year="+yearL+"and month="+monthL;
		 List l=this.getHibernateTemplate().find(hql);
		 return l;
	}
	
	public void saveNotice(){
		Notice notice=new Notice();
		notice.setFileId("060902B");
		notice.setTitle("關於實習");
		notice.setYear(new Long(2006));
		notice.setMonth(new Long(1));
		notice.setNoticeOrg("軟件學院");
		notice.setDateTime(new Date());
		notice.setProceeding("今天下午花旗軟件公司要來軟件學院招聘實習生,望有關部門接洽是與!");
		notice.setRemark("本次招聘計劃為15個人,請通知同學們!");
	    notice.setPlace("開發區");  
		notice.setEditState(new Long(2));
		notice.setEditorName("Jackie");
		notice.setModifyTime(new Date());
		notice.setReceiveState(new Long(1));
		notice.setReceiverName("Brookly");
		notice.setReceiveDate(new Date());
	//	Notice notice=new Notice("060902A","实习生招聘",new Long(2006),new Long(1),"大连理工大学",new Long(2),"Jackie","Eric",new Date());
		this.getHibernateTemplate().saveOrUpdate(notice);
		this.getHibernateTemplate().flush();
		
	}
	
	
	

}

⌨️ 快捷键说明

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