亞寵展、全球寵物產業風向標——亞洲寵物展覽會深度解析
829
2025-04-02
在企業文化建設中,會有不少公司在創辦自己的圖書館,以營造更好的學習氛圍,為員工提供優良的學習環境。
但圖書的借出、歸還、圖書信息管理對于行政人員來說是個比較麻煩的事,總是拿紙筆來登記、記錄不僅麻煩、易丟失,而且對所有圖書及人員的借閱數據進行分析。
缺乏有效的統計和分析,便難以了解各分類圖書的借閱頻次或者各部門人員的借閱次數,知曉哪些是受歡迎的圖書,哪些人員愛讀書,無法完美實現團隊閱讀文化、學習氛圍的營造和建設。
那么想要一款無需編碼、任意定制的在線、移動圖書管理系統,該從何做起呢?
下面我們一起來看!
用來記錄、管理企業圖書館的所有圖書信息。
字段設置:
圖書編號-單行文本,書名-當行文本,圖書分類-下拉框/單選按鈕,作者-單行文本,出版社-單行文本,定價-數字,借閱狀態-單行文本(默認值:可借閱)
*注:“圖書編號”可以開啟單行文本的掃碼輸入,直接掃圖書的出版條形碼獲取圖書的唯一編碼。 如下圖。
用來獲取員工的借閱申請,借出記錄,歸還記錄信息。并根據借出、歸還,自動修改圖書信息表里的圖書借閱狀態(簡道云的智能助手功能)。
圖書借閱是需要有人來審批的,所以這個表單采用流程表單設計。
流程設計如下(根據自己公司內部流程定制):
字段設置:
① 員工申請節點:
借閱狀態-單行文本(默認值:可借閱;用來限制用戶瀏覽到的圖書都是可借閱的)
部門-部門單選
借閱人-成員單選
書名-單行文本(數據聯動)
圖書信息-關聯查詢(關聯條件限定,根據圖書名稱來唯一限定)
② 借閱審批節點:
借閱審批-單選按鈕
借出時間-日期時間
到期時間-日期時間(可設置默認借閱時長)
借出簽字-手寫簽名(借出東西總是要簽字畫押確認的)
③ 圖書歸還節點:
是否歸還-單選按鈕
歸還時間-日期時間
借閱次數-數字(借閱審批=同意為1,否則為0)
圖書借閱的申請審批過后,員工領取圖書并簽字確認后,該圖書的借閱狀態就該變更為已借出,將無法再在借閱申請里出現這本書的書名了(因為有借閱狀態的聯動設置)。
而當員工歸還圖書,行政人員做好歸還登記后,即填寫歸還日期后,則改圖書的借閱狀態就該回復為可借閱狀態了。
圖書買了一本本,借閱審批一條條,到底哪些部門、哪些個人在借書?他們有喜歡看什么類型的書?哪本書最受歡迎?
這些就需要看下圖了!
這個儀表盤的數據來源于圖書信息表和圖書借閱審批表,經過數據工廠的加工后的復合數據。
到此,一個圖書借閱管理系統就定制完畢了,完全不需要任何碼代碼的過程,全程拖拽搞定。
圖書借閱管理系統java代碼
本文實例為大家分享了java實現簡單圖書借閱系統的具體代碼,供大家參考,具體內容如下
直接看代碼:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | package ttt; import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.border.TitledBorder; import javax.swing.table.DefaultTableModel; public class Labmsys extends JFrame{ JTable booktable= null ; static DefaultTableModel bookmodel= null ; JTable borrowtable= null ; static DefaultTableModel bmodel= null ; JPanel j1= new JPanel(); JPanel j2= new JPanel(); JPanel j3= new JPanel(); JButton button1= new JButton( "借書" ); JButton button2= new JButton( "還書" ); public Labmsys() { this .setLayout( new BorderLayout()); this .add(j1,BorderLayout.WEST); this .add(j2,BorderLayout.EAST); this .add(j3,BorderLayout.CENTER); j1.setBorder( new TitledBorder( "圖書借書表" )); j2.setBorder( new TitledBorder( "圖書庫存表" )); this .booktable=bookIn(); this .borrowtable=borrowIn(); JScrollPane jsp1= new JScrollPane(borrowtable); JScrollPane jsp2= new JScrollPane(booktable); j1.add(jsp1); j2.add(jsp2); j3.add(button1); j3.add(button2); //添加借書- button1.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub int rowNum=booktable.getSelectedRow(); System.out.println(rowNum); if (rowNum>= 0 ) { String isbn=booktable.getValueAt(rowNum, 0 ).toString(); System.out.println(isbn); int count=Integer.parseInt((String) booktable.getValueAt(rowNum, 2 )); String s=JOptionPane.showInputDialog( "請輸入學號" ); if (count<= 0 ) JOptionPane.showMessageDialog( null , "圖書庫存不足" ); else if ( null ==s) JOptionPane.showMessageDialog( null , "請輸入學號" ); else { if (borrowBook(isbn,s)) { System.out.println( "yes" ); JOptionPane.showMessageDialog( null , "successful!" ); } else JOptionPane.showMessageDialog( null , "Wrong!" ); } } else JOptionPane.showMessageDialog( null , "Choose book!" ); } }); //添加還書- button2.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub int rowNum=borrowtable.getSelectedRow(); System.out.println(rowNum); if (rowNum>= 0 ) { String isbn=borrowtable.getValueAt(rowNum, 2 ).toString(); String tablexh = borrowtable.getValueAt(rowNum, 1 ).toString(); System.out.println(isbn); String xh=JOptionPane.showInputDialog( "請輸入學號" ); if (!xh.equals(tablexh)) JOptionPane.showMessageDialog( null , "學號不正確" ); else { if (returnBook(isbn)) { JOptionPane.showMessageDialog( null , "successful!" ); } else JOptionPane.showMessageDialog( null , "Wrong!" ); } } else JOptionPane.showMessageDialog( null , "Choose book!" ); } }); } public boolean borrowBook(String isbn, String s) { int xh = Integer.parseInt(s); int isbn2 =Integer.parseInt(isbn); System.out.println( "學號:" +xh); boolean b= false ; String driver= "com.mysql.jdbc.Driver" ; String url= "jdbc:mysql://localhost:3306/test" ; String user= "root" ; String password= "123456" ; Connection conn= null ; Statement stmt= null ; try { Class.forName(driver); conn = DriverManager.getConnection(url, user, password); stmt = conn.createStatement(); System.out.println( "isbn:" +isbn); conn.setAutoCommit( false ); String sql1 = "update book set count=count-1 where isbn='" +isbn2+ "'" ; String sql2 = "insert into borrow(xh,isbn) values('" +xh+ "','" +isbn2+ "')" ; stmt.executeUpdate(sql1); stmt.executeUpdate(sql2); System.out.println( "isbn2:" +isbn2); //stmt = (PreparedStatement) conn.prepareStatement("update book set count=count-1 where isbn=?"); conn.commit(); stmt.close(); conn.close(); b= true ; } catch (Exception e) { try { conn.rollback(); } catch (Exception e1){e1.printStackTrace();} } return b; } private boolean returnBook(String isbn) { int isbn2 =Integer.parseInt(isbn); boolean b= false ; String driver= "com.mysql.jdbc.Driver" ; String url= "jdbc:mysql://localhost:3306/test" ; String user= "root" ; String password= "123456" ; Connection conn= null ; Statement stmt= null ; try { Class.forName(driver); conn = DriverManager.getConnection(url, user, password); stmt = conn.createStatement(); conn.setAutoCommit( false ); stmt.executeUpdate( "delete from borrow where isbn='" +isbn2+ "'" ); stmt.executeUpdate( "update book set count=count+1 where isbn='" +isbn2+ "'" ); System.out.println( "還書isbn2:" +isbn2); conn.commit(); stmt.close(); conn.close(); b= true ; } catch (Exception e) { try { conn.rollback(); } catch (Exception e1){e1.printStackTrace();}} return b; } private JTable borrowIn() { // TODO Auto-generated method stub String []head={ "id" , "xh" , "ISBN" }; String [][]data= null ; bookmodel= new DefaultTableModel(data,head); JTable t= new JTable(bookmodel); String driver= "com.mysql.jdbc.Driver" ; String url= "jdbc:mysql://localhost:3306/test" ; String user= "root" ; String password= "123456" ; Connection conn= null ; Statement stmt= null ; ResultSet rs= null ; try { Class.forName(driver); conn = DriverManager.getConnection(url, user, password); stmt = conn.createStatement(); rs=stmt.executeQuery( "select * from borrow" ); String[] row= new String[ 3 ]; while (rs.next()){ row[ 0 ]=rs.getString( 1 ); row[ 1 ]=rs.getString( 2 ); row[ 2 ]=rs.getString( 3 ); bookmodel.addRow(row); bookmodel.fireTableDataChanged(); } rs.close(); stmt.close(); conn.close();} catch (Exception e) { // TODO Auto-generated catch block System.out.println(e); } return t; } public JTable bookIn() { // TODO Auto-generated method stub String []head={ "ISBN" , "name" , "count" }; String [][]data= null ; bmodel= new DefaultTableModel(data,head); JTable t= new JTable(bmodel); String driver= "com.mysql.jdbc.Driver" ; String url= "jdbc:mysql://localhost:3306/test" ; String user= "root" ; String password= "123456" ; Connection conn= null ; Statement stmt= null ; ResultSet rs= null ; try { Class.forName(driver); conn = DriverManager.getConnection(url, user, password); stmt = conn.createStatement(); rs=stmt.executeQuery( "select * from book" ); String[] row= new String[ 3 ]; while (rs.next()){ row[ 0 ]=rs.getString( 1 ); row[ 1 ]=rs.getString( 2 ); row[ 2 ]=rs.getString( 3 ); bmodel.addRow(row); bmodel.fireTableDataChanged(); } rs.close(); stmt.close(); conn.close();} catch (Exception e) { // TODO Auto-generated catch block System.out.println(e); } return t; } public static void main(String[] args) { // TODO Auto-generated method stub Labmsys n= new Labmsys(); n.setTitle( "圖書借閱管理系統" ); n.setSize( 1000 , 500 ); n.setLocationRelativeTo( null ); n.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); n.setVisible( true ); } } |
數據庫:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | -- -- Table structure for table `book` -- DROP TABLE IF EXISTS `book`; CREATE TABLE `book` ( `ISBN` int (11) NOT NULL , ` name ` varchar (50) NOT NULL , ` count ` int (11) default NULL , PRIMARY KEY (`ISBN`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `book` -- LOCK TABLES `book` WRITE; /*!40000 ALTER TABLE `book` DISABLE KEYS */; INSERT INTO `book` VALUES (662530, 'c#' ,9),(662545, 'python' ,12),(663520, 'c++' ,6),(663548, 'java' ,8); /*!40000 ALTER TABLE `book` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `borrow` -- DROP TABLE IF EXISTS `borrow`; CREATE TABLE `borrow` ( `id` int (11) NOT NULL auto_increment, `xh` int (11) NOT NULL , `isbn` int (11) NOT NULL , PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `borrow` -- LOCK TABLES `borrow` WRITE; /*!40000 ALTER TABLE `borrow` DISABLE KEYS */; INSERT INTO `borrow` VALUES (1006,123456,662545),(1007,456789,663520),(1009,789456,6 |
版權聲明:本文內容由網絡用戶投稿,版權歸原作者所有,本站不擁有其著作權,亦不承擔相應法律責任。如果您發現本站中有涉嫌抄襲或描述失實的內容,請聯系我們jiasou666@gmail.com 處理,核實后本網站將在24小時內刪除侵權內容。
版權聲明:本文內容由網絡用戶投稿,版權歸原作者所有,本站不擁有其著作權,亦不承擔相應法律責任。如果您發現本站中有涉嫌抄襲或描述失實的內容,請聯系我們jiasou666@gmail.com 處理,核實后本網站將在24小時內刪除侵權內容。