——————————DescriptionStart——————————
运行环境 Java≥8、MySQL≥5.7、Tomcat≥8
开发工具 eclipse/idea/myeclipse/sts等均可配置运行
适用 课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的SSM电子产品商城购物商城(java+ssm+jsp+mysql)
管理员: admin 123456
用户: xm 123456 calvin 123456 mv 123456 mm 123456 kiki 123456 kkkk 123456 yoyo 123456 zzh 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 shapplyDAO.update(shapply); return "redirect:shapplyList.do" ; } @RequestMapping("admin/shapplyDel") public String shapplyDel (int id, HttpServletRequest request,HttpServletResponse response) { shapplyDAO.delete(id); return "redirect:shapplyList.do" ; } @RequestMapping("qtShapplyDel") public String qtShapplyDel (int id, HttpServletRequest request,HttpServletResponse response) { shapplyDAO.delete(id); return "redirect:shapply.do" ; } }
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 public String addressEdit (Address address,HttpServletRequest request) { String orderid = request.getParameter("orderid" ); addressDAO.update(address); return "redirect:skipFukuan.do?id=" +orderid; } @RequestMapping("addressDel") public String addressDel (int id, HttpServletRequest request) { String orderid = request.getParameter("orderid" ); Address address = addressDAO.findById(id); address.setDelstatus("1" ); addressDAO.update(address); return "redirect:skipFukuan.do?id=" +orderid; } @RequestMapping("updateIsmr") public String updateIsmr (int id, HttpServletRequest request) { Member member = (Member)request.getSession().getAttribute("sessionmember" ); String orderid = request.getParameter("orderid" ); HashMap map = new HashMap(); map.put("memberid" , member.getId()); List<Address> list = addressDAO.selectAll(map); for (Address address:list){ address.setIsmr("no" ); addressDAO.update(address); } Address addr = addressDAO.findById(id); addr.setIsmr("yes" ); addressDAO.update(addr); return "redirect:skipFukuan.do?id=" +orderid; } }
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 54 wrt = response.getWriter(); } catch (IOException e) { e.printStackTrace(); } wrt.write(str); } return "" ; } public void delete (HttpServletRequest request, String tablename) { int i = 0 ; try { String did = request.getParameter("did" ); if (did == null ) did = request.getParameter("scid" ); if (did != null ) { if (did.length() > 0 ) { Statement st = conn.createStatement(); st.execute("delete from " + tablename + " where id=" + did); st.close(); } } } catch (SQLException e) { e.printStackTrace(); } } public String getCols (String table) { String str = "" ; Connection conn = this .getConn(); try { Statement st = conn.createStatement(); ResultSet rs = st.executeQuery("select * from " + table); ResultSetMetaData rsmd = rs.getMetaData(); int i = rsmd.getColumnCount(); for (int j = 2 ; j <= i; j++) { str += rsmd.getColumnName(j) + "," ; } } catch (Exception e) { e.printStackTrace(); } str = str.substring(0 , str.length() - 1 ); return str; }
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 if(optionstr.length()>0)optionstr=optionstr.substring(0,optionstr.length()-3); String nbs = ""; if(i>0)nbs=" "; checkbox+="<label > "+nbs+"<input type ='checkbox' name ='"+name+"' value =\ ""+optionstr +"\"> "+optionstr+"</label > \n"; checkbox+="<label > - "+nstr+" <input type ='text' size ='5' name ='"+optionstr+"' value =\ "\"> </label > <br /> \n"; i++; } checkbox+="<input type =hidden name ='"+name+"' value ='' /> <input type =hidden name ='dk-"+name+"-value' value ='"+nstr+"' /> "; return checkbox; } public static String getFileUpInfo() { String jscode = ""; jscode+="<font onclick =\ "uploaddoc ()\" src =\ "js /nopic.jpg \" style ='cursor:hand' id =txt > 点击此处上传</font > "; jscode+=" <input type =text readonly style ='border:0px' size =30 name =\ "docname \" id =\ "docname \" value =\ "\" /> "; return jscode; } public static String tform(HashMap map) { String jscode = ""; try{ jscode+="<script type =\ "text /javascript \"> \n"; jscode+="function getPvalue()\n" ; jscode+="{\n" ; Set set = map.entrySet(); Iterator it = set.iterator(); while (it.hasNext()) { String pm=((Object )it.next()).toString(); String str1 = "" ; String str2 = "" ; String [] strs = pm.split("=" ); str1 = strs[0]; if (strs.length==1 )str2="" ; if (strs.length==2 )str2=strs[1 ]; str2 = str2.replaceAll("\r\n" , "-----" ); if (!str1.equals("content" )){
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 request.setAttribute("categroystr" , categroystr); } saveobject.getCart(request); saveobject.getCategoryObject(request); return "shop" ; } @RequestMapping("fubiLb") public String fubiLb (@RequestParam(defaultValue = "1",value = "pageNum") Integer pageNum,HttpServletRequest request) { HashMap map = new HashMap(); map.put("issj" , "yes" ); map.put("leibie" , "积分商品" ); List<Product> nlist = productDAO.selectAll(map); request.setAttribute("nlist" , nlist); PageHelper.startPage(pageNum,10 ); List<Product> list = productDAO.selectAll(map); PageInfo<Product> pageInfo = new PageInfo<Product>(list); request.setAttribute("pageInfo" , pageInfo); saveobject.getCart(request); saveobject.getCategoryObject(request); return "fubilb" ; } @RequestMapping("admin/udateIstj") public String udateIstj (HttpServletRequest request) { String id = request.getParameter("id" ); String istj = request.getParameter("type" ); String shop = request.getParameter("shop" ); Product product = productDAO.findById(Integer.parseInt(id)); product.setIstj(istj); productDAO.update(product); return "redirect:productMsg.do" ; } @RequestMapping("admin/udateIssj") public String udateIssj (HttpServletRequest request) {
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 ProductDAO productDao; @Resource OrdermsgDAO ordermsgDAO; @Resource OrdermsgdetailsDAO ordermsgdetailsDAO; @Resource MemberDAO memberDAO; @Resource InventoryDAO inventoryDAO; @RequestMapping("/admin/statisticsNum") public String saleProduct (HttpServletRequest request) { User shop = (User)request.getSession().getAttribute("admin" ); HashMap map = new HashMap(); map.put("saver" , shop.getId()); map.put("leibie" , "购买商品" ); List<Product> plist = productDao.selectProductAll(map); ArrayList nlist = new ArrayList(); ArrayList slist = new ArrayList(); for (Product product:plist){ int outnum = 0 ; HashMap map1 = new HashMap(); map1.put("productid" , product.getId()); map1.put("type" , "out" ); System.out.println(map); List<Inventory> outlist = inventoryDAO.selectAll(map1); for (Inventory out:outlist){ outnum += out.getNum(); } nlist.add("'" +product.getProductname()+"'" ); slist.add(outnum); } request.setAttribute("nlist" , nlist); request.setAttribute("slist" , slist); return "admin/tjnum" ; } @RequestMapping("/admin/selectSaleMoney") public String selectSaleMoney (HttpServletRequest request) { User shop = (User)request.getSession().getAttribute("admin" ); HashMap map = new HashMap(); map.put("fkstatus" , "交易完成" ); if (!shop.getUsertype().equals("" )){ map.put("saver" , shop.getId());
——————————PayStart——————————
项目链接: https://javayms.github.io?id=201323020309201dd https://javayms.pages.dev?id=201323020309201dd