基于javaweb+mysql的ssm酒吧后台管理系统(java+ssm+jsp+html+mysql)

本文详细介绍了基于Java、SSM框架(Spring+SpringMVC+Mybatis)、JSP和HTML的酒吧后台管理系统,涵盖了登录验证、用户管理、数据操作等内容,适合课程设计、大作业和项目实践。
摘要由CSDN通过智能技术生成

基于javaweb+mysql的ssm酒吧后台管理系统(java+ssm+jsp+html+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

基于javaweb+mysql的SSM酒吧后台管理系统(java+ssm+jsp+html+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.数据库:MySql 5.7版本;

技术栈

  1. 后端:Spring+SpringMVC+Mybatis 2. 前端:HTML+CSS+JavaScript+jsp

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中application.yml配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/ 登录
/**

* 后台管理-用户页

*/

@Controller

public class UserController extends BaseController{

@Resource(name="userService")

private UserService userService;

@Resource(name="addressService")

private AddressService addressService;

@Resource(name ="reviewService")

private ReviewService reviewService;

@Resource(name = "productOrderItemService")

//转到后台管理-用户页-ajax

@RequestMapping(value = "admin/user", method = RequestMethod.GET)

public String goUserManagePage(HttpSession session, Map<String, Object> map){

logger.info("获取前十条用户信息");

PageUtil pageUtil = new PageUtil(0, 10);

List<User> userList = userService.getList(null, null, pageUtil);

map.put("userList", userList);

logger.info("获取用户总数量");

Integer userCount = userService.getTotal(null);

map.put("userCount", userCount);


public class ForeLoginController extends BaseController {

@Resource(name = "userService")

private UserService userService;

//登录页

@RequestMapping(value = "login", method = RequestMethod.GET)

public String goToPage(HttpSession session, Map<String, Object> map) {

logger.info("转到前台天猫-登录页");

return "fore/loginPage";

//登陆验证-ajax

@ResponseBody


if (user == null) {

logger.info("登录验证失败");

jsonObject.put("success", false);

} else {

logger.info("登录验证成功,用户ID传入会话");

session.setAttribute("userId", user.getUser_id());

jsonObject.put("success", true);

return jsonObject.toJSONString();

//退出当前账号

@RequestMapping(value = "login/logout", method = RequestMethod.GET)

public String logout(HttpSession session) {

jsonObject.put("success", true);

return jsonObject.toJSONString();

//退出当前账号

@RequestMapping(value = "login/logout", method = RequestMethod.GET)

public String logout(HttpSession session) {

Object o = session.getAttribute("userId");

if (o != null) {

session.removeAttribute("userId");

session.invalidate();

logger.info("登录信息已清除,返回用户登录页");

return "redirect:/login";

用户管理控制层:

/**


logger.info("根据{}排序,是否倒序:{}",orderBy,isDesc);

orderUtil = new OrderUtil(orderBy, isDesc);

JSONObject object = new JSONObject();

logger.info("按条件获取第{}页的{}条用户", index + 1, count);

PageUtil pageUtil = new PageUtil(index, count);

List<User> userList = userService.getList(user, orderUtil, pageUtil);

object.put("userList", JSONArray.parseArray(JSON.toJSONString(userList)));

logger.info("按条件获取用户总数量");

Integer userCount = userService.getTotal(user);

object.put("userCount", userCount);

logger.info("获取分页信息");

pageUtil.setTotal(userCount);

Stack<String> addressStack = new Stack<>();

//最后一级地址

addressStack.push(address.getAddress_name() + " ");

//如果不是第一级地址

while (!address.getAddress_areaId().equals(address.getAddress_regionId().getAddress_areaId())) {

address = addressService.get(address.getAddress_regionId().getAddress_areaId());

addressStack.push(address.getAddress_name() + " ");

StringBuilder builder = new StringBuilder();

while (!addressStack.empty()) {

builder.append(addressStack.pop());

logger.info("所在地地址字符串:{}", builder);

user.setUser_address(new Address().setAddress_name(builder.toString()));


public String logout(HttpSession session) {

Object o = session.getAttribute("userId");

if (o != null) {

session.removeAttribute("userId");

session.invalidate();

logger.info("登录信息已清除,返回用户登录页");

return "redirect:/login";

用户管理控制层:

/**

* 后台管理-用户页

*/


logger.info("登录验证失败");

jsonObject.put("success", false);

} else {

logger.info("登录验证成功,用户ID传入会话");

session.setAttribute("userId", user.getUser_id());

jsonObject.put("success", true);

return jsonObject.toJSONString();

//退出当前账号

@RequestMapping(value = "login/logout", method = RequestMethod.GET)

public String logout(HttpSession session) {

Object o = session.getAttribute("userId");

if (o != null) {

session.removeAttribute("userId");

logger.info("获取用户详情-购物车订单项对应的产品信息");

for (ProductOrderItem productOrderItem : productOrderItemList) {

Integer productId = productOrderItem.getProductOrderItem_product().getProduct_id();

logger.warn("获取产品ID为{}的产品信息", productId);

Product product = productService.get(productId);

if (product != null) {

logger.warn("获取产品ID为{}的第一张预览图片信息", productId);

product.setSingleProductImageList(productImageService.getList(

productId, (byte) 0, new PageUtil(0, 1))

);

productOrderItem.setProductOrderItem_product(product);

user.setProductOrderItemList(productOrderItemList);

if (user.getUser_realname() != null) {


logger.info("用户隐私加密");

user.setUser_realname(user.getUser_realname().substring(0, 1) + "*");

} else {

user.setUser_realname("未命名");

map.put("user",user);

logger.info("转到后台管理-用户详情页-ajax方式");

return "admin/include/userDetails";

//按条件查询用户-ajax

@ResponseBody

@RequestMapping(value = "admin/user/{index}/{count}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")

public String getUserBySearch(@RequestParam(required = false) String user_name/* 用户名称 */,


logger.info("转到后台管理-用户页-ajax方式");

return "admin/userManagePage";

//转到后台管理-用户详情页-ajax

@RequestMapping(value = "admin/user/{uid}", method = RequestMethod.GET)

public String getUserById(HttpSession session, Map<String,Object> map, @PathVariable Integer uid/* 用户ID */){

logger.info("获取user_id为{}的用户信息",uid);

User user = userService.get(uid);

logger.info("获取用户详情-所在地地址信息");

Address address = addressService.get(user.getUser_address().getAddress_areaId());

Stack<String> addressStack = new Stack<>();

//最后一级地址


user.setUser_homeplace(new Address().setAddress_name(builder.toString()));

logger.info("获取用户详情-购物车订单项信息");

List<ProductOrderItem> productOrderItemList = productOrderItemService.getListByUserId(

user.getUser_id(), null

);

if (productOrderItemList != null) {

logger.info("获取用户详情-购物车订单项对应的产品信息");

for (ProductOrderItem productOrderItem : productOrderItemList) {

Integer productId = productOrderItem.getProductOrderItem_product().getProduct_id();

logger.warn("获取产品ID为{}的产品信息", productId);

Product product = productService.get(productId);


logger.info("获取用户详情-所在地地址信息");

Address address = addressService.get(user.getUser_address().getAddress_areaId());

Stack<String> addressStack = new Stack<>();

//最后一级地址

addressStack.push(address.getAddress_name() + " ");

//如果不是第一级地址

while (!address.getAddress_areaId().equals(address.getAddress_regionId().getAddress_areaId())) {

address = addressService.get(address.getAddress_regionId().getAddress_areaId());

addressStack.push(address.getAddress_name() + " ");

StringBuilder builder = new StringBuilder();

while (!addressStack.empty()) {

builder.append(addressStack.pop());

logger.info("所在地地址字符串:{}", builder);

//如果不是第一级地址

while (!address.getAddress_areaId().equals(address.getAddress_regionId().getAddress_areaId())) {

address = addressService.get(address.getAddress_regionId().getAddress_areaId());

addressStack.push(address.getAddress_name() + " ");

StringBuilder builder = new StringBuilder();

while (!addressStack.empty()) {

builder.append(addressStack.pop());

logger.info("所在地地址字符串:{}", builder);

user.setUser_address(new Address().setAddress_name(builder.toString()));

logger.info("获取用户详情-家乡地址信息");

address = addressService.get(user.getUser_homeplace().getAddress_areaId());


} else {

logger.info("登录验证成功,用户ID传入会话");

session.setAttribute("userId", user.getUser_id());

jsonObject.put("success", true);

return jsonObject.toJSONString();

//退出当前账号

@RequestMapping(value = "login/logout", method = RequestMethod.GET)

public String logout(HttpSession session) {

Object o = session.getAttribute("userId");

if (o != null) {


orderUtil = new OrderUtil(orderBy, isDesc);

JSONObject object = new JSONObject();

logger.info("按条件获取第{}页的{}条用户", index + 1, count);

PageUtil pageUtil = new PageUtil(index, count);

List<User> userList = userService.getList(user, orderUtil, pageUtil);

object.put("userList", JSONArray.parseArray(JSON.toJSONString(userList)));

logger.info("按条件获取用户总数量");

Integer userCount = userService.getTotal(user);

object.put("userCount", userCount);

logger.info("获取分页信息");


//退出当前账号

@RequestMapping(value = "login/logout", method = RequestMethod.GET)

public String logout(HttpSession session) {

Object o = session.getAttribute("userId");

if (o != null) {

session.removeAttribute("userId");

session.invalidate();

logger.info("登录信息已清除,返回用户登录页");

return "redirect:/login";

用户管理控制层:

/**

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值