基於Springboot商品進銷存管理系統的設計與實現
一、項目簡介
本項目實現瞭基於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實現商品進銷存管理系統的功能模塊、所用技術、界面展示以及部分代碼,系統整體設計的結構比較清晰,功能 也相對完整,比較適合做畢業設計或課程設計使用。
到此這篇關於基於Springboot商品進銷存管理系統的設計與實現的文章就介紹到這瞭,更多相關Springboot商品進銷存管理系統內容請搜索WalkonNet以前的文章或繼續瀏覽下面的相關文章希望大傢以後多多支持WalkonNet!
推薦閱讀:
- Spring Data JPA中 in 條件參數的傳遞方式
- Mybatis Plus QueryWrapper復合用法詳解
- Java Spring Cloud 負載均衡詳解
- mybatis-plus返回查詢總記錄數方式
- Spring MVC使用jstl 標簽c:forEach 遍歷輸出雙層嵌套List的數據方式