基于数据库的餐厅管理系统

package text;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Scanner;

public class function {
	 //连接对象
    Connection connection=null;
    //创建预编译对象
    PreparedStatement ps=null;
    //创建结果集
    ResultSet rs = null;
    Scanner scan = new Scanner(System.in);
	 public void selectcostomer() throws SQLException{
	        connection = cwd.getCon();
	        String sql = "select * from costomer where gno = ?";
	        try {
	            ps = connection.prepareStatement(sql);
	            Scanner scan = new Scanner(System.in);
	            System.out.println("请输入要查询的顾客的编号号:");
	            String  gno = scan.next();
	            ps.setString(1,gno);
	            rs = ps.executeQuery();
	            while (rs.next()){
	                String Gno = rs.getString(1);
	                String gname = rs.getString(2);
	                String zno = rs.getString(3);
	                String ghost = rs.getString(4);
	                String gmember = rs.getString(5);
	                String gremark= rs.getString(6);
	                System.out.println("编号:"+Gno);
	                System.out.println("姓名:"+gname);
	                System.out.println("餐桌:"+zno);
	                System.out.println("开单人:"+ghost);
	                System.out.println("会员:"+gmember);
	                System.out.println("备注:"+gremark);
	             }
	            System.out.printf("查询成功 ");
	        } catch (SQLException e) {
	            e.printStackTrace();
	        }finally {
	            cwd.closeCon(connection);
	        }
	    }
	
	 
	 public void selectoc() throws SQLException{
	        connection = cwd.getCon();
	        String sql = "select gname,cname,os from costomer,commodity,oc where costomer.gno=oc.gno and commodity.cno=oc.cno ";
	        try {
	            ps = connection.prepareStatement(sql);
	            Scanner scan = new Scanner(System.in);
	           
	            rs = ps.executeQuery();
	            while (rs.next()){
	                String gname = rs.getString(1);
	                String cname = rs.getString(2);
	                String os = rs.getString(3);
	                System.out.println("顾客姓名:"+gname);
	                System.out.println("商品姓名:"+cname);
	                System.out.println("满意度:"+os);
	               
	             }
	            System.out.printf("查询成功 ");
	        } catch (SQLException e) {
	            e.printStackTrace();
	        }finally {
	            cwd.closeCon(connection);
	        }
	    }
	
	 
	 public void selectsweep() throws SQLException{
	        connection = cwd.getCon();
	        String sql = "select sname,zlo from staff,fanzhuo,sweep where staff.sno=sweep.sno and fanzhuo.zno=sweep.zno";
	        try {
	            ps = connection.prepareStatement(sql);
	            Scanner scan = new Scanner(System.in);
	            rs = ps.executeQuery();
	            while (rs.next()){
	                String sname = rs.getString(1);
	                String zno = rs.getString(2);
	                System.out.println("打扫职工的姓名:"+sname);
	                System.out.println("打扫餐桌的位置:"+zno);
	               
	             }
	            System.out.printf("查询成功 ");
	        } catch (SQLException e) {
	            e.printStackTrace();
	        }finally {
	            cwd.closeCon(connection);
	        }
	    }
	 
	 
	 public int insertcostomer() throws SQLException{ 
		 int result = 0; 
		 connection =  cwd.getCon(); 
		 System.out.printf("请输入插入顾客信息");
		String sql = "insert into costomer values(?,?,?,?,?,?)";
	try { 
		//数据库信息
		 /*gno char(7) not null primary key,
        gname varchar2(50) not null,
        zno char(2) not null,
        ghost varchar2(50) not null,     
        gmember char(4) not null check(gmember in('是','否')),
        gremark varchar2(150),*/
		String gno=scan.next();           
		String gname=scan.next();        
		String zno=scan.next();            
		String ghost=scan.next();
		String gmember=scan.next();
		String g=scan.next();
		ps =  connection.prepareStatement(sql); 
	      ps.setString(1,gno);
	      ps.setString(2,gname); 
	      ps.setString(3,zno); 
	      ps.setString(4,ghost);
	      ps.setString(5,gmember);
	      ps.setString(6,g);
	      result = ps.executeUpdate(); 
	      System.out.printf(" 插入成功 ");
		

	      } 
		catch (SQLException e) 
		{ 
			e.printStackTrace();
		 }
		finally { 
			cwd.closeCon(connection); 
		} 
		return result;
	}
	
	 
	 public int updatecostomer() throws SQ
  • 3
    点赞
  • 32
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
一、需求分析 随着社会服务行业的发展,餐饮业对自身服务的质量和能力也有了更高的要求。餐饮管理系统正是在这样的情况之下越来越受到重视。餐厅的内部服务项目众多,既需要完成前台的服务工作,还需要完成后台的管理工作,如果没有一套可靠的餐饮管理系统,单凭手工操作,不仅效率低,而且会极大地影响到酒店的服务质量。 设计的目标:实现餐饮管理的科学化、自动化,提高各个模版的办公效率,为高质量的餐饮服务提供保证。 系统功能概述 民以食为天,随着人民生活水平的提高,餐饮业在服务行业中占有越来越重要的地位。经过多年发展,餐饮管理已经逐渐由定性管理,进入到重视定量管理的科学阶段。众所周知,在定量管理的具体实现方法和手段方面,最有效的工具就是计算机管理。 传统的手工操作管理存在着许多无法避免的问题,例如: 人工计算机账单金额出现差错; 收银工作中跑单、漏单、偷钱现象普遍; 个别服务员作弊、改单、宰客情形时有发生; 客人消费单据难以保存和查询。 如果借助计算机来管理,就可以轻松的解决处理这些问题。一个餐饮管理信息系统应该包括基本的餐厅的服务管理、管理人员信息的维护等,以及与之相应的操作。所以整个餐饮管理信息系统分为两个大部分,即后台的数据管理维护和前台的操作。后台数据库的管理能保证系统各项功能正常运行,前台操作能提供给客户尽可能方便快捷的服务。 功能模块划分 1. 前台操作系统 订餐管理模块:点菜(输入桌台代码和食物代码)、加菜、下单。 结账管理模块:结账(输入桌台代码)、结账方式选择(包括现金结账、信用卡结账、支票结账、签单等)。 交班管理模块:统计当班数据(包括桌台数、人民币结账金额以及总金额等),为下班操作作准备。 2. 后台管理维护系统 用户权限设置:可以查询员工的基本资料(姓名、性别、年龄、出生年月、籍贯、家庭住址等),员工登录名称、密码、员工操作权限等,可以根据需要进行设置。 菜谱设置:新菜单录入(包括菜式名称、代码、类型、价格、成本等)、菜式修改、删除等菜式维护。 付款方式设置:分为人民币付款、信用卡、支票签单等,可以根据需要进行添加和删除。 系统流程分析 系统流程图1所示。当用户进入系统主界面以后,新用户经过注册后才能凭借其用户名和密码登录,老用户可以直接登录。用户登录以后,系统自动判断出其操作权限。操作权限包括普通员工和管理人员。新用户的操作权限默认为是普通员工。普通员工只能进行订餐、结账操作,而管理人员除此之外还可以进行系统设置与营业分析。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值