Java项目:ssm校园在线点餐系统源码

项目介绍

系统主要分为前台和后台,分为管理员与普通用户两种角色; 前台主要功能有:用户注册、用户登录、我的购物车、我的订单、商品评论、校园资讯

后台主要功能有:用户管理、商品管理、订单管理、评论管理、资讯管理等

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.数据库:MySql 5.7版本;

6.是否Maven项目:是;

技术栈

1. 后端:Spring+SpringMVC+Mybatis

2. 前端:JSP+H-ui+jQuery+Bootstrap

使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;

2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;

若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;

3. 将项目中jdbc.properties配置文件中的数据库配置改为自己的配置; 4. 前台访问路径:http://localhost:8080/fore/foreIndex

后台访问地址:http://localhost:8080/login

前台界面

后台界面

相关代码

分类控制器

package com.byh.biyesheji.controller;

import com.byh.biyesheji.pojo.Category;
import com.byh.biyesheji.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * 商品分类模块controller
 */
@Controller
@RequestMapping("/category")
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    @RequestMapping("/list")
    public String list(Model model){
        List<Category> list = categoryService.list();
        model.addAttribute("list",list);
        model.addAttribute("size",list.size());
        return "productmodule/category-list";
    }

    @RequestMapping("/addCategory")
    public String add(@RequestParam(value = "name")String name){
        Category category = new Category();
        category.setName(name);
        categoryService.save(category);
        return "productmodule/category-list";
    }

    @RequestMapping("/delCategory")
    public String del(@RequestParam(value = "id")int id){
        categoryService.del(id);
        return "redirect:list";
    }

    @RequestMapping("/editCategory")
    public String edit(@RequestParam(value = "id")int id,Model model){
        Category category = categoryService.get(id);
        model.addAttribute("category",category);
        return "productmodule/category-edit";
    }

    @RequestMapping("/updateCategory")
    public String update(Category category,Model model){
        categoryService.update(category);
        return "redirect:list";
    }

}

如果也想学习本系统,下面领取。回复:181ssm

经验分享 程序员 微信小程序 职场和发展