基于javaweb+mysql的ssm仓库管理系统(java+ssm+jsp+js+jquery+layui+mysql)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SSM仓库管理系统(java+ssm+jsp+js+jquery+layui+mysql)
项目介绍
基于SSM的仓库管理系统设计与实现
角色:管理员、员工
管理员:管理员登录系统后,可以对个人中心、员工管理、厂商信息管理、司机信息管理、门店信息管理、仓库信息管理、货物信息管理、货物入库管理、货物出库管理等功能
员工:员工登录到仓库管理系统后,可以对个人中心、厂商信息管理、司机信息管理、门店信息管理、仓库信息管理、货物信息管理、货物入库管理、货物出库管理等功能
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.是否Maven项目: 否;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目; 6.数据库:MySql 5.7/8.0等版本均可;
技术栈
后端:SSM(Spring+SpringMVC+Mybatis) 前端:JSP+CSS+JS+JQUERY+Layui
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,修改配置,运行项目; 3. 将项目中db.xml配置文件中的数据库配置改为自己的配置,然后运行;
*/
@RequestMapping(value = "deleteGoods", method = RequestMethod.GET)
public
@ResponseBody
Map<String, Object> deleteGoods(@RequestParam("goodsID") Integer goodsID) throws GoodsManageServiceException {
// 初始化 Response
Response responseContent = ResponseFactory.newInstance();
// 删除
String result = goodsManageService.deleteGoods(goodsID) ? Response.RESPONSE_RESULT_SUCCESS : Response.RESPONSE_RESULT_ERROR;
// 设置 Response
responseContent.setResponseResult(result);
if (queryResult != null) {
goodsList = (List<Goods>) queryResult.get("data");
// 获取生成的文件
File file = goodsManageService.exportGoods(goodsList);
// 写出文件
if (file != null) {
// 设置响应头
response.addHeader("Content-Disposition", "attachment;filename=" + fileName);
FileInputStream inputStream = new FileInputStream(file);
OutputStream outputStream = response.getOutputStream();
public class GoodsManageHandler {
@Autowired
private GoodsManageService goodsManageService;
private static final String SEARCH_BY_ID = "searchByID";
private static final String SEARCH_BY_NAME = "searchByName";
private static final String SEARCH_ALL = "searchAll";
/**
* 通用的记录查询
* @param searchType 查询类型
* @param keyWord 查询关键字
* @param offset 分页偏移值
* @param limit 分页大小
* @param searchType 查询类型
* @param offset 分页偏移值
* @param limit 分页大小
* @return 返回所有符合条件的记录
*/
private Map<String, Object> query(String keyWord, String searchType, int offset, int limit) throws RepositoryAdminManageServiceException {
Map<String, Object> queryResult = null;
// query
switch (searchType) {
case SEARCH_ALL:
queryResult = repositoryAdminManageService.selectAll(offset, limit);
// 生成文件
File file = repositoryAdminManageService.exportRepositoryAdmin(repositoryAdmins);
// 输出文件
if (file != null) {
// 设置响应头
response.addHeader("Content-Disposition", "attachment;filename=" + fileName);
FileInputStream inputStream = new FileInputStream(file);
OutputStream outputStream = response.getOutputStream();
byte[] buffer = new byte[8192];
int len;
while ((len = inputStream.read(buffer, 0, buffer.length)) > 0) {
outputStream.write(buffer, 0, len);
outputStream.flush();
* @param searchType 搜索类型
* @param offset 如有多条记录时分页的偏移值
* @param limit 如有多条记录时分页的大小
* @param keyWord 搜索的关键字
* @return 返回查询的结果,其中键值为 rows 的代表查询到的每一记录,若有分页则为分页大小的记录;键值为 total 代表查询到的符合要求的记录总条数
*/
@SuppressWarnings("unchecked")
@RequestMapping(value = "getCustomerList", method = RequestMethod.GET)
public
@ResponseBody
Map<String, Object> getCustomerList(@RequestParam("searchType") String searchType,
default:
// do other things
break;
return queryResult;
/**
* 查询仓库管理员信息
* @param searchType 查询类型
* @param offset 分页偏移值
* @param limit 分页大小
* @param keyWord 查询关键字
* @return 返回一个Map,其中key=rows,表示查询出来的记录;key=total,表示记录的总条数
*/
*/
private Map<String, Object> query(String keyWord, String searchType, int offset, int limit) throws RepositoryAdminManageServiceException {
Map<String, Object> queryResult = null;
// query
switch (searchType) {
case SEARCH_ALL:
queryResult = repositoryAdminManageService.selectAll(offset, limit);
break;
case SEARCH_BY_ID:
if (StringUtils.isNumeric(keyWord))
* @param file 保存有货物信息的文件
* @return 返回一个map,其中:key 为 result表示操作的结果,包括:success 与
* error;key为total表示导入的总条数;key为available表示有效的条数
*/
@RequestMapping(value = "importGoods", method = RequestMethod.POST)
public
@ResponseBody
Map<String, Object> importGoods(@RequestParam("file") MultipartFile file) throws GoodsManageServiceException {
// 初始化 Response
Response responseContent = ResponseFactory.newInstance();
* @param keyWord 查询关键字
* @param response HttpServletResponse
*/
@SuppressWarnings("unchecked")
@RequestMapping(value = "exportRepositoryAdmin", method = RequestMethod.GET)
public void exportRepositoryAdmin(@RequestParam("searchType") String searchType,
@RequestParam("keyWord") String keyWord, HttpServletResponse response) throws RepositoryAdminManageServiceException, IOException {
// 导出文件名
String fileName = "repositoryAdminInfo.xlsx";
// 查询
List<RepositoryAdmin> repositoryAdmins;
Map<String, Object> queryResult = query(keyWord, searchType, -1, -1);
if (queryResult != null)
responseContent.setResponseTotal(total);
responseContent.setCustomerInfo("available", available);
return responseContent.generateResponse();
/**
* 导出货物信息
* @param searchType 查找类型
* @param keyWord 查找关键字
* @param response HttpServletResponse
*/
@SuppressWarnings("unchecked")
@RequestMapping(value = "exportGoods", method = RequestMethod.GET)
* @param searchType 查询类型
* @param keyWord 查询关键字
* @param response HttpServletResponse
*/
@SuppressWarnings("unchecked")
@RequestMapping(value = "exportRepositoryAdmin", method = RequestMethod.GET)
public void exportRepositoryAdmin(@RequestParam("searchType") String searchType,
@RequestParam("keyWord") String keyWord, HttpServletResponse response) throws RepositoryAdminManageServiceException, IOException {
// 导出文件名
String fileName = "repositoryAdminInfo.xlsx";
// 查询
List<RepositoryAdmin> repositoryAdmins;
*/
@RequestMapping(value = "/**/goodsManage")
@Controller
public class GoodsManageHandler {
@Autowired
private GoodsManageService goodsManageService;
private static final String SEARCH_BY_ID = "searchByID";
private static final String SEARCH_BY_NAME = "searchByName";
private static final String SEARCH_ALL = "searchAll";
/**
// 参数检查
if (StringUtils.isNumeric(customerIDStr)) {
// 转换为 Integer
Integer customerID = Integer.valueOf(customerIDStr);
// 刪除
String result = customerManageService.deleteCustomer(customerID) ? Response.RESPONSE_RESULT_SUCCESS : Response.RESPONSE_RESULT_ERROR;
responseContent.setResponseResult(result);
} else
responseContent.setResponseResult(Response.RESPONSE_RESULT_ERROR);
return responseContent.generateResponse();
/**
* 导入客户信息
* @param file 保存有客户信息的文件
@ResponseBody
Map<String, Object> deleteCustomer(@RequestParam("customerID") String customerIDStr) throws CustomerManageServiceException {
// 初始化 Response
Response responseContent = ResponseFactory.newInstance();
// 参数检查
if (StringUtils.isNumeric(customerIDStr)) {
// 转换为 Integer
Integer customerID = Integer.valueOf(customerIDStr);
// 刪除
String result = customerManageService.deleteCustomer(customerID) ? Response.RESPONSE_RESULT_SUCCESS : Response.RESPONSE_RESULT_ERROR;
responseContent.setResponseResult(result);
} else
* @param searchType 查询类型
* @param offset 分页偏移值
* @param limit 分页大小
* @return 返回所有符合条件的记录
*/
private Map<String, Object> query(String keyWord, String searchType, int offset, int limit) throws RepositoryAdminManageServiceException {
Map<String, Object> queryResult = null;
// query
switch (searchType) {
case SEARCH_ALL:
queryResult = repositoryAdminManageService.selectAll(offset, limit);
break;
private GoodsManageService goodsManageService;
private static final String SEARCH_BY_ID = "searchByID";
private static final String SEARCH_BY_NAME = "searchByName";
private static final String SEARCH_ALL = "searchAll";
/**
* 通用的记录查询
* @param searchType 查询类型
* @param keyWord 查询关键字
* @param offset 分页偏移值
* @param limit 分页大小
* @return 返回一个 Map ,包含所有符合要求的查询结果,以及记录的条数
int available = 0;
if (file != null) {
Map<String, Object> importInfo = goodsManageService.importGoods(file);
if (importInfo != null) {
total = (int) importInfo.get("total");
available = (int) importInfo.get("available");
result = Response.RESPONSE_RESULT_SUCCESS;
// 设置 Response
responseContent.setResponseResult(result);
responseContent.setResponseTotal(total);
responseContent.setCustomerInfo("available", available);
return responseContent.generateResponse();