欢迎来到天天文库
浏览记录
ID:33301066
大小:233.50 KB
页数:51页
时间:2019-02-23
《最新资料图书管理系统程序代码精选》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、模块设计基础模块SqlSession:利用mybatis获取jdbc,其中有inter.select,update,select等方法Stringresource="mybatis-config.xml";InputStreaminputStream=Resources.getResourceAsStream(resource);SqlSessionFactorysqlSessionFactory=newSqlSessionFactoryBuilder().build(inputStream);SqlSessionsesson=
2、sqlSessionFactory.openSession();Dao基础模块所有的dao都继承于BaseDao;代码/***保存利用mybatis的xml*model保存的对象*idmybatis的id名*/PublicvoidSave(BaseModelmodel,Stringid){sesson.inster(idmodel);}……Model基础模块所有的模型都继承于BaseModel;代码片段/***字段编号*/Privateintid;PublicvoidsetId(Stringid){This.id=id;}Pub
3、licStringgetId(){Returnid;}添加书籍代码片段Bookbook=newBook();book.setId(…..);……..Book.setTitle(….);BooksManageDaobookDao=newBooksManageDao();bookDao.save(“addBook”,book);删除书籍代码片段BookDaobookDao=newBookDao();Bookbook=(Book)bookDao.getModel(id);BooksManageDaobookDao=newBooksMa
4、nageDao();bookDao.delete(“deleteBook”,book);更新书籍代码片段BookDaobookDao=newBookDao();Bookbook=(Book)bookDao.getModel(id);book.setId(…..);……..Book.setTitle(….);BooksManageDaobookDao=newBooksManageDao();bookDao.update(“updateBook”,book);查询书籍代码片段//数据库的自定义一页显示10条IntpageNo=“当前
5、页数”BooksManageDaobookDao=newBooksManageDao();bookDao.select(“selectteBook”,pageNo);添加用户代码片段Studentstudent=newStudent();student.setId(…..);……..student.setTitle(….);StudentDaostudentDao=newStudentDao();studentDao.save(“addStudent”,book);删除用户代码片段Intid=“字段编号”StudentDaost
6、udentDao=newStudentDao()Studentstudent=(Student)studentDao.getModel(id);student.setId(…..);StudentDaostudentDao=newStudentDao();studentDao.delete(“deleteStudent”,book);更新用户代码片段Intid=“字段编号”StudentDaostudentDao=newStudentDao()Studentstudent=(Student)studentDao.getModel
7、(id);student.setId(…..);……..student.setTitle(….);StudentDaostudentDao=newStudentDao();studentDao.update(“updeteStudent”,book);查询用户代码片段//数据库的自定义一页显示10条IntpageNo=“当前页数”StudentDaostudentDao=newStudentDao();studentDao.select(“selectStudent”,pageNo);借阅书籍代码片段Borrowborrow=n
8、ewBorrow();Studentstudent=newStudent();student.setId(…..);……..student.setTitle(….);Bookbook=newBook();book.setId(…..);……..book.setT
此文档下载收益归作者所有