1.概述
本系统是基于Java设计的网页式开发项目,是一款用于物资管理人员对物资管理,其中包括对物资信息,出库物资信息,入库物资信息,物资信息余额等相关内容的管理,具有物资管理、用户管理、出库物资管理、入库物资管理、等相关功能的小型数据库管理应用系统。
2.开发环境
数据库:MySQL
代码编写工具:IntelliJ IDEA 2019
相关编译技术及工具:Jdk1.8 Springboot2.7 Spring SpringMVC Mybatis Thymeleaf Bootstrap3.6 Jquery Ajax HTML CSS Javascript
3.E-R模型图
4.数据库表
5. 功能演示
6.源代码
package cn.edu.ncst.controller; import cn.edu.ncst.entity.Balance; import cn.edu.ncst.service.BalanceService; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import javax.annotation.Resource; import java.util.ArrayList; @Controller @RequestMapping("/balance") public class BalanceController { @Resource private BalanceService balanceService; @ResponseBody @GetMapping("/queryall") public ModelAndView queryAll(){ ModelAndView mv = new ModelAndView(); ArrayListlist = balanceService.queryAll(); mv.addObject("lists",list); mv.setViewName("balance_table"); return mv; } @ResponseBody @GetMapping("/selectbyid") public Balance querybyid(Integer id){ ArrayList list = balanceService.queryAll(); for(Balance balance :list){ if (balance.getId() == id){ return balance; } } return null; } } package cn.edu.ncst.controller; import cn.edu.ncst.entity.InResource; import cn.edu.ncst.service.InResourceService; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import javax.annotation.Resource; import java.util.ArrayList; @Controller @RequestMapping("/inresource") public class InResourceController { @Resource private InResourceService inResourceService; @GetMapping("/queryall") public ModelAndView queryAll(){ ModelAndView mv = new ModelAndView(); ArrayList list; list = inResourceService.queyrAll(); System.out.println(list); mv.addObject("inres",list); mv.setViewName("inresource_table"); return mv; } @PostMapping("/add") @ResponseBody public String addUser(InResource resource){ String info; int i= inResourceService.add(resource); if (i!=0){ info="添加成功!"; } else { info = "添加失败!"; } return info; } @GetMapping("/delete") public String addUser(String id){ inResourceService.delete(Integer.parseInt(id)); return "redirect:/inresource/queryall"; } @GetMapping("/select") @ResponseBody public InResource selectById(String id){ InResource resource= inResourceService.select(Integer.valueOf(id)); return resource; } @PostMapping("/modify") @ResponseBody public String modify(InResource resource){ String info; int i= inResourceService.modify(resource); if (i!=0){ info="修改成功!"; } else { info = "修改失败!"; } return info; } } package cn.edu.ncst.controller; import cn.edu.ncst.entity.OutResource; import cn.edu.ncst.service.OutResourceService; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import javax.annotation.Resource; import java.util.ArrayList; @Controller @RequestMapping("/outresource") public class OutResourceController { @Resource private OutResourceService outResourceService; @GetMapping("/queryall") public ModelAndView queryAll(){ ModelAndView mv = new ModelAndView(); ArrayList list; list = outResourceService.queryAll(); System.out.println(list); mv.addObject("inres",list); mv.setViewName("outresource_table"); return mv; } @PostMapping("/add") @ResponseBody public String addUser(OutResource resource){ String info; int i= outResourceService.add(resource); if (i!=0){ info="添加成功!"; } else { info = "添加失败!"; } return info; } @GetMapping("/delete") public String addUser(String id){ outResourceService.delete(Integer.parseInt(id)); return "redirect:/outresource/queryall"; } @GetMapping("/select") @ResponseBody public OutResource selectById(String id){ OutResource resource= outResourceService.select(Integer.valueOf(id)); return resource; } @PostMapping("/modify") @ResponseBody public String modify(OutResource resource){ String info; int i= outResourceService.modify(resource); if (i!=0){ info="修改成功!"; } else { info = "修改失败!"; } return info; } } package cn.edu.ncst.controller; import cn.edu.ncst.entity.Resource; import cn.edu.ncst.service.ResourceService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import java.util.ArrayList; @Controller @RequestMapping("/resource") public class ResouceController { @javax.annotation.Resource private ResourceService resourceService; @GetMapping("/queryall") public ModelAndView queryAll(){ ModelAndView mv = new ModelAndView(); ArrayList list; list = resourceService.queyrAll(); mv.addObject("res",list); mv.setViewName("resource_table"); return mv; } @PostMapping("/add") @ResponseBody public String addUser(Resource resource){ String info; System.out.println(resource); System.out.println(resource); int i= resourceService.addResource(resource); if (i!=0){ info="添加成功!"; } else { info = "添加失败!"; } return info; } @GetMapping("/delete") public String addUser(String id){ resourceService.delete(Integer.parseInt(id)); return "redirect:/resource/queryall"; } @GetMapping("/select") @ResponseBody public Resource selectById(String id){ Resource resource= resourceService.select(Integer.valueOf(id)); return resource; } @PostMapping("/modify") @ResponseBody public String modify(Resource resource){ String info; int i= resourceService.modify(resource); if (i!=0){ info="修改成功!"; } else { info = "修改失败!"; } return info; } } package cn.edu.ncst.controller; import cn.edu.ncst.entity.User; import cn.edu.ncst.service.UserService; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import javax.annotation.Resource; import java.util.ArrayList; @Controller @RequestMapping("/user") public class UserController { @Resource private UserService userService; @GetMapping("/login") public String login(User user){ boolean flag = userService.queryByuserNameAndPassword(user); String info; if (flag){ return "homePage"; } info="用户名或密码错误"; return "login_error"; } @PostMapping("/add") @ResponseBody public String addUser(User user){ String info; int i= userService.addUSer(user); if (i!=0){ info="添加成功!"; } else { info = "添加失败!"; } return info; } @GetMapping("/queryall") public ModelAndView queryAll(){ ModelAndView mv = new ModelAndView(); ArrayList list; list = userService.queyrAll(); mv.addObject("users",list); mv.setViewName("user_table"); return mv; } @GetMapping("/delete") public String addUser(String userId){ userService.deletUserById(Integer.parseInt(userId)); return "redirect:/user/queryall"; } @GetMapping("/select") @ResponseBody public User selectById(String userId){ User user= userService.selectById(Integer.parseInt(userId)); return user; } @PostMapping("/modify") @ResponseBody public String modify(User user){ String info; int i= userService.modyfy(user); if (i!=0){ info="修改成功!"; } else { info = "修改失败!"; } return info; } } package cn.edu.ncst.dao; import cn.edu.ncst.entity.InResource; import org.apache.ibatis.annotations.Mapper; import java.util.ArrayList; @Mapper public interface InResourceDao { ArrayList queryAll(); int add(InResource inResource); int delete(Integer id); InResource select(Integer id); int modify(InResource resource); } package cn.edu.ncst.dao; import cn.edu.ncst.entity.OutResource; import org.apache.ibatis.annotations.Mapper; import java.util.ArrayList; @Mapper public interface OutResourceDao { ArrayList queryAll(); int add(OutResource resource); int delete(Integer id); OutResource select(Integer id); int modify(OutResource resource); } package cn.edu.ncst.dao; import cn.edu.ncst.entity.Resource; import org.apache.ibatis.annotations.Mapper; import java.util.ArrayList; @Mapper public interface ResourceDao { ArrayList select * from t_outsource insert into t_outsource (name,size,category,unit,number,price,money,reTime,opperson,reperson,remark,warehouse) values (#{name},#{size},#{category},#{unit},#{number},#{price},#{money},#{reTime},#{opperson},#{reperson},#{remark},#{warehouse}) delete from t_outsource where id=#{id} select * from t_outsource where id=#{id} update t_outsource set name=#{name},size=#{size},category=#{category},unit=#{unit}, number=#{number},price=#{price},money=#{money},reTime=#{reTime},opperson=#{opperson},reperson=#{reperson},remark=#{remark},warehouse=#{warehouse} where id=#{id} queryAll(); int add(Resource resource); int delete(Integer id); Resource select(Integer id); int modify(Resource resource); } package cn.edu.ncst.dao; import cn.edu.ncst.entity.User; import org.apache.ibatis.annotations.Mapper; import java.util.ArrayList; @Mapper public interface UserDao { int queryByuserNameAndPassword(String userName,String password); int addUser(String userName,String password); ArrayList select * from t_resource insert into t_resource (name,size,category,unit) values (#{name},#{size},#{category},#{unit}) delete from t_resource where id=#{id} select * from t_resource where id=#{id} update t_resource set name=#{name},size=#{size},category=#{category},unit=#{unit} where id=#{id} queryAll(); int deleteUser(int userId); User selectById(int userId); int modify(User user); } package cn.edu.ncst.entity; public class Balance { private int id; private String name; private String size; private String category; private String unit; private String number; private String money; private String warehouse; public Balance() { } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSize() { return size; } public void setSize(String size) { this.size = size; } public String getCategory() { return category; } public void setCategory(String category) { this.category = category; } public String getUnit() { return unit; } public void setUnit(String unit) { this.unit = unit; } public String getNumber() { return number; } public void setNumber(String number) { this.number = number; } public String getMoney() { return money; } public void setMoney(String money) { this.money = money; } public String getWarehouse() { return warehouse; } public void setWarehouse(String warehouse) { this.warehouse = warehouse; } public Balance(int id, String name, String size, String category, String unit, String number, String money, String warehouse) { this.id = id; this.name = name; this.size = size; this.category = category; this.unit = unit; this.number = number; this.money = money; this.warehouse = warehouse; } } package cn.edu.ncst.entity; public class InResource { private String name; private String size; private Integer id; private String category; private String unit; private String number; private String price; private String money; private String putTime; private String opperson; private String keeper; private String remark; private String warehouse; public InResource() { } public InResource(String name, String size, int id, String category, String unit, String number, String price, String money, String putTime, String opperson, String keeper, String remark, String warehouse) { this.name = name; this.size = size; this.id = id; this.category = category; this.unit = unit; this.number = number; this.price = price; this.money = money; this.putTime = putTime; this.opperson = opperson; this.keeper = keeper; this.remark = remark; this.warehouse = warehouse; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSize() { return size; } public void setSize(String size) { this.size = size; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getCategory() { return category; } public void setCategory(String category) { this.category = category; } public String getUnit() { return unit; } public void setUnit(String unit) { this.unit = unit; } public String getNumber() { return number; } public void setNumber(String number) { this.number = number; } public String getPrice() { return price; } public void setPrice(String price) { this.price = price; } public String getMoney() { return money; } public void setMoney(String money) { this.money = money; } public String getPutTime() { return putTime; } public void setPutTime(String putTime) { this.putTime = putTime; } public String getOpperson() { return opperson; } public void setOpperson(String opperson) { this.opperson = opperson; } public String getKeeper() { return keeper; } public void setKeeper(String keeper) { this.keeper = keeper; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } public String getWarehouse() { return warehouse; } public void setWarehouse(String warehouse) { this.warehouse = warehouse; } } package cn.edu.ncst.entity; public class OutResource { private String name; private String size; private int id; private String category; private String unit; private String number; private String price; private String money; private String reTime; private String opperson; private String reperson; private String remark; private String warehouse; public OutResource(String name, String size, int id, String category, String unit, String number, String price, String money, String reTime, String opperson, String reperson, String remark, String warehouse) { this.name = name; this.size = size; this.id = id; this.category = category; this.unit = unit; this.number = number; this.price = price; this.money = money; this.reTime = reTime; this.opperson = opperson; this.reperson = reperson; this.remark = remark; this.warehouse = warehouse; } public OutResource() { } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSize() { return size; } public void setSize(String size) { this.size = size; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getCategory() { return category; } public void setCategory(String category) { this.category = category; } public String getUnit() { return unit; } public void setUnit(String unit) { this.unit = unit; } public String getNumber() { return number; } public void setNumber(String number) { this.number = number; } public String getPrice() { return price; } public void setPrice(String price) { this.price = price; } public String getMoney() { return money; } public void setMoney(String money) { this.money = money; } public String getReTime() { return reTime; } public void setReTime(String reTime) { this.reTime = reTime; } public String getOpperson() { return opperson; } public void setOpperson(String opperson) { this.opperson = opperson; } public String getReperson() { return reperson; } public void setReperson(String reperson) { this.reperson = reperson; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } public String getWarehouse() { return warehouse; } public void setWarehouse(String warehouse) { this.warehouse = warehouse; } } package cn.edu.ncst.entity; public class Resource { private Integer id; private String name; private String size; private String category; private String unit; public Resource(Integer id, String name, String size, String category, String unit) { this.id = id; this.name = name; this.size = size; this.category = category; this.unit = unit; } public Resource() { } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSize() { return size; } public void setSize(String size) { this.size = size; } public String getCategory() { return category; } public void setCategory(String category) { this.category = category; } public String getUnit() { return unit; } public void setUnit(String unit) { this.unit = unit; } @Override public String toString() { return "Resource{" + "id=" + id + ", name='" + name + ''' + ", size='" + size + ''' + ", category='" + category + ''' + ", unit='" + unit + ''' + '}'; } } package cn.edu.ncst.entity; public class User { private int userId; private String userName; private String password; public User() { } public User(int userId, String userName, String password) { this.userId = userId; this.userName = userName; this.password = password; } public int getUserId() { return userId; } public void setUserId(int userId) { this.userId = userId; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } @Override public String toString() { return "User{" + "userId=" + userId + ", userName=" + userName + ", password=" + password + '}'; } } package cn.edu.ncst; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class MimsApplication { public static void main(String[] args) { SpringApplication.run(MimsApplication.class, args); } } package cn.edu.ncst.service; import cn.edu.ncst.entity.Balance; import java.util.ArrayList; import java.util.List; public interface BalanceService { ArrayList select count(userId) from t_user where userName=#{userName} and password=#{password} insert into t_user (userName,password) values(#{userName},#{password}) select * from t_user delete from t_user where userId=#{userId} select * from t_user where userId=#{userId} update t_user set userName=#{userName},password=#{password} where userId=#{userId} queryAll(); } package cn.edu.ncst.service; import cn.edu.ncst.entity.InResource; import java.util.ArrayList; public interface InResourceService { ArrayList queyrAll(); int add(InResource inResource); int delete(Integer id); InResource select(Integer id); int modify(InResource resource); } package cn.edu.ncst.service; import cn.edu.ncst.entity.OutResource; import java.util.ArrayList; public interface OutResourceService { ArrayList queryAll(); int add(OutResource resource); int delete(Integer id); OutResource select(Integer id); int modify(OutResource resource); } package cn.edu.ncst.service; import cn.edu.ncst.entity.Resource; import java.util.ArrayList; public interface ResourceService { ArrayList queyrAll(); int addResource(Resource resource); int delete(Integer id); Resource select(Integer id); int modify(Resource resource); } package cn.edu.ncst.service; import cn.edu.ncst.entity.User; import java.util.ArrayList; public interface UserService { boolean queryByuserNameAndPassword(User user); int addUSer(User user); ArrayList queyrAll(); int deletUserById(int userId); User selectById(int userId); int modyfy(User user); } #配置数据库 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.url=jdbc:mysql://localhost:3306/mims?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2b8 spring.datasource.username=root spring.datasource.password=123456 #配置日志文件 mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl #配置thymeleaf 登录页面 物资余额浏览 物资余额浏览
">物资编号 物资名称 规格型号 类别 计量单位 数量 金额 仓库 物资余额信息 导航面板 物资管理系统 欢迎登陆本系统! 增加用户
入库物资管理 入库物资管理页面
">*** 作 物资编号 物资名称 规格型号 类别 数量 单价 金额 入库时间 经办人 保管人 仓库 备注 删除 编辑物资信息 登录页面 出库物资管理 出库物资管理页面
">*** 作 物资编号 物资名称 规格型号 类别 数量 单价 金额 入库时间 经办人 保管人 仓库 备注 删除 编辑物资信息 物资管理 物资管理页面
">*** 作 物资编号 物资名称 规格型号 类别 计量单位 删除 编辑物资信息 用户管理 用户管理页面
">用户id 用户名 用户密码 *** 作 删除 编辑用户信息
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)