⼿撸⼀个外卖点餐系统后台,可以写上简历的实战项⽬!外卖点餐系统的实现
实体类的编写
(1)菜品类(菜品id,菜品名,菜品类型,上架时间,单价,⽉销售,总数量)
import java.util.Date;
public class Menu {
private String mid;
private String name;
private String type;画龙舟
private Date dateIssued;
private double price;
private int monthlySales;
private int totalQuantity;
public Menu() {
super();
// TODO Auto-generated constructor stub
}
public Menu(String mid, String name, String type, Date dateIssued, double price, int monthlySales, int totalQuantity) {
super();
this.mid = mid;
this.name = name;
this.dateIssued = dateIssued;
this.price = price;
}
public String getMid() {
return mid;
}
public void tMid(String mid) {
this.mid = mid;
}
public String getName() {
return name;
}
public void tName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void tType(String type) {
}
public Date getDateIssued() {
return dateIssued;
}
public void tDateIssued(Date dateIssued) {
this.dateIssued = dateIssued;
}
public double getPrice() {
return price;冷静的反义词是什么
}
public void tPrice(double price) {
this.price = price;
}
public int getMonthlySales() {
return monthlySales;
}
public void tMonthlySales(int monthlySales) {
}
public int getTotalQuantity() {
return totalQuantity;
}
public void tTotalQuantity(int totalQuantity) {
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((dateIssued == null) ? 0 : dateIssued.hashCode()); result = prime * result + ((mid == null) ? 0 : mid.hashCode());
result = prime * result + monthlySales;
result = prime * result + ((name == null) ? 0 : name.hashCode());
long temp;
temp = Double.doubleToLongBits(price);
result = prime * result + (int) (temp ^ (temp >>> 32));
result = prime * result + totalQuantity;
result = prime * result + ((type == null) ? 0 : type.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return fal;
if (getClass() != Class())
return fal;
Menu other = (Menu) obj;
if (dateIssued == null) {
if (other.dateIssued != null)
return fal;
} el if (!dateIssued.equals(other.dateIssued))
return fal;
if (mid == null) {
if (other.mid != null)
return fal;
坚定信念的意思
} el if (!mid.equals(other.mid))
return fal;
浦东政务if (monthlySales != hlySales)
return fal;
if (name == null) {
if (name == null) {
if (other.name != null)
return fal;
} el if (!name.equals(other.name))
return fal;
if (Double.doubleToLongBits(price) != Double.doubleToLongBits(other.price))
return fal;
if (totalQuantity != alQuantity)
return fal;
if (type == null) {
if (pe != null)
return fal;
} el if (!type.pe))
return fal;
return true;
}
@Override
public String toString() {
return "Menu [mid=" + mid + ", name=" + name + ", type=" + type + ", dateIssued=" + dateIssued + ", price=" + price + ", monthlySales=" + monthlySales + ", totalQuantity=" + totalQuantity + "]";
}
}
import java.util.ArrayList;
怀孕可以喝茶水吗import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.Set;
import java.util.stream.Collectors;
public class MenuManager implements DAO<Menu> {
static Map<String, Menu> map = new HashMap<String, Menu>();
static {
map.put("01", new Menu("01", "邹蹄", "垃圾⾷品", new Date(2020,10,12), 200, 1200, 500));
map.put("02", new Menu("02", "邹腰⼦", "垃圾⾷品", new Date(2020,9,22), 30, 1000, 20));
map.put("03", new Menu("03", "邹⼤肠", "垃圾⾷品", new Date(2020,10,23), 88.8, 900, 1000));
map.put("04", new Menu("04", "邹⾁", "垃圾⾷品", new Date(2020,1,1), 99.99, 10, 8829));
map.put("05", new Menu("05", "邹头", "垃圾⾷品", new Date(2020,7,7), 3300, 20000, 4287));
指导工作
map.put("06", new Menu("06", "邹鞭", "补品", new Date(), 998, 999999, 9999));
}
@Override
public void inrt(Menu menu) {
map.Mid(), menu);
}
@Override
public Menu findById(String id) {
(id);
}
//显⽰所有菜品(按菜品销量从⾼到低排序输出)
@Override
public List findAll() {
List<Entry<String,Menu>> list = Set().stream()
.sorted((p1,p2) -> p2.getValue().getMonthlySales() - p1.getValue().getMonthlySales())
.List());
return list;
}
@Override
public void delete(String id) {
}
/
**
* 查看指定类别的菜品信息
* @param type 菜品类别
* @return
*/
public List<Menu> findByType(String type) {
List<Menu> list = Set().stream()
.filter(p -> p.getValue().getType().equals(type))
.map(p -> p.getValue())
.List());
return list;
}
//根据菜品id修改菜品价格
public void replacePrice(String mid, double price) {
}
//根据菜品id查询菜品价格
public double showPrice(String mid) {
(mid).getPrice();
}
//根据菜品类别显⽰所有菜品
public void showType() {
国美苏宁
读书手抄报简笔画
.sorted((p1,p2) -> p1.getValue().getType().Value().getType()))
.List())
.forEach(System.out::println);
}
//根据菜品id修改菜品数量
public void replaceTotalQuantity(String mid, int totalQuantity) {
}
}
管理员类(管理员id,账号,密码)
public class Administrator {
private String aid;
private String account;
private String password;
public Administrator() {
super();
// TODO Auto-generated constructor stub
}
public Administrator(String aid, String account, String password) {
super();
this.aid = aid;
this.account = account;
this.password = password;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((account == null) ? 0 : account.hashCode());
result = prime * result + ((aid == null) ? 0 : aid.hashCode());
result = prime * result + ((password == null) ? 0 : password.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return fal;
if (getClass() != Class())
return fal;
Administrator other = (Administrator) obj;
if (account == null) {
if (other.account != null)
return fal;
} el if (!account.equals(other.account))
return fal;
if (aid == null) {
if (other.aid != null)
return fal;
} el if (!aid.equals(other.aid))
return fal;
if (password == null) {
if (other.password != null)
return fal;
} el if (!password.equals(other.password))
return fal;
return true;
}
@Override
public String toString() {
return "Administrator [aid=" + aid + ", account=" + account + ", password=" + password + "]"; }
public String getAid() {
return aid;
}
public void tAid(String aid) {
this.aid = aid;
}
public String getAccount() {
return account;
}
public void tAccount(String account) {
this.account = account;
}
public String getPassword() {
return password;