图书管理系统——面向对象程序设计韩爽

Action层:publicStringlogin(){booleanflag=iss.login(admin);if(flag){return"success";}message="用户名或口令错误!";return"fail";}Service层:publicbooleanlogin(TAdminadmin){TAdmina=isd.login(admin);if(a!=null){returntrue;}returnfalse;}Dao层:publicTAdminlogin(TAdminadmin){Sessionsession=this.getHibernateTemplate().getSessionFactory().openSession();Queryq=session.createQuery("fromTAdminawherea.adminName=anda.adminPassword=").setString(0,admin.getAdminName()).setString(1,admin.getAdminPassword());TAdmina=(TAdmin)q.uniqueResult();returna;}

2.图书管理模块的实现图书管理模块主要分为图书入库、查看图书、统计图书,其中图书入库是往图书管理数据库中添加图书信息。看图书功能中可以查看图书详细信息,并对图书信息进行修改或删除某些废弃图书信息。(1)图书入库功能的实现点击添加图书功能,填写图书基本信息,为图书选择类型,类型是与数据库交互动态生成的下拉列表.publicStringaddInfoBook(){this.sortList=ibs.listBookSort();return"add";}publicListlistBookSort(){returnthis.getHibernateTemplate().find("fromTSorttsort");}publicStringaddSaveBook(){ibs.saveBook(book);book=null;bookList=this.listBook();return"Book";}publicvoidsaveBook(TBookbook){Datenow=newDate();book.setBuyDate(now);book.setCurrentNum(book.getTotalNum());ibd.saveBook(book);}publicvoidsaveBook(TBookbook){this.getHibernateTemplate().save(book);}3.(1)图书维护功能的实现

returnlist;(2)删除图书功能的实现publicStringdeleteOneBook(){ibs.delBookById(bookNum);bookList=this.listBook();return"Book";}publicStringdeleteMoreBook(){ibs.delMoreBook(bookNums);bookList=this.listBook();return"Book";}publicvoiddelBookById(StringbookNum){this.getHibernateTemplate().delete(this.getHibernateTemplate().get(TBook.class,bookNum));}publicvoiddelMoreBook(String[]bookNums){for(inti=0;i

(3)修改图书信息功能的实现publicStringmodifyInfoBook(){this.sortList=ibs.listBookSort();book=ibs.queryOneBookById(bookNum);return"modifyInfo";}publicStringmodifySaveBook(){ibs.modifyBook(book);book=null;bookList=this.listBook();return"Book";}publicTBookqueryOneBookById(StringbookNum){TBookbook=(TBook)this.getSession().createQuery("fromTBooktbwheretb.bookNum=").setString(0,bookNum).uniqueResult();this.getSession().close();returnbook;}publicvoidmodifyBook(TBookbook){this.getHibernateTemplate().update(book);}(4)查看图书详细信息功能的实现

publicStringinfoDetailBook(){book=ibs.queryOneBookById(bookNum);return"Detail";}publicTBookqueryOneBookById(StringbookNum){TBookbook=(TBook)this.getSession().createQuery("fromTBooktbwheretb.bookNum=").setString(0,bookNum).uniqueResult();this.getSession().close();returnbook;}4.学生管理模块的实现学生管理模块主要分为添加学生、查看学生、修改学生,查看学生的详细信息。(1)学生添加功能的实现

publicStringaddInfoStudent(){this.academyList=iss.listAllAcademy();return"add";}publicvoidaddStudent(TStudentstudent){Datenow=newDate();student.setCreateDate(now);student.setLendedNum(0);isd.saveStudent(student);}其实现的代码如下:publicStringaddInfoStudent(){this.academyList=iss.listAllAcademy();return"add";}publicvoidaddStudent(TStudentstudent){Datenow=newDate();student.setCreateDate(now);student.setLendedNum(0);isd.saveStudent(student);}publicListlistAllAcademy(){returnthis.getHibernateTemplate().find("fromTAcademyta");}publicListlistAllClass(){returnthis.getHibernateTemplate().find("fromTClasstc");}publicvoidsaveStudent(TStudentstudent){this.getHibernateTemplate().save(student);}(2)学生维护功能的实现

publicStringlistAllStudent(){studentList=this.getStudentListByPage();return"Student";}publicListlistAllStudent(Pagepage){Sessionsession=this.getHibernateTemplate().getSessionFactory().openSession();Queryq=session.createQuery("fromTStudentts");q.setFirstResult(page.getStartRow());q.setMaxResults(5);Listlist=q.list();returnlist;}5.(1)删除学生功能的实现管理员删除读者,删除时可删除一个,也可同时多选删除。

publicStringdeleteOneStudent(){iss.deleteOneStudent(studentNum);studentList=this.getStudentListByPage();return"Student";}publicStringdeleteMoreStudent(){iss.deleteMoreStudent(studentNums);studentList=this.getStudentListByPage();return"Student";}publicvoiddeleteOneStudent(StringstudentNum){this.getHibernateTemplate().delete(this.getHibernateTemplate().get(TStudent.class,studentNum));}publicvoiddeleteMoreStudent(String[]studentNums){for(inti=0;i

publicStringmodifyInfoStudent(){this.student=iss.getStudentByid(studentNum);this.academyList=iss.listAllAcademy();this.classList=iss.listClassById(student.getAcademyId().getAcademyId());return"modifyInfo";}publicStringmodifySaveStudent(){iss.modifyStudentByid(student);student=null;studentList=this.getStudentListByPage();return"Student";}publicTStudentgetStudentByid(StringstudentNum){return(TStudent)this.getHibernateTemplate().get(TStudent.class,studentNum);}publicvoidmodifyStudentByid(TStudentstudent){this.getHibernateTemplate().update(student);}(3)查看读者详细信息功能的实现publicStringinfoDetailStudent(){student=iss.getOneStudentById(studentNum);return"Detail";}publicTStudentqueryOneStudentById(StringstudentNum){TStudentstudent=(TStudent)this.getSession().createQuery("fromTStudenttswherets.studentNum=").setString(0,studentNum).uniqueResult();this.getSession().close();returnstudent;}

publicStringdelBookStudent(){message=ils.delBookStudent(bookStudent);return"success";}publicStringdelBookStudent(TBookStudentbookStudent){TBookbook=ild.getOneBook(bookStudent.getBookId());TStudentstudent=ild.getOneStudent(bookStudent.getStudentId());booleanflag=ild.delBookStudent(bookStudent.getStudentId(),bookStudent.getBookId());if(!flag){return"没有该记录!";}book.setCurrentNum(book.getCurrentNum()+1);student.setLendedNum(student.getLendedNum()-1);return"还书成功";}publicbooleandelBookStudent(StringstudentId,StringbookId){Sessionsession=this.getHibernateTemplate().getSessionFactory().openSession();Queryq=session.createQuery("fromTBookStudenttbswheretbs.studentId=andtbs.bookId=").setString(0,studentId).setString(1,bookId);Listlist=q.list();if(list.size()!=0){TBookStudentbookStudent=list.get(0);this.getHibernateTemplate().delete(bookStudent);returntrue;}returnfalse;}7.(1)图书检索模块的实现本模块主要是用户能够输入自己想要查询图书的条件来快速的检索。

THE END
1.Java基础项目:图书管理系统java图书馆管理系统代码信息管理系统的需求日益增加,图书管理系统作为一种常见的信息管理工具,广泛应用于图书馆、书店和个人图书管理中。它可以帮助用户方便地管理图书信息,包括图书的录入、查询、修改和删除等功能。 Java作为一种广泛使用的编程语言,以其跨平台性、面向对象的特性和丰富的类库而受到开发者的青睐。在开发图书管理系统时,Java的https://blog.csdn.net/thinking_chou/article/details/144403299
2.系统设计数据库系统的存储在关系数据库中,数据以行和列的方式组织数据。关系数据库最显著的特点就是SQL(结构化查询语言)和事务处理(ACID),典型的代表有MySQL,Oracle,DB2等。在关系数据库中,一行数据代表数据模型的一种实例,数据与数据之间的关系通过外键等进行关联,因此非常适合存储关系型的数据,而数据在存储设备上一般按照行来组织。 https://www.jianshu.com/p/0e5247a7af3c
3.图书馆管理系统中表tbuser和表tbbook之间的关系是()。图书馆管理系统中表tb_user和表tb_book之间的关系是( )。A.一对一B.一对多C.多对多D.不确定的答案是什么.用刷刷题APP,拍照搜索答疑.刷刷题(shuashuati.com)是专业的大学职业搜题找答案,刷题练习的工具.一键将文档转化为在线题库手机刷题,以提高学习效率,是学习的生产力https://www.shuashuati.com/ti/01f378d51c6a49228ca34b5e080ce995.html
4.图书馆管理系统中表TBUSER和表TB图书馆管理系统中表TB_USER和表TB_BOOK之间的关系是()单选题分A一对一的正确答案和题目解析https://m.12tiku.com/tiku/9999/41724184.html
5.C语言实现图书馆管理系统C语言这篇文章主要为大家详细介绍了C语言实现图书馆管理系统,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下GPT4.0+Midjourney绘画+国内大模型 会员永久免费使用!【 如果你想靠AI翻身,你先需要一个靠谱的工具!】本文实例为大家分享了C语言实现图书馆管理系统的具体代码,供大家参考,具体内容https://www.jb51.net/article/218271.htm
6.创建或更新表的统计信息Facebookx.com 共享LinkedIn电子邮件 打印 你当前正在访问 Microsoft Azure Global Edition 技术文档网站实施统计信息管理 显示另外 6 个 本文提供的建议和示例适用于创建和更新专用 SQL 池中有关表的查询优化[user_type_id] = ty.[user_type_id]JOINsys.tables tbONco.[object_id] = tb.[object_id]https://docs.microsoft.com/zh-cn/azure/sql-data-warehouse/sql-data-warehouse-tables-statistics
7.小波TxT文件超级批量处理.zip小波TxT文件超级批量处理.删除内容,修改内容,添加内容,删除指定行,删除批量内容,删除关键词所在行,首行文字设为标题等功能https://www.iteye.com/resource/feng137891-12736266
8.书栈网·BookStack一款开源的向量数据库,支持针对 TB 级向量的增删改操作和近实时查询,具有高度灵活、稳定可靠以及高速查询加州大学开发的一种对象-关系型数据库管理系统(ORDBMS) PrestoDB (19) Facebook 开源的数据查询引擎 User Interface,泛指用户的操作界面 设计(10) 各种感觉形式传达出来的过程 游戏开发 https://www.bookstack.cn/
9.python中级知识.md·空虚的心/blog将系统中的所有内存块根据其存活时间划分为不同的集合,每个集合为一个 代,垃圾收集的频率随着代的存活时间增大而减少python默认定义三代对象集合,索引数越大,存活时间越长。? 引用计数 -->python 采用类似windows内核对象的方式进行内存管理每个对象,都维护着指向该对象的引用的计数,系统会自动维护这些标签,并且https://gitee.com/kongxudexin/blog/blob/master/python%E4%B8%AD%E7%BA%A7%E7%9F%A5%E8%AF%86.md
10.2023年网络攻击事件盘点近日,安全研究人员在流行的开源电子病历系统OpenEMR中发现多个严重漏洞,可被攻击者组合利用,在服务器上远程执行代码。OpenEMR是一种全球流行的电子病历(EHR)系统和医疗实践管理解决方案,被全球超过10万家医疗机构使用,服务超过2亿患者。 Google Fi数据泄漏,黑客发起SIM卡交换攻击 https://www.51cto.com/article/778045.html
11.新建作业模板HPC23.0.0超算用户手册06$USER:作业提交用户名称。 $dir:作业模板名称+作业提交时间,该路径由系统自动生成。 作业密级 密级等级 系统开启三员管理后展示,新建和编辑模板时密级等级默认为系统最低密级,不支持编辑和删除;在提交作业界面中密级等级可以选择用户当前密级以及低于当前密级的其他密级。 说明: 普通模板提交的可视化作业新建会话时,https://support.huawei.com/enterprise/zh/doc/EDOC1100347973/57f0b009
12.中国移动IT开发L1理论考试题库及答案下(多选题部分)50.网络与信息安全涉及所有的信息资产,需要建立全方位、多层次可扩展的安全技术防护体系,主要通过层面提出安全防护方案A、安全域划分与边界整合B、网元自身安全功能和配置C基础安全技术防护手段D、安全运行管理系统(ISMP)答案ABCD 51.以下操作中,数组比线性表速度更快的是()A、原地逆序B、头部插入C、返回中间节点D、https://www.yxfsz.com/view/1557559711783555073