基于javaweb+mysql的ssm推荐算法商城系统(java+ssm+jsp+js+jquery+layui+mysql)
私信源码获取及调试交流
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的SSM推荐算法商城系统(java+ssm+jsp+js+jquery+layui+mysql)
项目介绍
角色:管理员、用户
用户登陆后,主要模块包括主页、个人中心、评论、购物车、我的收藏等功能。
管理员登陆后,主要模块包括主页、个人中心、用户管理、商品分类管理、商品信息管理、系统管理、订单管理等功能
环境需要
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.是否Maven项目: 否;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目; 6.数据库:MySql 5.7/8.0等版本均可;
技术栈
后端:SSM(Spring+SpringMVC+Mybatis)
前端:JSP+CSS+JS+JQUERY+Layui
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,修改配置,运行项目;
@RequestMapping("/exupdate")
public String exupdateItemCategory(ItemCategory itemCategory){
itemCategory.setIsDelete(0);
String i = itemCategory.getName();
itemCategoryService.updateById(itemCategory);
return "redirect:/itemCategory/findBySql.action";
/**
* 修改二级目录
* @param itemCategory
* @return
return "/orderDetail/orderDetailList";
品类管理控制层:
@Controller
@RequestMapping("/itemCategory")
public class ItemCategoryController extends BaseController {
@Autowired
private ItemCategoryService itemCategoryService;
/**
* 分页查询类目列表
*/
@RequestMapping("/findBySql")
public String findBySql(Model model,ItemCategory itemCategory){
String sql = "select * from item_category where isDelete = 0 and pid is null order by id";
json.put(Consts.RES, 1);
return json.toJSONString();
/**
* 跳转到购物车页面
* @param model
* @param request
* @return
*/
@RequestMapping("/findBySql")
public String findBySql(Model model, HttpServletRequest request) {
Object userId = request.getSession().getAttribute("userId");
if(userId==null){
* @param itemCategory
* @return
*/
@RequestMapping("/exupdate2")
public String exupdateTwoItemCategory(ItemCategory itemCategory){
itemCategory.setIsDelete(0);
String i = itemCategory.getName();
Integer pid = itemCategory.getPid();
itemCategoryService.updateById(itemCategory);
return "redirect:/itemCategory/findBySql2.action?pid="+pid;
// return "redirect:/itemCategory/findBySql2.action?pid="+pid;
public String delete(Integer id){
carService.deleteById(id);
return "success";
订单详情控制层:
@Controller
@RequestMapping("/orderDetail")
public class OrderDetailController {
@Autowired
private OrderDetailService orderDetailService;
/**
* 获取订单详情列表
public String exaddItemCategory(ItemCategory itemCategory){
itemCategory.setIsDelete(0);
itemCategoryService.insert(itemCategory);
return "redirect:/itemCategory/findBySql";
// return "itemCategory/itemCategory";
/**
* 添加二级类目
* @param itemCategory
* @return
*/
@RequestMapping("/exadd2")
public String exaddItemCategory2(ItemCategory itemCategory){
itemCategory.setIsDelete(0);
public String findBySql(Model model,ItemCategory itemCategory){
String sql = "select * from item_category where isDelete = 0 and pid is null order by id";
Pager<ItemCategory> pagers = itemCategoryService.findBySqlRerturnEntity(sql);
model.addAttribute("pagers",pagers);
model.addAttribute("obj",itemCategory);
return "itemCategory/itemCategory";
/**
*转向添加一级分类页面
* @return
*/
@RequestMapping("/add")
itemCategoryService.updateById(itemCategory);
return "redirect:/itemCategory/findBySql2.action?pid="+pid;
// return "redirect:/itemCategory/findBySql2.action?pid="+pid;
/**
* 删除一个类目
* @param id
* @return
*/
@RequestMapping("/delete")
public String deleteItemCategory(Integer id){
//把对应类目的isdelete改为1后更新
return "/orderDetail/orderDetailList";
品类管理控制层:
@Controller
@RequestMapping("/itemCategory")
public class ItemCategoryController extends BaseController {
@Autowired
private ItemCategoryService itemCategoryService;
/**
* 分页查询类目列表
*/
@RequestMapping("/findBySql")
public String findBySql(Model model,ItemCategory itemCategory){
String sql = "select * from item_category where isDelete = 0 and pid is null order by id";
itemCategoryService.insert(itemCategory);
return "redirect:/itemCategory/findBySql2.action?pid="+pid;
// return "itemCategory/itemCategory";
/**
* 修改一级目录
* @param itemCategory
* @return
*/
@RequestMapping("/exupdate")
public String exupdateItemCategory(ItemCategory itemCategory){
itemCategory.setIsDelete(0);
@RequestMapping("/exupdate2")
public String exupdateTwoItemCategory(ItemCategory itemCategory){
itemCategory.setIsDelete(0);
String i = itemCategory.getName();
Integer pid = itemCategory.getPid();
itemCategoryService.updateById(itemCategory);
return "redirect:/itemCategory/findBySql2.action?pid="+pid;
// return "redirect:/itemCategory/findBySql2.action?pid="+pid;
/**
* 删除一个类目
* @param id
BigDecimal bigDecimal = new BigDecimal(t).setScale(2, RoundingMode.UP);
Double tDouble = bigDecimal.doubleValue();
car.setTotal(tDouble + "");
carService.insert(car);
json.put(Consts.RES, 1);
return json.toJSONString();
/**
* 跳转到购物车页面
* @param model
* @param request
* @return
*/
@Controller
@RequestMapping("/car")
public class CarController {
@Autowired
private CarService carService;
@Autowired
private ItemService itemService;
/**
* 加入购物车
* @param request
@Controller
@RequestMapping("/orderDetail")
public class OrderDetailController {
@Autowired
private OrderDetailService orderDetailService;
/**
* 获取订单详情列表
* @param model
* @param orderDetail
* @return
*/
@RequestMapping("/findbysql")
@RequestMapping("/addcar")
@ResponseBody
public String addcar(HttpServletRequest request, Car car) {
JSONObject json = new JSONObject();
Object userId = request.getSession().getAttribute("userId");
//如果未登录,返回0,提示先登录
if (userId == null) {
json.put(Consts.RES, 0);
return json.toJSONString();
//保存到购物车
* @param id
* @return
*/
@RequestMapping("/delete")
public String deleteItemCategory(Integer id){
//把对应类目的isdelete改为1后更新
ItemCategory itemCategory = itemCategoryService.load(id);
itemCategory.setIsDelete(1);
itemCategoryService.updateById(itemCategory);
//如果类目下有子类目,把对应类目的isdelete改为1后更新
String sql = "update item_category set isDelete=1 where pid="+id;
itemCategoryService.updateBysql(sql);
* 跳转到修改类目页面
* @return
*/
@RequestMapping("/update")
public String updateItemCategory(Integer id,Model model){
ItemCategory itemCategory = itemCategoryService.load(id);
model.addAttribute("item",itemCategory);
return "/itemCategory/update";
/**
* 跳转到修改二级类目页面
* @return
*/
* 跳转到修改类目页面
* @return
*/
@RequestMapping("/update")
public String updateItemCategory(Integer id,Model model){
ItemCategory itemCategory = itemCategoryService.load(id);
model.addAttribute("item",itemCategory);
return "/itemCategory/update";
/**
* 跳转到修改二级类目页面
* @return