项目编号:BS-XX-127
一,项目简介
本项目实现了基于springboot的进销存管理系统,主要用户开设网店的相关商品的进货、销售、库存的管理,功能比较完整,有着完备的权限管理系统,可以自行根据需要来设计角色和分配权限,权限的粒度可以做到页面级的权限控制,整个项目来讲比较优秀。主要实现的功能有如下几个模块:
- 基础管理模块:包含客户管理、供应商管理、商品管理三个子模块
- 进货管理模块:包含商品进货、退货、商品退货查询几个子查块
- 销售管理:包含商品销售、退货、销售退货查询几个子查块
- 系统管理:包含部门管理、菜单管理、权限管理、角色管理、用户管理五个子模块
- 其它管理:包含登陆日志查询、系统公告管理、图标管理等几个子模块
- 个人中心:包含个人资料管理、密码修改等相关功能
二,环境介绍
语言环境:Java: jdk1.8
数据库:Mysql: mysql5.7 / Redis缓存数据库
应用服务器:Tomcat: tomcat8.5.31
开发工具:IDEA或eclipse
后台开发技术:Springboot+Mybatis-plus+Shiro
前端开发技术:Bootstrap+Layui+Freemarker模板
三,系统展示
超级管理员登陆系统:system/123456
编辑
基础管理—客户管理
编辑
基础管理—供应商管理
编辑
基础管理—商品管理
编辑
进货管理—商品进货 也可在此实现退货
编辑
进货管理—商品退货查询
编辑
销售管理—商品销售
编辑
销售管理—销售退货查询
编辑
系统管理---部门管理
编辑
系统管理---菜单管理
编辑
系统管理---权限管理
编辑
系统管理---角色管理
编辑
系统管理---用户管理
编辑
其它管理—登陆日志
编辑
其它管理—系统公告
编辑
四,核心代码展示
package com.dev.shop.bus.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @Controller @RequestMapping("bus") public class BusinessController { /** * 跳转到客户管理页面 * @return */ @RequestMapping("toCustomerManager") public String toCustomerManager(){ return "business/customer/customerManager"; } /** * 跳转到供应商管理页面 * @return */ @RequestMapping("toProviderManager") public String toProviderManager(){ return "business/provider/providerManager"; } /** * 跳转到商品管理页面 * @return */ @RequestMapping("toGoodsManager") public String toGoodsManager(){ return "business/goods/goodsManager"; } /** * 跳转到进货管理页面 * @return */ @RequestMapping("toInportManager") public String toInportManager(){ return "business/inport/inportManager"; } /** * 跳转到退货管理页面 * @return */ @RequestMapping("toOutportManager") public String toOutportManager(){ return "business/outport/outportManager"; } /** * 跳转到商品销售管理页面 * @return */ @RequestMapping("toSalesManager") public String toSalesManager(){ return "business/sales/salesManager"; } /** * 跳转到商品销售管理页面 * @return */ @RequestMapping("toSalesbackManager") public String toSalesbackManager(){ return "business/salesback/salesbackManager"; } }
package com.dev.shop.bus.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.dev.shop.bus.entity.Customer; import com.dev.shop.bus.service.ICustomerService; import com.dev.shop.bus.vo.CustomerVo; import com.dev.shop.sys.common.Constast; import com.dev.shop.sys.common.DataGridView; import com.dev.shop.sys.common.ResultObj; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.io.Serializable; import java.util.ArrayList; import java.util.Collection; import java.util.List; @RestController @RequestMapping("/customer") public class CustomerController { @Autowired private ICustomerService customerService; /** * 查询所有的客户 * @param customerVo * @return */ @RequestMapping("loadAllCustomer") public DataGridView loadAllCustomer(CustomerVo customerVo){ //1.声明一个分页page对象 IPage<Customer> page = new Page(customerVo.getPage(),customerVo.getLimit()); //2.声明一个queryWrapper QueryWrapper<Customer> queryWrapper = new QueryWrapper(); queryWrapper.like(StringUtils.isNotBlank(customerVo.getCustomername()),"customername",customerVo.getCustomername()); queryWrapper.like(StringUtils.isNotBlank(customerVo.getConnectionpersion()),"connectionpersion",customerVo.getConnectionpersion()); queryWrapper.like(StringUtils.isNotBlank(customerVo.getPhone()),"phone",customerVo.getPhone()); customerService.page(page,queryWrapper); return new DataGridView(page.getTotal(),page.getRecords()); } /** * 添加一个客户 * @param customerVo * @return */ @RequestMapping("addCustomer") public ResultObj addCustomer(CustomerVo customerVo){ try { customerService.save(customerVo); return ResultObj.ADD_SUCCESS; } catch (Exception e) { e.printStackTrace(); return ResultObj.ADD_ERROR; } } /** * 修改一个客户 * @param customerVo * @return */ @RequestMapping("updateCustomer") public ResultObj updateCustomer(CustomerVo customerVo){ try { customerService.updateById(customerVo); return ResultObj.UPDATE_SUCCESS; } catch (Exception e) { e.printStackTrace(); return ResultObj.UPDATE_ERROR; } } /** * 删除一个客户 * @param id 客户的ID * @return */ @RequestMapping("deleteCustomer") public ResultObj deleteCustomer(Integer id){ try { customerService.removeById(id); return ResultObj.DELETE_SUCCESS; } catch (Exception e) { e.printStackTrace(); return ResultObj.DELETE_ERROR; } } /** * 批量删除客户 * @param customerVo 选中的客户 * @return */ @RequestMapping("batchDeleteCustomer") public ResultObj batchDeleteCustomer(CustomerVo customerVo){ try { Collection<Serializable> idList = new ArrayList<Serializable>(); for (Integer id : customerVo.getIds()) { idList.add(id); } customerService.removeByIds(idList); return ResultObj.DELETE_SUCCESS; } catch (Exception e) { e.printStackTrace(); return ResultObj.DELETE_ERROR; } } /** * 加载所有客户的下拉列表 * @return */ @RequestMapping("loadAllCustomerForSelect") public DataGridView loadAllCustomerForSelect(){ QueryWrapper<Customer> queryWrapper = new QueryWrapper<Customer>(); queryWrapper.eq("available", Constast.AVAILABLE_TRUE); List<Customer> list = customerService.list(queryWrapper); return new DataGridView(list); } }
package com.dev.shop.bus.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.dev.shop.bus.entity.Goods; import com.dev.shop.bus.entity.Provider; import com.dev.shop.bus.service.IGoodsService; import com.dev.shop.bus.service.IProviderService; import com.dev.shop.bus.vo.GoodsVo; import com.dev.shop.sys.common.AppFileUtils; import com.dev.shop.sys.common.Constast; import com.dev.shop.sys.common.DataGridView; import com.dev.shop.sys.common.ResultObj; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; @RestController @RequestMapping("/goods") public class GoodsController { @Autowired private IGoodsService goodsService; @Autowired private IProviderService providerService; /** * 查询商品 * @param goodsVo * @return */ @RequestMapping("loadAllGoods") public DataGridView loadAllGoods(GoodsVo goodsVo){ IPage<Goods> page = new Page<>(goodsVo.getPage(),goodsVo.getLimit()); QueryWrapper<Goods> queryWrapper = new QueryWrapper(); queryWrapper.eq(goodsVo.getProviderid()!=null&&goodsVo.getProviderid()!=0,"providerid",goodsVo.getProviderid()); queryWrapper.like(StringUtils.isNotBlank(goodsVo.getGoodsname()),"goodsname",goodsVo.getGoodsname()); queryWrapper.like(StringUtils.isNotBlank(goodsVo.getProductcode()),"productcode",goodsVo.getProductcode()); queryWrapper.like(StringUtils.isNotBlank(goodsVo.getPromitcode()),"promitcode",goodsVo.getPromitcode()); queryWrapper.like(StringUtils.isNotBlank(goodsVo.getDescription()),"description",goodsVo.getDescription()); queryWrapper.like(StringUtils.isNotBlank(goodsVo.getSize()),"size",goodsVo.getSize()); queryWrapper.orderByDesc("id"); goodsService.page(page,queryWrapper); List<Goods> records = page.getRecords(); for (Goods goods : records) { Provider provider = providerService.getById(goods.getProviderid()); if (null!=provider){ goods.setProvidername(provider.getProvidername()); } } return new DataGridView(page.getTotal(),page.getRecords()); } /** * 添加商品 * @param goodsVo * @return */ @RequestMapping("addGoods") public ResultObj addGoods(GoodsVo goodsVo){ try { if (goodsVo.getGoodsimg()!=null&&goodsVo.getGoodsimg().endsWith("_temp")){ String newName = AppFileUtils.renameFile(goodsVo.getGoodsimg()); goodsVo.setGoodsimg(newName); } goodsService.save(goodsVo); return ResultObj.ADD_SUCCESS; } catch (Exception e) { e.printStackTrace(); return ResultObj.ADD_ERROR; } } /** * 修改商品 * @param goodsVo * @return */ @RequestMapping("updateGoods") public ResultObj updateGoods(GoodsVo goodsVo){ try { //商品图片不是默认图片 if (!(goodsVo.getGoodsimg()!=null&&goodsVo.getGoodsimg().equals(Constast.DEFAULT_IMG))){ if (goodsVo.getGoodsimg().endsWith("_temp")){ String newName = AppFileUtils.renameFile(goodsVo.getGoodsimg()); goodsVo.setGoodsimg(newName); //删除原先的图片 String oldPath = goodsService.getById(goodsVo.getId()).getGoodsimg(); AppFileUtils.removeFileByPath(oldPath); } } goodsService.updateById(goodsVo); return ResultObj.UPDATE_SUCCESS; } catch (Exception e) { e.printStackTrace(); return ResultObj.UPDATE_ERROR; } } /** * 删除商品 * @param id * @return */ @RequestMapping("deleteGoods") public ResultObj deleteGoods(Integer id,String goodsimg){ try { //删除商品的图片 AppFileUtils.removeFileByPath(goodsimg); goodsService.removeById(id); return ResultObj.DELETE_SUCCESS; } catch (Exception e) { e.printStackTrace(); return ResultObj.DELETE_ERROR; } } /** * 加载所有可用的商品 * @return */ @RequestMapping("loadAllGoodsForSelect") public DataGridView loadAllGoodsForSelect(){ QueryWrapper<Goods> queryWrapper = new QueryWrapper<Goods>(); queryWrapper.eq("available",Constast.AVAILABLE_TRUE); List<Goods> list = goodsService.list(queryWrapper); for (Goods goods : list) { Provider provider = providerService.getById(goods.getProviderid()); if (null!=provider){ goods.setProvidername(provider.getProvidername()); } } return new DataGridView(list); } /** * 根据供应商ID查询商品信息 * @param providerid 供应商ID * @return */ @RequestMapping("loadGoodsByProviderId") public DataGridView loadGoodsByProviderId(Integer providerid){ QueryWrapper<Goods> queryWrapper = new QueryWrapper<Goods>(); queryWrapper.eq("available",Constast.AVAILABLE_TRUE); queryWrapper.eq(providerid!=null,"providerid",providerid); List<Goods> list = goodsService.list(queryWrapper); for (Goods goods : list) { Provider provider = providerService.getById(goods.getProviderid()); if (null!=provider){ goods.setProvidername(provider.getProvidername()); } } return new DataGridView(list); } }
package com.dev.shop.bus.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; import lombok.experimental.Accessors; import java.io.Serializable; @Data @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) @TableName("bus_customer") @ToString public class Customer implements Serializable { private static final long serialVersionUID=1L; @TableId(value = "id", type = IdType.AUTO) private Integer id; private String customername; private String zip; private String address; private String telephone; private String connectionpersion; private String phone; private String bank; private String account; private String email; private String fax; private Integer available; }
五,项目总结
以上展示了基于Springboot实现商品进销存管理系统的功能模块、所用技术、界面展示以及部分代码,系统整体设计的结构比较清晰,功能 也相对完整,比较适合做毕业设计或课程设计使用。