ImageVerifierCode 换一换
格式:DOCX , 页数:35 ,大小:150.20KB ,
资源ID:19709245      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/19709245.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(网上订餐系统源程序清单课程设计Word下载.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

网上订餐系统源程序清单课程设计Word下载.docx

1、用户个人信息管理模块选择相应个人信息管理功能执行相应信息管理方法用户订餐模块选择相应订餐功能执行相应订餐方法2模块1(database)2.1功能说明数据库底层设计,涉及直接对数据库表中数据操作的公共方法的设计。2.2设计说明(1)本模块在网上订餐系统中处于底层,包括系统内的各个实体类及属性的设计,通过Dao层与其它层进行交互,在Daoimpl里面定义对Dao层的具体实现。(2)考虑到若数据库被意外改动不方便重新建立,所以使用Hibernate进行数据库的连接和数据表的创建等工作。而且由管理员进行定期的备份工作,方便数据表信息恢复。(3)由于系统中几乎对所有类对象的操作都要涉及到增加、删除、修

2、改和查询,为了增强代码的重用性,所以把对数据库增删改查的操作都提取出来作为公共代码使用。2.3原代码清单2.3.1子模块1(valueObject)(1)用户信息表(t_user)/用Hibernate的XML方式,在Person.hbm.xml中,管理用户表 class name=Person table=t_user generator class=native/id property name=user_name length=30 not-null=true /user_passuser_mailuser_realname50user_sexuser_role4one-to-one n

3、ame=userinfo property-ref=user cascade=delete!配置跟用户信息表的一对一的关系映射- set name=message inverse=- 配置跟留言表Message的一对多的关系映射 - /hibernate-mapping(2)菜单信息表(t_menu)/用Hibernate的XML方式,在Mymenu.hbm.xml中,管理菜单表MyMenut_menumenu_idmenu_namemenu_intromenu_price5ordersfalse (3)订单信息表(t_order)/用Hibernate的XML方式,在Orders.hbm.x

4、ml中,管理订单表order_idorder_numorder_noticeother_noticestatesorder_datemany-to-one name= column=menu(4)留言信息表(t_message)/用Hibernate的XML方式,在Orders.hbm.xml中,管理留言表t_messageidsubject45content200datesmg_date(5)配送信息表(userInfo)/用Hibernate的XML方式,在UserInfo.hbm.xml中,管理留言表UserInfot_userInfoaddress100tel15mobile11not

5、ice150sendDatesend_date unique=2.3.2子模块2(connectConfig)(1)ApplicationContext.xml中配置和数据库的连接,设置Hibernate对数据库的自动管理,由Spring将所有类当作Bean进行管理。context:component-scan base-package=cn.softbean id=dataSource class=com.mchange.v2.c3p0.ComboPooledDataSource destroy-method=close配置数据库连接名、用户名和密码等,配置数据源-/beansessionF

6、actory class=org.springframework.orm.hibernate3.LocalSessionFactoryBean ref=mappingResourceslist-将所有实体类的配置文件列出,在hibernate配置文件中添加映射-valuecn/soft/vo/Person.hbm.xml/list/propertyhibernatePropertiespropsprop key=hibernate.dialectorg.hibernate.dialect.MySQL5Dialecthibernate.hbm2ddl.autoupdatehibernate.tr

7、ansaction.factory_class org.hibernate.transaction.JDBCTransactionFactory txManagerorg.springframework.orm.hibernate3.HibernateTransactionManagertx:annotation-driven proxy-target-class= transaction-manager=配置类名和bean的id名的对应,方便在struts配置文件中使用- (2)hibernate.cfg.xml中添加映射,应用XML方式创建数据库session-factoryhiberna

8、te.connection.driver_classcom.mysql.jdbc.Driver hibernate.connection.urljdbc:mysql:/localhost/orderhibernate.connection.usernamerootformat_sqltruemapping class=cn.soft.vo.PersonApplicationContext.xml -/session-factory3模块2(menuManage)3.1功能说明 本模块主要实现菜单的管理工作,下设菜单添加、菜单删除、菜单修改和菜单查询4个子功能模块,可以对菜单中菜品的各项属性进行

9、编辑和修改,可实现添加菜单记录时上传新菜单图片。3.2设计说明(1)本模块通过MenuDao与其它层进行交互,在MenuImpl里面定义dao层的具体实现。(3)在MenuAction中定义与菜单表操作有关的方法,并返回字符串的结构通过struts中的配置跳转到下一个相应页面或方法。3.3原代码清单3.3.1子模块1(menuQuery)图3-1 菜单查询流程图/查找出所有菜单,并分页显示,供管理员管理菜单页面使用,之后返回“menulist”,跳转到manage/menu_manage下的menu_index.jsp页面,通过依次读取searchList中的记录,来逐条显示菜单信息。 pub

10、lic String menuList() ActionContext ac = ActionContext.getContext();QueryResult qr = nextPage.viewList(menuDao, page,15, MyMenu.class, order by o.menu_id); ac.getSession().put(searchList, qr.getResultSet();page, page); return menulist; 3.3.2子模块2(menuAdd)图3-2 管理员添加菜单流程图(1)添加菜单,自动按升序生成menu_id并将该条记录添加到

11、菜单表里,跳转到上传图片界面。public String addMenu() menuDao.save(menu); HttpServletRequest request = ServletActionContext.getRequest(); int new_id = menu.getMenu_id(); request.getSession().setAttribute(new_id,new_id);success(2)上传图片类,上传到项目webRoot文件夹下的dishes-img文件夹中,根据刚刚上传的菜单id命名为某菜单id.jpg。HttpServletResponse resp

12、onse = ServletActionContext.getResponse();HttpServletRequest request = ServletActionContext.getRequest();HttpSession session=request.getSession();public File getUpload() return upload;public void setUpload(File upload) this.upload = upload;public String getUploadFileName() return uploadFileName;publ

13、ic void setUploadFileName(String uploadFileName) this.uploadFileName = uploadFileName;public String getUploadContentType() return uploadContentType;public void setUploadContentType(String uploadContentType)this.uploadContentType = uploadContentType;public String upload() ActionContext act=ActionCont

14、ext.getContext(); PrintWriter out=null; try response.setCharacterEncoding(GBK out=response.getWriter(); catch (IOException e1) e1.printStackTrace(); String realpath=ServletActionContext.getServletContext().getRealPath(/dishes-img if(upload!=null) File saveDir=new File(realpath); if(!saveDir.exists()

15、 saveDir.mkdirs(); int new_id1=(Integer)session.getAttribute( String img_id=String.valueOf(new_id1); String img_name=img_id.concat(.jpg this.setUploadFileName(img_name); File saveFile=new File(saveDir,uploadFileName); try FileUtils.copyFile(upload, saveFile); catch (IOException e) e.printStackTrace(

16、); 3.3.3子模块3(menuDelete)3-3 删除菜单流程图/删除菜单方法,跳转到菜单管理页面。public String deleteMenu() HttpServletRequest request = ServletActionContext.getRequest(); int id = Integer.parseInt(request.getParameter(menuID); menuDao.delete(MyMenu.class, id);3.3.4子模块4(menuUpdate)图3-4 更新菜单流程图(1)根据id先查出对应菜单的信息,然后跳转到更新页面public

17、String updateUI() MyMenu m = menuDao.find(MyMenu.class, id);, m);update /更新菜单信息,调用menuDao的update方法进行更新public String updateMenu() MyMenu m = menuDao.find(MyMenu.class, menu.getMenu_id(); m.setMenu_name(menu.getMenu_name(); m.setMenu_price(menu.getMenu_price(); m.setMenu_intro(menu.getMenu_intro(); me

18、nuDao.update(m); public String getName() return name; public void setName(String name) this.name = name; public int getPage() return page; public void setPage(int page) this.page = page; public MyMenu getMenu() return menu; public void setMenu(MyMenu menu) this.menu = menu;4模块3(messageManage)4.1功能说明

19、 本模块中下设添加留言、浏览留言和删除留言2个子功能模块,用户可以对自己的留言进行管理,管理员可以对所有用户的留言进行管理。4.2设计说明(1)本模块通过MessageDao与其它层交互,在MessageImpl里面定义dao层的具体实现。(3)在MessageAction中定义与菜单表操作有关的方法,并返回字符串的结构通过struts中的配置跳转到下一个相应页面或方法。4.3原代码清单4.3.1子模块1(messageQuery)图4-1 管理员查看留言流程图(1)/*如果用户已处于登录状态,就查询出所有留言记录,返回到一个显示留言列表的视图,如果没有登录则返回的到登录界面视图让用户先登录*/ public String messageUI() ActionContext a

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1