文章目录
- 母婴商城系统
- 一、项目演示
- 二、项目介绍
- 三、系统部分功能截图
- 四、万字论文参考
- 五、部分代码展示
- 六、底部获取项目源码和万字论文参考(9.9¥带走)
母婴商城系统
一、项目演示
母婴商城系统
二、项目介绍
基于SSH的母婴商城系统
系统角色 : 管理员、用户
一,管理员
1、用户登陆 2、商品展示 3、会员注册 4、我的购物车 5、我的订单 6、留言反馈 7、促销信息
二,用户
1、修改登陆密码 2、商品类型管理 3、商品信息管理 4、会员信息管理 5、订单信息管理 6、留言反馈管理 7、促销信息管理
语言:java
技术栈:Spring;JSP; Struts2; hibernate
数据库:MySQL
三、系统部分功能截图
四、万字论文参考
五、部分代码展示
package com.itbaizhan.action;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.apache.struts2.ServletActionContext;
import com.itbaizhan.dao.TGoodsDAO;
import com.itbaizhan.dao.TMingxiDAO;
import com.itbaizhan.dao.TOrderDAO;
import com.itbaizhan.model.TGoods;
import com.itbaizhan.model.THuiyuan;
import com.itbaizhan.model.TMingxi;
import com.itbaizhan.model.TOrder;
import com.itbaizhan.util.Cart;
import com.opensymphony.xwork2.ActionSupport;
public class buyAction extends ActionSupport
{
private TGoodsDAO goodsDAO;
private TOrderDAO orderDAO;
private TMingxiDAO mingxiDAO;
private String message;
private String path;
public String addToCart()
{
HttpServletRequest request=ServletActionContext.getRequest();
HttpSession session=request.getSession();
int goodsId=Integer.parseInt(request.getParameter("goodsId"));
int shuliang=Integer.parseInt(request.getParameter("shuliang"));
TGoods goods=goodsDAO.findById(goodsId);
TMingxi mingxi=new TMingxi();
mingxi.setGoods(goods);
mingxi.setGoodsShuliang(shuliang);
Cart cart = (Cart)session.getAttribute("cart");
cart.addGoods(goodsId, mingxi);
session.setAttribute("cart",cart);
this.setMessage("成功购物");
this.setPath("myCart.action");
return "succeed";
}
public String myCart()
{
return ActionSupport.SUCCESS;
}
public String orderQueren()
{
Map request=(Map)ServletActionContext.getContext().get("request");
return ActionSupport.SUCCESS;
}
public String orderSubmit()
{
HttpServletRequest request=ServletActionContext.getRequest();
HttpSession session=request.getSession();
Cart cart = (Cart)session.getAttribute("cart");
THuiyuan huiyuan=(THuiyuan)session.getAttribute("huiyuan");
TOrder order=new TOrder();
//order.setId(id);
order.setBianhao(new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()));
order.setXiadanshi(new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(new Date()));
order.setZt("待受理");
order.setSonghuodizhi(request.getParameter("songhuodizhi"));
order.setFukuanfangshi(request.getParameter("fukuanfangshi"));
order.setZongjia(cart.getTotalPrice());
order.setHuiyuanId(huiyuan.getId());
orderDAO.save(order);
for (Iterator it = cart.getItems().values().iterator(); it.hasNext();)
{
TMingxi mingxi = (TMingxi) it.next();
mingxi.setOrderId(order.getId());
mingxi.setGoodsId(mingxi.getGoods().getId());
mingxiDAO.save(mingxi);
}
cart.getItems().clear();
session.setAttribute("cart", cart);
request.setAttribute("order", order);
return ActionSupport.SUCCESS;
}
public String orderMine()
{
Map session= ServletActionContext.getContext().getSession();
THuiyuan huiyuan=(THuiyuan)session.get("huiyuan");
String sql="from TOrder where huiyuanId="+huiyuan.getId();
List orderList=orderDAO.getHibernateTemplate().find(sql);
Map request=(Map)ServletActionContext.getContext().get("request");
request.put("orderList", orderList);
return ActionSupport.SUCCESS;
}
public String orderDel()
{
HttpServletRequest request=ServletActionContext.getRequest();
int id=Integer.parseInt(request.getParameter("id"));
TOrder order=orderDAO.findById(id);
orderDAO.delete(order);
this.setMessage("订单删除完毕");
this.setPath("orderMine.action");
return "succeed";
}
public String orderMana()
{
String sql="from TOrder";
List orderList=orderDAO.getHibernateTemplate().find(sql);
Map request=(Map)ServletActionContext.getContext().get("request");
request.put("orderList", orderList);
return ActionSupport.SUCCESS;
}
public String orderShouli()
{
HttpServletRequest request=ServletActionContext.getRequest();
int id=Integer.parseInt(request.getParameter("id"));
TOrder order=orderDAO.findById(id);
order.setZt("已受理");
orderDAO.attachDirty(order);
request.setAttribute("msg", "受理订单成功");
return "msg";
}
public String orderDetail()
{
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 TGoodsDAO getGoodsDAO()
{
return goodsDAO;
}
public TMingxiDAO getMingxiDAO()
{
return mingxiDAO;
}
public void setMingxiDAO(TMingxiDAO mingxiDAO)
{
this.mingxiDAO = mingxiDAO;
}
public void setGoodsDAO(TGoodsDAO goodsDAO)
{
this.goodsDAO = goodsDAO;
}
public TOrderDAO getOrderDAO()
{
return orderDAO;
}
public void setOrderDAO(TOrderDAO orderDAO)
{
this.orderDAO = orderDAO;
}
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;
}
}
package com.itbaizhan.action;
import java.util.List;
import java.util.Map;
import org.apache.struts2.ServletActionContext;
import com.itbaizhan.dao.TCuxiaoDAO;
import com.itbaizhan.dao.TGoodsDAO;
import com.itbaizhan.model.TCuxiao;
import com.opensymphony.xwork2.ActionSupport;
public class cuxiaoAction extends ActionSupport
{
private Integer id;
private String biaoti;
private String neirong;
private String fabushi;
private TCuxiaoDAO cuxiaoDAO;
public String cuxiaoAdd()
{
TCuxiao cuxiao=new TCuxiao();
cuxiao.setBiaoti(biaoti);
cuxiao.setNeirong(neirong);
cuxiao.setFabushi(fabushi);
cuxiaoDAO.save(cuxiao);
Map request=(Map)ServletActionContext.getContext().get("request");
request.put("msg", "信息添加完毕");
return "msg";
}
public String cuxiaoMana()
{
String sql="from TCuxiao";
List cuxiaoList=cuxiaoDAO.getHibernateTemplate().find(sql);
Map request=(Map)ServletActionContext.getContext().get("request");
request.put("cuxiaoList", cuxiaoList);
return ActionSupport.SUCCESS;
}
public String cuxiaoDel()
{
TCuxiao cuxiao=cuxiaoDAO.findById(id);
cuxiaoDAO.delete(cuxiao);
Map request=(Map)ServletActionContext.getContext().get("request");
request.put("msg", "信息删除完毕");
return "msg";
}
public String cuxiaoAll()
{
String sql="from TCuxiao";
List cuxiaoList=cuxiaoDAO.getHibernateTemplate().find(sql);
Map request=(Map)ServletActionContext.getContext().get("request");
request.put("cuxiaoList", cuxiaoList);
return ActionSupport.SUCCESS;
}
public String cuxiaoDetailQian()
{
TCuxiao cuxiao=cuxiaoDAO.findById(id);
Map request=(Map)ServletActionContext.getContext().get("request");
request.put("cuxiao", cuxiao);
return ActionSupport.SUCCESS;
}
public Integer getId()
{
return id;
}
public void setId(Integer id)
{
this.id = id;
}
public String getBiaoti()
{
return biaoti;
}
public void setBiaoti(String biaoti)
{
this.biaoti = biaoti;
}
public String getNeirong()
{
return neirong;
}
public void setNeirong(String neirong)
{
this.neirong = neirong;
}
public String getFabushi()
{
return fabushi;
}
public void setFabushi(String fabushi)
{
this.fabushi = fabushi;
}
public TCuxiaoDAO getCuxiaoDAO()
{
return cuxiaoDAO;
}
public void setCuxiaoDAO(TCuxiaoDAO cuxiaoDAO)
{
this.cuxiaoDAO = cuxiaoDAO;
}
}
package com.itbaizhan.action;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.ServletActionContext;
import com.itbaizhan.dao.TGoodsDAO;
import com.itbaizhan.model.TGoods;
import com.itbaizhan.util.Pagesize;
import com.itbaizhan.util.Pagination;
import com.opensymphony.xwork2.ActionSupport;
public class goodsAction extends ActionSupport
{
private Integer id;
private Integer leibieId;
private String mingcheng;
private String jieshao;
private String fujian;
private Integer jiage;
private Integer tejia;
private String shifoutejia;
private String del;
private TGoodsDAO goodsDAO;
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;
}
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 goodsAll()
{
String sql="from TGoods where del='no' order by id desc";
List goodsList=goodsDAO.getHibernateTemplate().find(sql);
HttpServletRequest request=ServletActionContext.getRequest();
int index=0;
if(request.getParameter("index")==null)
{
index=1;
}
else
{
index=Integer.parseInt(request.getParameter("index"));
}
int fromIndex = (index - 1) * Pagesize.size;
int toIndex = Math.min(fromIndex + Pagesize.size, goodsList.size());
List goodsList1 = goodsList.subList(fromIndex, toIndex);
Pagination p = new Pagination();
p.setIndex(index);
p.setPageSize(Pagesize.size);
p.setTotle(goodsList.size());
p.setData(goodsList1);
request.setAttribute("page", p);
return ActionSupport.SUCCESS;
}
public String goodsDetailQian()
{
TGoods goods=goodsDAO.findById(id);
Map request=(Map)ServletActionContext.getContext().get("request");
request.put("goods", goods);
return ActionSupport.SUCCESS;
}
public String goodsByLeibie()
{
String sql="from TGoods where del='no' and leibieId=?";
Object[] con={leibieId};
Map request=(Map)ServletActionContext.getContext().get("request");
List goodsList=goodsDAO.getHibernateTemplate().find(sql,con);
request.put("goodsList", goodsList);
System.out.println(goodsList.size()+"&&");
return ActionSupport.SUCCESS;
}
public String goodsRes()
{
String sql="from TGoods where del='no' and mingcheng like '%"+mingcheng.trim()+"%'";
List goodsList=goodsDAO.getHibernateTemplate().find(sql);
Map request=(Map)ServletActionContext.getContext().get("request");
request.put("goodsList", goodsList);
return ActionSupport.SUCCESS;
}
public Integer getLeibieId()
{
return leibieId;
}
public void setLeibieId(Integer leibieId)
{
this.leibieId = leibieId;
}
public Integer getId()
{
return id;
}
public void setId(Integer id)
{
this.id = id;
}
public String getMingcheng()
{
return mingcheng;
}
public void setMingcheng(String mingcheng)
{
this.mingcheng = mingcheng;
}
public String getJieshao()
{
return jieshao;
}
public void setJieshao(String jieshao)
{
this.jieshao = jieshao;
}
public String getFujian()
{
return fujian;
}
public void setFujian(String fujian)
{
this.fujian = fujian;
}
public Integer getJiage()
{
return jiage;
}
public void setJiage(Integer jiage)
{
this.jiage = jiage;
}
public Integer getTejia()
{
return tejia;
}
public void setTejia(Integer tejia)
{
this.tejia = tejia;
}
public String getShifoutejia()
{
return shifoutejia;
}
public void setShifoutejia(String shifoutejia)
{
this.shifoutejia = shifoutejia;
}
public String getDel()
{
return del;
}
public void setDel(String del)
{
this.del = del;
}
public TGoodsDAO getGoodsDAO()
{
return goodsDAO;
}
public void setGoodsDAO(TGoodsDAO goodsDAO)
{
this.goodsDAO = goodsDAO;
}
}
六、底部获取项目源码和万字论文参考(9.9¥带走)
有问题,或者需要协助调试运行项目的也可以