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







基于javaweb的SSM在线服装商城购物商城(java+ssm+mysql+jsp)
1 2 3 4 5 6
| 管理员: admin 123456
用户 user1 123456 user2 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
| public void setItemsService(ItemsService itemsService) { this.itemsService = itemsService; }
}
@Controller
@RequestMapping(value = "/article", produces = "text/plain;charset=utf-8") public class ArticleAction extends BaseAction { @Autowired @Resource private ArticleService articleService;
@RequestMapping("createArticle.action") public String createArticle() { return "admin/addarticle"; }
@RequestMapping("addArticle.action") public String addArticle(Article article) { article.setAddtime(VeDate.getStringDateShort()); article.setHits("0"); this.articleService.insertArticle(article); return "redirect:/article/createArticle.action"; }
@RequestMapping("deleteArticle.action") public String deleteArticle(String id) { this.articleService.deleteArticle(id); return "redirect:/article/getAllArticle.action"; }
|
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
| @RequestMapping("deleteArticle.action") public String deleteArticle(String id) { this.articleService.deleteArticle(id); return "redirect:/article/getAllArticle.action"; }
@RequestMapping("deleteArticleByIds.action") public String deleteArticleByIds() { String[] ids = this.getRequest().getParameterValues("articleid"); for (String articleid : ids) { this.articleService.deleteArticle(articleid); } return "redirect:/article/getAllArticle.action"; }
@RequestMapping("updateArticle.action") public String updateArticle(Article article) { this.articleService.updateArticle(article); return "redirect:/article/getAllArticle.action"; }
@RequestMapping("getAllArticle.action") public String getAllArticle(String number) { List<Article> articleList = this.articleService.getAllArticle(); PageHelper.getPage(articleList, "article", null, null, 10, number, this.getRequest(), null); return "admin/listarticle"; }
@RequestMapping("queryArticleByCond.action") public String queryArticleByCond(String cond, String name, String number) { Article article = new Article(); if (cond != null) { if ("title".equals(cond)) { article.setTitle(name); } if ("image".equals(cond)) { article.setImage(name); } if ("contents".equals(cond)) { article.setContents(name); } if ("addtime".equals(cond)) { article.setAddtime(name); } if ("hits".equals(cond)) { article.setHits(name); } }
|
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
| } if ("regdate".equals(cond)) { users.setRegdate(name); } }
List<String> nameList = new ArrayList<String>(); List<String> valueList = new ArrayList<String>(); nameList.add(cond); valueList.add(name); PageHelper.getPage(this.usersService.getUsersByLike(users), "users", nameList, valueList, 10, number, this.getRequest(), "query"); name = null; cond = null; return "admin/queryusers"; }
@RequestMapping("getUsersById.action") public String getUsersById(String id) { Users users = this.usersService.getUsersById(id); this.getRequest().setAttribute("users", users); return "admin/editusers"; }
public UsersService getUsersService() { return usersService; }
public void setUsersService(UsersService usersService) { this.usersService = usersService; }
}
|
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
| if (maxPage <= (Integer.parseInt(number) + 1)) { buffer.append("尾页"); } else { buffer.append("<a href=\"index/recommend.action?number=" + (maxPage - 1) + "\">尾页</a>"); } html = buffer.toString(); this.getRequest().setAttribute("html", html); this.getRequest().setAttribute("goodsList", goodsList); return "users/list"; }
// 全部产品 @RequestMapping("all.action") public String all(String number) { this.front(); List<Goods> goodsList = new ArrayList<Goods>(); List<Goods> tempList = this.goodsService.getAllGoods(); int pageNumber = tempList.size(); int maxPage = pageNumber; if (maxPage % 9 == 0) { maxPage = maxPage / 9; } else { maxPage = maxPage / 9 + 1; } if (number == null) { number = "0"; } int start = Integer.parseInt(number) * 9; int over = (Integer.parseInt(number) + 1) * 9; int count = pageNumber - over; if (count <= 0) { over = pageNumber; } for (int i = start; i < over; i++) { Goods x = tempList.get(i); goodsList.add(x); } String html = ""; StringBuffer buffer = new StringBuffer(); buffer.append(" 共为"); buffer.append(maxPage); buffer.append("页 共有"); buffer.append(pageNumber); buffer.append("条 当前为第"); buffer.append((Integer.parseInt(number) + 1)); buffer.append("页 ");
|
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
| public void setComplainsService(ComplainsService complainsService) { this.complainsService = complainsService; }
}
@Controller
@RequestMapping(value = "/cart", produces = "text/plain;charset=utf-8") public class CartAction extends BaseAction { @Autowired @Resource private CartService cartService; @Autowired @Resource private UsersService usersService; @Autowired @Resource private GoodsService goodsService;
@RequestMapping("createCart.action") public String createCart() { List<Users> usersList = this.usersService.getAllUsers(); this.getRequest().setAttribute("usersList", usersList); List<Goods> goodsList = this.goodsService.getAllGoods(); this.getRequest().setAttribute("goodsList", goodsList); return "admin/addcart"; }
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=461423512708201bz
https://javayms.pages.dev?id=461423512708201bz