——————————DescriptionStart——————————
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明






基于javaweb的SSH超市进销存管理系统超市管理系统(java+hibernate+struts+jsp+mysql)
管理员:
admin/123456
员工:
emp0001 123456
emp0002 123456
emp003 123456
——————————CodeStart——————————
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 48 49 50 51 52 53
| public SellInfo(Integer sellInfoId) { this.sellInfoId = sellInfoId; }
public SellInfo(Integer sellInfoId, String goodNo, Double price, Integer number, Double totalPrice, Timestamp sellTime) { this.sellInfoId = sellInfoId; this.goodNo = goodNo; this.price = price; this.number = number; this.totalPrice = totalPrice; this.sellTime = sellTime; }
public Integer getSellInfoId() { return this.sellInfoId; }
public void setSellInfoId(Integer sellInfoId) { this.sellInfoId = sellInfoId; }
public String getGoodNo() { return this.goodNo; }
public void setGoodNo(String goodNo) { this.goodNo = goodNo; }
public Double getPrice() { return this.price; }
public void setPrice(Double price) { this.price = price; }
public Integer getNumber() { return this.number; }
public void setNumber(Integer number) { this.number = number; }
public Double getTotalPrice() { return this.totalPrice;
|
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
| }
public int getIsSpecial() { return isSpecial; }
public void setIsSpecial(int isSpecial) { this.isSpecial = isSpecial; }
}
public class SellDao { private final int PAGE_SIZE = 5; public void SaveSellInfo(SellInfo sellInfo,GoodStockInfo stock) throws Exception {
Session s = null; Transaction tx = null; try { s = HibernateUtil.getSession(); tx = s.beginTransaction(); s.save(sellInfo); s.saveOrUpdate(stock); tx.commit(); } catch (HibernateException e) { if(tx != null) tx.rollback(); throw e; } finally { HibernateUtil.closeSession(); }
|
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 48 49 50 51 52
| if(totalPage>1&¤tPage!=totalPage) sellInfoPageFootStr += " <A onclick='document.queryForm.currentPage.value=" + totalPage + ";document.queryForm.submit();' href='#'"+">尾页</A> "; else sellInfoPageFootStr += " 尾页 "; sellInfoPageFootStr+="第<input name=currentPage type=text size=2>页 <input type=submit value=GO>" ; return sellInfoPageFootStr; } private void QueryGoodInfo() { goodList=goodsDao.QueryGoodInfo("","",-1,1); } public List<GoodInfo> getGoodList() { return goodList; } public void setGoodList(List<GoodInfo> goodList) { this.goodList = goodList; } public String getGoodNo() { return goodNo; } public void setGoodNo(String goodNo) { this.goodNo = goodNo; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } public int getNumber() { return number; } public void setNumber(int number) { this.number = number; } public double getTotalPrice() { return totalPrice; } public void setTotalPrice(double totalPrice) { this.totalPrice = totalPrice; } public Timestamp getSellDate() { return sellDate; } public void setSellDate(Timestamp sellDate) { this.sellDate = sellDate; } public int getCurrentPage() { return currentPage; } public void setCurrentPage(int currentPage) { this.currentPage = currentPage;
|
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 class StockDao { private final int PAGE_SIZE = 5; public int CalculateTotalPage(String goodNo, String goodName) { Session s = null; try { s = HibernateUtil.getSession(); String hql = "from GoodStockInfo s where 1=1"; if(!goodNo.equals("")) { hql += " and s.goodNo='"+goodNo+"'" ; } if(!goodName.equals("")) { hql += " and s.goodInfo.goodName='"+goodName+"'" ; } Query q = s.createQuery(hql); int recordCount = q.list().size(); int mod = recordCount % this.PAGE_SIZE; int totalPage = recordCount / this.PAGE_SIZE; if(mod != 0) totalPage++; return totalPage; } finally { HibernateUtil.closeSession(); } }
@SuppressWarnings("unchecked") public List<GoodStockInfo> QueryStockInfo(String goodNo, String goodName, int currentPage) { Session s = null; try { s = HibernateUtil.getSession(); String hql = "from GoodStockInfo s where 1=1"; if(!goodNo.equals("")) { hql += " and s.goodNo='"+goodNo+"'" ; } if(!goodName.equals("")) { hql += " and s.goodInfo.goodName='"+goodName+"'" ; } Query q = s.createQuery(hql); int startIndex = (currentPage-1) * this.PAGE_SIZE; q.setFirstResult(startIndex); q.setMaxResults(this.PAGE_SIZE); List<GoodStockInfo> stockInfoList = q.list(); return stockInfoList;
|
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 getGoodUnit() { return this.goodUnit; }
public void setGoodUnit(String goodUnit) { this.goodUnit = goodUnit; }
public String getGoodModel() { return this.goodModel; }
public void setGoodModel(String goodModel) { this.goodModel = goodModel; }
public String getGoodSpecs() { return this.goodSpecs; }
public void setGoodSpecs(String goodSpecs) { this.goodSpecs = goodSpecs; }
public Double getGoodPrice() { return this.goodPrice; }
public void setGoodPrice(Double goodPrice) { this.goodPrice = goodPrice; }
public String getGoodPlace() { return this.goodPlace; }
public void setGoodPlace(String goodPlace) { this.goodPlace = goodPlace; }
public String getGoodMemo() { return this.goodMemo; }
public void setGoodMemo(String goodMemo) { this.goodMemo = goodMemo;
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=221723170209201cz
https://javayms.pages.dev?id=221723170209201cz