1、项目介绍
基于SSM的奶茶店管理系统,奶茶销售管理系统,奶茶网上销售管理系统,分为用户和管理员两个角色。
普通用户的功能有:登录、注册、浏览商品信息、加入购物车、下单购买、管理收货地址、我的订单、商品搜索、查看网站公告、查看系统帮助、用户反馈等功能。
管理员的功能有:登录、管理员管理、系统帮助管理、修改密码、商品分类管理、商品管理、客户管理、公告管理、订单管理、客户反馈管理、评论管理等功能。
2、技术框架
编程语言:Java
架构:B/S
后端框架:SSM
前端框架:jsp
数据库:MySQL
是否Maven项目:否
运行环境:JDK8+MySQL5.6+Idea+Tomcat8.5
3、演示视频
基于ssm的奶茶店管理系统
4、项目截图
4.1、首页
4.2、商品详情
4.3、商品评论
4.4、商品搜索
4.5、商品分类
4.6、网站公告
4.7、系统帮助
4.8、客户反馈
4.9、用户登录
4.10、用户注册
4.11、加入购物车
4.12、结算
4.13、个人资料管理
4.14、管理收货地址
4.15、我的订单
4.16、后台登录
4.17、管理员-管理员管理
4.18、系统帮助管理
4.19、修改密码
4.20、商品分类管理
4.21、商品管理
4.22、客户管理
4.23、公告管理
4.24、订单管理
4.25、客户反馈管理
4.26、评论管理
5、代码示例
/**
* 商品信息Controller业务控制类
*/
@Controller
public class GoodsController {
/**
* 注入Service
*/
@Autowired
private GoodsService goodsService;
@Autowired
private CategoryService categoryService;
/**
* 商品信息列表
*
* @param request
* @return
* @throws Exception
*/
@RequestMapping(value = "/goods_list")
public String list(HttpServletRequest request) throws Exception {
/**
* 获取分页参数
*/
int offset = 0; // 记录偏移量
int counts = 0; // 总记录数
try {
offset = Integer.parseInt(request.getParameter("pager.offset"));
} catch (Exception e) {
}
PageBean page = new PageBean(offset);
Goods goods = new Goods();
String bianhao = request.getParameter("bianhao");
goods.setBianhao(bianhao);
request.setAttribute("bianhao", bianhao);
String name = request.getParameter("name");
goods.setName(name);
goods.setDelflag("1");// 查询未删除的商品
request.setAttribute("name", name);
// 查询记录总数
counts = goodsService.getCount(goods);
// 获取当前页记录
List goodsList = goodsService.queryGoodsList(goods, page);
request.setAttribute("list", goodsList);
Category categoryQuery = new Category();
List<Category> categoryList = categoryService.queryCategoryList(categoryQuery, null);
request.setAttribute("categoryList", categoryList);
// 将分页相关参数放到request中
request.setAttribute("itemSize", counts);
int page_count = counts % PageBean.PAGE_IETM == 0 ? counts / PageBean.PAGE_IETM : counts / PageBean.PAGE_IETM + 1;
request.setAttribute("pageItem", PageBean.PAGE_IETM);
request.setAttribute("pageTotal", page_count);
return "/admin/goods/goods_list.jsp";
}
/**
* 跳转到新增商品信息界面
*
* @param request
* @return
* @throws Exception
*/
@RequestMapping(value = "/goods_toAdd")
public String toAdd(HttpServletRequest request) throws Exception {
Category category = new Category();
List<Category> categoryList = categoryService.queryCategoryList(category, null);
request.setAttribute("categoryList", categoryList);
return "/admin/goods/goods_add.jsp";
}
/**
* 保存新增商品信息
*
* @param goods
* @param request
* @return
* @throws Exception
*/
@RequestMapping(value = "/goods_add")
public String add(Goods goods, HttpServletRequest request) throws Exception {
goods.setSaleflag("1"); // 上架
goods.setDelflag("1"); // 正常
// 保存到数据库
goodsService.insertGoods(goods);
return "redirect:goods_list.action";
}
/**
* 跳转到更新商品信息界面
*
* @param request
* @return
* @throws Exception
*/
@RequestMapping(value = "/goods_toUpdate")
public String toUpdate(HttpServletRequest request) throws Exception {
int id = Integer.parseInt(request.getParameter("id"));
// 根据ID查询出需要更新的记录
Goods goods = goodsService.queryGoodsById(id);
request.setAttribute("goods", goods);
Category category = new Category();
List<Category> categoryList = categoryService.queryCategoryList(category, null);
request.setAttribute("categoryList", categoryList);
return "/admin/goods/goods_update.jsp";
}
/**
* 更新商品信息
*
* @param goods
* @param request
* @return
* @throws Exception
*/
@RequestMapping(value = "/goods_update")
public String update(Goods goods, HttpServletRequest request) throws Exception {
// 更新数据库
goodsService.updateGoods(goods);
return "redirect:goods_list.action";
}
/**
* 删除商品信息
*
* @param request
* @return
* @throws Exception
*/
@RequestMapping(value = "/goods_delete")
public String delete(HttpServletRequest request) throws Exception {
// 根据id删除数据库记录
int id = Integer.parseInt(request.getParameter("id"));
Goods goods = goodsService.queryGoodsById(id);
goods.setDelflag("-1");// 修改状态为已删除
goodsService.updateGoods(goods);
return "redirect:goods_list.action";
}
/**
* 商品上下架
*
* @param request
* @return
* @throws Exception
*/
@RequestMapping(value = "/goods_saleflag")
public String saleflag(HttpServletRequest request) throws Exception {
// 根据id删除数据库记录
int id = Integer.parseInt(request.getParameter("id"));
String saleflag = request.getParameter("saleflag");
Goods goods = goodsService.queryGoodsById(id);
goods.setSaleflag(saleflag);
goodsService.updateGoods(goods);
return "redirect:goods_list.action";
}
/**
* 查看商品信息详情
*
* @param request
* @return
* @throws Exception
*/
@RequestMapping(value = "/goods_toView")
public String toView(HttpServletRequest request) throws Exception {
int id = Integer.parseInt(request.getParameter("id"));
// 根据ID查询出记录放到request中,到前台jsp界面显示
Goods goods = new Goods();
goods.setId(id);
List<Goods> list = goodsService.queryGoodsList(goods, null);
goods = list.get(0);
request.setAttribute("goods", goods);
return "/admin/goods/goods_view.jsp";
}
/**
* 判断商品编号是否存在
*
* @return
*/
@ResponseBody
@RequestMapping(value = "/goods_bianhaoExist")
public String bianhaoExist(HttpServletRequest request) throws Exception {
String exist = "true";
String bianhao = request.getParameter("bianhao");
Goods goods = new Goods();
goods.setBianhao(bianhao);
List list = goodsService.queryGoodsList(goods, null);
if (list != null && list.size() > 0) {
exist = "false"; // 验证插件需要返回false 返回false时验证提示已存在
}
return exist;
}
}