博主介绍:✌csdn优质原创作者、Java领域优质创作者,全栈开发工程师,精通Java后端开发、Android开发、Html开发,专注于Java技术领域和毕业设计、课程设计✌
🍅文末获取联系,详情可看主页🍅
精彩博客推荐👇🏻👇🏻👇🏻👇🏻
项目描述
JavaWeb实战之酒店管理系统,一个完整的Spring+MyBatis+MySQL+layui整合项目,适用于毕业设计、课程设计以及锻炼项目实战的伙伴,熟练一下前后端开发框架,融会贯通。功能比较完善。使用框架并不是很难,关键是要理解起底层原理,先技术,再思想。实践才能出真知。
主要技术:
后端技术:Spring + Spring MVC + Mybatis
前端技术:layui+JSP+JQuery+JavaScript
数据库:MySQL
项目管理:Maven
开发工具:Intellij IDEA
主要功能:
- 住客管理
- 房间管理
- 会员管理
- 库存管理
- 系统管理
- 账号管理(登录登出/找回密码等)
系统构成图
项目目录结构
功能展示
登录界面
首页
住客管理
添加住客、删除住客、修改住客、查询住客
房间管理
添加房间、删除房间、修改房间、查询房间
会员管理
添加会员、删除会员、修改会员、查询会员
库存管理
办理入库、出库,入库单、出库单查询/打印,出入库统计等
系统设置
网站信息、修改密码、清除缓存
代码实现
package com.hotel.controller;
import com.hotel.pojo.Admin;
import com.hotel.pojo.Home;
import com.hotel.pojo.Stock;
import com.hotel.service.StockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpSession;
import java.util.List;
/**
* @description 库存管理
**/
@RequestMapping("/stock")
@Controller
public class StockController {
@Autowired
private StockService stockService;
@RequestMapping("/list")
public ModelAndView list(){
ModelAndView mv = new ModelAndView();
List<Stock> stockList = stockService.queryStockList();
mv.addObject("list",stockList);
mv.setViewName("stock_list");
return mv;
}
@RequestMapping("/warehousingDetail")
public ModelAndView warehousingDetail(int id, HttpSession session){
ModelAndView mv = new ModelAndView();
Stock stock = stockService.queryStockById(id);
mv.addObject("stock",stock);
mv.setViewName("stock_warehousing");
return mv;
}
@RequestMapping("/warehousing")
public String warehousing(Stock stock){
stockService.warehousing(stock);
return "redirect:/stock/list";
}
@RequestMapping("/outboundDetail")
public ModelAndView outboundDetail(int id){
ModelAndView mv = new ModelAndView();
Stock stock = stockService.queryStockById(id);
mv.addObject("stock",stock);
mv.setViewName("stock_outbound");
return mv;
}
@RequestMapping("/outbound")
public String outbound(Stock stock){
stockService.outbound(stock);
return "redirect:/stock/list";
}
}
package com.hotel.service;
import com.hotel.dao.StockMapper;
import com.hotel.pojo.Constants;
import com.hotel.pojo.Stock;
import com.hotel.pojo.StockDocument;
import com.hotel.util.CommonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
**/
@Service
public class StockServiceImpl implements StockService {
@Autowired
private StockMapper stockMapper;
@Autowired
private StockDocumentService documentService;
@Override
@Transactional(rollbackFor = {Exception.class})
public int warehousing(Stock stock){
Stock st = null;
if(stock.getId()>0) {
st = stock;
}else {
st = stockMapper.queryStockByNameAndPrice(stock);
}
stock.setUpdate_time(CommonUtil.getNowTime());
int insert = 0;
if (st != null) {
stock.setId(st.getId());
insert = stockMapper.updateStock(stock);
} else {
stock.setCreate_time(CommonUtil.getNowTime());
insert = stockMapper.insertStock(stock);
}
if (insert > 0) {
StockDocument stockDocument = createStockDocument(stock,Constants.StockType.warehousing);
insert = documentService.addStockDocument(stockDocument);
}
return insert;
}
@Override
@Transactional(rollbackFor = Exception.class)
public int outbound(Stock stock) {
stock.setNumber(-stock.getNumber());
stock.setUpdate_time(CommonUtil.getNowTime());
int update = stockMapper.updateStock(stock);
if (update > 0) {
stock.setNumber(Math.abs(stock.getNumber()));
StockDocument stockDocument = createStockDocument(stock,Constants.StockType.outbound);
update = documentService.addStockDocument(stockDocument);
}
return update;
}
@Override
public Stock queryStockByNameAndPrice(Stock stock) {
return stockMapper.queryStockByNameAndPrice(stock);
}
@Override
public Stock queryStockById(int id) {
return stockMapper.queryStockById(id);
}
@Override
public List<Stock> queryStockList() {
return stockMapper.queryStockList();
}
private StockDocument createStockDocument(Stock stock,String type){
StockDocument stockDocument = new StockDocument();
stockDocument.setName(stock.getName());
stockDocument.setPrice(stock.getPrice());
stockDocument.setSupplier(stock.getSupplier());
stockDocument.setCreator(stock.getCreator());
stockDocument.setNumber(stock.getNumber());
stockDocument.setTotal(Math.abs(stock.getNumber()) * stock.getPrice());
stockDocument.setCreate_time(stock.getUpdate_time());
stockDocument.setType(type);
StockDocument document = null;
String stockNumber = null;
int i = 0;
while (i<10) {
stockNumber = CommonUtil.createStockNumber(type, stock.getUpdate_time());
document = documentService.queryByStockNumber(stockNumber);
if (document == null) {
i = 10;
} else {
i++;
}
}
stockDocument.setStock_number(stockNumber);
return stockDocument;
}
}
论文文档目录
写在最后:此项目开箱即用,非开源,需要源码、设计文档或要定制化功能需求的小伙伴可以私信我,也可直接添加主页vx,有任何问题可以在评论区提,我会一一回复。整个系统功能完整,运行流畅,页面干净整洁,交互方便,逻辑也比较清晰,如果大家觉得有用,就点赞、收藏、转发吧,创作不易,点赞是最好的鼓励。