基于SSM的教材管理系统

文章目录

  • 教材管理系统
    • 一、项目演示
    • 二、项目介绍
    • 三、系统部分功能截图
    • 四、部分代码展示
    • 五、底部获取项目源码(9.9¥)

教材管理系统

一、项目演示

基于SSM的教材管理系统

二、项目介绍

有三个角色
1、管理员
功能模块:用户管理、教材录入、供应商录入、教材入库、所有付款记录、教材热度分析
管理员可以增删改查教材、教材商、入库教材、用户(用户包括学生和教师)可以对教材商、教材进行excel的导入导出操作
2、教师
功能模块:教师领取教材、教师可以领取入库的教材,可以退还教材
3、学生
功能模块:学生领取教材、学生的教材、学生付款记录、学生只能在对应的教师那里领取教材,并且可以退还教材、查询自己已经领取的教材,并且对已领教材付款。
语言:java
框架:Spring、SpringMVC、Mybatis、layui、jquery、bootstrap
数据库:MySQL

三、系统部分功能截图

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

四、部分代码展示

package com.dev.books.controller;import com.alibaba.fastjson.JSON;
import com.dev.books.pojo.Profession;
import com.dev.books.pojo.User;
import com.dev.books.service.UserService;
import com.dev.books.util.Layui;
import com.dev.books.util.RandNum;
import com.wordnik.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;@Controller
public class UserController {@AutowiredUserService userService;private final Logger log =  LoggerFactory.getLogger(UserController.class);@ResponseBody@RequestMapping(value = "/userLogin")@ApiOperation(value = "根据用户名获取用户对象", httpMethod = "GET", response = User.class, notes = "根据用户名获取用户对象")public String userLogin(String account, String password, HttpServletRequest request ){HttpSession session = request.getSession(true);//新建session对象User user = userService.findOneUser(account,password);session.setAttribute("user",user);if(user!=null){return "success";}return "fail";}@ResponseBody@RequestMapping(value = "/getAllUser",produces="application/json;charset=UTF-8")public String getAllUser(@RequestParam("limit") String limit, @RequestParam("page") String page){//System.out.println("bjshbd");//int error = 1/0;int start = (Integer.parseInt(page) - 1)*Integer.parseInt(limit);int pageSize = Integer.parseInt(limit);List<User>list = userService.findAllUsersByPage(start,pageSize);List<User>allData = userService.findAllUsers();System.out.println(list);Layui l = Layui.data(allData.size(), list);String result = JSON.toJSONString(l);System.out.println(result);return result;}@ResponseBody@RequestMapping(value = "/getUserInfo",produces="application/json;charset=UTF-8",method =RequestMethod.POST )public String getUserInfo(@RequestParam("limit") String limit, @RequestParam("page") String page,@RequestParam("key[college_data]") String college_data,@RequestParam("key[profession_data]") String profession_data,@RequestParam("key[grade_data]") String grade_data,@RequestParam("key[cclass_data]") String cclass_data){System.out.println("profession_data:"+profession_data);List<User>list = userService.findUserByCondictions(college_data,profession_data,grade_data,cclass_data);Layui l = Layui.data(list.size(), list);return JSON.toJSONString(l);}@ResponseBody@RequestMapping(value = "/updateUserInfo" )public String updateUserInfo(@RequestBody Map map,HttpServletRequest request){HttpSession session = request.getSession(true);//新建session对象User user = (User) session.getAttribute("user");  //将对应数据存入session中String id = user.getId();map.put("id",id);int n = userService.updateUserInfo(map);if(n>0){return "success";}return "failure";}@ResponseBody@RequestMapping(value = "/updateUserPwd" )public String updateUserPwd(@RequestBody Map map,HttpServletRequest request){HttpSession session = request.getSession(true);//新建session对象User user = (User) session.getAttribute("user");  //将对应数据存入session中String id = user.getId();System.out.println(map);String password = map.get("password").toString();System.out.println("password:"+password);int n = userService.updateUserPwd(password,id);if(n>0){return "success";}return "failure";}@ResponseBody@RequestMapping(value = "/findUserById" ,produces="application/json;charset=UTF-8")public String findUserById(HttpServletRequest request){HttpSession session = request.getSession(true);//新建session对象User user = (User) session.getAttribute("user");  //将对应数据存入session中String id = user.getId();User u = userService.findUserById(id);List<User> list = new ArrayList<>();list.add(u);Layui l = Layui.data(list.size(), list);return JSON.toJSONString(l);}/*删除学生,教师信息*/@ResponseBody@RequestMapping("/deleteUser")public String deleteUser(@RequestParam("id")String id){User user = userService.findUserById(id);int n = 0;if(user.getIdentification().equals("学生")){userService.deleteUser(id);n = userService.deleteStuUserInfo(id);if(n>0){return "success";}else {return "failure";}}else if(user.getIdentification().equals("教师")){userService.deleteUser(id);userService.deleteStuUserInfo(id);n = userService.deleteTeacherUserInfo(id);if(n>0){return "success";}else {return "failure";}}return "failure";}/*增加学生信息*/@ResponseBody@RequestMapping("/insertUser")public String insertUser(){return "";}@ResponseBody@RequestMapping(value = "/findAllTeacher",produces="application/json;charset=UTF-8")public String findAllTeacher(){List<User> users = userService.findAllTeacher();Layui l = Layui.data(users.size(), users);return JSON.toJSONString(l);}@ResponseBody@RequestMapping(value = "/insertStuUser",produces="application/json;charset=UTF-8")public String insertStuUser(@RequestBody Map map){Map userMap = new HashMap();Map userInfoMap = new HashMap();String id = RandNum.getGUID();userMap.put("id",id);userMap.put("identification","学生");userMap.put("name",map.get("name"));userMap.put("password",map.get("password"));userMap.put("phone",map.get("phone"));userMap.put("email",map.get("email"));userInfoMap.put("user_id",id);userInfoMap.put("col_id",map.get("col_id"));userInfoMap.put("prof_id",map.get("prof_id"));userInfoMap.put("gra_id",map.get("gra_id"));userInfoMap.put("ccl_id",map.get("ccl_id"));userInfoMap.put("t_id",map.get("t_id"));userService.insertUser(userMap);int n = userService.insertStuUserInfo(userInfoMap);if(n>0){return "success";}else {return "failure";}}@ResponseBody@RequestMapping(value = "/insertTeaUser",produces="application/json;charset=UTF-8")public String insertTeaUser(@RequestBody Map map){Map userMap = new HashMap();Map teacherInfoMap = new HashMap();String id = RandNum.getGUID();userMap.put("id",id);userMap.put("identification","教师");userMap.put("name",map.get("name"));userMap.put("password",map.get("password"));userMap.put("phone",map.get("phone"));userMap.put("email",map.get("email"));teacherInfoMap.put("user_id",id);teacherInfoMap.put("col_id",map.get("col_id"));teacherInfoMap.put("prof_id",map.get("prof_id"));teacherInfoMap.put("gra_id",map.get("gra_id"));teacherInfoMap.put("ccl_id",map.get("ccl_id"));userService.insertUser(userMap);int n = userService.insertStuUserInfo(teacherInfoMap);if(n>0){return "success";}else {return "failure";}}}
package com.dev.books.controller;import cn.afterturn.easypoi.entity.vo.NormalExcelConstants;
import com.alibaba.fastjson.JSON;
import com.dev.books.pojo.Book;
import com.dev.books.pojo.Supplier;
import com.dev.books.service.BookService;
import com.dev.books.service.SupplierService;
import com.dev.books.util.Layui;
import com.dev.books.util.POIUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;@Controller
public class BookController {@AutowiredBookService bookService;/*将表格中的数据插入到*/@ResponseBody@RequestMapping("/book/insertData")public Object supplierImportExcel(@RequestParam("file") MultipartFile file){int n= 0;//long s = file.getSize();Map<String,Object> map = new HashMap<>();Map<String, Object> result = new HashMap<String, Object>();List<Book> book = POIUtil.importExcel(file,Book.class);System.out.println(book);//List <Supplier> supplier2 = supplierService.findAllSupplier();//supplier1.addAll(supplier2);for(int i=0;i<book.size();i++){map.put("id",book.get(i).getId());map.put("book_name",book.get(i).getBook_name());map.put("book_kind",book.get(i).getBook_kind());map.put("book_price",book.get(i).getBook_price());map.put("qs_name",book.get(i).getQs_name());n = bookService.addBook(map);}System.out.println("map:"+map);if(n>0){result.put("code", 0);result.put("message", "success");result.put("data", file.getOriginalFilename());}else{result.put("code", -1);result.put("message", "failure");result.put("data", file.getOriginalFilename());}return result;}@ResponseBody@RequestMapping(value = "/book/getAllBookByPage",produces="application/json;charset=UTF-8")public String getAllBookByPage(@RequestParam("limit") String limit, @RequestParam("page") String page){int start = (Integer.parseInt(page) - 1)*Integer.parseInt(limit);int pageSize = Integer.parseInt(limit);List <Supplier> books = bookService.findAllBookByPages(start,pageSize);List <Supplier> allData = bookService.findAllBook();Layui l = Layui.data(allData.size(), books);return JSON.toJSONString(l);}@ResponseBody@RequestMapping(value = "/book/getAllBook",produces="application/json;charset=UTF-8")public String getAllBook(){List <Supplier> allData = bookService.findAllBook();Layui l = Layui.data(allData.size(), allData);return JSON.toJSONString(l);}@ResponseBody@RequestMapping(value = "/book/findAllBookKind",produces="application/json;charset=UTF-8")public String findAllBookKind(){List <String> allKinds = bookService.findAllBookKind();return JSON.toJSONString(allKinds);}@RequestMapping("/book/exportData")public String exportData(HttpServletResponse response){List <Supplier> books = bookService.findAllBook();POIUtil.exportExcel(books,Book.class,"书籍基本信息","",response);return  NormalExcelConstants.EASYPOI_EXCEL_VIEW;//需要配置新的视图解析器并设置优先级和扫描}@ResponseBody@RequestMapping(value = "/updateBookById")public String updateBookById(@RequestBody Map map){int n = bookService.updateBookById(map);if(n>0){return "success";}return "failure";}@ResponseBody@RequestMapping(value = "/deleteBookById")public String deleteBookById(@RequestParam("book_id")String book_id){int n = bookService.deleteBookById(book_id);if(n>0){return "success";}return "failure";}@ResponseBody@RequestMapping(value = "/findAllBookByBookName",produces="application/json;charset=UTF-8")public String findAllBookByBookName(@RequestParam("key[book_name]")String book_name){List<Supplier> books = bookService.findAllBookByBookName(book_name);Layui l = Layui.data(books.size(), books);return JSON.toJSONString(l);}@ResponseBody@RequestMapping(value = "/findBookNameByQsName",produces="application/json;charset=UTF-8")public String findBookNameByQsName(@RequestParam("qs_name")String qs_name){List<String> book_names = bookService.findBookNameByQsName(qs_name);return JSON.toJSONString(book_names);}
}
package com.dev.books.controller;import com.alibaba.fastjson.JSON;
import com.dev.books.pojo.StoreIn;
import com.dev.books.pojo.StoreOut;
import com.dev.books.service.StoreInService;
import com.dev.books.util.Layui;
import com.dev.books.util.RandNum;
import org.apache.commons.logging.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;@Controller
public class StoreInController {@AutowiredStoreInService storeInService;@ResponseBody@RequestMapping(value = "/getAllStoreInByPage",produces="application/json;charset=UTF-8")public String getAllStoreInByPage(@RequestParam("limit") String limit, @RequestParam("page") String page){int start = (Integer.parseInt(page) - 1)*Integer.parseInt(limit);int pageSize = Integer.parseInt(limit);List<StoreIn> storeIns = storeInService.findAllStoreInByPage(start,pageSize);List<StoreIn> allData = storeInService.findAllStoreIn();Layui l = Layui.data(allData.size(), storeIns);String result = JSON.toJSONString(l);System.out.println("result:"+result);return  result;}@ResponseBody@RequestMapping(value = "/getAllStoreInBookName",produces="application/json;charset=UTF-8")public String getAllStoreInBookName(){List<StoreIn> allData = storeInService.findAllStoreIn();List<String> list = new ArrayList<>();for (int i=0;i<allData.size();i++){list.add(allData.get(i).getBook_name());}Layui l = Layui.data(allData.size(), list);String result = JSON.toJSONString(l);System.out.println("result:"+result);return  result;}@ResponseBody@RequestMapping(value = "/insertStoreIn")public String insertStoreIn(/*@RequestParam("store_info")String store_info,@RequestParam("book_count")String book_count,@RequestParam("book_name")String book_name*/@RequestBody Map dataMap){System.out.println(dataMap);String store_info =dataMap.get("store_info").toString();String book_count = dataMap.get("book_count").toString();String book_name =dataMap.get("book_name").toString();String qs_name = dataMap.get("qs_name").toString();String id = RandNum.getGUID();Date date = new Date();StoreIn storeIn = new StoreIn(id,date,store_info,Integer.parseInt(book_count),book_name,qs_name,Integer.parseInt(book_count));/*使用fastjson把类转换成json,有两个好处,1.需要map类型传参数2.fastjson能够格式化时间类型*/String storeInJson = JSON.toJSONString(storeIn);Map map = JSON.parseObject(storeInJson, Map.class);System.out.println(map);int n = storeInService.insertStoreIn(map);if(n>0){return "success";}return  "failure";}@ResponseBody@RequestMapping(value = "/getStoreInById")public String getStoreInById(@RequestParam("id")String id){StoreIn storeIn = storeInService.findStoreInById(id);String book_id = storeIn.getBook_id();return book_id;}@ResponseBody@RequestMapping(value = "/deleteStoreIn")public String deleteStoreIn(@RequestParam("id")String id){int n = storeInService.deleteStoreIn(id);if(n>0){return "success";}return "failure";}@ResponseBody@RequestMapping(value = "/findStoreInPercent",produces="application/json;charset=UTF-8")public String findStoreInPercent(@RequestParam("book_type")String book_type){List<StoreIn> storeIns = storeInService.findStoreInPercent(book_type);Map<String, List<StoreIn>> map = new HashMap<String, List<StoreIn>>();for (StoreIn storeIn : storeIns) {if (map.get(storeIn.getBook_name()) == null) {List<StoreIn> data = new ArrayList<StoreIn>();data.add(storeIn);map.put(storeIn.getBook_name(), data);} else {//定位到和之前键相同的list,然后扩充listList<StoreIn> data = map.get(storeIn.getBook_name());data.add(storeIn);}}System.out.println(map);int book_count = 0;int book_init = 0;double persent = 0.0;List<StoreIn> so = new ArrayList<>();for (Map.Entry<String, List<StoreIn>> a : map.entrySet()) {List<StoreIn> sto = a.getValue();for(int i=0;i<sto.size();i++) {book_count += sto.get(i).getBook_count();book_init += sto.get(i).getBook_init();System.out.println("book_count:"+book_count);System.out.println("book_init:"+book_init);Double p = (book_init-book_count) *1.0/ book_init;BigDecimal bd = new BigDecimal(p);persent = bd.setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue();System.out.println(persent);}so.add(new StoreIn(a.getKey(),persent));book_count = 0;book_init = 0;}System.out.println("list表总计:"+so);String jsonString = JSON.toJSONString(so);return jsonString;}
}

五、底部获取项目源码(9.9¥)

有问题,或者需要协助调试运行项目的也可以

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/468846.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Atcoder ABC339 A - TLD

TLD 时间限制&#xff1a;2s 内存限制&#xff1a;1024MB 【原题地址】 所有图片源自Atcoder&#xff0c;题目译文源自脚本Atcoder Better! 点击此处跳转至原题 【问题描述】 【输入格式】 【输出格式】 【样例1】 【样例输入1】 atcoder.jp【样例输出1】 jp【样例说明…

猫头虎分享已解决Bug ‍ || Python Error: KeyError: ‘key_name‘

博主猫头虎的技术世界 &#x1f31f; 欢迎来到猫头虎的博客 — 探索技术的无限可能&#xff01; 专栏链接&#xff1a; &#x1f517; 精选专栏&#xff1a; 《面试题大全》 — 面试准备的宝典&#xff01;《IDEA开发秘籍》 — 提升你的IDEA技能&#xff01;《100天精通鸿蒙》 …

linux信号机制[二]

阻塞信号 信号相关概念 实际执行信号的处理动作称为信号递达(Delivery)信号从产生到递达之间的状态,称为信号未决(Pending)。[收到信号但是没有处理]进程可以选择阻塞 (Block )某个信号。被阻塞的信号产生时将保持在未决状态,直到进程解除对此信号的阻塞,才执行递达的动作.注…

如何有效的向 AI 提问 ?

目录 〇、导言 一、Base LLM 与 Instruction Tuned LLM 二、如何提出有效的问题 &#xff1f; 1. 明确问题&#xff1a; 2. 简明扼要&#xff1a; 3. 避免二义性&#xff1a; 4. 避免绝对化的问题&#xff1a; 5. 利用引导词&#xff1a; 6. 检查语法和拼写&#xff1…

统计图饼图绘制方法(C语言)

统计图饼图绘制方法&#xff08;C语言&#xff09; 常用的统计图有条形图、柱形图、折线图、曲线图、饼图、环形图、扇形图。 前几类图比较容易绘制&#xff0c;饼图绘制较难。今值此介绍饼图的绘制方法。 本方法采用C语言的最基本功能&#xff1a; &#xff08; 1.&#xff09…

51单片机编程基础(C语言):LED点阵屏

点阵屏介绍 类似于数码管&#xff0c;要用到肉眼视觉效应。扫描&#xff0c;才能把每一个LED都能选中&#xff0c;从而显示我们想要的图形&#xff0c;否则&#xff0c; 只能一次点亮一个LED&#xff0c; LED使用 51单片机点阵屏电路图&#xff1a; 实际连接顺序如下图&#…

寒假作业:2024/2/14

作业1&#xff1a;编程实现二维数组的杨辉三角 代码&#xff1a; #include <stdio.h> #include <string.h> #include <stdlib.h> int main(int argc, const char *argv[]) {int n;printf("please enter n:");scanf("%d",&n);int a…

17 ABCD数码管显示与动态扫描原理

1. 驱动八位数码管循环点亮 1.1 数码管结构图 数码管有两种结构&#xff0c;共阴极和共阳极&#xff0c;ACX720板上的是共阳极数码管&#xff0c;低电平点亮。 1.2 三位数码管等效电路图 为了节约I/O接口&#xff0c;各个数码管的各段发光管被连在一起&#xff0c;通过sel端…

使用 Chainlit, Langchain 及 Elasticsearch 轻松实现对 PDF 文件的查询

在我之前的文章 “Elasticsearch&#xff1a;与多个 PDF 聊天 | LangChain Python 应用教程&#xff08;免费 LLMs 和嵌入&#xff09;” 里&#xff0c;我详述如何使用 Streamlit&#xff0c;Langchain, Elasticsearch 及 OpenAI 来针对 PDF 进行聊天。在今天的文章中&#xf…

CVE-2023-41892 漏洞复现

CVE-2023-41892 开题&#xff0c;是一个RCE Thanks for installing Craft CMS! You’re looking at the index.twig template file located in your templates/ folder. Once you’re ready to start building out your site’s front end, you can replace this with someth…

30个AI变现案例(上)

精选整理了30个AI变现案例&#xff0c;每一个都可以作为一个完整的副业去实践&#xff0c;AI时代已经来了&#xff0c;所有不甘于现状的朋友&#xff0c;都应该去下场&#xff0c;先把手弄脏&#xff0c;不要怕&#xff0c;实践起来&#xff01; 1&#xff0e;【副业创业】AI剧…

AIGC | AI提示词构建

文章目录 &#x1f4da;BARD提示词构建法&#x1f407;前言&#x1f407;第一步&#xff1a;阐述背景Background&#x1f407;第二步&#xff1a;定义目标Aim&#x1f407;第三步&#xff1a;设定角色Role&#x1f407;第四步&#xff1a;设置要求Demand &#x1f4da;测试与迭…