




已阅读5页,还剩23页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
得分:课程设计报告食品消费卡管理系统设计姓名班级学号课程名称指导教师2015年1月1日目录一 食品消费卡管理系统应用分析21.1食品消费卡管理系统的应用背景21.2学生管理系统应用需求21.3食品消费卡管理系统功能分析3二 总体设计32.1数据库概念设计32.2应用软件系统功能划分4三 系统详细设计53.1数据库关系模式设计53.2软件模块设计53.3各模块功能5四 系统实现64.1登录界面设计64.2功能界面和食品管理设计64.3消费卡管理设计74.4消费记录74.5餐厅管理8五 实验总结91食品消费卡管理系统应用分析1.1食品消费卡管理系统的应用背景依据现阶段食堂食品的实际业务情况,通过对整个系统的需求分析、概念模型设计、逻辑模型设计到物理数据库模型设计与实现等各环节进行分析与描述。从而以此为基础,建立起科学、高效的管理系统,实现食品管理,餐厅管理以及消费管理的功能。最终达到方便管理人员对食品,消费等的管理,实现食堂管理的高效化和统一化,和提高管理方便性及可行性的目的。1.2学生管理系统应用需求1.2.1功能需求通过对学生使用消费卡在学校餐厅的消费流程进行分析,完成具有食品管理、消费管理、餐厅管理等相关功能的小型数据库管理应用系统。完成人员、消费卡、餐厅、食品价目表的维护完成消费表的生成,并计算消费折扣。 按人员、时间、餐厅统计计算消费总额按食品类别、时间、餐厅统计计算消费总额等功能。1.2.2数据处理需求系统主要处理需求有如下几点:1)对基本信息管理:食品信息、学生信息、餐厅信息等;2)对食品管理:食品登记、食品查询、食品消费等;3)对消费管理:消费登记、消费记录查询等。1.3食品消费卡管理系统功能分析从数据库获得相应的权限后,登录进去,然后对食品表,消费卡,餐厅表等进行增,删,改,查的操作。功能流程图如下:表1 功能流程图2 总体设计2.1数据库概念设计本系统主要有食品,餐厅和消费卡三个实体集,一个餐厅可以有多种食品,一种食品也可以在不同餐厅中,这两个实体集之间是多对多联系;一个消费人员可以点多道菜,每道菜可以被多个消费人员点,这两个实体集间关系是多对多关系;一个消费人员有一张消费卡,一张消费卡只能被一个人拥有,这两个实体集之间关系是一对一。全局e-r图如下:表2 全局e-r图实体装换为所对应的关系模式:食品(食品编号,菜名,菜价,食品类型)餐厅(餐厅编号,餐厅名称,日销售额)消费卡(学号 消费卡编号 联系方式)消费人员(学号 姓名 班级 性别)联系转化为所对应的关系模式:使用(餐厅编号,消费卡编号)拥有(学号,消费卡编号)购买(食品编号,消费卡编号,学号)出售(餐厅编号, 食品编号)2.2应用软件系统功能划分1)消费卡管理显示消费卡的相关信息,便于管理员进行下一步操作。2) 菜单管理显示菜单的相关信息,便于管理员进行下一步操作。3) 食品管理显示食品表的相关信息,便于管理员进行下一步操作。4) 餐厅管理显示餐厅表的相关信息,便于管理员进行下一步操作。3 系统详细设计3.1数据库关系模式设计实体完整性约束:食品信息(食品编号,菜名,菜价,食品类型)餐厅信息(餐厅编号,餐厅名称,日销售额)消费卡信息( 学号 姓名 班级 性别 消费卡编号 联系方式)消费记录信息(餐厅号,学号,菜数量,消费额,消费记录)3.2软件模块设计软件分为四大模块,分别为消费卡模块,菜单模块,食品模块,登陆信息模块,餐厅模块。3.3各模块功能消费卡模块功能:查询,添加,删除,修改消费卡信息菜单模块功能:查询,修改,添加,删除食品编号,菜名,菜价,食品类型。食品模块功能:包含所有食品编号菜名菜价等。登陆信息模块功能:使用登陆账号,密码登入食品消费卡管理系统。消费记录模块功能:查询部分消费者的消费信息。4 系统实现4.1登录界面设计管理员登录时,只有输入正确的账号和密码,才能进入,正确的账号和密码存储在数据库中,账号或密码错误时,也会有相应的提示,登录界面如下:表3 登录界面输入正确的账号和密码,然后即可进入。4.2功能界面和食品管理设计登录进入之后,便会出现如下界面:表4 主界面主界面显示的是食品表的相关信息,由菜单栏和相应的按钮组成,可以清楚的看到食品表的结构和详细信息,也可以进行食品表的相关操作。4.3消费卡管理设计消费卡管理的界面设计如下:表5 消费卡界面通过上图,我们可以清楚的看到消费卡表的详细信息,通过查询,添加,修改,删除按钮可以对表进行操作,满足实际需求。4.4消费记录消费记录界面设计如下:表6 消费记录在数据库中,通过复杂查询,可以得到上述的信息,通过上表,我们能够详细的看到每个同学的消费情况,可以方便管理员的管理。4.5餐厅管理餐厅管理的界面设计如下:表7 餐厅表通过上图可知餐厅表的详细信息,管理员可通过相应的按钮对餐厅表进行相关操作。5 实验总结通过本次课程设计,明白了实验的重要性,不管你的理论知识学习的如何,都必须通过不断的练习才能对知识有更深刻的理解。我不但加深了对数据库基础理论和基本知识的理解,更是学习和实践了如何对食品销售管理系统数据库进行设计。通过实战,更详细的了解了系统开发的具体流程。通过对系统的需求分析、概念模型设计、逻辑模型设计到物理数据库模型设计与实现等各环节的实施和设计,学习和理解了开发和设计一个小型数据库系统时设计数据库系统模型的基本方法。虽然实际设计操作过程中还是出存在很多不足,但是通过亲自动手和动脑,运用数据库解决实际问题的能力仍得到了一定提高。 附录package java;import java.io.ioexception;import java.util.properties;public class config /step1:创建连接配置文件对象 private final static properties prop = new properties(); static try /step2:加载perties配置文件 prop.load(config.class.getresourceasstream(perties); catch (ioexception e) e.printstacktrace(); /step3:设置获取配置文件7个常量 public static final string class_name = prop.getproperty(driverclassname); public static final string database_url = prop.getproperty(database_url); public static final string username = prop.getproperty(username); public static final string password = prop.getproperty(password);package java;import java.sql.*;public class databasehelper /三大属性,四大方法 /三大属性是指 jdbc体系中的三个核心接口 private connection conn = null; private preparedstatement pstmt = null; private resultset rs = null; /四大方法 /method1:创建数据库连接 public connection getconnection() throws classnotfoundexception, sqlexception try /step1:加载连接驱动,java反射原理 class.forname(config.class_name); /step2:创建connection接口对象,用于获取数据库连接对象。三个参数 url连接的字符串,username账号,password密码 string url = config.database_url; system.out.println(url= + url); /step3:创建数据库连接 conn = drivermanager.getconnection(url, config.username, config.password); catch (classnotfoundexception e) e.printstacktrace(); conn=null; throw e; catch (sqlexception e) e.printstacktrace(); conn=null; throw e; return conn; /method2:关闭数据库方法 public void closeconn() /关闭顺序:resultset preparedstatement connection /关闭:resultset if (rs != null) try rs.close(); catch (sqlexception e) / todo auto-generated catch block e.printstacktrace(); /关闭:preparedstatement if (pstmt != null) try pstmt.close(); catch (sqlexception e) / todo auto-generated catch block e.printstacktrace(); /关闭:connection if (conn != null) try conn.close(); catch (sqlexception e) / todo auto-generated catch block e.printstacktrace(); system.out.println(数据库连接已关闭); /method3:用于发送 增、删、改 的方法 public int executeupdate(final string sql, final object params)throws exception /step1:获取数据库连接 this.getconnection(); try /step3:创建statement接口对象 pstmt = conn.preparestatement(sql); /step4:动态为pstmt对象赋值参数 for (int i = 0; i params.length; i+) pstmt.setobject(i + 1, paramsi); /step5:使用statement对象发送sql语句 int affectedrows = pstmt.executeupdate(); /step6:返回结果 return affectedrows; catch (sqlexception e) / todo auto-generated catch block e.printstacktrace(); return -1; /method4:用于发送 查询结果 的方法 public resultset execquery(final string sql, final object params)throws exception /step1:获取数据库连接 this.getconnection(); try /step3:创建preparedstatement接口对象 pstmt = conn.preparestatement(sql); /step4:动态为pstmt对象赋值参数 for (int i = 0; i params.length; i+) pstmt.setobject(i + 1, paramsi); /step5:使用statement对象发送sql语句 rs = pstmt.executequery(); /step6:返回结果 return rs; catch (sqlexception e) / todo auto-generated catch block e.printstacktrace(); return null; public int getmaxid(string sql, object params) throws exception /step1:获取数据库连接 this.getconnection(); try /step3:创建preparedstatement接口对象 pstmt = conn.preparestatement(sql); /step4:动态为pstmt对象赋值参数 for (int i = 0; i params.length; i+) pstmt.setobject(i + 1, paramsi); /step5:使用statement对象发送sql语句 rs = pstmt.executequery(); /step6:返回结果 return rs.getint(1); catch (sqlexception e) / todo auto-generated catch block e.printstacktrace(); return 0; finally this.closeconn(); driverclassname=com.microsoft.sqlserver.jdbc.sqlserverdriverdatabase_url=jdbc:sqlserver:/:1433;databasename=foodcardusername=rootpassword=123456 package sql;import java.databasehelper;import com.zjl.entity.card;import java.sql.connection;import java.sql.sqlexception;import java.sql.statement;import java.util.logging.level;import java.util.logging.logger;public class cardaction static databasehelper helper = new databasehelper(); static connection conn = null; public static int addcard() throws classnotfoundexception, sqlexception conn = helper.getconnection(); statement stmt=conn.createstatement(); string sql=insert into card values (+card.cardid+,+card.useraccount+, +card.username+,+card.userclass+,+card.usersex+,+card.usertel+); stmt.executeupdate(sql); conn.close(); return 1; public static void updatedata() throws classnotfoundexception, sqlexception conn = helper.getconnection(); statement stmt=conn.createstatement();string sql=update card set useraccount=+card.useraccount+,username=+card.username +,userclass=+card.userclass+,usersex=+card.usersex+,usertel=+card.usertel + where cardid=+card.cardid+; stmt.execute(sql); conn.close(); public static void delrow() throws classnotfoundexception, sqlexception conn = helper.getconnection(); statement stmt=conn.createstatement(); string sql=delete from card where cardid=+card.cardid+; stmt.execute(sql); conn.close(); /* * to change this license header, choose license headers in project properties. * to change this template file, choose tools | templates * and open the template in the editor. */package sql;import java.databasehelper;import java.sql.connection;import java.sql.resultset;import java.sql.statement;import javax.swing.jtable;import javax.swing.table.defaulttablemodel;public class gettabledata databasehelper helper = new databasehelper(); connection conn = null; public void getdata(jtable tableinfo,string tablename,int clonum) tableinfo.removeall(); try conn = helper.getconnection(); statement stmt=conn.createstatement(); string sql=select * from +tablename+; tableinfo = setmodellist(tableinfo, tablename); resultset res=stmt.executequery(sql); string str=new string100100; int row=0; while( res.next() ) row+; for(int j=1;j=clonum;j+) strrowj-1=res.getstring(j); conn.close();/ tablemodel model=tableinfo.getmodel(); defaulttablemodel model=(defaulttablemodel) tableinfo.getmodel(); for(int i=0;irow;i+) model.addrow(stri+1); tableinfo.setmodel(model); catch(exception e) e.printstacktrace(); public void getrecorddata(jtable tableinfo,string tablename) tableinfo.removeall(); try conn = helper.getconnection(); statement stmt=conn.createstatement(); string sql=select card.cardid,card.username,food.vname,food.belong,restaurant.rno,restaurant.rname,consume.cmoney,consume.ctime from consume join food on consume.vno=food.vno join card on consume.cinfo=card.cardid join restaurant on consume.rno=restaurant.rno; tableinfo = setmodellist(tableinfo, record); resultset res=stmt.executequery(sql); string str=new string100100; int row=0; while( res.next() ) row+; for(int j=1;j=8;j+) strrowj-1=res.getstring(j); conn.close(); defaulttablemodel model=(defaulttablemodel) tableinfo.getmodel(); for(int i=0;irow;i+) model.addrow(stri+1); tableinfo.setmodel(model); catch(exception e) e.printstacktrace(); public void querydata(jtable tableinfo,string tablename,int clonum,string noname,string no) try conn = helper.getconnection(); statement stmt=conn.createstatement(); string sql=select * from +tablename+ where +noname+=+no+; tableinfo = setmodellist(tableinfo, tablename); resultset res=stmt.executequery(sql); string str=new string100100; int row=0; while( res.next() ) row+; for(int j=1;j=clonum;j+) strrowj-1=res.getstring(j); conn.close();/ tablemodel model=tableinfo.getmodel(); defaulttablemodel model=(defaulttablemodel) tableinfo.getmodel(); for(int i=0;i= 0; index-) tablemodel.removerow(index); if(name.equals(food) table.setmodel(new javax.swing.table.defaulttablemodel( new object , new string 食品编号, 菜名,菜价, 食品类型 ) class types = new class java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class ; boolean canedit = new boolean false, false, false, false, false, false, false, false, false, false, false, false, false ; public class getcolumnclass(int columnindex) return types columnindex; public boolean iscelleditable(int rowindex, int columnindex) return canedit columnindex; ); else if(name.equals(restaurant) table.setmodel(new javax.swing.table.defaulttablemodel( new object , new string 餐厅编号, 餐厅名称,日营业额, ) class types = new class java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class ; boolean canedit = new boolean false, false, false, false, false, false, false, false, false, false, false, false, false ; public class getcolumnclass(int columnindex) return types columnindex; public boolean iscelleditable(int rowindex, int columnindex) return canedit columnindex; ); else if(name.equals(card) table.setmodel(new javax.swing.table.defaulttablemodel( new object , new string 消费卡编号, 学生学号,学生姓名,学生班级,学生性别,联系方式 ) class types = new class java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class ; boolean canedit = new boolean false, false, false, false, false, false, false, false, false, false, false, false, false ; public class getcolumnclass(int columnindex) return types columnindex; public boolean iscelleditable(int rowindex, int columnindex) return canedit columnindex; ); else if(name.equals(record) table.setmodel(new javax.swing.table.defaulttablemodel( new object , new string 消费卡编号, 学生姓名,食品名称,食品种类,餐厅编号,餐厅名称,消费金额,消费日期 ) class types = new class java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class, java.lang.string.class ; boolean canedit = new boolean false, false, false, false, false, false, false, false, false, false, false, false, false ; public class getcolumnclass(int columnindex) return types columnindex; public boolean iscelleditable(int rowindex, int columnindex) return canedit columnindex; ); return table; /* * to change this license header, choose license headers in project properties. * to change this template file, choose tools | templates * and open the template in the editor. */package sql;import com.zjl.entity.resaurant;import java.databasehelper;import java.sql.connection;import java.sql.sqlexception;import java.sql.statement;public class resaurantaction static databasehelper helper = new databasehelper(); static connection conn = nu
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025-2030动力电池隔膜材料技术迭代方向与专利布局分析
- 2025-2030动力电池负极材料技术革新与产能扩张节奏预测
- 2025-2030动力电池系统集成技术演进与CTP方案优劣比较
- 2025-2030动力电池正极材料技术迭代与成本下降空间评估
- 2025-2030动力电池梯次利用检测标准研究
- 2025-2030动力电池梯次利用技术标准与回收网络建设规划报告
- 2025-2030动力电池回收利用网络体系建设痛点与商业模式创新
- 2025-2030动力电池回收利用商业模式与政策环境专项研究报告
- 物业费催缴及投诉处理规范流程
- 幼儿园目标管理体系与执行方案
- 表面活性剂的基本作用
- 员工网络安全责任书
- 工程建设项目审批流程图(政府投资工程建设项目(市政类线性项目))
- 消防安全周巡查记录表
- 士林变频器说明书SL
- 博雅汉语准中级加速篇1
- 第二章第一节 遗传论与环境论心理学课件
- 九年级物理上册《第十三章 内能与热机》单元检测卷及答案(沪科版)
- 能源化学与能源化工概论-第一章 能源简介
- GB/T 16866-2006铜及铜合金无缝管材外形尺寸及允许偏差
- 量子信息与量子计算课件
评论
0/150
提交评论