计算机毕业设计 基于html5的图书管理系统的设计与实现 Java实战项目 附源码+文档+视频讲解

博主介绍:✌从事软件开发10年之余,专注于Java技术领域、Python人工智能及数据挖掘、小程序项目开发和Android项目开发等。CSDN、掘金、华为云、InfoQ、阿里云等平台优质作者✌
🍅文末获取源码联系🍅
👇🏻 精彩专栏推荐订阅👇🏻 不然下次找不到哟
————————————————
计算机毕业设计《1000套》✌

目录

1、项目介绍及开发技术

1.1 项目介绍

1.2 开发技术

2、系统功能设计结构图

3、功能截图

3.1 前台功能

3.2 后台功能

4、数据库表结构设计

5、关键代码

5.1 书籍出入库Controller模块 

5.2 书籍出入库Service模块 

5.3 书籍出入库ServiceImpl模块

5.4 书籍出入库Dao模块

6、论文目录结构

7、源码获取


1、项目介绍及开发技术

1.1 项目介绍

传统办法管理信息首先需要花费的时间比较多,其次数据出错率比较高,而且对错误的数据进行更改也比较困难,最后,检索数据费事费力。因此,在计算机上安装图书管理系统软件来发挥其高效地信息处理的作用,可以规范信息管理流程,让管理工作可以系统化和程序化,同时,图书管理系统的有效运用可以帮助管理人员准确快速地处理信息。

图书管理系统在对开发工具的选择上也很慎重,为了便于开发实现,选择的开发工具为Eclipse,选择的数据库工具为Mysql。以此搭建开发环境实现图书管理系统的功能。其中管理员管理用户,新闻公告。

图书管理系统是一款运用软件开发技术设计实现的应用系统,在信息处理上可以达到快速的目的,不管是针对数据添加,数据维护和统计,以及数据查询等处理要求,图书管理系统都可以轻松应对。

1.2 开发技术

Java开发语言、SpringBoot、MyBatisPlus、MySQL数据库、Maven、IDEA开发工具、JDK1.8+、Vue、HTML、CSS、JS。

2、系统功能设计结构图

3、功能截图

3.1 前台功能

首页

论坛

 公告信息

 书籍

 个人中心

3.2 后台功能

登录

用户信息管理:对用户信息进行查询管理,可以删除用户信息、修改用户信息、新增用户信息,

还进行了对用户名称的模糊查询的条件。

书籍信息管理: 查看已发布的书籍信息数据,修改书籍信息,书籍信息作废,即可删除,还进行了对书籍信息名称的模糊查询 书籍信息信息的类型查询等等一些条件。

盘点信息管理: 根据盘点信息进行条件查询,还可以对盘点信息进行新增、修改、查询操作等等。

公告信息管理: 根据公告信息进行新增、修改、查询操作等等。

4、数据库表结构设计

CREATE DATABASE /*!32312 IF NOT EXISTS*/`tushuguanlixitong` /*!40100 DEFAULT CHARACTER SET utf8 */;

USE `tushuguanlixitong`;

/*Table structure for table `config` */

DROP TABLE IF EXISTS `config`;

CREATE TABLE `config` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `name` varchar(100) DEFAULT NULL COMMENT '配置参数名称',
  `value` varchar(100) DEFAULT NULL COMMENT '配置参数值',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='配置文件';

/*Data for the table `config` */

insert  into `config`(`id`,`name`,`value`) values (1,'轮播图1','upload/config1.jpg'),(2,'轮播图2','upload/config2.jpg'),(3,'轮播图3','upload/config3.jpg');

/*Table structure for table `dictionary` */

DROP TABLE IF EXISTS `dictionary`;

CREATE TABLE `dictionary` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `dic_code` varchar(200) DEFAULT NULL COMMENT '字段',
  `dic_name` varchar(200) DEFAULT NULL COMMENT '字段名',
  `code_index` int(11) DEFAULT NULL COMMENT '编码',
  `index_name` varchar(200) DEFAULT NULL COMMENT '编码名字  Search111 ',
  `super_id` int(11) DEFAULT NULL COMMENT '父字段id',
  `beizhu` varchar(200) DEFAULT NULL COMMENT '备注',
  `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=39 DEFAULT CHARSET=utf8 COMMENT='字典';

/*Data for the table `dictionary` */

insert  into `dictionary`(`id`,`dic_code`,`dic_name`,`code_index`,`index_name`,`super_id`,`beizhu`,`create_time`) values (18,'shuji_types','书籍类型',1,'书籍类型1',NULL,NULL,'2023-04-10 15:16:31'),(19,'shuji_types','书籍类型',2,'书籍类型2',NULL,NULL,'2023-04-10 15:16:31'),(20,'shuji_types','书籍类型',3,'书籍类型3',NULL,NULL,'2023-04-10 15:16:31'),(21,'shujia_types','所在书架',1,'所在书架1',NULL,NULL,'2023-04-10 15:16:31'),(22,'shujia_types','所在书架',2,'所在书架2',NULL,NULL,'2023-04-10 15:16:31'),(23,'shujia_types','所在书架',3,'所在书架3',NULL,NULL,'2023-04-10 15:16:31'),(24,'shuji_yuyue_types','借阅状态',101,'借阅中',NULL,NULL,'2023-04-10 15:16:31'),(25,'shuji_yuyue_types','借阅状态',102,'提前还书',NULL,NULL,'2023-04-10 15:16:31'),(26,'shuji_yuyue_types','借阅状态',103,'已到期',NULL,NULL,'2023-04-10 15:16:31'),(27,'shuji_yuyue_types','借阅状态',104,'已还书',NULL,NULL,'2023-04-10 15:16:31'),(28,'shuji_yuyue_types','订单类型',105,'已评价',NULL,NULL,'2023-04-10 15:16:31'),(29,'news_types','公告类型',1,'公告类型1',NULL,NULL,'2023-04-10 15:16:31'),(30,'news_types','公告类型',2,'公告类型2',NULL,NULL,'2023-04-10 15:16:31'),(31,'news_types','公告类型',3,'公告类型3',NULL,NULL,'2023-04-10 15:16:31'),(32,'sex_types','性别',1,'男',NULL,NULL,'2023-04-10 15:16:31'),(33,'sex_types','性别',2,'女',NULL,NULL,'2023-04-10 15:16:31'),(34,'forum_state_types','帖子状态',1,'发帖',NULL,NULL,'2023-04-10 15:16:31'),(35,'forum_state_types','帖子状态',2,'回帖',NULL,NULL,'2023-04-10 15:16:31'),(36,'shuji_collection_types','收藏表类型',1,'收藏',NULL,NULL,'2023-04-10 15:16:31'),(37,'shuji_churu_inout_types','出入库类型',1,'出库',NULL,NULL,'2023-04-10 15:16:31'),(38,'shuji_churu_inout_types','出入库类型',2,'入库',NULL,NULL,'2023-04-10 15:16:31');

/*Table structure for table `fajin` */

DROP TABLE IF EXISTS `fajin`;

CREATE TABLE `fajin` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
  `yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
  `fajin_price` decimal(10,2) DEFAULT NULL COMMENT '缴纳金额',
  `fajin_content` text COMMENT '缴纳原因 ',
  `insert_time` timestamp NULL DEFAULT NULL COMMENT '添加时间',
  `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间  show3 listShow',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8 COMMENT='罚金信息';

/*Data for the table `fajin` */

insert  into `fajin`(`id`,`yonghu_id`,`fajin_price`,`fajin_content`,`insert_time`,`create_time`) values (1,3,'693.07','缴纳原因1','2023-04-10 15:17:49','2023-04-10 15:17:49'),(2,1,'567.86','缴纳原因2','2023-04-10 15:17:49','2023-04-10 15:17:49'),(3,1,'159.66','缴纳原因3','2023-04-10 15:17:49','2023-04-10 15:17:49'),(4,1,'684.68','缴纳原因4','2023-04-10 15:17:49','2023-04-10 15:17:49'),(5,2,'573.62','缴纳原因5','2023-04-10 15:17:49','2023-04-10 15:17:49'),(6,1,'90.57','缴纳原因6','2023-04-10 15:17:49','2023-04-10 15:17:49'),(7,1,'621.96','缴纳原因7','2023-04-10 15:17:49','2023-04-10 15:17:49'),(9,2,'652.89','缴纳原因9','2023-04-10 15:17:49','2023-04-10 15:17:49'),(11,2,'527.99','缴纳原因11','2023-04-10 15:17:49','2023-04-10 15:17:49'),(13,3,'373.48','缴纳原因13','2023-04-10 15:17:49','2023-04-10 15:17:49'),(14,3,'20.87','缴纳原因14','2023-04-10 15:17:49','2023-04-10 15:17:49');

/*Table structure for table `forum` */

DROP TABLE IF EXISTS `forum`;

CREATE TABLE `forum` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `forum_name` varchar(200) DEFAULT NULL COMMENT '帖子标题  Search111 ',
  `yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
  `users_id` int(11) DEFAULT NULL COMMENT '管理员',
  `forum_content` text COMMENT '发布内容',
  `super_ids` int(11) DEFAULT NULL COMMENT '父id',
  `forum_state_types` int(11) DEFAULT NULL COMMENT '帖子状态',
  `insert_time` timestamp NULL DEFAULT NULL COMMENT '发帖时间',
  `update_time` timestamp NULL DEFAULT NULL COMMENT '修改时间',
  `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show2',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8 COMMENT='论坛';

/*Data for the table `forum` */

insert  into `forum`(`id`,`forum_name`,`yonghu_id`,`users_id`,`forum_content`,`super_ids`,`forum_state_types`,`insert_time`,`update_time`,`create_time`) values (1,'帖子标题1',1,NULL,'发布内容1',135,1,'2023-04-10 15:17:49','2023-04-10 15:17:49','2023-04-10 15:17:49'),(2,'帖子标题2',1,NULL,'发布内容2',435,1,'2023-04-10 15:17:49','2023-04-10 15:17:49','2023-04-10 15:17:49'),(3,'帖子标题3',3,NULL,'发布内容3',172,1,'2023-04-10 15:17:49','2023-04-10 15:17:49','2023-04-10 15:17:49'),(4,'帖子标题4',1,NULL,'发布内容4',184,1,'2023-04-10 15:17:49','2023-04-10 15:17:49','2023-04-10 15:17:49'),(5,'帖子标题5',3,NULL,'发布内容5',471,1,'2023-04-10 15:17:49','2023-04-10 15:17:49','2023-04-10 15:17:49'),(6,'帖子标题6',1,NULL,'发布内容6',189,1,'2023-04-10 15:17:49','2023-04-10 15:17:49','2023-04-10 15:17:49'),(7,'帖子标题7',2,NULL,'发布内容7',388,1,'2023-04-10 15:17:49','2023-04-10 15:17:49','2023-04-10 15:17:49'),(8,'帖子标题8',1,NULL,'发布内容8',185,1,'2023-04-10 15:17:49','2023-04-10 15:17:49','2023-04-10 15:17:49'),(9,'帖子标题9',3,NULL,'发布内容9',377,1,'2023-04-10 15:17:49','2023-04-10 15:17:49','2023-04-10 15:17:49'),(10,'帖子标题10',1,NULL,'发布内容10',464,1,'2023-04-10 15:17:49','2023-04-10 15:17:49','2023-04-10 15:17:49'),(11,'帖子标题11',1,NULL,'发布内容11',328,1,'2023-04-10 15:17:49','2023-04-10 15:17:49','2023-04-10 15:17:49'),(13,'帖子标题13',3,NULL,'发布内容13',33,1,'2023-04-10 15:17:49','2023-04-10 15:17:49','2023-04-10 15:17:49'),(14,'帖子标题14',3,NULL,'发布内容14',166,1,'2023-04-10 15:17:49','2023-04-10 15:17:49','2023-04-10 15:17:49'),(21,NULL,1,NULL,'可以删除自己上传的帖子和评论',14,2,'2023-04-10 15:55:41',NULL,'2023-04-10 15:55:41'),(22,NULL,NULL,1,'22222222222222222',14,2,'2023-04-10 15:58:05',NULL,'2023-04-10 15:58:05');

/*Table structure for table `news` */

DROP TABLE IF EXISTS `news`;

CREATE TABLE `news` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `news_name` varchar(200) DEFAULT NULL COMMENT '公告标题  Search111 ',
  `news_types` int(11) DEFAULT NULL COMMENT '公告类型  Search111 ',
  `news_photo` varchar(200) DEFAULT NULL COMMENT '公告图片',
  `insert_time` timestamp NULL DEFAULT NULL COMMENT '添加时间',
  `news_content` text COMMENT '公告详情',
  `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 nameShow',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8 COMMENT='公告信息';

/*Data for the table `news` */

insert  into `news`(`id`,`news_name`,`news_types`,`news_photo`,`insert_time`,`news_content`,`create_time`) values (1,'公告标题1',2,'upload/news1.jpg','2023-04-10 15:17:49','公告详情1','2023-04-10 15:17:49'),(2,'公告标题2',2,'upload/news2.jpg','2023-04-10 15:17:49','公告详情2','2023-04-10 15:17:49'),(3,'公告标题3',1,'upload/news3.jpg','2023-04-10 15:17:49','公告详情3','2023-04-10 15:17:49'),(4,'公告标题4',2,'upload/news4.jpg','2023-04-10 15:17:49','公告详情4','2023-04-10 15:17:49'),(5,'公告标题5',2,'upload/news5.jpg','2023-04-10 15:17:49','公告详情5','2023-04-10 15:17:49'),(6,'公告标题6',1,'upload/news6.jpg','2023-04-10 15:17:49','公告详情6','2023-04-10 15:17:49'),(7,'公告标题7',1,'upload/news7.jpg','2023-04-10 15:17:49','公告详情7','2023-04-10 15:17:49'),(8,'公告标题8',3,'upload/news8.jpg','2023-04-10 15:17:49','公告详情8','2023-04-10 15:17:49'),(9,'公告标题9',2,'upload/news9.jpg','2023-04-10 15:17:49','公告详情9','2023-04-10 15:17:49'),(10,'公告标题10',3,'upload/news10.jpg','2023-04-10 15:17:49','公告详情10','2023-04-10 15:17:49'),(11,'公告标题11',3,'upload/news11.jpg','2023-04-10 15:17:49','公告详情11','2023-04-10 15:17:49'),(12,'公告标题12',1,'upload/news12.jpg','2023-04-10 15:17:49','公告详情12','2023-04-10 15:17:49'),(13,'公告标题13',3,'upload/news13.jpg','2023-04-10 15:17:49','公告详情13','2023-04-10 15:17:49'),(14,'公告标题14',2,'upload/news14.jpg','2023-04-10 15:17:49','公告详情14','2023-04-10 15:17:49');

/*Table structure for table `pandian` */

DROP TABLE IF EXISTS `pandian`;

CREATE TABLE `pandian` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
  `shuji_id` int(11) DEFAULT NULL COMMENT '书籍',
  `pandian_num` int(11) DEFAULT NULL COMMENT '盘点数量',
  `pandian_content` longtext COMMENT '备注',
  `insert_time` timestamp NULL DEFAULT NULL COMMENT '添加时间',
  `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8 COMMENT='每日盘点';

/*Data for the table `pandian` */

insert  into `pandian`(`id`,`shuji_id`,`pandian_num`,`pandian_content`,`insert_time`,`create_time`) values (1,1,5,'备注1','2023-04-10 15:17:49','2023-04-10 15:17:49'),(2,2,276,'备注2','2023-04-10 15:17:49','2023-04-10 15:17:49'),(3,3,38,'备注3','2023-04-10 15:17:49','2023-04-10 15:17:49'),(4,4,169,'备注4','2023-04-10 15:17:49','2023-04-10 15:17:49'),(5,5,328,'备注5','2023-04-10 15:17:49','2023-04-10 15:17:49'),(6,6,316,'备注6','2023-04-10 15:17:49','2023-04-10 15:17:49'),(7,7,153,'备注7','2023-04-10 15:17:49','2023-04-10 15:17:49'),(8,8,13,'备注8','2023-04-10 15:17:49','2023-04-10 15:17:49'),(9,9,280,'备注9','2023-04-10 15:17:49','2023-04-10 15:17:49'),(10,10,370,'备注10','2023-04-10 15:17:49','2023-04-10 15:17:49'),(11,11,231,'备注11','2023-04-10 15:17:49','2023-04-10 15:17:49'),(12,12,231,'备注12','2023-04-10 15:17:49','2023-04-10 15:17:49'),(13,13,440,'备注13','2023-04-10 15:17:49','2023-04-10 15:17:49'),(14,14,487,'备注14','2023-04-10 15:17:49','2023-04-10 15:17:49');

/*Table structure for table `shuji` */

DROP TABLE IF EXISTS `shuji`;

CREATE TABLE `shuji` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
  `shuji_uuid_number` varchar(200) DEFAULT NULL COMMENT '书籍编号  Search111 ',
  `shuji_name` varchar(200) DEFAULT NULL COMMENT '书籍名称  Search111 ',
  `shuji_zuozhe` varchar(200) DEFAULT NULL COMMENT '书籍作者',
  `shuji_chubanshe` varchar(200) DEFAULT NULL COMMENT '出版社',
  `shuji_photo` varchar(200) DEFAULT NULL COMMENT '书籍照片',
  `shuji_types` int(11) DEFAULT NULL COMMENT '书籍类型 Search111',
  `shujia_types` int(11) DEFAULT NULL COMMENT '所在书架 Search111',
  `shujia_address` varchar(200) DEFAULT NULL COMMENT '详细地址',
  `shuji_kucun_number` int(11) DEFAULT NULL COMMENT '书籍库存',
  `shuji_clicknum` int(11) DEFAULT NULL COMMENT '热度 ',
  `shuji_content` text COMMENT '书籍介绍 ',
  `shuji_delete` int(11) DEFAULT NULL COMMENT '逻辑删除',
  `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间  show1 show2 photoShow',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8 COMMENT='书籍';

/*Data for the table `shuji` */

insert  into `shuji`(`id`,`shuji_uuid_number`,`shuji_name`,`shuji_zuozhe`,`shuji_chubanshe`,`shuji_photo`,`shuji_types`,`shujia_types`,`shujia_address`,`shuji_kucun_number`,`shuji_clicknum`,`shuji_content`,`shuji_delete`,`create_time`) values (1,'1681111070041','书籍名称1','书籍作者1','出版社1','upload/shuji1.jpg',1,1,'详细地址1',91,40,'书籍介绍1',1,'2023-04-10 15:17:49'),(2,'1681111070029','书籍名称2','书籍作者2','出版社2','upload/shuji2.jpg',3,2,'详细地址2',92,345,'书籍介绍2',1,'2023-04-10 15:17:49'),(3,'1681111070010','书籍名称3','书籍作者3','出版社3','upload/shuji3.jpg',1,1,'详细地址3',93,277,'书籍介绍3',1,'2023-04-10 15:17:49'),(4,'1681111070029','书籍名称4','书籍作者4','出版社4','upload/shuji4.jpg',2,2,'详细地址4',105,45,'书籍介绍4',1,'2023-04-10 15:17:49'),(5,'1681111070044','书籍名称5','书籍作者5','出版社5','upload/shuji5.jpg',2,1,'详细地址5',105,78,'书籍介绍5',1,'2023-04-10 15:17:49'),(6,'1681111070008','书籍名称6','书籍作者6','出版社6','upload/shuji6.jpg',2,1,'详细地址6',106,305,'书籍介绍6',1,'2023-04-10 15:17:49'),(7,'1681111069992','书籍名称7','书籍作者7','出版社7','upload/shuji7.jpg',1,3,'详细地址7',107,236,'书籍介绍7',1,'2023-04-10 15:17:49'),(8,'1681111069962','书籍名称8','书籍作者8','出版社8','upload/shuji8.jpg',1,3,'详细地址8',108,477,'书籍介绍8',1,'2023-04-10 15:17:49'),(9,'1681111070047','书籍名称9','书籍作者9','出版社9','upload/shuji9.jpg',1,2,'详细地址9',110,47,'书籍介绍9',1,'2023-04-10 15:17:49'),(10,'1681111070022','书籍名称10','书籍作者10','出版社10','upload/shuji10.jpg',3,3,'详细地址10',1010,464,'书籍介绍10',1,'2023-04-10 15:17:49'),(11,'1681111070014','书籍名称11','书籍作者11','出版社11','upload/shuji11.jpg',2,2,'详细地址11',1011,154,'书籍介绍11',1,'2023-04-10 15:17:49'),(12,'1681111069996','书籍名称12','书籍作者12','出版社12','upload/shuji12.jpg',1,3,'详细地址12',1012,134,'书籍介绍12',1,'2023-04-10 15:17:49'),(13,'1681111069976','书籍名称13','书籍作者13','出版社13','upload/shuji13.jpg',3,2,'详细地址13',1013,436,'书籍介绍13',1,'2023-04-10 15:17:49'),(14,'1681111070027','书籍名称14','书籍作者14','出版社14','upload/shuji14.jpg',1,2,'详细地址14',1014,469,'书籍介绍14',1,'2023-04-10 15:17:49');

/*Table structure for table `shuji_churu_inout` */

DROP TABLE IF EXISTS `shuji_churu_inout`;

CREATE TABLE `shuji_churu_inout` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `shuji_churu_inout_uuid_number` varchar(200) DEFAULT NULL COMMENT '出入库流水号',
  `shuji_churu_inout_name` varchar(200) DEFAULT NULL COMMENT '出入库名称  Search111 ',
  `shuji_churu_inout_types` int(11) DEFAULT NULL COMMENT '出入库类型  Search111 ',
  `shuji_churu_inout_content` longtext COMMENT '备注',
  `insert_time` timestamp NULL DEFAULT NULL COMMENT '添加时间',
  `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 COMMENT='出入库';

/*Data for the table `shuji_churu_inout` */

insert  into `shuji_churu_inout`(`id`,`shuji_churu_inout_uuid_number`,`shuji_churu_inout_name`,`shuji_churu_inout_types`,`shuji_churu_inout_content`,`insert_time`,`create_time`) values (1,'1681111069982','出入库名称1',2,'备注1','2023-04-10 15:17:49','2023-04-10 15:17:49'),(2,'1681111070056','出入库名称2',1,'备注2','2023-04-10 15:17:49','2023-04-10 15:17:49'),(3,'1681111069974','出入库名称3',1,'备注3','2023-04-10 15:17:49','2023-04-10 15:17:49'),(4,'1681111070003','出入库名称4',2,'备注4','2023-04-10 15:17:49','2023-04-10 15:17:49'),(5,'1681111069978','出入库名称5',1,'备注5','2023-04-10 15:17:49','2023-04-10 15:17:49'),(6,'1681111070058','出入库名称6',1,'备注6','2023-04-10 15:17:49','2023-04-10 15:17:49'),(7,'1681111070016','出入库名称7',1,'备注7','2023-04-10 15:17:49','2023-04-10 15:17:49'),(8,'1681111070027','出入库名称8',2,'备注8','2023-04-10 15:17:49','2023-04-10 15:17:49'),(9,'1681111070048','出入库名称9',1,'备注9','2023-04-10 15:17:49','2023-04-10 15:17:49'),(10,'1681111070007','出入库名称10',2,'备注10','2023-04-10 15:17:49','2023-04-10 15:17:49'),(11,'1681111070018','出入库名称11',1,'备注11','2023-04-10 15:17:49','2023-04-10 15:17:49'),(12,'1681111070045','出入库名称12',2,'备注12','2023-04-10 15:17:49','2023-04-10 15:17:49'),(13,'1681111070033','出入库名称13',1,'备注13','2023-04-10 15:17:49','2023-04-10 15:17:49'),(14,'1681111070065','出入库名称14',1,'备注14','2023-04-10 15:17:49','2023-04-10 15:17:49'),(15,'1681113432890','出库书籍1 、2、3 各10本',1,'','2023-04-10 15:57:13','2023-04-10 15:57:13');

/*Table structure for table `shuji_churu_inout_list` */

DROP TABLE IF EXISTS `shuji_churu_inout_list`;

CREATE TABLE `shuji_churu_inout_list` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `shuji_churu_inout_id` int(11) DEFAULT NULL COMMENT '出入库',
  `shuji_id` int(11) DEFAULT NULL COMMENT '书籍',
  `shuji_churu_inout_list_number` int(11) DEFAULT NULL COMMENT '操作数量',
  `insert_time` timestamp NULL DEFAULT NULL COMMENT '操作时间',
  `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8 COMMENT='出入库详情';

/*Data for the table `shuji_churu_inout_list` */

insert  into `shuji_churu_inout_list`(`id`,`shuji_churu_inout_id`,`shuji_id`,`shuji_churu_inout_list_number`,`insert_time`,`create_time`) values (1,1,1,106,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(2,2,2,157,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(3,3,3,479,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(4,4,4,396,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(5,5,5,471,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(6,6,6,47,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(7,7,7,430,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(8,8,8,322,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(9,9,9,380,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(10,10,10,79,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(11,11,11,10,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(12,12,12,167,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(13,13,13,250,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(14,14,14,116,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(15,15,1,10,'2023-04-10 15:57:13','2023-04-10 15:57:13'),(16,15,2,10,'2023-04-10 15:57:13','2023-04-10 15:57:13'),(17,15,3,10,'2023-04-10 15:57:13','2023-04-10 15:57:13');

/*Table structure for table `shuji_collection` */

DROP TABLE IF EXISTS `shuji_collection`;

CREATE TABLE `shuji_collection` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `shuji_id` int(11) DEFAULT NULL COMMENT '书籍',
  `yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
  `shuji_collection_types` int(11) DEFAULT NULL COMMENT '类型',
  `insert_time` timestamp NULL DEFAULT NULL COMMENT '收藏时间',
  `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show3 photoShow',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8 COMMENT='书籍收藏';

/*Data for the table `shuji_collection` */

insert  into `shuji_collection`(`id`,`shuji_id`,`yonghu_id`,`shuji_collection_types`,`insert_time`,`create_time`) values (1,1,3,1,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(4,4,2,1,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(5,5,3,1,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(6,6,1,1,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(7,7,1,1,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(8,8,2,1,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(9,9,1,1,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(10,10,1,1,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(11,11,3,1,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(12,12,2,1,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(13,13,3,1,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(14,14,2,1,'2023-04-10 15:17:49','2023-04-10 15:17:49');

/*Table structure for table `shuji_commentback` */

DROP TABLE IF EXISTS `shuji_commentback`;

CREATE TABLE `shuji_commentback` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `shuji_id` int(11) DEFAULT NULL COMMENT '书籍',
  `yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
  `shuji_commentback_text` longtext COMMENT '评价内容',
  `insert_time` timestamp NULL DEFAULT NULL COMMENT '评价时间',
  `reply_text` longtext COMMENT '回复内容',
  `update_time` timestamp NULL DEFAULT NULL COMMENT '回复时间',
  `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 COMMENT='书籍评价';

/*Data for the table `shuji_commentback` */

insert  into `shuji_commentback`(`id`,`shuji_id`,`yonghu_id`,`shuji_commentback_text`,`insert_time`,`reply_text`,`update_time`,`create_time`) values (1,1,2,'评价内容1','2023-04-10 15:17:49','回复信息1','2023-04-10 15:17:49','2023-04-10 15:17:49'),(2,2,3,'评价内容2','2023-04-10 15:17:49','回复信息2','2023-04-10 15:17:49','2023-04-10 15:17:49'),(3,3,1,'评价内容3','2023-04-10 15:17:49','回复信息3','2023-04-10 15:17:49','2023-04-10 15:17:49'),(4,4,3,'评价内容4','2023-04-10 15:17:49','回复信息4','2023-04-10 15:17:49','2023-04-10 15:17:49'),(5,5,3,'评价内容5','2023-04-10 15:17:49','回复信息5','2023-04-10 15:17:49','2023-04-10 15:17:49'),(6,6,3,'评价内容6','2023-04-10 15:17:49','回复信息6','2023-04-10 15:17:49','2023-04-10 15:17:49'),(7,7,2,'评价内容7','2023-04-10 15:17:49','回复信息7','2023-04-10 15:17:49','2023-04-10 15:17:49'),(8,8,3,'评价内容8','2023-04-10 15:17:49','回复信息8','2023-04-10 15:17:49','2023-04-10 15:17:49'),(9,9,2,'评价内容9','2023-04-10 15:17:49','回复信息9','2023-04-10 15:17:49','2023-04-10 15:17:49'),(10,10,1,'评价内容10','2023-04-10 15:17:49','回复信息10','2023-04-10 15:17:49','2023-04-10 15:17:49'),(11,11,1,'评价内容11','2023-04-10 15:17:49','回复信息11','2023-04-10 15:17:49','2023-04-10 15:17:49'),(12,12,3,'评价内容12','2023-04-10 15:17:49','回复信息12','2023-04-10 15:17:49','2023-04-10 15:17:49'),(13,13,2,'评价内容13','2023-04-10 15:17:49','回复信息13','2023-04-10 15:17:49','2023-04-10 15:17:49'),(14,14,1,'评价内容14','2023-04-10 15:17:49','回复信息14','2023-04-10 15:17:49','2023-04-10 15:17:49'),(15,12,1,'登录后才可以进入数据详情页进行收藏评论借阅等操作','2023-04-10 15:55:00','回复1111111111111111111111111111111111111','2023-04-10 15:56:38','2023-04-10 15:55:00');

/*Table structure for table `shuji_yuyue` */

DROP TABLE IF EXISTS `shuji_yuyue`;

CREATE TABLE `shuji_yuyue` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
  `shuji_id` int(11) DEFAULT NULL COMMENT '书籍',
  `yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
  `shuji_yuyue_time` timestamp NULL DEFAULT NULL COMMENT '借阅时间',
  `shuji_yuyue_num` int(11) DEFAULT NULL COMMENT '借阅天数',
  `shuji_yuyue_types` int(11) DEFAULT NULL COMMENT '借阅状态 Search111',
  `shuji_yuyue_delete` int(11) DEFAULT NULL COMMENT '逻辑删除',
  `insert_time` timestamp NULL DEFAULT NULL COMMENT '添加时间',
  `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间  show3 listShow',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8 COMMENT='书籍借阅';

/*Data for the table `shuji_yuyue` */

insert  into `shuji_yuyue`(`id`,`shuji_id`,`yonghu_id`,`shuji_yuyue_time`,`shuji_yuyue_num`,`shuji_yuyue_types`,`shuji_yuyue_delete`,`insert_time`,`create_time`) values (1,1,3,'2023-04-10 15:17:49',394,105,1,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(2,2,3,'2023-04-10 15:17:49',349,104,1,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(3,3,2,'2023-04-10 15:17:49',296,103,1,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(4,4,1,'2023-04-10 15:17:49',201,104,1,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(5,5,2,'2023-04-10 15:17:49',274,105,1,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(6,6,2,'2023-04-10 15:17:49',36,102,1,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(7,7,2,'2023-04-10 15:17:49',369,103,1,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(8,8,3,'2023-04-10 15:17:49',242,102,1,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(9,9,1,'2023-04-10 15:17:49',35,102,1,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(10,10,2,'2023-04-10 15:17:49',364,104,1,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(11,11,3,'2023-04-10 15:17:49',74,102,1,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(12,12,1,'2023-04-10 15:17:49',381,105,1,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(13,13,1,'2023-04-10 15:17:49',6,105,1,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(14,14,2,'2023-04-10 15:17:49',203,103,1,'2023-04-10 15:17:49','2023-04-10 15:17:49'),(18,7,1,'2023-04-10 15:53:36',3,103,1,'2023-04-10 15:53:42','2023-04-10 15:53:42');

/*Table structure for table `token` */

DROP TABLE IF EXISTS `token`;

CREATE TABLE `token` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `userid` bigint(20) NOT NULL COMMENT '用户id',
  `username` varchar(100) NOT NULL COMMENT '用户名',
  `tablename` varchar(100) DEFAULT NULL COMMENT '表名',
  `role` varchar(100) DEFAULT NULL COMMENT '角色',
  `token` varchar(200) NOT NULL COMMENT '密码',
  `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '新增时间',
  `expiratedtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '过期时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COMMENT='token表';

/*Data for the table `token` */

insert  into `token`(`id`,`userid`,`username`,`tablename`,`role`,`token`,`addtime`,`expiratedtime`) values (7,1,'a1','yonghu','用户','08y40onpde488bud1rwnvpx9a8ozknmi','2023-04-10 15:23:55','2023-04-10 16:53:37'),(8,1,'admin','users','管理员','s6a1s8w44knjehzej4918osfxsc4xls2','2023-04-10 15:34:46','2023-04-10 16:59:19');

/*Table structure for table `users` */

DROP TABLE IF EXISTS `users`;

CREATE TABLE `users` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `username` varchar(100) NOT NULL COMMENT '用户名',
  `password` varchar(100) NOT NULL COMMENT '密码',
  `role` varchar(100) DEFAULT '管理员' COMMENT '角色',
  `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '新增时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='管理员';

/*Data for the table `users` */

insert  into `users`(`id`,`username`,`password`,`role`,`addtime`) values (1,'admin','admin','管理员','2023-03-14 16:36:44');

/*Table structure for table `yonghu` */

DROP TABLE IF EXISTS `yonghu`;

CREATE TABLE `yonghu` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `username` varchar(200) DEFAULT NULL COMMENT '账户',
  `password` varchar(200) DEFAULT NULL COMMENT '密码',
  `yonghu_name` varchar(200) DEFAULT NULL COMMENT '用户姓名 Search111 ',
  `yonghu_photo` varchar(255) DEFAULT NULL COMMENT '头像',
  `yonghu_phone` varchar(200) DEFAULT NULL COMMENT '用户手机号',
  `yonghu_id_number` varchar(200) DEFAULT NULL COMMENT '用户身份证号 ',
  `yonghu_email` varchar(200) DEFAULT NULL COMMENT '邮箱',
  `sex_types` int(11) DEFAULT NULL COMMENT '性别 Search111 ',
  `yonghu_delete` int(11) DEFAULT '1' COMMENT '假删',
  `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='用户';

/*Data for the table `yonghu` */

insert  into `yonghu`(`id`,`username`,`password`,`yonghu_name`,`yonghu_photo`,`yonghu_phone`,`yonghu_id_number`,`yonghu_email`,`sex_types`,`yonghu_delete`,`create_time`) values (1,'a1','123456','用户姓名1','upload/yonghu1.jpg','17703786901','410224199010102001','1@qq.com',1,1,'2023-04-10 15:17:49'),(2,'a2','123456','用户姓名2','upload/yonghu2.jpg','17703786902','410224199010102002','2@qq.com',1,1,'2023-04-10 15:17:49'),(3,'a3','123456','用户姓名3','upload/yonghu3.jpg','17703786903','410224199010102003','3@qq.com',2,1,'2023-04-10 15:17:49');

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

5、关键代码

5.1 书籍出入库Controller模块 

/**
 * 出入库
 * 后端接口
 * @author 学长编程
 * @email
 * WeChat jsjbysj88
*/
@RestController
@Controller
@RequestMapping("/shujiChuruInout")
public class ShujiChuruInoutController {
    private static final Logger logger = LoggerFactory.getLogger(ShujiChuruInoutController.class);

    private static final String TABLE_NAME = "shujiChuruInout";

    @Autowired
    private ShujiChuruInoutService shujiChuruInoutService;

    @Autowired
    private TokenService tokenService;

    @Autowired
    private DictionaryService dictionaryService;//字典
    @Autowired
    private FajinService fajinService;//罚金信息
    @Autowired
    private ForumService forumService;//论坛
    @Autowired
    private NewsService newsService;//公告信息
    @Autowired
    private PandianService pandianService;//每日盘点
    @Autowired
    private ShujiService shujiService;//书籍
    @Autowired
    private ShujiChuruInoutListService shujiChuruInoutListService;//出入库详情
    @Autowired
    private ShujiCollectionService shujiCollectionService;//书籍收藏
    @Autowired
    private ShujiCommentbackService shujiCommentbackService;//书籍评价
    @Autowired
    private ShujiYuyueService shujiYuyueService;//书籍借阅
    @Autowired
    private YonghuService yonghuService;//用户
    @Autowired
    private UsersService usersService;//管理员

    /**
    * 后端列表
    */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
        logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(false)
            return R.error(511,"永不会进入");
        else if("用户".equals(role))
            params.put("yonghuId",request.getSession().getAttribute("userId"));
        CommonUtil.checkMap(params);
        PageUtils page = shujiChuruInoutService.queryPage(params);

        //字典表数据转换
        List<ShujiChuruInoutView> list =(List<ShujiChuruInoutView>)page.getList();
        for(ShujiChuruInoutView c:list){
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(c, request);
        }
        return R.ok().put("data", page);
    }

    /**
    * 后端详情
    */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id, HttpServletRequest request){
        logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        ShujiChuruInoutEntity shujiChuruInout = shujiChuruInoutService.selectById(id);
        if(shujiChuruInout !=null){
            //entity转view
            ShujiChuruInoutView view = new ShujiChuruInoutView();
            BeanUtils.copyProperties( shujiChuruInout , view );//把实体数据重构到view中
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(view, request);
            return R.ok().put("data", view);
        }else {
            return R.error(511,"查不到数据");
        }

    }

    /**
    * 后端保存
    */
    @RequestMapping("/save")
    public R save(@RequestBody ShujiChuruInoutEntity shujiChuruInout, HttpServletRequest request){
        logger.debug("save方法:,,Controller:{},,shujiChuruInout:{}",this.getClass().getName(),shujiChuruInout.toString());

        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(false)
            return R.error(511,"永远不会进入");

        Wrapper<ShujiChuruInoutEntity> queryWrapper = new EntityWrapper<ShujiChuruInoutEntity>()
            .eq("shuji_churu_inout_name", shujiChuruInout.getShujiChuruInoutName())
            .eq("shuji_churu_inout_types", shujiChuruInout.getShujiChuruInoutTypes())
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        ShujiChuruInoutEntity shujiChuruInoutEntity = shujiChuruInoutService.selectOne(queryWrapper);
        if(shujiChuruInoutEntity==null){
            shujiChuruInout.setInsertTime(new Date());
            shujiChuruInout.setCreateTime(new Date());
            shujiChuruInoutService.insert(shujiChuruInout);
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

    /**
    * 后端修改
    */
    @RequestMapping("/update")
    public R update(@RequestBody ShujiChuruInoutEntity shujiChuruInout, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {
        logger.debug("update方法:,,Controller:{},,shujiChuruInout:{}",this.getClass().getName(),shujiChuruInout.toString());
        ShujiChuruInoutEntity oldShujiChuruInoutEntity = shujiChuruInoutService.selectById(shujiChuruInout.getId());//查询原先数据

        String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(false)
//            return R.error(511,"永远不会进入");

            shujiChuruInoutService.updateById(shujiChuruInout);//根据id更新
            return R.ok();
    }

    /**
    * 出库
    */
    @RequestMapping("/outShujiChuruInoutList")
    public R outShujiChuruInoutList(@RequestBody  Map<String, Object> params,HttpServletRequest request){
        logger.debug("outShujiChuruInoutList方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));

        String role = String.valueOf(request.getSession().getAttribute("role"));

        //取出入库名称并判断是否存在
        String shujiChuruInoutName = String.valueOf(params.get("shujiChuruInoutName"));
        Wrapper<ShujiChuruInoutEntity> queryWrapper = new EntityWrapper<ShujiChuruInoutEntity>()
            .eq("shuji_churu_inout_name", shujiChuruInoutName)
            ;
        ShujiChuruInoutEntity shujiChuruInoutSelectOne = shujiChuruInoutService.selectOne(queryWrapper);
        if(shujiChuruInoutSelectOne != null)
            return R.error(511,"出入库名称已被使用");

        Map<String, Integer> map = (Map<String, Integer>) params.get("map");
        if(map == null || map.size() == 0)
            return R.error(511,"列表内容不能为空");


        Set<String> ids = map.keySet();

        List<ShujiEntity> shujiList = shujiService.selectBatchIds(ids);
        if(shujiList == null || shujiList.size() == 0){
            return R.error(511,"查数据库查不到数据");
        }else{
            for(ShujiEntity w:shujiList){
                Integer value = w.getShujiKucunNumber()-map.get(String.valueOf(w.getId()));
                if(value <0){
                    return R.error(511,"出库数量大于库存数量");
                }
                w.setShujiKucunNumber(value);
            }
        }

        //当前表
        ShujiChuruInoutEntity shujiChuruInoutEntity = new ShujiChuruInoutEntity<>();
            shujiChuruInoutEntity.setShujiChuruInoutUuidNumber(String.valueOf(new Date().getTime()));
            shujiChuruInoutEntity.setShujiChuruInoutName(shujiChuruInoutName);
            shujiChuruInoutEntity.setShujiChuruInoutTypes(1);
            shujiChuruInoutEntity.setShujiChuruInoutContent("");
            shujiChuruInoutEntity.setInsertTime(new Date());
            shujiChuruInoutEntity.setCreateTime(new Date());

        boolean insertShujiChuruInout = shujiChuruInoutService.insert(shujiChuruInoutEntity);
        //list表
        ArrayList<ShujiChuruInoutListEntity> shujiChuruInoutLists = new ArrayList<>();
        if(insertShujiChuruInout){
            for(String id:ids){
                ShujiChuruInoutListEntity shujiChuruInoutListEntity = new ShujiChuruInoutListEntity();
                    shujiChuruInoutListEntity.setShujiChuruInoutId(shujiChuruInoutEntity.getId());
                    shujiChuruInoutListEntity.setShujiId(Integer.valueOf(id));
                    shujiChuruInoutListEntity.setShujiChuruInoutListNumber(map.get(id));
                    shujiChuruInoutListEntity.setInsertTime(new Date());
                    shujiChuruInoutListEntity.setCreateTime(new Date());
                shujiChuruInoutLists.add(shujiChuruInoutListEntity);
                shujiService.updateBatchById(shujiList);
            }
            shujiChuruInoutListService.insertBatch(shujiChuruInoutLists);
        }

        return R.ok();
    }

    /**
    *入库
    */
    @RequestMapping("/inShujiChuruInoutList")
    public R inShujiChuruInoutList(@RequestBody  Map<String, Object> params,HttpServletRequest request){
        logger.debug("inShujiChuruInoutList方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
        //params:{"map":{"1":2,"2":3},"wuziOutinName":"订单1"}

        String role = String.valueOf(request.getSession().getAttribute("role"));

        //取当前表名称并判断
        String shujiChuruInoutName = String.valueOf(params.get("shujiChuruInoutName"));
        Wrapper<ShujiChuruInoutEntity> queryWrapper = new EntityWrapper<ShujiChuruInoutEntity>()
            .eq("shuji_churu_inout_name", shujiChuruInoutName)
            ;
        ShujiChuruInoutEntity shujiChuruInoutSelectOne = shujiChuruInoutService.selectOne(queryWrapper);
        if(shujiChuruInoutSelectOne != null)
            return R.error(511,"出入库名称已被使用");


        Map<String, Integer> map = (Map<String, Integer>) params.get("map");
        if(map == null || map.size() == 0)
            return R.error(511,"列表内容不能为空");

        Set<String> ids = map.keySet();

        List<ShujiEntity> shujiList = shujiService.selectBatchIds(ids);
        if(shujiList == null || shujiList.size() == 0){
            return R.error(511,"查数据库查不到数据");
        }else{
            for(ShujiEntity w:shujiList){
                w.setShujiKucunNumber(w.getShujiKucunNumber()+map.get(String.valueOf(w.getId())));
            }
        }

        //当前表
        ShujiChuruInoutEntity shujiChuruInoutEntity = new ShujiChuruInoutEntity<>();
            shujiChuruInoutEntity.setShujiChuruInoutUuidNumber(String.valueOf(new Date().getTime()));
            shujiChuruInoutEntity.setShujiChuruInoutName(shujiChuruInoutName);
            shujiChuruInoutEntity.setShujiChuruInoutTypes(2);
            shujiChuruInoutEntity.setShujiChuruInoutContent("");
            shujiChuruInoutEntity.setInsertTime(new Date());
            shujiChuruInoutEntity.setCreateTime(new Date());


        boolean insertShujiChuruInout = shujiChuruInoutService.insert(shujiChuruInoutEntity);
        //list表
        ArrayList<ShujiChuruInoutListEntity> shujiChuruInoutLists = new ArrayList<>();
        if(insertShujiChuruInout){
            for(String id:ids){
                ShujiChuruInoutListEntity shujiChuruInoutListEntity = new ShujiChuruInoutListEntity();
                shujiChuruInoutListEntity.setShujiChuruInoutId(shujiChuruInoutEntity.getId());
                shujiChuruInoutListEntity.setShujiId(Integer.valueOf(id));
                shujiChuruInoutListEntity.setShujiChuruInoutListNumber(map.get(id));
                shujiChuruInoutListEntity.setInsertTime(new Date());
                shujiChuruInoutListEntity.setCreateTime(new Date());
                shujiChuruInoutLists.add(shujiChuruInoutListEntity);
                shujiService.updateBatchById(shujiList);
            }
            shujiChuruInoutListService.insertBatch(shujiChuruInoutLists);
        }

        return R.ok();
    }
    /**
    * 删除
    */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids, HttpServletRequest request){
        logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
        List<ShujiChuruInoutEntity> oldShujiChuruInoutList =shujiChuruInoutService.selectBatchIds(Arrays.asList(ids));//要删除的数据
        shujiChuruInoutService.deleteBatchIds(Arrays.asList(ids));
        shujiChuruInoutListService.delete(new EntityWrapper<ShujiChuruInoutListEntity>().in("shuji_churu_inout_id",ids));

        return R.ok();
    }

    /**
     * 批量上传
     */
    @RequestMapping("/batchInsert")
    public R save( String fileName, HttpServletRequest request){
        logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
        Integer yonghuId = Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")));
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        //.eq("time", new SimpleDateFormat("yyyy-MM-dd").format(new Date()))
        try {
            List<ShujiChuruInoutEntity> shujiChuruInoutList = new ArrayList<>();//上传的东西
            Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段
            Date date = new Date();
            int lastIndexOf = fileName.lastIndexOf(".");
            if(lastIndexOf == -1){
                return R.error(511,"该文件没有后缀");
            }else{
                String suffix = fileName.substring(lastIndexOf);
                if(!".xls".equals(suffix)){
                    return R.error(511,"只支持后缀为xls的excel文件");
                }else{
                    URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径
                    File file = new File(resource.getFile());
                    if(!file.exists()){
                        return R.error(511,"找不到上传文件,请联系管理员");
                    }else{
                        List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件
                        dataList.remove(0);//删除第一行,因为第一行是提示
                        for(List<String> data:dataList){
                            //循环
                            ShujiChuruInoutEntity shujiChuruInoutEntity = new ShujiChuruInoutEntity();
//                            shujiChuruInoutEntity.setShujiChuruInoutUuidNumber(data.get(0));                    //出入库流水号 要改的
//                            shujiChuruInoutEntity.setShujiChuruInoutName(data.get(0));                    //出入库名称 要改的
//                            shujiChuruInoutEntity.setShujiChuruInoutTypes(Integer.valueOf(data.get(0)));   //出入库类型 要改的
//                            shujiChuruInoutEntity.setShujiChuruInoutContent("");//详情和图片
//                            shujiChuruInoutEntity.setInsertTime(date);//时间
//                            shujiChuruInoutEntity.setCreateTime(date);//时间
                            shujiChuruInoutList.add(shujiChuruInoutEntity);


                            //把要查询是否重复的字段放入map中
                                //出入库流水号
                                if(seachFields.containsKey("shujiChuruInoutUuidNumber")){
                                    List<String> shujiChuruInoutUuidNumber = seachFields.get("shujiChuruInoutUuidNumber");
                                    shujiChuruInoutUuidNumber.add(data.get(0));//要改的
                                }else{
                                    List<String> shujiChuruInoutUuidNumber = new ArrayList<>();
                                    shujiChuruInoutUuidNumber.add(data.get(0));//要改的
                                    seachFields.put("shujiChuruInoutUuidNumber",shujiChuruInoutUuidNumber);
                                }
                        }

                        //查询是否重复
                         //出入库流水号
                        List<ShujiChuruInoutEntity> shujiChuruInoutEntities_shujiChuruInoutUuidNumber = shujiChuruInoutService.selectList(new EntityWrapper<ShujiChuruInoutEntity>().in("shuji_churu_inout_uuid_number", seachFields.get("shujiChuruInoutUuidNumber")));
                        if(shujiChuruInoutEntities_shujiChuruInoutUuidNumber.size() >0 ){
                            ArrayList<String> repeatFields = new ArrayList<>();
                            for(ShujiChuruInoutEntity s:shujiChuruInoutEntities_shujiChuruInoutUuidNumber){
                                repeatFields.add(s.getShujiChuruInoutUuidNumber());
                            }
                            return R.error(511,"数据库的该表中的 [出入库流水号] 字段已经存在 存在数据为:"+repeatFields.toString());
                        }
                        shujiChuruInoutService.insertBatch(shujiChuruInoutList);
                        return R.ok();
                    }
                }
            }
        }catch (Exception e){
            e.printStackTrace();
            return R.error(511,"批量插入数据异常,请联系管理员");
        }
    }

    /**
    * 前端列表
    */
    @IgnoreAuth
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){
        logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));

        CommonUtil.checkMap(params);
        PageUtils page = shujiChuruInoutService.queryPage(params);

        //字典表数据转换
        List<ShujiChuruInoutView> list =(List<ShujiChuruInoutView>)page.getList();
        for(ShujiChuruInoutView c:list)
            dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段

        return R.ok().put("data", page);
    }

    /**
    * 前端详情
    */
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") Long id, HttpServletRequest request){
        logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        ShujiChuruInoutEntity shujiChuruInout = shujiChuruInoutService.selectById(id);
            if(shujiChuruInout !=null){


                //entity转view
                ShujiChuruInoutView view = new ShujiChuruInoutView();
                BeanUtils.copyProperties( shujiChuruInout , view );//把实体数据重构到view中

                //修改对应字典表字段
                dictionaryService.dictionaryConvert(view, request);
                return R.ok().put("data", view);
            }else {
                return R.error(511,"查不到数据");
            }
    }

    /**
    * 前端保存
    */
    @RequestMapping("/add")
    public R add(@RequestBody ShujiChuruInoutEntity shujiChuruInout, HttpServletRequest request){
        logger.debug("add方法:,,Controller:{},,shujiChuruInout:{}",this.getClass().getName(),shujiChuruInout.toString());
        Wrapper<ShujiChuruInoutEntity> queryWrapper = new EntityWrapper<ShujiChuruInoutEntity>()
            .eq("shuji_churu_inout_uuid_number", shujiChuruInout.getShujiChuruInoutUuidNumber())
            .eq("shuji_churu_inout_name", shujiChuruInout.getShujiChuruInoutName())
            .eq("shuji_churu_inout_types", shujiChuruInout.getShujiChuruInoutTypes())
//            .notIn("shuji_churu_inout_types", new Integer[]{102})
            ;
        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        ShujiChuruInoutEntity shujiChuruInoutEntity = shujiChuruInoutService.selectOne(queryWrapper);
        if(shujiChuruInoutEntity==null){
            shujiChuruInout.setInsertTime(new Date());
            shujiChuruInout.setCreateTime(new Date());
        shujiChuruInoutService.insert(shujiChuruInout);

            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

}

5.2 书籍出入库Service模块 

package com.service;

import com.baomidou.mybatisplus.service.IService;
import com.utils.PageUtils;
import com.entity.ShujiChuruInoutListEntity;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.lang.Nullable;
import java.util.List;

/**
 * 出入库详情 服务类
 */
public interface ShujiChuruInoutListService extends IService<ShujiChuruInoutListEntity> {

    /**
    * @param params 查询参数
    * @return 带分页的查询出来的数据
    */
     PageUtils queryPage(Map<String, Object> params);

}

5.3 书籍出入库ServiceImpl模块

package com.service.impl;

import com.utils.StringUtil;
import com.service.DictionaryService;
import com.utils.ClazzDiff;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.lang.reflect.Field;
import java.util.*;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;
import com.utils.PageUtils;
import com.utils.Query;
import org.springframework.web.context.ContextLoader;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import com.dao.ShujiChuruInoutListDao;
import com.entity.ShujiChuruInoutListEntity;
import com.service.ShujiChuruInoutListService;
import com.entity.view.ShujiChuruInoutListView;

/**
 * 出入库详情 服务实现类
 */
@Service("shujiChuruInoutListService")
@Transactional
public class ShujiChuruInoutListServiceImpl extends ServiceImpl<ShujiChuruInoutListDao, ShujiChuruInoutListEntity> implements ShujiChuruInoutListService {

    @Override
    public PageUtils queryPage(Map<String,Object> params) {
        Page<ShujiChuruInoutListView> page =new Query<ShujiChuruInoutListView>(params).getPage();
        page.setRecords(baseMapper.selectListView(page,params));
        return new PageUtils(page);
    }

}

5.4  书籍出入库Dao模块

package com.dao;

import com.entity.ShujiChuruInoutEntity;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.plugins.pagination.Pagination;

import org.apache.ibatis.annotations.Param;
import com.entity.view.ShujiChuruInoutView;

/**
 * 出入库 Dao 接口
 *
 * @author 
 */
public interface ShujiChuruInoutDao extends BaseMapper<ShujiChuruInoutEntity> {

   List<ShujiChuruInoutView> selectListView(Pagination page,@Param("params")Map<String,Object> params);

}

6、论文目录结构

7、源码获取

感谢大家的阅读,如有不懂的问题可以评论区交流或私聊!

喜欢文章可以点赞、收藏、关注、评论

获取源码请私信

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

数据结构期末复习(1)数据结构和算法 线性表

数据结构期末总复习&#xff08;gaois课堂版&#xff09; 数据结构的概念 数据结构是计算机科学中的一个重要概念&#xff0c;它指的是组织和存储数据的方式。数据结构可以帮助我们高效地操作和管理数据&#xff0c;使得计算机程序能够更加有效地执行各种任务。 数据结构有很…

关于链表的一些问题

求链表的中间节点 可以定义两个指针&#xff0c;一个一次走两步一个一次走一步&#xff0c;当走的快的走到NULL时&#xff0c;走的慢的就是链表的中间节点。&#xff08;此法求出的偶数个节点的链表的中间节点是它中间的第二个&#xff09; 求倒数第K个节点 也可以定义两个指…

【HarmonyOS】ArkTS语言介绍与组件方式运用

从今天开始&#xff0c;博主将开设一门新的专栏用来讲解市面上比较热门的技术 “鸿蒙开发”&#xff0c;对于刚接触这项技术的小伙伴在学习鸿蒙开发之前&#xff0c;有必要先了解一下鸿蒙&#xff0c;从你的角度来讲&#xff0c;你认为什么是鸿蒙呢&#xff1f;它出现的意义又是…

【网络安全 | MD5截断比较】PHP、Python脚本利用

前言 在解题中&#xff0c;当遇到类似 substr(md5(a),-6,6) 7788这样的MD5截断比较的题目时&#xff0c;只有求出a的值才能进行接下来的操作。 一个一个去猜是不可能的&#xff0c;通常使用脚本解决&#xff0c;文末给出实战案例。 PHP循环脚本 <?phpfor($i1;$i<9…

小信跳房子的题解

原题描述&#xff1a; 时间&#xff1a;1s 空间&#xff1a;256M 题目描述&#xff1a; 小信在玩跳房子游戏&#xff0c;已知跳房子游戏的图表现为一颗完美的具有个节点的二叉树。从根节点依次编号为。节点的左子节点编号为&#xff0c;右子节点编号为。 小信从从节点出发&…

python观察图像的直流分量——冈萨雷斯数字图像处理

原理 在数字图像处理中&#xff0c;图像的直流分量&#xff08;DC分量&#xff09;是指图像中的平均亮度水平。这个概念源自于傅里叶变换&#xff0c;其中信号可以分解为多个频率成分。在这个上下文中&#xff0c;直流分量对应于频率为零的成分&#xff0c;即信号的平均值。 在…

【实用工具】vim常用命令

快速移动(上下左右箭头可替代) 左移 h 右移 l 下移 j 上移 K在本行操作 0 移动到本行行首 ^ 移动到本行的第一个不是 blank 字符 $ 移动到本行行尾 w 光标移动到下一个单词的开头 e 光标移动到下一个单词的结尾跨行移动光标 nG 光标定位到第n行的行首 gg 光标定位到第一行的…

基于JAVA的食品生产管理系统 开源项目

目录 一、摘要1.1 项目介绍1.2 项目录屏 二、功能模块2.1 加工厂管理模块2.2 客户管理模块2.3 食品管理模块2.4 生产销售订单管理模块2.5 系统管理模块2.6 其他管理模块 三、系统展示四、核心代码4.1 查询食品4.2 查询加工厂4.3 新增生产订单4.4 新增销售订单4.5 查询客户 五、…

看懂基本的电路原理图(入门)

文章目录 前言一、二极管二、电容三、接地一般符号四、晶体振荡器五、各种符号的含义六、查看原理图的顺序总结 前言 电子入门&#xff0c;怎么看原理图&#xff0c;各个图标都代表什么含义&#xff0c;今天好好来汇总一下。 就比如这个电路原理图来说&#xff0c;各个符号都…

我的2023年度总结(一)

在本文开始之前&#xff0c;先对我2023年的所为进行一些道歉&#xff1a; 部分工作中的客户/合作伙伴&#xff0c;在2023年我可能时长怠慢了您的消息。但我真不是故意的(有时可能在忙其他事情)。2024年&#xff0c;如有任何问题请尽可能抛过来吧。部分粉丝朋友&#xff0c;甚至…

2023-12-22 LeetCode每日一题(得到山形数组的最少删除次数)

2023-12-22每日一题 一、题目编号 1671. 得到山形数组的最少删除次数二、题目链接 点击跳转到题目位置 三、题目描述 我们定义 arr 是 山形数组 当且仅当它满足&#xff1a; arr.length > 3存在某个下标 i &#xff08;从 0 开始&#xff09; 满足 0 < i < arr.…

精品Nodejs实现的在线菜谱食谱美食学习系统的设计与实现

《[含文档PPT源码等]精品Nodejs实现的在线菜谱学习系统的设计与实现[包运行成功]》该项目含有源码、文档、PPT、配套开发软件、软件安装教程、项目发布教程、包运行成功&#xff01; 软件开发环境及开发工具&#xff1a; 操作系统&#xff1a;Windows 10、Windows 7、Windows…

【数据结构——图】图的遍历(头歌习题)【合集】

目录 第1关&#xff1a;邻接矩阵存储图的深度优先遍历任务描述相关知识邻接矩阵存储图图的遍历DFS伪代码——邻接矩阵存储实现 完整代码 第2关&#xff1a;邻接表存储图的广度优先遍历任务描述相关知识邻接表存储图图的遍历广度优先遍历过程&#xff1a;BFS伪代码——邻接表实现…

安装Hadoop:Hadoop的单机模式、伪分布式模式——备赛笔记——2024全国职业院校技能大赛“大数据应用开发”赛项

前言 Hadoop包括三种安装模式&#xff1a; 单机模式&#xff1a;只在一台机器上运行&#xff0c;存储是采用本地文件系统&#xff0c;没有采用分布式文件系统HDFS&#xff1b;伪分布式模式&#xff1a;存储采用分布式文件系统HDFS&#xff0c;但是&#xff0c;HDFS的名称节点…

2024 GMF|The Sandbox 为创作者赋能的新时代

以新的 GMF 模型和专门的参与池奖励来开启 2024 年吧。 11 月 3 日&#xff0c;我们在香港全球创作者日上宣布&#xff0c;The Sandbox 已为所有创作者分配了100,000,000 SAND&#xff0c;将通过 GMF 进行分发。作为首次启动的建设者挑战&#xff0c;我们准备了专门的 SAND 参与…

day9--java高级编程:多线程

1 Day16–多线程01 1.1 程序概念 程序(program)&#xff1a;是为完成特定任务、用某种语言编写的一组指令的集合。即指一段静态的代码&#xff0c;静态对象。 1.2 进程 1.2.1 概念 进程(process)&#xff1a;是程序的一次执行过程&#xff0c;或是正在运行的一个程序。是一…

2024年【安全员-A证】考试内容及安全员-A证最新解析

题库来源&#xff1a;安全生产模拟考试一点通公众号小程序 安全员-A证考试内容参考答案及安全员-A证考试试题解析是安全生产模拟考试一点通题库老师及安全员-A证操作证已考过的学员汇总&#xff0c;相对有效帮助安全员-A证最新解析学员顺利通过考试。 1、【多选题】下列关于门…

龙年红包封面来了,可以领取了。

今天是周六&#xff0c;后天就是元旦了&#xff0c;过完元旦就快要过年了&#xff0c;大家又要开始发红包和收红包了。下面分享一个腾讯的龙年红包封面给大家&#xff0c;可以免费领取&#xff0c;大家可以看下我领取的发红包的效果图&#xff0c;如下所示。 下面这个是红包打开…

Unity之组件的生命周期

PS&#xff1a;第二天&#xff0c;依旧在摸鱼学unity 一、组件的概念 我本身是由Web后端转到了游戏后端&#xff0c;最近因为工作原因在学ET框架。学到了 ECS 编程模式开发&#xff08;E —— Entity&#xff0c;C —— Component &#xff0c; S —— System&#xff09;实体、…

linux go环境安装 swag

下载依赖包 go get -u github.com/swaggo/swag编译 移动到下载的go-swagger包目录,一般在$GOPATH/pkg/mod下 查看 GOPATH echo $GOPATHcd /root/GolangProjects/pkg/mod/github.com/swaggo/swagv1.16.2go install ./cmd/swag/不出意外&#xff0c;$GOPATH/bin下 已经有了sw…