資源簡(jiǎn)介
超市管理系統(tǒng)(JAVA/SSH+MySql),源代碼+數(shù)據(jù)庫(kù)
代碼片段和文件信息
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請(qǐng)求
?*?@param?response響應(yīng)
?*?@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
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件???????5508??2011-06-29?08:41??超市管理系統(tǒng)\DB\New?Project?20110629?0841.sql
?????文件???????4641??2011-06-24?13:22??超市管理系統(tǒng)\supermarket\.classpath
?????文件????????306??2011-06-27?08:01??超市管理系統(tǒng)\supermarket\.myme
?????文件???????1284??2011-06-21?14:50??超市管理系統(tǒng)\supermarket\.project
?????文件????????330??2011-06-20?13:42??超市管理系統(tǒng)\supermarket\.settings\org.eclipse.jdt.core.prefs
?????文件???????6084??2011-06-25?14:23??超市管理系統(tǒng)\supermarket\src\action\GoodsAction.java
?????文件????????566??2011-06-21?16:53??超市管理系統(tǒng)\supermarket\src\action\RoleAction.java
?????文件???????3535??2011-06-25?14:12??超市管理系統(tǒng)\supermarket\src\action\SaleAction.java
?????文件???????4815??2011-06-27?06:37??超市管理系統(tǒng)\supermarket\src\action\UserAction.java
?????文件???????1535??2011-06-24?11:56??超市管理系統(tǒng)\supermarket\src\applicationContext-action.xm
?????文件???????1932??2011-06-22?09:52??超市管理系統(tǒng)\supermarket\src\applicationContext-beans.xm
?????文件???????2010??2011-06-21?08:52??超市管理系統(tǒng)\supermarket\src\applicationContext-common.xm
?????文件????????336??2011-06-22?08:31??超市管理系統(tǒng)\supermarket\src\biz\GoodsBiz.java
?????文件????????833??2011-06-22?08:24??超市管理系統(tǒng)\supermarket\src\biz\impl\GoodsBizImpl.java
?????文件????????338??2011-06-21?15:37??超市管理系統(tǒng)\supermarket\src\biz\impl\RoleBizImpl.java
?????文件????????848??2011-06-25?14:12??超市管理系統(tǒng)\supermarket\src\biz\impl\SaleBizImpl.java
?????文件????????817??2011-06-25?13:08??超市管理系統(tǒng)\supermarket\src\biz\impl\UserBizImpl.java
?????文件????????107??2011-06-21?11:13??超市管理系統(tǒng)\supermarket\src\biz\RoleBiz.java
?????文件????????382??2011-06-25?14:12??超市管理系統(tǒng)\supermarket\src\biz\SaleBiz.java
?????文件????????339??2011-06-24?09:11??超市管理系統(tǒng)\supermarket\src\biz\UserBiz.java
?????文件????????337??2011-06-24?14:03??超市管理系統(tǒng)\supermarket\src\dao\GoodsDao.java
?????文件????????998??2011-06-25?10:00??超市管理系統(tǒng)\supermarket\src\dao\impl\GoodsDaoImpl.java
?????文件????????367??2011-06-21?13:38??超市管理系統(tǒng)\supermarket\src\dao\impl\RoleDaoImpl.java
?????文件???????1469??2011-06-25?10:14??超市管理系統(tǒng)\supermarket\src\dao\impl\SaleDaoImpl.java
?????文件???????1172??2011-06-25?13:18??超市管理系統(tǒng)\supermarket\src\dao\impl\UserDaoImpl.java
?????文件????????107??2011-06-24?11:54??超市管理系統(tǒng)\supermarket\src\dao\RoleDao.java
?????文件????????382??2011-06-25?14:11??超市管理系統(tǒng)\supermarket\src\dao\SaleDao.java
?????文件????????339??2011-06-25?14:11??超市管理系統(tǒng)\supermarket\src\dao\UserDao.java
?????文件????????518??2011-06-22?10:41??超市管理系統(tǒng)\supermarket\src\entity\Goods.hbm.xm
?????文件???????1015??2011-06-22?10:40??超市管理系統(tǒng)\supermarket\src\entity\Goods.java
............此處省略173個(gè)文件信息
評(píng)論
共有 條評(píng)論