oa_archive_borrowbean.java
来自「java开发的办公系统 1.系统管理 (地区管理,部门管理,菜单管理,用户管理」· Java 代码 · 共 945 行 · 第 1/3 页
JAVA
945 行
} } /** * @author Administrator * @param item:要添加的数据对象UsersItem * @return keyId:当前添加记录的id号 否则返回 0 * @see 添加一条记录 */ public int addItemAndMaxId(Oa_archive_borrowItem item){ try{ String sql="insert into "+T.OA_ARCHIVE_BORROW+"("+ "archive_information_id,"+ "archive_category_id,"+ "archive_category_nodepath,"+ "archive_no,"+ "archive_title,"+ "copies_num,"+ "page_num,"+ "borrow_destination,"+ "borrow_user,"+ "borrow_name,"+ "borrow_departmentid,"+ "borrow_department,"+ "borrow_date,"+ "back_date,"+ "back_user,"+ "back_name,"+ "realback_date,"+ "back_confirm_user,"+ "back_confirm_name,"+ "complete_info,"+ "workflow_id,"+ "workflow_state_id,"+ "workflow_state_name,"+ "approval_type,"+ "appraisal_method,"+ "approval_user,"+ "approval_name,"+ "approval_departmentid,"+ "approval_department,"+ "receive_user,"+ "receive_name,"+ "func_id,"+ "appraisal_result,"+ "state_type)values("+ ""+item.getArchive_information_id()+","+ ""+item.getArchive_category_id()+","+ "'"+item.getArchive_category_nodepath()+"',"+ "'"+item.getArchive_no()+"',"+ "'"+item.getArchive_title()+"',"+ ""+item.getCopies_num()+","+ ""+item.getPage_num()+","+ "'"+item.getBorrow_destination()+"',"+ "'"+item.getBorrow_user()+"',"+ "'"+item.getBorrow_name()+"',"+ ""+item.getBorrow_departmentid()+","+ "'"+item.getBorrow_department()+"',"+ "'"+item.getBorrow_date()+"',"+ "'"+item.getBack_date()+"',"+ "'"+item.getBack_user()+"',"+ "'"+item.getBack_name()+"',"+ "'"+item.getRealback_date()+"',"+ "'"+item.getBack_confirm_user()+"',"+ "'"+item.getBack_confirm_name()+"',"+ "'"+item.getComplete_info()+"',"+ ""+item.getWorkflow_id()+","+ ""+item.getWorkflow_state_id()+","+ "'"+item.getWorkflow_state_name()+"',"+ ""+item.getApproval_type()+","+ ""+item.getAppraisal_method()+","+ "'"+item.getApproval_user()+"',"+ "'"+item.getApproval_name()+"',"+ "'"+item.getApproval_departmentid()+"',"+ "'"+item.getApproval_department()+"',"+ "'"+item.getReceive_user()+"',"+ "'"+item.getReceive_name()+"',"+ "'"+item.getFunc_id()+"',"+ ""+item.getAppraisal_result()+","+ ""+item.getState_type()+")"; executeUpdate(sql); sql = "select max(id) as id from "+T.OA_ARCHIVE_BORROW; rs = executeQuery(sql); if (rs.next()) { keyId = rs.getInt("id"); return keyId; } else return 0; }catch(SQLException e){ System.out.println(e.toString()); return 0; } finally{ DBclose(); } } /** * @author Administrator * @param item:要修改的数据对象Oa_archive_borrowItem * @return boolean:如果修改成功返回true,否则返回false * @see 修改一条记录 */ public boolean updateItem(Oa_archive_borrowItem item){ try{ String sql="update "+T.OA_ARCHIVE_BORROW+" set "+ "archive_information_id="+item.getArchive_information_id()+","+ "archive_category_id="+item.getArchive_category_id()+","+ "archive_category_nodepath='"+item.getArchive_category_nodepath()+"',"+ "archive_no='"+item.getArchive_no()+"',"+ "archive_title='"+item.getArchive_title()+"',"+ "copies_num="+item.getCopies_num()+","+ "page_num="+item.getPage_num()+","+ "borrow_destination='"+item.getBorrow_destination()+"',"+ "borrow_user='"+item.getBorrow_user()+"',"+ "borrow_name='"+item.getBorrow_name()+"',"+ "borrow_departmentid="+item.getBorrow_departmentid()+","+ "borrow_department='"+item.getBorrow_department()+"',"+ "borrow_date='"+item.getBorrow_date()+"',"+ "back_date='"+item.getBack_date()+"',"+ "back_user='"+item.getBack_user()+"',"+ "back_name='"+item.getBack_name()+"',"+ "realback_date='"+item.getRealback_date()+"',"+ "back_confirm_user='"+item.getBack_confirm_user()+"',"+ "back_confirm_name='"+item.getBack_confirm_name()+"',"+ "complete_info='"+item.getComplete_info()+"',"+ "workflow_state_id="+item.getWorkflow_state_id()+","+ "workflow_state_name='"+item.getWorkflow_state_name()+"',"+ "approval_type="+item.getApproval_type()+","+ "appraisal_method="+item.getAppraisal_method()+","+ "approval_user='"+item.getApproval_user()+"',"+ "approval_name='"+item.getApproval_name()+"',"+ "approval_departmentid='"+item.getApproval_departmentid()+"',"+ "approval_department='"+item.getApproval_department()+"',"+ "receive_user='"+item.getReceive_user()+"',"+ "receive_name='"+item.getReceive_name()+"',"+ "func_id='"+item.getFunc_id()+"',"+ "state_type="+item.getState_type()+" where id="+item.getId(); return executeUpdate(sql); }catch(Exception e){ System.out.println(e.toString()); return false; } finally{ DBclose(); } } public boolean updateAppraisal_result(String appraisal_result,String id){ try{ String sql="update "+T.OA_ARCHIVE_BORROW+" set "+ "appraisal_result="+appraisal_result+" where id="+id; return executeUpdate(sql); }catch(Exception e){ System.out.println(e.toString()); return false; } finally{ DBclose(); } } /** * @author Administrator * @param item:要修改的数据对象Oa_archive_borrowItem * @return boolean:如果修改成功返回true,否则返回false * @see 修改一条记录 */ public boolean updateItemFile(Oa_archive_borrowItem item){ try{ String sql="update "+T.OA_ARCHIVE_BORROW+" set "+ "archive_information_id="+item.getArchive_information_id()+","+ "archive_category_id="+item.getArchive_category_id()+","+ "archive_category_nodepath='"+item.getArchive_category_nodepath()+"',"+ "archive_no='"+item.getArchive_no()+"',"+ "archive_title='"+item.getArchive_title()+"',"+ "copies_num="+item.getCopies_num()+","+ "page_num="+item.getPage_num()+","+ "borrow_destination='"+item.getBorrow_destination()+"',"+ "borrow_user='"+item.getBorrow_user()+"',"+ "borrow_name='"+item.getBorrow_name()+"',"+ "borrow_departmentid="+item.getBorrow_departmentid()+","+ "borrow_department='"+item.getBorrow_department()+"',"+ "borrow_date='"+item.getBorrow_date()+"',"+ "back_date='"+item.getBack_date()+"',"+ "back_user='"+item.getBack_user()+"',"+ "back_name='"+item.getBack_name()+"',"+ "realback_date='"+item.getRealback_date()+"',"+ "back_confirm_user='"+item.getBack_confirm_user()+"',"+ "back_confirm_name='"+item.getBack_confirm_name()+"',"+ "complete_info='"+item.getComplete_info()+"',"+ "workflow_state_id="+item.getWorkflow_state_id()+","+ "workflow_state_name='"+item.getWorkflow_state_name()+"',"+ "approval_type="+item.getApproval_type()+","+ "appraisal_method="+item.getAppraisal_method()+","+ "approval_user='"+item.getApproval_user()+"',"+ "approval_name='"+item.getApproval_name()+"',"+ "approval_departmentid='"+item.getApproval_departmentid()+"',"+ "approval_department='"+item.getApproval_department()+"',"+ "receive_user='"+item.getReceive_user()+"',"+ "receive_name='"+item.getReceive_name()+"',"+ "func_id='"+item.getFunc_id()+"',"+ "state_type="+item.getState_type()+" where id="+item.getId(); return executeUpdate(sql); }catch(Exception e){ System.out.println(e.toString()); return false; } finally{ DBclose(); } } /** * @author Administrator * @param item:要删除的数据对象Oa_archive_borrowItem * @return boolean:如果删除成功返回true,否则返回false * @see 删除一条记录 */ public boolean removeItem(Oa_archive_borrowItem item){ try{ String sql="delete from "+T.OA_ARCHIVE_BORROW+" where id="+item.getId() ; return executeUpdate(sql); }catch(Exception e){ System.out.println(e.toString()); return false; } finally{ DBclose(); } } /** * @author Administrator * @param ids:要删除的记录的ids数组 * @return boolean:如果删除成功返回true,否则返回false * @see 批量删除条记录 */ public boolean removeItems(String[] ids) { try{ String sql="delete from "+T.OA_ARCHIVE_BORROW+" where id in ("; String filter=""; for(int i=0;i<ids.length-1;i++){ filter+=ids[i]+","; } filter+=ids[ids.length-1]+")"; sql+=filter; sql+=" delete from "+T.OA_ARCHIVE_BORROW_VERIFYRECORD+" where oa_archive_borrow_id in ("; sql+=filter; sql+=" delete from "+T.OA_ARCHIVE_BORROW_FLOWRECORD+" where oa_archive_borrow_id in ("; sql+=filter; return executeUpdate(sql); }catch(Exception e){ System.out.println(e.toString()); return false; } finally{ DBclose(); } } /** * @author Administrator * @param sql:要更新的sql 语句 * @return boolean:如果执行成功返回true,否则返回false * @see 执行更新一条sql 语句 */ public boolean executeUpdate(String sql){ try{ access.getConnection(); return access.executeUpdate(sql); } catch(Exception e){ System.out.println(e.toString()); return false; } } /** * @author Administrator * @param sql:要查询的sql 语句 * @return boolean:如果执行成功返回true,否则返回false * @see 执行查询一条sql 语句 */ public ResultSet executeQuery(String sql){ try { access.getConnection(); rs=access.executeQuery(sql); return rs; } catch(Exception e){ System.out.println(e.toString()); return null; } } /** * @author Administrator * @param 无 * @return 无 * @see 关闭数据库操作对象 */ public void DBclose(){ try { access.DBclose(rs); } catch(Exception e) { System.out.println(e.toString()); } }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?