• 大小: 1.21MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-10-01
  • 语言: Java
  • 标签: java  点餐系统  mysql  

资源简介

java小系统,使用 swing开发的点餐系统,界面友好。数据库脚本在工程下的sql目录下。需要修改com.food.util.DbUtil.java中的数据库用户名和密码,程序入口在com.food.view.LogOnFrm.java; 管理员用户名密码admin/123,登录后可以管理套餐;顾客可以注册后登录,进行点餐...

资源截图

代码片段和文件信息

package com.food.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import com.food.model.Goods;
import com.food.util.StringUtil;

public class GoodsDao {
public int GoodsAdd(Connection conGoods goods) throws Exception{
String sql=“insert into goods values(null????)“;
PreparedStatement pstmt=con.prepareStatement(sql);
pstmt.setString(1 goods.getGoodsName());
pstmt.setFloat(2 goods.getPrice());
pstmt.setString(3 goods.getGoodsDesc());
pstmt.setString(4 goods.getImagelink());
return pstmt.executeUpdate();
}
public ResultSet goodsList(Connection conGoods goods) throws Exception{
StringBuffer sb=new StringBuffer(“select * from ‘goods‘“);
if(StringUtil.isNotEmpty(goods.getGoodsName())){
sb.append(“ and goodsName like ‘%“+goods.getGoodsName()+“%‘“);
}
if((goods.getPrice1()!=0)&&(goods.getPrice()==0) ){//低价格有,高价格无
sb.append(“ and price>=“+goods.getPrice1());
}else if(goods.getPrice()>goods.getPrice1()){//中间价格
sb.append(“ and price between “+goods.getPrice1()+“ and “+goods.getPrice());
}
else if((goods.getPrice()!=0)){//高价格有,低价格无或者和高价格一样
sb.append(“ and price<=“+goods.getPrice());
}
if(goods.getId()!=0){
sb.append(“ and id=“+goods.getId());
}
//System.out.println(sb.toString().replaceFirst(“and“ “where“));
PreparedStatement pstmt=con.prepareStatement(sb.toString().replaceFirst(“and“ “where“));
return pstmt.executeQuery();
}

public int goodsDelete(Connection conString id) throws Exception{
String sql=“delete from goods where id=?“;
PreparedStatement pstmt=con.prepareStatement(sql);
pstmt.setString(1 id);
return pstmt.executeUpdate();
}

public int goodsModify(Connection conGoods goods) throws Exception{
String sql=“update goods set goodsName=?goodsDesc=?price=?imagelink=? where id=?“;
PreparedStatement pstmt=con.prepareStatement(sql);
pstmt.setString(1 goods.getGoodsName());
pstmt.setString(2 goods.getGoodsDesc());
pstmt.setFloat(3 goods.getPrice());
pstmt.setString(4 goods.getImagelink());
pstmt.setInt(5 goods.getId());
return pstmt.executeUpdate();
}
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-12-21 18:30  OrderMeal\
     文件         577  2017-12-21 18:37  OrderMeal\.classpath
     文件         385  2013-07-05 16:07  OrderMeal\.project
     目录           0  2017-12-21 18:20  OrderMeal\.settings\
     文件          53  2017-12-21 18:20  OrderMeal\.settings\org.eclipse.core.resources.prefs
     文件         629  2013-07-05 16:07  OrderMeal\.settings\org.eclipse.jdt.core.prefs
     目录           0  2017-12-21 18:38  OrderMeal\bin\
     目录           0  2017-12-21 18:38  OrderMeal\bin\com\
     目录           0  2017-12-21 18:38  OrderMeal\bin\com\java1234\
     目录           0  2017-12-21 18:38  OrderMeal\bin\com\java1234\dao\
     文件        3055  2017-12-21 18:38  OrderMeal\bin\com\java1234\dao\GoodsDao.class
     文件        3500  2017-12-21 18:38  OrderMeal\bin\com\java1234\dao\OrderDao.class
     文件        2630  2017-12-21 18:38  OrderMeal\bin\com\java1234\dao\UserDao.class
     目录           0  2017-12-21 18:38  OrderMeal\bin\com\java1234\model\
     文件        1951  2017-12-21 18:38  OrderMeal\bin\com\java1234\model\Goods.class
     文件        2989  2017-12-21 18:38  OrderMeal\bin\com\java1234\model\Order.class
     文件        1622  2017-12-21 18:38  OrderMeal\bin\com\java1234\model\User.class
     目录           0  2017-12-21 18:38  OrderMeal\bin\com\java1234\util\
     文件        1723  2017-12-21 18:50  OrderMeal\bin\com\java1234\util\DbUtil.class
     文件        1689  2017-12-21 18:38  OrderMeal\bin\com\java1234\util\StringUtil.class
     目录           0  2017-12-21 18:38  OrderMeal\bin\com\java1234\view\
     文件         882  2017-12-21 18:38  OrderMeal\bin\com\java1234\view\AccountModifyInterFrm$1.class
     文件         882  2017-12-21 18:38  OrderMeal\bin\com\java1234\view\AccountModifyInterFrm$2.class
     文件        8260  2017-12-21 18:38  OrderMeal\bin\com\java1234\view\AccountModifyInterFrm.class
     文件        8361  2013-07-09 07:35  OrderMeal\bin\com\java1234\view\AccountModifyInterFrm.form
     文件         791  2017-12-21 18:38  OrderMeal\bin\com\java1234\view\AdminFrm$1.class
     文件         791  2017-12-21 18:38  OrderMeal\bin\com\java1234\view\AdminFrm$2.class
     文件         791  2017-12-21 18:38  OrderMeal\bin\com\java1234\view\AdminFrm$3.class
     文件         745  2017-12-21 18:38  OrderMeal\bin\com\java1234\view\AdminFrm$4.class
     文件         791  2017-12-21 18:38  OrderMeal\bin\com\java1234\view\AdminFrm$5.class
     文件         560  2017-12-21 18:38  OrderMeal\bin\com\java1234\view\AdminFrm$6.class
............此处省略167个文件信息

评论

共有 条评论