基于javaweb+mysql的ssm仓库管理系统(java+ssm+jsp+js+layui+mysql)
私信源码获取及调试交流
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的SSM仓库管理系统(java+ssm+jsp+js+layui+mysql)
项目介绍
基于SSM的仓库管理系统
角色:管理员、用户
员工:员工登录系统后,可以查看主页,个人中心,客户信息管理,供应商管理,货物信息管理,货物入库管理,货物出库管理等功能,还能对每个功能逐一进行相应操作
管理员:管理员登录系统后,可以查看主页,个人中心,员工管理,客户信息管理,供应商管理,仓库信息管理,货物类型管理,货物信息管理,货物入库管理,货物出库管理等功能,还能对每个功能逐一进行相应操作
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 4.数据库:MySql 5.7/8.0版本均可; 5.是否Maven项目:是;
技术栈
后端:SSM(Spring+SpringMVC+Mybatis)
前端:JSP+CSS+JS+JQUERY+Layui
使用说明
项目运行: 1. 使用Navicat或者其它工具,在mysql中创建对应sql文件名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;
return new DataGridView(page.getTotal(),page.getRecords());
@RequestMapping("addOutput")
public ResultObj addOutput(OutputFormVo outputFormVo){
try {
TbUser tbUser = (TbUser) WebUtils.getSession().getAttribute("user");
outputFormVo.setCreateTime(new Date());
outputFormVo.setUserId(tbUser.getUserId());
QueryWrapper<Stock> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("goods_id",outputFormVo.getGoodsId());
queryWrapper.eq("house_id",outputFormVo.getHouseId());
Stock stock = stockService.getOne(queryWrapper);
UpdateWrapper<Stock> updateWrapper = new UpdateWrapper<>();
return ResultObj.ADD_ERROR_EXCEED;
}else if(inputFormVo.getChangeNumber() ==0){
return ResultObj.ERROR_ZERO;
} else {
stock.setNumber(inputFormVo.getChangeNumber()+stock.getNumber());
inputFormService.save(inputFormVo);
stockService.update(stock,updateWrapper);
return ResultObj.ADD_SUCCESS;
catch (Exception e) {
e.printStackTrace();
return ResultObj.ADD_ERROR;
@RequestMapping("deleteInput")
private TbUserService tbUserService;
@RequestMapping("loadAllOutput")
public DataGridView loadAllOutput(OutputFormVo outputFormVo) {
IPage<OutputForm> page = new Page<>(outputFormVo.getPage(),outputFormVo.getLimit());
QueryWrapper<OutputForm> queryWrapper = new QueryWrapper();
queryWrapper.eq(null!=outputFormVo.getFormId(),"form_id",outputFormVo.getFormId());
queryWrapper.eq(null != outputFormVo.getCustomerId() && outputFormVo.getCustomerId()!=0,"customer_id",outputFormVo.getCustomerId());
TbUser user = (TbUser) WebUtils.getSession().getAttribute("user");
queryWrapper.eq(null!=user.getRoleId() && 0!=user.getRoleId(),"house_id",user.getRoleId());
outputFormService.page(page,queryWrapper);
List<OutputForm> records = page.getRecords();
for(OutputForm outputForm : records){
return ResultObj.ADD_ERROR_UNDER;
} else if(outputFormVo.getChangeNumber() ==0){
return ResultObj.ERROR_ZERO;
} else {
stock.setNumber(stock.getNumber()-outputFormVo.getChangeNumber());
outputFormService.save(outputFormVo);
stockService.update(stock,updateWrapper);
return ResultObj.ADD_SUCCESS;
catch (Exception e) {
e.printStackTrace();
return ResultObj.ADD_ERROR;
stockService.save(stock1);
inputFormService.save(inputFormVo);
return ResultObj.ADD_SUCCESS;
if(changeNumber+stock.getNumber() > stock.getUpperAlert()){
return ResultObj.ADD_ERROR_EXCEED;
}else if(inputFormVo.getChangeNumber() ==0){
return ResultObj.ERROR_ZERO;
} else {
stock.setNumber(inputFormVo.getChangeNumber()+stock.getNumber());
inputFormService.save(inputFormVo);
@RequestMapping("addProvider")
public ResultObj addProvider(ProviderVo providerVo){
try {
providerService.save(providerVo);
return ResultObj.ADD_SUCCESS;
} catch (Exception e) {
e.printStackTrace();
return ResultObj.ADD_ERROR;
/**
* 修改一个供应商
* @param providerVo
* @return
public DataGridView loadAllProvider(ProviderVo providerVo){
//1.声明一个分页page对象
IPage<Provider> page = new Page(providerVo.getPage(),providerVo.getLimit());
//2.声明一个queryWrapper
QueryWrapper<Provider> queryWrapper = new QueryWrapper();
queryWrapper.eq(null != providerVo.getProviderId() && providerVo.getProviderId()!=0,"provider_id",providerVo.getProviderId());
queryWrapper.like(StringUtils.isNotBlank(providerVo.getManager()),"manager",providerVo.getManager());
queryWrapper.like(StringUtils.isNotBlank(providerVo.getTalePhone()),"tale_phone",providerVo.getTalePhone());
providerService.page(page,queryWrapper);
return new DataGridView(page.getTotal(),page.getRecords());
/**
* 添加一个供应商
@RestController
@RequestMapping("/input")
public class InputFormController {
@Resource
private GoodsService goodsService;
@Resource
private ProviderService providerService;
@Resource
private InputFormService inputFormService;
@Resource
Stock stock = stockService.getOne(queryWrapper);
UpdateWrapper<Stock> updateWrapper = new UpdateWrapper<>();
if(null != stock){ //如果库存中有这件商品
updateWrapper.eq("goods_id",stock.getGoodsId());
updateWrapper.eq("house_id",stock.getHouseId());
}else { //如果库存中没有这件商品
QueryWrapper<Stock> query = new QueryWrapper();
query.eq("house_id",houseId);
query.eq("goods_id",0);
Integer upperAlert = stockService.getOne(query).getUpperAlert();
if(changeNumber < upperAlert){
Stock stock1 = new Stock(goodsId,houseId,changeNumber,upperAlert,0);
System.out.println("stock1 = " + stock1);
outputForm.setSize(goods.getSize());
outputForm.setPackages(goods.getPackages());
outputForm.setPrice(goods.getPrice());
TbUser tbUser = tbUserService.getById(outputForm.getUserId());
if(null != tbUser){
outputForm.setUserName(tbUser.getName());
Warehouse warehouse = warehouseService.getById(outputForm.getHouseId());
if(null != warehouse){
outputForm.setHouseName(warehouse.getName());
return new DataGridView(page.getTotal(),page.getRecords());
@RequestMapping("addOutput")
queryWrapper.eq(null!=user.getRoleId() && 0!=user.getRoleId(),"house_id",user.getRoleId());
outputFormService.page(page,queryWrapper);
List<OutputForm> records = page.getRecords();
for(OutputForm outputForm : records){
Customer customer = customerService.getById(outputForm.getCustomerId());
if (null != customer){
outputForm.setCustomerName(customer.getName());
outputForm.setAddress(customer.getAddress());
Goods goods = goodsService.getById(outputForm.getGoodsId());
if(null != goods){
outputForm.setGoodsName(goods.getName());
outputForm.setSize(goods.getSize());
outputForm.setPackages(goods.getPackages());
outputForm.setUserName(tbUser.getName());
Warehouse warehouse = warehouseService.getById(outputForm.getHouseId());
if(null != warehouse){
outputForm.setHouseName(warehouse.getName());
return new DataGridView(page.getTotal(),page.getRecords());
@RequestMapping("addOutput")
public ResultObj addOutput(OutputFormVo outputFormVo){
try {
TbUser tbUser = (TbUser) WebUtils.getSession().getAttribute("user");
outputFormVo.setCreateTime(new Date());
outputFormVo.setUserId(tbUser.getUserId());
QueryWrapper<Stock> queryWrapper = new QueryWrapper<>();
inputForm.setUserName(tbUser.getName());
Warehouse warehouse = warehouseService.getById(inputForm.getHouseId());
if(null != warehouse){
inputForm.setHouseName(warehouse.getName());
return new DataGridView(page.getTotal(),page.getRecords());
@RequestMapping("addInput")
public ResultObj addInput(InputFormVo inputFormVo){
try {
TbUser tbUser = (TbUser) WebUtils.getSession().getAttribute("user");
inputFormVo.setCreateTime(new Date());
inputFormVo.setUserId(tbUser.getUserId());
Integer goodsId = inputFormVo.getGoodsId();
Integer houseId = inputFormVo.getHouseId();
TbUser user = (TbUser) WebUtils.getSession().getAttribute("user");
queryWrapper.eq(null!=user.getRoleId() && 0!=user.getRoleId(),"house_id",user.getRoleId());
outputFormService.page(page,queryWrapper);
List<OutputForm> records = page.getRecords();
for(OutputForm outputForm : records){
Customer customer = customerService.getById(outputForm.getCustomerId());
if (null != customer){
outputForm.setCustomerName(customer.getName());
outputForm.setAddress(customer.getAddress());
Goods goods = goodsService.getById(outputForm.getGoodsId());
if(null != goods){
outputForm.setGoodsName(goods.getName());
outputForm.setSize(goods.getSize());
private StockService stockService;
@Resource
private WarehouseService warehouseService;
@Resource
private TbUserService tbUserService;
@RequestMapping("loadAllInput")
public DataGridView loadAllInput(InputFormVo inputFormVo) {
IPage<InputForm> page = new Page<>(inputFormVo.getPage(), inputFormVo.getLimit());
QueryWrapper<InputForm> queryWrapper = new QueryWrapper();
queryWrapper.eq(null!=inputFormVo.getFormId(),"form_id",inputFormVo.getFormId());
queryWrapper.eq(null != inputFormVo.getProviderId() && inputFormVo.getProviderId()!=0,"provider_id",inputFormVo.getProviderId());
QueryWrapper<Stock> query = new QueryWrapper();
query.eq("house_id",houseId);
query.eq("goods_id",0);
Integer upperAlert = stockService.getOne(query).getUpperAlert();
if(changeNumber < upperAlert){
Stock stock1 = new Stock(goodsId,houseId,changeNumber,upperAlert,0);
System.out.println("stock1 = " + stock1);
stockService.save(stock1);
inputFormService.save(inputFormVo);
return ResultObj.ADD_SUCCESS;
if(changeNumber+stock.getNumber() > stock.getUpperAlert()){
return ResultObj.ADD_ERROR_EXCEED;
}else if(inputFormVo.getChangeNumber() ==0){
return ResultObj.ERROR_ZERO;
@Resource
private WarehouseService warehouseService;
@Resource
private TbUserService tbUserService;
@RequestMapping("loadAllInput")
public DataGridView loadAllInput(InputFormVo inputFormVo) {
IPage<InputForm> page = new Page<>(inputFormVo.getPage(), inputFormVo.getLimit());
QueryWrapper<InputForm> queryWrapper = new QueryWrapper();
queryWrapper.eq(null!=inputFormVo.getFormId(),"form_id",inputFormVo.getFormId());
queryWrapper.eq(null != inputFormVo.getProviderId() && inputFormVo.getProviderId()!=0,"provider_id",inputFormVo.getProviderId());
// queryWrapper.like(StringUtils.isNotBlank(inputFormVo.getName()),"name",inputFormVo.getName());
// queryWrapper.eq(inputFormVo.getPrice()!=null,"price",inputFormVo.getPrice());