Java项目:SSM实现茶叶电商销售商城

作者主页:源码空间站2022

 简介:Java领域优质创作者、Java项目、学习资料、技术互助

文末获取源码

项目介绍

该项目为前后台项目,分为普通用户与管理员两种角色,前台普通用户登录,后台管理员登录;

管理员角色包含以下功能:

管理员登录,用户管理,茶叶分类管理,茶叶商品管理,订单管理,操作发货收货,留言公告管理等功能。

用户角色包含以下功能:

茶叶商城首页,按照类型查看茶叶,用户登录注册,查看商品加入购物车,提交订单,查看留言和公告等功能。

环境需要

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+jQuery+Ajax

使用说明

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

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

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

3. 将项目中jdbc.properties配置文件中的数据库配置改为自己的配置;

4. 运行项目,输入localhost:8080/ 登录

运行截图

前台界面

后台界面

代码相关

首页管理控制器

@Controller
public class indexController {
	@Autowired
	private CategoryService categoryService;
	@Autowired
	private ProductService productService;

	@RequestMapping("/index")
	public String index(Model model,HttpServletRequest request) throws Exception {
			//查询一级分类
			List<Category> cList = categoryService.findCategory();
			request.getSession().getServletContext().setAttribute("cList",cList);
//			model.addAttribute("cList", cList);
			//查询热门商品
		    List<Product> hList= productService.findHotProduct();
			model.addAttribute("hList", hList);
			//查询最新商品
			List<Product> nList = productService.findNewProduct();
			model.addAttribute("nList", nList);
			
			//滚动图片专用,最多显示3个商品
			List<Product> sList;
			if(hList.size()>3)
			{
				sList = new ArrayList<Product>();
				sList.add(hList.get(0));
				sList.add(hList.get(1));
				sList.add(hList.get(2));
				model.addAttribute("sList", sList);
			}
			else
			{
				model.addAttribute("sList", hList);
			}
			
		return "index";
	}
	
	@RequestMapping("/about")
	public String about(Model model,HttpServletRequest request) throws Exception {
		return "about";
	}
	
	@RequestMapping("/contact")
	public String contact(Model model,HttpServletRequest request) throws Exception {
		return "contact";
	}
	
	@RequestMapping("/delivery")
	public String delivery(Model model,HttpServletRequest request) throws Exception {
		return "delivery";
	}
	
	//
	@RequestMapping("/searchProduct")
	public String searchProduct(@RequestParam String condition,Model model,HttpServletRequest request) throws Exception {
			//查询一级分类
			List<Category> cList = categoryService.findCategory();
			request.getSession().getServletContext().setAttribute("cList",cList); 
			//查询商品
		    List<Product> hList= productService.findHotProduct();
			model.addAttribute("hList", hList);
			
			//搜索商品
			List<Product> srList = productService.searchProduct(condition);
			model.addAttribute("srList", srList);
			
			//滚动图片专用,最多显示3个商品
			List<Product> sList;
			if(hList.size()>3)
			{
				sList = new ArrayList<Product>();
				sList.add(hList.get(0));
				sList.add(hList.get(1));
				sList.add(hList.get(2));
				model.addAttribute("sList", sList);
			}
			else
			{
				model.addAttribute("sList", hList);
			}
			
		return "searchProduct";
	}
}

 如果也想学习本系统,下面领取。关注并回复:157ssm

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值