基于javaweb的SSH网上订餐在线点餐系统(java+ssh+jsp+mysql+tomcat)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

261024323103

271024323103

281024323103

291024323103

301024323103

311024323103

321024323103

331024323103

基于javaweb的SSH网上订餐在线点餐系统(java+ssh+jsp+mysql+tomcat)

管理员 :
admin 123456

会员 :
liusan 123456
liqiang 123456

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46



public String huiyuanReg()
{
HttpServletRequest request=ServletActionContext.getRequest();

String sql="from THuiyuan where loginname=?";
Object[] c={loginname.trim()};
List huiyuanList=huiyuanDAO.getHibernateTemplate().find(sql,c);
if(huiyuanList.size()>0)
{
this.setMessage("账号已被占用,请重新注册");
this.setPath("qiantai/userreg/userreg.jsp");
}
else
{
THuiyuan huiyuan=new THuiyuan();

//huiyuan.setId(id);
huiyuan.setLoginname(loginname);
huiyuan.setLoginpw(loginname);
huiyuan.setXingming(xingming);

huiyuan.setXingbie(xingbie);
huiyuan.setNianling(nianling);
huiyuan.setAddress(address);
huiyuan.setDianhua(dianhua);

huiyuan.setLeixing("");
huiyuan.setDel("no");

huiyuanDAO.save(huiyuan);

this.setMessage("注册成功,请登录");
this.setPath("qiantai/default.jsp");
}

return "succeed";
}



public String huiyuanMana()
{
String sql="from THuiyuan where del='no'";
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{
HttpServletRequest request=ServletActionContext.getRequest();
int orderId=Integer.parseInt(request.getParameter("orderId"));

String sql="from TMingxi where orderId="+orderId;
List mingxiList=mingxiDAO.getHibernateTemplate().find(sql);
for(int i=0;i<mingxiList.size();i++)
{
TMingxi mingxi=(TMingxi)mingxiList.get(i);
mingxi.setGoods(goodsDAO.findById(mingxi.getGoodsId()));
}
request.setAttribute("mingxiList", mingxiList);
return ActionSupport.SUCCESS;
}

public String tongjiRes()
{
String sql="from TGoods where del='no' order by leibieId";
List goodsList=goodsDAO.getHibernateTemplate().find(sql);
for(int i=0;i<goodsList.size();i++)
{
TGoods goods=(TGoods)goodsList.get(i);
goods.setXiaoliang(get_xiaoliang(goods.getId()));
goods.setShouru(get_xiaoliang(goods.getId()) * goods.getTejia());

}
HttpServletRequest request=ServletActionContext.getRequest();
request.setAttribute("goodsList", goodsList);
return ActionSupport.SUCCESS;
}

public int get_xiaoliang(int goodsId)
{
int ii=0;
String sql="from TMingxi where goodsId="+goodsId;
List mingxiList=mingxiDAO.getHibernateTemplate().find(sql);
for(int i=0;i<mingxiList.size();i++)
{
TMingxi mingxi=(TMingxi)mingxiList.get(i);
ii=ii+mingxi.getGoodsShuliang();
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43

private String fujian;
private Integer jiage;
private Integer tejia;
private String shifoutejia;

private String del;

private TGoodsDAO goodsDAO;
private TPingjiaDAO pingjiaDAO;

public String goodsAdd()
{
TGoods goods=new TGoods();

//goods.setId(id);
goods.setLeibieId(leibieId);
goods.setMingcheng(mingcheng);
goods.setJieshao(jieshao);

goods.setFujian(fujian);
goods.setJiage(jiage);
goods.setTejia(jiage);
goods.setShifoutejia("no");

goods.setDel("no");

goodsDAO.save(goods);

Map request=(Map)ServletActionContext.getContext().get("request");
request.put("msg", "信息添加成功");
return "msg";
}


public String goodsMana()
{
String sql="from TGoods where del='no' order by leibieId";
List goodsList=goodsDAO.getHibernateTemplate().find(sql);

Map request=(Map)ServletActionContext.getContext().get("request");
request.put("goodsList", goodsList);
return ActionSupport.SUCCESS;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
}


public String goodsMana()
{
String sql="from TGoods where del='no' order by leibieId";
List goodsList=goodsDAO.getHibernateTemplate().find(sql);

Map request=(Map)ServletActionContext.getContext().get("request");
request.put("goodsList", goodsList);
return ActionSupport.SUCCESS;
}

public String goodsDel()
{
TGoods goods=goodsDAO.findById(id);
goods.setDel("yes");

goodsDAO.attachDirty(goods);

Map request=(Map)ServletActionContext.getContext().get("request");
request.put("msg", "信息删除成功");
return "msg";
}


public String goodsPre()
{
TGoods goods=goodsDAO.findById(id);

Map request=(Map)ServletActionContext.getContext().get("request");
request.put("goods", goods);
return ActionSupport.SUCCESS;
}

public String goodsEdit()
{
TGoods goods=goodsDAO.findById(id);

//goods.setId(id);
goods.setLeibieId(leibieId);
goods.setMingcheng(mingcheng);
goods.setJieshao(jieshao);

goods.setFujian(fujian);
goods.setJiage(jiage);
goods.setTejia(jiage);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
	{
this.leixing = leixing;
}



public String getDel()
{
return del;
}

public void setDel(String del)
{
this.del = del;
}

public String getMessage()
{
return message;
}

public void setMessage(String message)
{
this.message = message;
}

public String getPath()
{
return path;
}

public void setPath(String path)
{
this.path = path;
}

}




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
}
public TAdminDAO getAdminDAO()
{
return adminDAO;
}
public void setAdminDAO(TAdminDAO adminDAO)
{
this.adminDAO = adminDAO;
}

public String login(String userName,String userPw,int userType)
{

String result="no";

if(userType==0)//系统管理员登录
{
String sql="from TAdmin where userName=? and userPw=?";
Object[] con={userName.trim(),userPw.trim()};
List adminList=adminDAO.getHibernateTemplate().find(sql,con);
if(adminList.size()==0)
{
result="no";
}
else
{
WebContext ctx = WebContextFactory.get();
HttpSession session=ctx.getSession();
TAdmin admin=(TAdmin)adminList.get(0);
session.setAttribute("userType", 0);
session.setAttribute("admin", admin);
result="yes";
}
}
if(userType==1)
{
String sql="from THuiyuan where loginname=? and loginpw=? and del='no'";
Object[] con={userName.trim(),userPw.trim()};
List huiyuanList=huiyuanDAO.getHibernateTemplate().find(sql,con);

if(huiyuanList.size()==0)
{
result="no";
}
else
{


项目链接:
https://javayms.github.io?id=251024323103201ln
https://javayms.pages.dev?id=251024323103201ln