oa_document_sendbean.java
来自「java开发的办公系统 1.系统管理 (地区管理,部门管理,菜单管理,用户管理」· Java 代码 · 共 759 行 · 第 1/2 页
JAVA
759 行
if(b) sql1+=" where "+filter.toString(); rs = executeQuery(sql1); if(rs.next()){ totalRecord=rs.getInt("total"); } }catch(SQLException e){ System.out.print(e.toString()); } finally{ DBclose(); } return list; } /** * @author Administrator * @param 无 * @return KeyId:插入记录时当前记录的id号 * @see 获得插入记录时当前记录的id号 */ public int getKey(){ return keyId; } /** * @author Administrator * @param 无 * @return (totalRecord):插入记录时当前记录的id号 * @see 获得插入记录时当前记录的id号 */ public int getTotalRecord(){ return totalRecord; } /** * @author Administrator * @param item:要添加的数据对象Oa_document_sendItem * @return boolean:是否添加成功,如果添加成功返回true,否则返回false * @see 添加一条记录 */ public boolean addItem(Oa_document_sendItem item){ try{ String sql="insert into "+T.OA_DOCUMENT_SEND+"("+ "title,"+ "workflow_id,"+ "is_edit_flow,"+ "create_user,"+ "create_name,"+ "create_date,"+ "modify_user,"+ "modify_name,"+ "modify_time,"+ "temple_file,"+ "document_status,"+ "fileExt,"+ "workflow_state_id,"+ "workflow_state_name,"+ "approval_type,"+ "appraisal_method,"+ "approval_user,"+ "approval_name,"+ "approval_departmentid,"+ "approval_department,"+ "func_id,"+ "state_type,"+ "receive_user,"+ "receive_name)values("+ "'"+item.getTitle()+"',"+ ""+item.getWorkflow_id()+","+ ""+item.getIs_edit_flow()+","+ "'"+item.getCreate_user()+"',"+ "'"+item.getCreate_name()+"',"+ "'"+item.getCreate_date()+"',"+ "'"+item.getModify_user()+"',"+ "'"+item.getModify_name()+"',"+ "'"+item.getModify_time()+"',"+ "'"+item.getTemple_file()+"',"+ ""+item.getDocument_status()+","+ "'"+item.getFileExt()+"',"+ ""+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.getFunc_id()+"',"+ ""+item.getState_type()+","+ "'"+item.getReceive_user()+"',"+ "'"+item.getReceive_name()+"')"; return executeUpdate(sql); }catch(Exception e){ System.out.println(e.toString()); return false; } finally{ DBclose(); } } /** * @author Administrator * @param item:要添加的数据对象UsersItem * @return keyId:当前添加记录的id号 否则返回 0 * @see 添加一条记录 */ public int addItemAndMaxId(Oa_document_sendItem item){ try{ String sql="insert into "+T.OA_DOCUMENT_SEND+"("+ "title,"+ "workflow_id,"+ "is_edit_flow,"+ "create_user,"+ "create_name,"+ "create_date,"+ "temple_file,"+ "document_status,"+ "fileExt,"+ "workflow_state_id,"+ "workflow_state_name,"+ "approval_type,"+ "appraisal_method,"+ "approval_user,"+ "approval_name,"+ "approval_departmentid,"+ "approval_department,"+ "func_id,"+ "state_type,"+ "receive_user,"+ "receive_name)values("+ "'"+item.getTitle()+"',"+ ""+item.getWorkflow_id()+","+ ""+item.getIs_edit_flow()+","+ "'"+item.getCreate_user()+"',"+ "'"+item.getCreate_name()+"',"+ "'"+item.getCreate_date()+"',"+ "'"+item.getTemple_file()+"',"+ ""+item.getDocument_status()+","+ "'"+item.getFileExt()+"',"+ ""+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.getFunc_id()+"',"+ ""+item.getState_type()+","+ "'"+item.getReceive_user()+"',"+ "'"+item.getReceive_name()+"')"; executeUpdate(sql); sql = "select max(id) as id from "+T.OA_DOCUMENT_SEND; 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_document_sendItem * @return boolean:如果修改成功返回true,否则返回false * @see 修改一条记录 */ public boolean updateItem(Oa_document_sendItem item){ try{ String sql="update "+T.OA_DOCUMENT_SEND+" set "+ "title='"+item.getTitle()+"',"+ "is_edit_flow="+item.getIs_edit_flow()+","+ "modify_user='"+item.getModify_user()+"',"+ "modify_name='"+item.getModify_name()+"',"+ "modify_time='"+item.getModify_time()+"',"+ "temple_file='"+item.getTemple_file()+"' where id="+item.getId(); return executeUpdate(sql); }catch(Exception e){ System.out.println(e.toString()); return false; } finally{ DBclose(); } } /** * @author Administrator * @param item:要修改的数据对象Oa_document_sendItem * @return boolean:如果修改成功返回true,否则返回false * @see 修改一条记录 */ public boolean updateWorkflowState(Oa_document_sendItem item){ try{ String sql="update "+T.OA_DOCUMENT_SEND+" set "+ "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()+"',"+ "func_id='"+item.getFunc_id()+"',"+ "receive_name='"+item.getReceive_name()+"' where id="+item.getId(); return executeUpdate(sql); }catch(Exception e){ System.out.println(e.toString()); return false; } finally{ DBclose(); } } /** * @author Administrator * @param item:要修改的数据对象Oa_document_sendItem * @return boolean:如果修改成功返回true,否则返回false * @see 修改一条记录 */ public boolean updateDocument_Status(Oa_document_sendItem item){ try{ String sql="update "+T.OA_DOCUMENT_SEND+" set "+ "document_status="+item.getDocument_status()+" where id in ("+item.getId()+")"; return executeUpdate(sql); }catch(Exception e){ System.out.println(e.toString()); return false; } finally{ DBclose(); } } /** * @author Administrator * @param item:要修改的数据对象Oa_document_sendItem * @return boolean:如果修改成功返回true,否则返回false * @see 修改一条记录 */ public boolean updateItemFile(Oa_document_sendItem item){ try{ String sql="update "+T.OA_DOCUMENT_SEND+" set "+ "title='"+item.getTitle()+"',"+ "is_edit_flow="+item.getIs_edit_flow()+","+ "modify_user='"+item.getModify_user()+"',"+ "modify_name='"+item.getModify_name()+"',"+ "modify_time='"+item.getModify_time()+"',"+ "temple_file='"+item.getTemple_file()+"',"+ "fileExt='"+item.getFileExt()+"' where id="+item.getId(); return executeUpdate(sql); }catch(Exception e){ System.out.println(e.toString()); return false; } finally{ DBclose(); } } /** * @author Administrator * @param item:要删除的数据对象Oa_document_sendItem * @return boolean:如果删除成功返回true,否则返回false * @see 删除一条记录 */ public boolean removeItem(Oa_document_sendItem item){ try{ String sql="delete from "+T.OA_DOCUMENT_SEND+" 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_DOCUMENT_SEND+" 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_DOCUMENT_SEND_VERIFYRECORD+" where document_send_id in ("; sql+=filter; sql+=" delete from "+T.OA_DOCUMENT_SEND_FLOWRECORD+" where document_send_id in ("; sql+=filter; sql+=" delete from "+T.OA_DOCUMENT_SEND_RECEIVERECORD+" where document_send_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 + -
显示快捷键?