资源简介
本系统采用MVC模式开发的“果冻点餐系统”,适合Java初级选手学习,本系统实现了用户注册登录,点餐,商家管理订单等一系列功能。
演示效果和开发说明参考此链接:https://blog.csdn.net/nuist_NJUPT/article/details/105992417
代码片段和文件信息
package com.java1234.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import com.java1234.model.Goods;
import com.java1234.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 2020-05-31 12:08 orderMeal\
文件 512 2020-05-31 12:08 orderMeal\.classpath
文件 385 2020-05-31 12:08 orderMeal\.project
目录 0 2020-05-31 12:08 orderMeal\OrderMeal\
文件 385 2020-05-31 12:08 orderMeal\OrderMeal\.project
目录 0 2020-05-31 12:08 orderMeal\OrderMeal\.settings\
文件 598 2020-05-31 12:08 orderMeal\OrderMeal\.settings\org.eclipse.jdt.core.prefs
目录 0 2020-05-31 12:08 orderMeal\OrderMeal\bin\
目录 0 2020-05-31 12:08 orderMeal\OrderMeal\bin\com\
目录 0 2020-05-31 12:08 orderMeal\OrderMeal\bin\com\java1234\
目录 0 2020-05-31 12:08 orderMeal\OrderMeal\bin\com\java1234\dao\
文件 3055 2020-05-31 12:08 orderMeal\OrderMeal\bin\com\java1234\dao\GoodsDao.class
文件 3500 2020-05-31 12:08 orderMeal\OrderMeal\bin\com\java1234\dao\OrderDao.class
文件 2630 2020-05-31 12:08 orderMeal\OrderMeal\bin\com\java1234\dao\UserDao.class
目录 0 2020-05-31 12:08 orderMeal\OrderMeal\bin\com\java1234\model\
文件 1951 2020-05-31 12:08 orderMeal\OrderMeal\bin\com\java1234\model\Goods.class
文件 2989 2020-05-31 12:08 orderMeal\OrderMeal\bin\com\java1234\model\Order.class
文件 1622 2020-05-31 12:08 orderMeal\OrderMeal\bin\com\java1234\model\User.class
目录 0 2020-05-31 12:08 orderMeal\OrderMeal\bin\com\java1234\util\
文件 1736 2020-05-31 12:08 orderMeal\OrderMeal\bin\com\java1234\util\DbUtil.class
文件 1689 2020-05-31 12:08 orderMeal\OrderMeal\bin\com\java1234\util\StringUtil.class
目录 0 2020-05-31 12:08 orderMeal\OrderMeal\bin\com\java1234\view\
文件 882 2020-05-31 12:08 orderMeal\OrderMeal\bin\com\java1234\view\AccountModifyInterFrm$1.class
文件 882 2020-05-31 12:08 orderMeal\OrderMeal\bin\com\java1234\view\AccountModifyInterFrm$2.class
文件 8335 2020-05-31 12:08 orderMeal\OrderMeal\bin\com\java1234\view\AccountModifyInterFrm.class
文件 8361 2020-05-31 12:08 orderMeal\OrderMeal\bin\com\java1234\view\AccountModifyInterFrm.form
文件 791 2020-05-31 12:08 orderMeal\OrderMeal\bin\com\java1234\view\AdminFrm$1.class
文件 791 2020-05-31 12:08 orderMeal\OrderMeal\bin\com\java1234\view\AdminFrm$2.class
文件 791 2020-05-31 12:08 orderMeal\OrderMeal\bin\com\java1234\view\AdminFrm$3.class
文件 745 2020-05-31 12:08 orderMeal\OrderMeal\bin\com\java1234\view\AdminFrm$4.class
文件 791 2020-05-31 12:08 orderMeal\OrderMeal\bin\com\java1234\view\AdminFrm$5.class
............此处省略181个文件信息
评论
共有 条评论