oa_archive_informationbean.java
来自「java开发的办公系统 1.系统管理 (地区管理,部门管理,菜单管理,用户管理」· Java 代码 · 共 679 行 · 第 1/2 页
JAVA
679 行
package com.vere.oa.archive.bean; import java.sql.*; import java.util.*; import com.vere.db.*; import com.vere.manager.item.Oa_dictionaryItem; import com.vere.oa.archive.item.Oa_archive_categoryItem; import com.vere.oa.archive.item.Oa_archive_informationItem; public class Oa_archive_informationBean { private ResultSet rs=null; private int keyId; private int totalRecord; private Access access = null; public Oa_archive_informationBean() { try { access=new Access(); } catch(Exception e) { System.out.println(e.toString()); } } /** * @author Administrator * @param 无 * @return ArrayList:Oa_archive_informationItem 对象的 ArrayList 数组 * @see 取出 oa_archive_information 表中的所有记录,每一条记录存储在一个 Oa_archive_informationItem 对象中 */ public List find(){ ArrayList list=new ArrayList(); try { String sql="select * from "+T.OA_ARCHIVE_INFORMATION; rs = executeQuery(sql); while(rs.next()){ Oa_archive_informationItem item=new Oa_archive_informationItem(); item.setId(rs.getString("id")); item.setArchive_category_id(rs.getString("archive_category_id")); item.setArchive_category_nodepath(rs.getString("archive_category_nodepath")); item.setTimelimit_type(rs.getString("timelimit_type")); item.setStart_timelimit(rs.getString("start_timelimit")); item.setEnd_timelimit(rs.getString("end_timelimit")); item.setArchive_no(rs.getString("archive_no")); item.setArchive_title(rs.getString("archive_title")); item.setApproval_user(rs.getString("approval_user")); item.setApproval_name(rs.getString("approval_name")); item.setBorrow_departmentid(rs.getString("borrow_departmentid")); item.setBorrow_department(rs.getString("borrow_department")); item.setArchive_user(rs.getString("archive_user")); item.setArchive_name(rs.getString("archive_name")); item.setArchive_time(rs.getString("archive_time")); item.setSave_location(rs.getString("save_location")); item.setIntroduction(rs.getString("introduction")); item.setMeno(rs.getString("meno")); item.setFileExt(rs.getString("fileExt")); list.add(item); } }catch(SQLException e){ System.out.print(e.toString()); } finally{ DBclose(); } return list; } /** * @author Administrator * @param 无 * @return ArrayList:Oa_archive_informationItem 对象的 ArrayList 数组 * @see 取出 oa_archive_information 表中的所有记录,每一条记录存储在一个 Oa_archive_informationItem 对象中 */ public List findByIds(String ids){ ArrayList list=new ArrayList(); try { String sql="select * from "+T.OA_ARCHIVE_INFORMATION+" where id in ("+ids+")"; rs = executeQuery(sql); while(rs.next()){ Oa_archive_informationItem item=new Oa_archive_informationItem(); item.setId(rs.getString("id")); item.setArchive_category_id(rs.getString("archive_category_id")); item.setArchive_category_nodepath(rs.getString("archive_category_nodepath")); item.setTimelimit_type(rs.getString("timelimit_type")); item.setStart_timelimit(rs.getString("start_timelimit")); item.setEnd_timelimit(rs.getString("end_timelimit")); item.setArchive_no(rs.getString("archive_no")); item.setArchive_title(rs.getString("archive_title")); item.setApproval_user(rs.getString("approval_user")); item.setApproval_name(rs.getString("approval_name")); item.setBorrow_departmentid(rs.getString("borrow_departmentid")); item.setBorrow_department(rs.getString("borrow_department")); item.setArchive_user(rs.getString("archive_user")); item.setArchive_name(rs.getString("archive_name")); item.setArchive_time(rs.getString("archive_time")); item.setSave_location(rs.getString("save_location")); item.setIntroduction(rs.getString("introduction")); item.setMeno(rs.getString("meno")); item.setFileExt(rs.getString("fileExt")); list.add(item); } }catch(SQLException e){ System.out.print(e.toString()); } finally{ DBclose(); } return list; } /** * @author Administrator * @param id: 当前要修改记录的id号 * @return Oa_archive_informationItem * @see 取出 oa_archive_information 表中的指定id号的一条记录存储在一个 Oa_archive_informationItem 对象中 */ public Oa_archive_informationItem find(String id){ try { String sql="select "+T.OA_ARCHIVE_INFORMATION+".* ,"+T.OA_ARCHIVE_CATEGORY+".name as "+T.OA_ARCHIVE_CATEGORY+"_name ,"+T.OA_DICTIONARY+".code_name as "+T.OA_DICTIONARY+"_code_name from "+T.OA_ARCHIVE_INFORMATION+" ,"+T.OA_ARCHIVE_CATEGORY+" ,"+T.OA_DICTIONARY+" where "+T.OA_ARCHIVE_INFORMATION+".archive_category_id = "+T.OA_ARCHIVE_CATEGORY+".id and "+T.OA_ARCHIVE_INFORMATION+".timelimit_type = "+T.OA_DICTIONARY+".num and "+T.OA_ARCHIVE_INFORMATION+".id="+id; rs = executeQuery(sql); Oa_archive_informationItem item=new Oa_archive_informationItem(); if(rs.next()){ item.setId(rs.getString("id")); item.setArchive_category_id(rs.getString("archive_category_id")); item.setArchive_category_nodepath(rs.getString("archive_category_nodepath")); item.setTimelimit_type(rs.getString("timelimit_type")); item.setStart_timelimit(rs.getString("start_timelimit")); item.setEnd_timelimit(rs.getString("end_timelimit")); item.setArchive_no(rs.getString("archive_no")); item.setArchive_title(rs.getString("archive_title")); item.setApproval_user(rs.getString("approval_user")); item.setApproval_name(rs.getString("approval_name")); item.setBorrow_departmentid(rs.getString("borrow_departmentid")); item.setBorrow_department(rs.getString("borrow_department")); item.setArchive_user(rs.getString("archive_user")); item.setArchive_name(rs.getString("archive_name")); item.setArchive_time(rs.getString("archive_time")); item.setSave_location(rs.getString("save_location")); item.setIntroduction(rs.getString("introduction")); item.setMeno(rs.getString("meno")); item.setFileExt(rs.getString("fileExt")); Oa_archive_categoryItem oa_archive_categoryItem=new Oa_archive_categoryItem(); oa_archive_categoryItem.setName(rs.getString(T.OA_ARCHIVE_CATEGORY+"_name")); item.setOa_archive_categoryItem(oa_archive_categoryItem); Oa_dictionaryItem oa_dictionaryItem=new Oa_dictionaryItem(); oa_dictionaryItem.setCode_name(rs.getString(T.OA_DICTIONARY+"_code_name")); item.setOa_dictionaryItem(oa_dictionaryItem); } return item; }catch(SQLException e){ System.out.print(e.toString()); return null; } finally{ DBclose(); } } /** * @author Administrator * @param aItem: 查询的数据对象,page: 翻页时的当前页,pageSize: 翻页的每页显示的记录条数 * @return ArrayList:Oa_archive_informationItem 对象的 ArrayList 数组 * @see 查出 oa_archive_information 表中的指定数据,页号,页大小的每一条记录存储在一个 Oa_archive_informationItem 对象中 */ public List find(Oa_archive_informationItem aItem,int page,int pageSize){ int nextPageSize=pageSize*(page-1); ArrayList list=new ArrayList(); try { boolean b=false; StringBuffer filter=new StringBuffer(); String fvalue=null; fvalue=aItem.getArchive_category_id(); if(fvalue!=null && fvalue.length()>0) { if(b) filter.append(" and"); filter.append(" (','+"+T.OA_ARCHIVE_INFORMATION+".archive_category_nodepath+',' like ',%"+fvalue+"%,' or "+T.OA_ARCHIVE_INFORMATION+".archive_category_id ="+fvalue+") "); b=true; } fvalue=aItem.getTimelimit_type(); if(fvalue!=null && fvalue.length()>0) { if(b) filter.append(" and"); filter.append(" "+T.OA_ARCHIVE_INFORMATION+".timelimit_type ="+fvalue+" "); b=true; } fvalue=aItem.getArchive_time(); if(fvalue!=null && fvalue.length()>0) { if(b) filter.append(" and"); filter.append(" DATEDIFF(day,"+T.OA_ARCHIVE_INFORMATION+".archive_time,'"+fvalue+"')=0 "); b=true; } fvalue=aItem.getStart_timelimit(); if(fvalue!=null && fvalue.length()>0) { if(b) filter.append(" and"); filter.append(" DATEDIFF(day,"+T.OA_ARCHIVE_INFORMATION+".start_timelimit,'"+fvalue+"')>=0 "); b=true; } fvalue=aItem.getEnd_timelimit(); if(fvalue!=null && fvalue.length()>0) { if(b) filter.append(" and"); filter.append(" DATEDIFF(day,"+T.OA_ARCHIVE_INFORMATION+".end_timelimit,'"+fvalue+"')<=0 "); b=true; } fvalue=aItem.getArchive_no(); if(fvalue!=null && fvalue.length()>0) { if(b) filter.append(" and"); filter.append(" "+T.OA_ARCHIVE_INFORMATION+".archive_no like '%"+fvalue+"%' "); b=true; } fvalue=aItem.getArchive_title(); if(fvalue!=null && fvalue.length()>0) { if(b) filter.append(" and"); filter.append(" "+T.OA_ARCHIVE_INFORMATION+".archive_title like '%"+fvalue+"%' "); b=true; } fvalue=aItem.getApproval_user(); if(fvalue!=null && fvalue.length()>0) { if(b) filter.append(" and"); filter.append(" "+T.OA_ARCHIVE_INFORMATION+".approval_user like '%"+fvalue+"%' "); b=true; } fvalue=aItem.getApproval_name(); if(fvalue!=null && fvalue.length()>0) { if(b) filter.append(" and"); filter.append(" "+T.OA_ARCHIVE_INFORMATION+".approval_name like '%"+fvalue+"%' "); b=true; } fvalue=aItem.getBorrow_departmentid(); if(fvalue!=null && fvalue.length()>0) { if(b) filter.append(" and"); filter.append(" "+T.OA_ARCHIVE_INFORMATION+".borrow_departmentid like '%"+fvalue+"%' "); b=true; } fvalue=aItem.getBorrow_department(); if(fvalue!=null && fvalue.length()>0) { if(b) filter.append(" and"); filter.append(" "+T.OA_ARCHIVE_INFORMATION+".borrow_department like '%"+fvalue+"%' "); b=true; } fvalue=aItem.getArchive_user(); if(fvalue!=null && fvalue.length()>0) { if(b) filter.append(" and"); filter.append(" "+T.OA_ARCHIVE_INFORMATION+".archive_user like '%"+fvalue+"%' "); b=true; } fvalue=aItem.getArchive_name(); if(fvalue!=null && fvalue.length()>0) { if(b) filter.append(" and"); filter.append(" "+T.OA_ARCHIVE_INFORMATION+".archive_name like '%"+fvalue+"%' "); b=true; } fvalue=aItem.getSave_location(); if(fvalue!=null && fvalue.length()>0) { if(b) filter.append(" and"); filter.append(" "+T.OA_ARCHIVE_INFORMATION+".save_location like '%"+fvalue+"%' "); b=true; } fvalue=aItem.getIntroduction(); if(fvalue!=null && fvalue.length()>0) { if(b) filter.append(" and"); filter.append(" "+T.OA_ARCHIVE_INFORMATION+".introduction like '%"+fvalue+"%' "); b=true; } fvalue=aItem.getMeno(); if(fvalue!=null && fvalue.length()>0) { if(b) filter.append(" and"); filter.append(" "+T.OA_ARCHIVE_INFORMATION+".meno like '%"+fvalue+"%' "); b=true; } fvalue=aItem.getFileExt(); if(fvalue!=null && fvalue.length()>0) { if(b) filter.append(" and"); filter.append(" "+T.OA_ARCHIVE_INFORMATION+".fileExt like '%"+fvalue+"%' "); b=true; } fvalue="has_link_table"; if(fvalue!=null && fvalue.length()>0) { if(b) filter.append(" and"); filter.append(" "+T.OA_ARCHIVE_INFORMATION+".archive_category_id = "+T.OA_ARCHIVE_CATEGORY+".id and "); filter.append(" "+T.OA_ARCHIVE_INFORMATION+".timelimit_type = "+T.OA_DICTIONARY+".code and "+T.OA_DICTIONARY+".num =8 "); b=true; } StringBuffer sql=new StringBuffer(); sql.append(" select top "+pageSize+" "+T.OA_ARCHIVE_INFORMATION+".* ,"+T.OA_ARCHIVE_CATEGORY+".name as "+T.OA_ARCHIVE_CATEGORY+"_name ,"+T.OA_DICTIONARY+".code_name as "+T.OA_DICTIONARY+"_code_name from "+T.OA_ARCHIVE_INFORMATION+" ,"+T.OA_ARCHIVE_CATEGORY+" ,"+T.OA_DICTIONARY+" where "); if(b) { sql.append(" "+filter.toString()+" and "); } sql.append(" ("+T.OA_ARCHIVE_INFORMATION+".id not in (SELECT TOP "+Integer.toString(nextPageSize)+" "+T.OA_ARCHIVE_INFORMATION+".id from "+T.OA_ARCHIVE_INFORMATION+" ,"+T.OA_ARCHIVE_CATEGORY+" ,"+T.OA_DICTIONARY+" "); if(b) { sql.append(" where "+filter.toString()+" "); } sql.append(" order by "+T.OA_ARCHIVE_INFORMATION+".id desc )) order by "+T.OA_ARCHIVE_INFORMATION+".id desc "); rs = executeQuery(sql.toString()); while(rs.next()){ Oa_archive_informationItem item=new Oa_archive_informationItem(); item.setId(rs.getString("id")); item.setArchive_category_id(rs.getString("archive_category_id")); item.setArchive_category_nodepath(rs.getString("archive_category_nodepath")); item.setTimelimit_type(rs.getString("timelimit_type")); item.setStart_timelimit(rs.getString("start_timelimit")); item.setEnd_timelimit(rs.getString("end_timelimit")); item.setArchive_no(rs.getString("archive_no")); item.setArchive_title(rs.getString("archive_title")); item.setApproval_user(rs.getString("approval_user")); item.setApproval_name(rs.getString("approval_name")); item.setBorrow_departmentid(rs.getString("borrow_departmentid")); item.setBorrow_department(rs.getString("borrow_department")); item.setArchive_user(rs.getString("archive_user")); item.setArchive_name(rs.getString("archive_name")); item.setArchive_time(rs.getString("archive_time")); item.setSave_location(rs.getString("save_location")); item.setIntroduction(rs.getString("introduction")); item.setMeno(rs.getString("meno")); item.setFileExt(rs.getString("fileExt")); Oa_archive_categoryItem oa_archive_categoryItem=new Oa_archive_categoryItem(); oa_archive_categoryItem.setName(rs.getString(T.OA_ARCHIVE_CATEGORY+"_name")); item.setOa_archive_categoryItem(oa_archive_categoryItem); Oa_dictionaryItem oa_dictionaryItem=new Oa_dictionaryItem(); oa_dictionaryItem.setCode_name(rs.getString(T.OA_DICTIONARY+"_code_name"));
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?