本專案實現了基於springboot的進銷存管理系統,主要用戶開設網店的相關商品的進貨、銷售、庫存的管理,功能比較完整,有著完整的權限管理系統,可以自行依需求設計角色和分配權限,權限的粒度可以做到頁面級的權限控制,整個專案來講比較優秀。主要實現的功能有以下幾個模組:
基礎管理模組:包含顧客管理、供應商管理、商品管理三個子模組
進貨管理模組:包含商品進貨、退貨、商品退貨查詢幾個子查塊
銷售管理:包含商品銷售、退貨、銷售退貨查詢幾個子查塊
系統管理:包含部門管理、選單管理、權限管理、角色管理、使用者管理五個子模組
其它管理:包含登陸日誌查詢、系統公告管理、圖示管理等幾個子模組
個人中心:包含個人資料管理、密碼修改等相關功能
語言環境:Java: jdk1.8
#資料庫:Mysql: mysql5.7 / Redis快取資料庫
應用伺服器:Tomcat: tomcat8.5.31
開發工具:IDEA或eclipse
後台開發技術:Springboot Mybatis-plus Shiro
前端開發技術:Bootstrap Layui Freemarker範本
超級管理者登陸系統:system/123456
基礎管理—客戶管理
#基礎管理—供應商管理
基礎管理—商品管理
進貨管理—商品進貨 也可在此實現退貨
#進貨管理—商品退貨查詢
#銷售管理&mdash ;商品銷售
銷售管理—銷售退貨查詢
系統管理---部門管理
系統管理---選單管理
#系統管理---權限管理
系統管理---角色管理
系統管理---使用者管理
其它管理—登陸日誌
其它管理—系統公告
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商品進銷存管理系統如何實現的詳細內容。更多資訊請關注PHP中文網其他相關文章!