• 大小: 18.05MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-06-18
  • 语言: Java
  • 标签:         

资源简介

超市管理系统(JAVA/SSH+MySql),源代码+数据库

资源截图

代码片段和文件信息

package action;

import java.util.Date;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;

import entity.Goods;
import entity.Sale;
import entity.User;
import form.GoodsForm;

import biz.GoodsBiz;
import biz.SaleBiz;

public class GoodsAction extends DispatchAction {
private GoodsBiz goodsBiz;
    private SaleBiz saleBiz; 
public void setSaleBiz(SaleBiz saleBiz) {
this.saleBiz = saleBiz;
}
public void setGoodsBiz(GoodsBiz goodsBiz) {
this.goodsBiz = goodsBiz;
}
/**
 * 添加商品
 * @param mapping指向
 * @param form表单
 * @param request请求
 * @param response响应
 * @return
 * @throws Exception
 */
public ActionForward addGood(ActionMapping mapping ActionForm form
HttpServletRequest request HttpServletResponse response)
throws Exception {
GoodsForm goodsForm=(GoodsForm)form;
Goods goods=new Goods();
goods.setGoodsName(goodsForm.getGoods().getGoodsName());
goods.setGoodsDis(goodsForm.getGoods().getGoodsDis());
goods.setGoodsNum(goodsForm.getGoods().getGoodsNum());
goods.setGoodsPrice(goodsForm.getGoods().getGoodsPrice());
goods.setGoodsType(goodsForm.getGoods().getGoodsType());
goodsBiz.addGood(goods);
return mapping.findForward(“ok“);
}
public ActionForward buyGood(ActionMapping mapping ActionForm form
HttpServletRequest request HttpServletResponse response)
throws Exception {
ActionForward forword;
        int id=Integer.parseInt(request.getParameter(“msn“).toString());
        Goods good=goodsBiz.getGoodById(id);
        if(good.getGoodsNum()>0){
         Goods g=new Goods();
            g.setGoodsId(id);
            g.setGoodsName(good.getGoodsName());
            g.setGoodsPrice(good.getGoodsPrice());
            g.setGoodsType(good.getGoodsType());
            g.setGoodsDis(good.getGoodsDis());
            g.setGoodsNum(good.getGoodsNum()-1);
            goodsBiz.updateGood(g);
            Sale sale=new Sale(); 
            sale.setSaleDate(new Date());
            sale.setGoods(g);
            User user=(User)request.getSession().getAttribute(“user“);
            sale.setUser(user);
            double price=0;
            if(user.getIsMember().equals(“是“)&&good.getGoodsDis()!=0){
             sale.setSalePrice(good.getGoodsPrice()*good.getGoodsDis());
             price=good.getGoodsPrice()*good.getGoodsDis();
            }else{
              sale.setSalePrice(g.getGoodsPrice());
              price=good.getGoodsPrice();
            }
            request.getSession().setAttribute(“price“ price);
            saleBiz.addSale(sale);
            forword=mapping.findForward(“result“);
        }else{
         forword=mapping.findForward(“error“);
        }
        re

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       5508  2011-06-29 08:41  超市管理系统\DB\New Project 20110629 0841.sql

     文件       4641  2011-06-24 13:22  超市管理系统\supermarket\.classpath

     文件        306  2011-06-27 08:01  超市管理系统\supermarket\.mymetadata

     文件       1284  2011-06-21 14:50  超市管理系统\supermarket\.project

     文件        330  2011-06-20 13:42  超市管理系统\supermarket\.settings\org.eclipse.jdt.core.prefs

     文件       6084  2011-06-25 14:23  超市管理系统\supermarket\src\action\GoodsAction.java

     文件        566  2011-06-21 16:53  超市管理系统\supermarket\src\action\RoleAction.java

     文件       3535  2011-06-25 14:12  超市管理系统\supermarket\src\action\SaleAction.java

     文件       4815  2011-06-27 06:37  超市管理系统\supermarket\src\action\UserAction.java

     文件       1535  2011-06-24 11:56  超市管理系统\supermarket\src\applicationContext-action.xml

     文件       1932  2011-06-22 09:52  超市管理系统\supermarket\src\applicationContext-beans.xml

     文件       2010  2011-06-21 08:52  超市管理系统\supermarket\src\applicationContext-common.xml

     文件        336  2011-06-22 08:31  超市管理系统\supermarket\src\biz\GoodsBiz.java

     文件        833  2011-06-22 08:24  超市管理系统\supermarket\src\biz\impl\GoodsBizImpl.java

     文件        338  2011-06-21 15:37  超市管理系统\supermarket\src\biz\impl\RoleBizImpl.java

     文件        848  2011-06-25 14:12  超市管理系统\supermarket\src\biz\impl\SaleBizImpl.java

     文件        817  2011-06-25 13:08  超市管理系统\supermarket\src\biz\impl\UserBizImpl.java

     文件        107  2011-06-21 11:13  超市管理系统\supermarket\src\biz\RoleBiz.java

     文件        382  2011-06-25 14:12  超市管理系统\supermarket\src\biz\SaleBiz.java

     文件        339  2011-06-24 09:11  超市管理系统\supermarket\src\biz\UserBiz.java

     文件        337  2011-06-24 14:03  超市管理系统\supermarket\src\dao\GoodsDao.java

     文件        998  2011-06-25 10:00  超市管理系统\supermarket\src\dao\impl\GoodsDaoImpl.java

     文件        367  2011-06-21 13:38  超市管理系统\supermarket\src\dao\impl\RoleDaoImpl.java

     文件       1469  2011-06-25 10:14  超市管理系统\supermarket\src\dao\impl\SaleDaoImpl.java

     文件       1172  2011-06-25 13:18  超市管理系统\supermarket\src\dao\impl\UserDaoImpl.java

     文件        107  2011-06-24 11:54  超市管理系统\supermarket\src\dao\RoleDao.java

     文件        382  2011-06-25 14:11  超市管理系统\supermarket\src\dao\SaleDao.java

     文件        339  2011-06-25 14:11  超市管理系统\supermarket\src\dao\UserDao.java

     文件        518  2011-06-22 10:41  超市管理系统\supermarket\src\entity\Goods.hbm.xml

     文件       1015  2011-06-22 10:40  超市管理系统\supermarket\src\entity\Goods.java

............此处省略173个文件信息

评论

共有 条评论