博主主页:猫头鹰源码
博主简介:Java领域优质创作者、CSDN博客专家、公司架构师、全网粉丝5万+、专注Java技术领域和毕业设计项目实战
主要内容:毕业设计(Javaweb项目|小程序等)、简历模板、学习资料、面试题库、技术咨询
文末联系获取
该系统基于SSM整合,数据层为MyBatis,mysql数据库,具有完整的业务逻辑,适合选题:商城、水果商城、网上购物、网购、在线购物等。
用户:登陆注册、商品详情、分类查看、筛选商品、加入购物车、收藏、我的订单等
管理员:登陆、用户管理、分类管理、商品管理、订单维护、公告管理、留言管理
具备完整的商城业务逻辑。
后端:springboot、mybatis
前端:layui,js,css等,html页面
开发工具:idea
数据库:mysql 5.7
JDK版本:jdk1.8
下面是首页

水果商品详情

购物车

我的订单查看

我的收藏

个人中心

留言信息

后台的登录

后台首页

后台商品维护

后台用户管理

商品修改操作
- /**
- * 分页查询商品列表
- */
- @RequestMapping("/findBySql")
- public String findBySql(Model model, Item item){
- String sql = "select * from item where isDelete = 0 ";
- if(!isEmpty(item.getName())){
- sql += " and name like '%" + item.getName() + "%' ";
- }
- sql += " order by id desc";
- Pager<Item> pagers = itemService.findBySqlRerturnEntity(sql);
- model.addAttribute("pagers",pagers);
- model.addAttribute("obj",item);
- return "item/item";
- }
-
- /**
- * 添加商品入口
- */
- @RequestMapping("/add")
- public String add(Model model){
- String sql = "select * from item_category where isDelete = 0 and pid is not null order by id";
- List<ItemCategory> listBySqlReturnEntity = itemCategoryService.listBySqlReturnEntity(sql);
- model.addAttribute("types",listBySqlReturnEntity);
- return "item/add";
- }
-
- /**
- * 执行添加商品
- */
- @RequestMapping("/exAdd")
- public String exAdd(Item item, @RequestParam("file")CommonsMultipartFile[] files, HttpServletRequest request) throws IOException {
- itemCommon(item, files, request);
- item.setGmNum(0);
- item.setIsDelete(0);
- item.setScNum(0);
- itemService.insert(item);
- return "redirect:/item/findBySql.action";
- }
-
- /**
- * 修改商品入口
- */
- @RequestMapping("/update")
- public String update(Integer id,Model model){
- Item obj = itemService.load(id);
- String sql = "select * from item_category where isDelete = 0 and pid is not null order by id";
- List<ItemCategory> listBySqlReturnEntity = itemCategoryService.listBySqlReturnEntity(sql);
- model.addAttribute("types",listBySqlReturnEntity);
- model.addAttribute("obj",obj);
- return "item/update";
- }
-
- /**
- * 执行修改商品
- */
- @RequestMapping("/exUpdate")
- public String exUpdate(Item item, @RequestParam("file")CommonsMultipartFile[] files, HttpServletRequest request) throws IOException {
- itemCommon(item, files, request);
- itemService.updateById(item);
- return "redirect:/item/findBySql.action";
- }
-
- /**
- * 新增和更新的公共方法
- */
- private void itemCommon(Item item, @RequestParam("file") CommonsMultipartFile[] files, HttpServletRequest request) throws IOException {
- if(files.length>0) {
- for (int s = 0; s < files.length; s++) {
- String n = UUIDUtils.create();
- String path = SystemContext.getRealPath() + "\\resource\\ueditor\\upload\\" + n + files[s].getOriginalFilename();
- File newFile = new File(path);
- //通过CommonsMultipartFile的方法直接写文件
- files[s].transferTo(newFile);
- if (s == 0) {
- item.setUrl1(request.getContextPath()+"\\resource\\ueditor\\upload\\" + n + files[s].getOriginalFilename());
- }
- if (s == 1) {
- item.setUrl2(request.getContextPath()+"\\resource\\ueditor\\upload\\" + n + files[s].getOriginalFilename());
- }
- if (s == 2) {
- item.setUrl3(request.getContextPath()+"\\resource\\ueditor\\upload\\" + n + files[s].getOriginalFilename());
- }
- if (s == 3) {
- item.setUrl4(request.getContextPath()+"\\resource\\ueditor\\upload\\" + n + files[s].getOriginalFilename());
- }
- if (s == 4) {
- item.setUrl5(request.getContextPath()+"\\resource\\ueditor\\upload\\" + n + files[s].getOriginalFilename());
- }
- }
- }
- ItemCategory byId = itemCategoryService.getById(item.getCategoryIdTwo());
- item.setCategoryIdOne(byId.getPid());
- }
-
- /**
- * 商品下架
- */
- @RequestMapping("/delete")
- public String update(Integer id){
- Item obj = itemService.load(id);
- obj.setIsDelete(1);
- itemService.updateById(obj);
- return "redirect:/item/findBySql.action";
- }
-
- /**
- * 按关键字或者二级分类查询
- */
- @RequestMapping("/shoplist")
- public String shoplist(Item item,String condition,Model model){
- String sql = "select * from item where isDelete=0";
- if(!isEmpty(item.getCategoryIdTwo())){
- sql +=" and category_id_two = " +item.getCategoryIdTwo();
- }
- if(!isEmpty(condition)){
- sql += " and name like '%" + condition +"%' ";
- model.addAttribute("condition",condition);
- }
- if(!isEmpty(item.getPrice())){
- sql += " order by (price+0) desc";
- }
- if(!isEmpty(item.getGmNum())){
- sql += " order by gmNum desc";
- }
- if(isEmpty(item.getPrice())&&isEmpty(item.getGmNum())){
- sql += " order by id desc";
- }
-
- Pager<Item> pagers = itemService.findBySqlRerturnEntity(sql);
- model.addAttribute("pagers",pagers);
- model.addAttribute("obj",item);
- return "item/shoplist";
- }
前端首页
- /**
- * 前端首页
- */
- @RequestMapping("/uIndex")
- public String uIndex(Model model, Item item,HttpServletRequest request){
- String sql1 = "select * from item_category where isDelete=0 and pid is null order by name";
- List<ItemCategory> fatherList = itemCategoryService.listBySqlReturnEntity(sql1);
- List<CategoryDto> list = new ArrayList<>();
- if(!CollectionUtils.isEmpty(fatherList)){
- for(ItemCategory ic:fatherList){
- CategoryDto dto = new CategoryDto();
- dto.setFather(ic);
- //查询二级类目
- String sql2 = "select * from item_category where isDelete=0 and pid="+ic.getId();
- List<ItemCategory> childrens = itemCategoryService.listBySqlReturnEntity(sql2);
- dto.setChildrens(childrens);
- list.add(dto);
- model.addAttribute("lbs",list);
- }
- }
- //折扣商品
- List<Item> zks = itemService.listBySqlReturnEntity("select * from item where isDelete=0 and zk is not null order by zk desc limit 0,10");
- model.addAttribute("zks",zks);
-
- //热销商品
- List<Item> rxs = itemService.listBySqlReturnEntity("select * from item where isDelete=0 order by gmNum desc limit 0,10");
- model.addAttribute("rxs",rxs);
-
- return "login/uIndex";
- }
以上就是部分功能展示,从整体上来看,本系统功能是十分完整的,界面设计简洁大方,交互友好,数据库设计也很合理,规模适中,代码工整,清晰,适合学习使用。
好了,今天就到这儿吧,小伙伴们点赞、收藏、评论,一键三连走起呀,下期见~~