博主介绍:✌从事软件开发10年之余,专注于Java技术领域、Python人工智能及数据挖掘、小程序项目开发和Android项目开发等。CSDN、掘金、华为云、InfoQ、阿里云等平台优质作者✌
🍅文末获取源码联系🍅
👇🏻 精彩专栏推荐订阅👇🏻 不然下次找不到哟
目录
[1.1 项目介绍](#1.1 项目介绍)
[1.2 开发技术](#1.2 开发技术)
[5.1 物资管理Controller模块](#5.1 物资管理Controller模块)
[5.2 物资管理Service模块](#5.2 物资管理Service模块)
[5.3 物资管理ServiceImpl模块](#5.3 物资管理ServiceImpl模块)
[5.4 物资管理Dao模块](#5.4 物资管理Dao模块)
1、项目介绍及开发技术
1.1 项目介绍
如今社会上各行各业,都喜欢用自己行业的专属软件工作,互联网发展到这个时候,人们已经发现离不开了互联网。新技术的产生,往往能解决一些老技术的弊端问题。因为传统物资综合管理系统信息管理难度大,容错率低,管理人员处理数据费工费时,所以专门为解决这个难题开发了一个物资综合管理系统管理系统,可以解决许多问题。物资综合管理系统管理系统可以提高物资综合管理系统信息管理问题的解决效率,优化物资综合管理系统信息处理流程,保证物资综合管理系统信息数据的安全,它是一个非常可靠,非常安全的应用程序。
1.2 开发技术
Java开发语言、SpringBoot、MyBatisPlus、MySQL数据库、Maven、IDEA开发工具、JDK1.8+、Vue、HTML、CSS、JS。
2、系统功能设计结构图
3、功能截图
物资管理:管理员在物资管理界面中可以对界面中显示,可以对物资信息的物资状态进行查看,可以添加新的物资信息等。
物资申报管理: 管理员在物资申报管理界面中查看物资申报种类信息,物资申报描述信息,新增物资申报信息等。
公告管理:管理员在公告管理界面中新增公告,可以删除公告。
公告类型管理: 管理员在公告类型管理界面查看公告的工作状态,可以对公告的数据进行导出,可以添加新公告的信息,可以编辑公告信息,删除公告信息。
4、数据库表结构设计
sql
CREATE DATABASE /*!32312 IF NOT EXISTS*/`wuzizongheguanlixitong` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `wuzizongheguanlixitong`;
/*Table structure for table `caozuorizhi` */
DROP TABLE IF EXISTS `caozuorizhi`;
CREATE TABLE `caozuorizhi` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
`caozuorizhi_this_biao` varchar(200) DEFAULT NULL COMMENT '操作人所在表 Search111 ',
`caozuorizhi_caozuobiao` varchar(200) DEFAULT NULL COMMENT '操作表 Search111 ',
`caozuorizhi_caozuozhanghu` varchar(200) DEFAULT NULL COMMENT '操作账户 Search111 ',
`caozuorizhi_caozuoleixing` varchar(200) DEFAULT NULL COMMENT '操作类型 Search111 ',
`caozuorizhi_text` mediumtext COMMENT '操作内容 Search111 ',
`insert_time` timestamp NULL DEFAULT NULL COMMENT '操作时间 Search111 ',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4530 DEFAULT CHARSET=utf8 COMMENT='操作日志';
/*Data for the table `caozuorizhi` */
/*Table structure for table `config` */
DROP TABLE IF EXISTS `config`;
CREATE TABLE `config` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`name` varchar(100) NOT NULL COMMENT '配置参数名称',
`value` varchar(100) DEFAULT NULL COMMENT '配置参数值',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='配置文件';
/*Data for the table `config` */
/*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=16 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 (1,'sex_types','性别类型',1,'男',NULL,NULL,'2023-04-10 09:38:14'),(2,'sex_types','性别类型',2,'女',NULL,NULL,'2023-04-10 09:38:14'),(3,'gonggao_types','公告类型',1,'公告类型1',NULL,NULL,'2023-04-10 09:38:14'),(4,'gonggao_types','公告类型',2,'公告类型2',NULL,NULL,'2023-04-10 09:38:14'),(5,'wuzi_types','物资类型',1,'物资类型1',NULL,NULL,'2023-04-10 09:38:14'),(6,'wuzi_types','物资类型',2,'物资类型2',NULL,NULL,'2023-04-10 09:38:14'),(7,'wuzi_types','物资类型',3,'物资类型3',NULL,NULL,'2023-04-10 09:38:14'),(8,'wuzi_types','物资类型',4,'物资类型4',NULL,NULL,'2023-04-10 09:38:14'),(9,'wuzi_churu_inout_types','出入库类型',1,'出库',NULL,NULL,'2023-04-10 09:38:14'),(10,'wuzi_churu_inout_types','出入库类型',2,'入库',NULL,NULL,'2023-04-10 09:38:14'),(11,'wuzi_yuyue_yesno_types','报名状态',1,'待审核',NULL,NULL,'2023-04-10 09:38:14'),(12,'wuzi_yuyue_yesno_types','报名状态',2,'同意',NULL,NULL,'2023-04-10 09:38:14'),(13,'wuzi_yuyue_yesno_types','报名状态',3,'拒绝',NULL,NULL,'2023-04-10 09:38:14'),(14,'yuedu_types','月度用料类型',1,'已使用',NULL,NULL,'2023-04-10 09:38:14'),(15,'yuedu_types','月度用料类型',2,'未使用',NULL,NULL,'2023-04-10 09:38:14');
/*Table structure for table `gonggao` */
DROP TABLE IF EXISTS `gonggao`;
CREATE TABLE `gonggao` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
`gonggao_name` varchar(200) DEFAULT NULL COMMENT '公告名称 Search111 ',
`gonggao_photo` varchar(200) DEFAULT NULL COMMENT '公告图片 ',
`gonggao_types` int(11) NOT NULL COMMENT '公告类型 Search111 ',
`insert_time` timestamp NULL DEFAULT NULL COMMENT '发布时间',
`gonggao_content` longtext 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 `gonggao` */
insert into `gonggao`(`id`,`gonggao_name`,`gonggao_photo`,`gonggao_types`,`insert_time`,`gonggao_content`,`create_time`) values (1,'公告名称1','upload/gonggao1.jpg',2,'2023-04-10 09:38:25','公告详情1','2023-04-10 09:38:25'),(2,'公告名称2','upload/gonggao2.jpg',1,'2023-04-10 09:38:25','公告详情2','2023-04-10 09:38:25'),(3,'公告名称3','upload/gonggao3.jpg',2,'2023-04-10 09:38:25','公告详情3','2023-04-10 09:38:25'),(4,'公告名称4','upload/gonggao4.jpg',2,'2023-04-10 09:38:25','公告详情4','2023-04-10 09:38:25'),(5,'公告名称5','upload/gonggao5.jpg',2,'2023-04-10 09:38:25','公告详情5','2023-04-10 09:38:25'),(6,'公告名称6','upload/gonggao6.jpg',1,'2023-04-10 09:38:25','公告详情6','2023-04-10 09:38:25'),(7,'公告名称7','upload/gonggao7.jpg',1,'2023-04-10 09:38:25','公告详情7','2023-04-10 09:38:25'),(8,'公告名称8','upload/gonggao8.jpg',1,'2023-04-10 09:38:25','公告详情8','2023-04-10 09:38:25'),(9,'公告名称9','upload/gonggao9.jpg',2,'2023-04-10 09:38:25','公告详情9','2023-04-10 09:38:25'),(10,'公告名称10','upload/gonggao10.jpg',2,'2023-04-10 09:38:25','公告详情10','2023-04-10 09:38:25'),(11,'公告名称11','upload/gonggao11.jpg',1,'2023-04-10 09:38:25','公告详情11','2023-04-10 09:38:25'),(12,'公告名称12','upload/gonggao12.jpg',2,'2023-04-10 09:38:25','公告详情12','2023-04-10 09:38:25'),(13,'公告名称13','upload/gonggao13.jpg',1,'2023-04-10 09:38:25','公告详情13','2023-04-10 09:38:25'),(14,'公告名称14','upload/gonggao14.jpg',2,'2023-04-10 09:38:25','公告详情14','2023-04-10 09:38:25');
/*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=3 DEFAULT CHARSET=utf8 COMMENT='token表';
/*Data for the table `token` */
insert into `token`(`id`,`userid`,`username`,`tablename`,`role`,`token`,`addtime`,`expiratedtime`) values (1,1,'admin','users','管理员','4duqvmxvvw3nikn1xr6ohahnjs512vmm','2023-04-10 09:47:09','2023-04-10 11:30:14'),(2,1,'a1','yonghu','用户','fum7awtiulay4sszkgoqail9d7lyi5bm','2023-04-10 09:47:24','2023-04-10 11:25:34');
/*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-04-10 09:38:14');
/*Table structure for table `wuzi` */
DROP TABLE IF EXISTS `wuzi`;
CREATE TABLE `wuzi` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
`wuzi_name` varchar(200) DEFAULT NULL COMMENT '物资名称 Search111 ',
`wuzi_uuid_number` varchar(200) DEFAULT NULL COMMENT '物资编号',
`wuzi_photo` varchar(200) DEFAULT NULL COMMENT '物资照片',
`wuzi_types` int(11) DEFAULT NULL COMMENT '物资类型 Search111',
`wuzi_kucun_number` int(11) DEFAULT NULL COMMENT '物资库存',
`wuzi_content` longtext COMMENT '物资介绍 ',
`wuzi_delete` int(11) DEFAULT NULL COMMENT '逻辑删除',
`insert_time` timestamp NULL 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 `wuzi` */
insert into `wuzi`(`id`,`wuzi_name`,`wuzi_uuid_number`,`wuzi_photo`,`wuzi_types`,`wuzi_kucun_number`,`wuzi_content`,`wuzi_delete`,`insert_time`,`create_time`) values (1,'物资名称1','1681090705272','upload/wuzi1.jpg',3,101,'物资介绍1',1,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(2,'物资名称2','1681090705328','upload/wuzi2.jpg',4,102,'物资介绍2',1,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(3,'物资名称3','1681090705363','upload/wuzi3.jpg',3,103,'物资介绍3',1,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(4,'物资名称4','1681090705295','upload/wuzi4.jpg',4,104,'物资介绍4',1,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(5,'物资名称5','1681090705284','upload/wuzi5.jpg',2,105,'物资介绍5',1,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(6,'物资名称6','1681090705359','upload/wuzi6.jpg',1,106,'物资介绍6',1,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(7,'物资名称7','1681090705356','upload/wuzi7.jpg',3,107,'物资介绍7',1,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(8,'物资名称8','1681090705323','upload/wuzi8.jpg',1,108,'物资介绍8',1,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(9,'物资名称9','1681090705279','upload/wuzi9.jpg',4,109,'物资介绍9',1,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(10,'物资名称10','1681090705304','upload/wuzi10.jpg',4,1010,'物资介绍10',1,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(11,'物资名称11','1681090705351','upload/wuzi11.jpg',4,1011,'物资介绍11',1,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(12,'物资名称12','1681090705343','upload/wuzi12.jpg',4,1012,'物资介绍12',1,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(13,'物资名称13','1681090705349','upload/wuzi13.jpg',4,1113,'物资介绍13',1,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(14,'物资名称14','1681090705283','upload/wuzi14.jpg',3,964,'物资介绍14',1,'2023-04-10 09:38:25','2023-04-10 09:38:25');
/*Table structure for table `wuzi_churu_inout` */
DROP TABLE IF EXISTS `wuzi_churu_inout`;
CREATE TABLE `wuzi_churu_inout` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`wuzi_churu_inout_uuid_number` varchar(200) DEFAULT NULL COMMENT '出入库流水号',
`wuzi_churu_inout_name` varchar(200) DEFAULT NULL COMMENT '出入库名称 Search111 ',
`wuzi_churu_inout_types` int(11) DEFAULT NULL COMMENT '出入库类型 Search111 ',
`wuzi_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=17 DEFAULT CHARSET=utf8 COMMENT='出入库';
/*Data for the table `wuzi_churu_inout` */
insert into `wuzi_churu_inout`(`id`,`wuzi_churu_inout_uuid_number`,`wuzi_churu_inout_name`,`wuzi_churu_inout_types`,`wuzi_churu_inout_content`,`insert_time`,`create_time`) values (1,'1681090705286','出入库名称1',2,'备注1','2023-04-10 09:38:25','2023-04-10 09:38:25'),(2,'1681090705311','出入库名称2',1,'备注2','2023-04-10 09:38:25','2023-04-10 09:38:25'),(3,'1681090705272','出入库名称3',2,'备注3','2023-04-10 09:38:25','2023-04-10 09:38:25'),(4,'1681090705317','出入库名称4',1,'备注4','2023-04-10 09:38:25','2023-04-10 09:38:25'),(5,'1681090705358','出入库名称5',1,'备注5','2023-04-10 09:38:25','2023-04-10 09:38:25'),(6,'1681090705359','出入库名称6',1,'备注6','2023-04-10 09:38:25','2023-04-10 09:38:25'),(7,'1681090705348','出入库名称7',1,'备注7','2023-04-10 09:38:25','2023-04-10 09:38:25'),(8,'1681090705303','出入库名称8',2,'备注8','2023-04-10 09:38:25','2023-04-10 09:38:25'),(9,'1681090705361','出入库名称9',2,'备注9','2023-04-10 09:38:25','2023-04-10 09:38:25'),(10,'1681090705346','出入库名称10',2,'备注10','2023-04-10 09:38:25','2023-04-10 09:38:25'),(11,'1681090705272','出入库名称11',1,'备注11','2023-04-10 09:38:25','2023-04-10 09:38:25'),(12,'1681090705359','出入库名称12',2,'备注12','2023-04-10 09:38:25','2023-04-10 09:38:25'),(13,'1681090705336','出入库名称13',1,'备注13','2023-04-10 09:38:25','2023-04-10 09:38:25'),(14,'1681090705341','出入库名称14',1,'备注14','2023-04-10 09:38:25','2023-04-10 09:38:25'),(15,'1681093550841','111',2,'','2023-04-10 10:25:51','2023-04-10 10:25:51'),(16,'1681093562375','2222',1,'','2023-04-10 10:26:02','2023-04-10 10:26:02');
/*Table structure for table `wuzi_churu_inout_list` */
DROP TABLE IF EXISTS `wuzi_churu_inout_list`;
CREATE TABLE `wuzi_churu_inout_list` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`wuzi_churu_inout_id` int(11) DEFAULT NULL COMMENT '出入库',
`wuzi_id` int(11) DEFAULT NULL COMMENT '物资',
`wuzi_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=17 DEFAULT CHARSET=utf8 COMMENT='出入库详情';
/*Data for the table `wuzi_churu_inout_list` */
insert into `wuzi_churu_inout_list`(`id`,`wuzi_churu_inout_id`,`wuzi_id`,`wuzi_churu_inout_list_number`,`insert_time`,`create_time`) values (1,1,1,230,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(2,2,2,357,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(3,3,3,495,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(4,4,4,313,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(5,5,5,294,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(6,6,6,192,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(7,7,7,452,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(8,8,8,227,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(9,9,9,243,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(10,10,10,71,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(11,11,11,291,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(12,12,12,12,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(13,13,13,374,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(14,14,14,191,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(15,15,13,100,'2023-04-10 10:25:51','2023-04-10 10:25:51'),(16,16,14,50,'2023-04-10 10:26:02','2023-04-10 10:26:02');
/*Table structure for table `wuzi_yuyue` */
DROP TABLE IF EXISTS `wuzi_yuyue`;
CREATE TABLE `wuzi_yuyue` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`wuzi_yuyue_uuid_number` varchar(200) DEFAULT NULL COMMENT '报名编号 Search111 ',
`wuzi_id` int(11) DEFAULT NULL COMMENT '物资',
`yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
`wuzi_yuyue_text` longtext COMMENT '申报理由',
`wuzi_yuyue_yesno_types` int(11) DEFAULT NULL COMMENT '报名状态 Search111 ',
`wuzi_yuyue_yesno_text` longtext COMMENT '审核回复',
`wuzi_yuyue_shenhe_time` timestamp NULL 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=18 DEFAULT CHARSET=utf8 COMMENT='物资申报';
/*Data for the table `wuzi_yuyue` */
insert into `wuzi_yuyue`(`id`,`wuzi_yuyue_uuid_number`,`wuzi_id`,`yonghu_id`,`wuzi_yuyue_text`,`wuzi_yuyue_yesno_types`,`wuzi_yuyue_yesno_text`,`wuzi_yuyue_shenhe_time`,`insert_time`,`create_time`) values (1,'1681090705289',1,1,'申报理由1',1,NULL,NULL,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(2,'1681090705282',2,2,'申报理由2',1,NULL,NULL,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(3,'1681090705337',3,1,'申报理由3',1,NULL,NULL,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(4,'1681090705358',4,2,'申报理由4',1,NULL,NULL,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(5,'1681090705375',5,3,'申报理由5',1,NULL,NULL,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(6,'1681090705376',6,3,'申报理由6',1,NULL,NULL,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(7,'1681090705281',7,1,'申报理由7',1,NULL,NULL,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(8,'1681090705367',8,3,'申报理由8',1,NULL,NULL,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(9,'1681090705279',9,1,'申报理由9',1,NULL,NULL,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(10,'1681090705345',10,3,'申报理由10',1,NULL,NULL,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(11,'1681090705282',11,3,'申报理由11',1,NULL,NULL,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(12,'1681090705353',12,1,'申报理由12',1,NULL,NULL,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(13,'1681090705343',13,3,'申报理由13',1,NULL,NULL,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(14,'1681090705320',14,2,'申报理由14',1,NULL,NULL,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(15,'1681093380940',1,1,'手打',1,'',NULL,'2023-04-10 10:23:05','2023-04-10 10:23:05'),(16,'1681093441892',14,1,'出库50个',2,'同意','2023-04-10 10:25:13','2023-04-10 10:24:11','2023-04-10 10:24:11'),(17,'1681093455004',13,1,'入库100',2,'同意','2023-04-10 10:25:05','2023-04-10 10:24:22','2023-04-10 10:24:22');
/*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_phone` varchar(200) DEFAULT NULL COMMENT '用户手机号',
`yonghu_id_number` varchar(200) DEFAULT NULL COMMENT '用户身份证号',
`yonghu_photo` varchar(200) DEFAULT NULL COMMENT '用户头像',
`sex_types` int(11) DEFAULT NULL COMMENT '性别',
`yonghu_email` varchar(200) DEFAULT NULL 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_phone`,`yonghu_id_number`,`yonghu_photo`,`sex_types`,`yonghu_email`,`create_time`) values (1,'a1','123456','用户姓名1','17703786901','410224199010102001','upload/yonghu1.jpg',2,'1@qq.com','2023-04-10 09:38:25'),(2,'a2','123456','用户姓名2','17703786902','410224199010102002','upload/yonghu2.jpg',1,'2@qq.com','2023-04-10 09:38:25'),(3,'a3','123456','用户姓名3','17703786903','410224199010102003','upload/yonghu3.jpg',2,'3@qq.com','2023-04-10 09:38:25');
/*Table structure for table `yuedu` */
DROP TABLE IF EXISTS `yuedu`;
CREATE TABLE `yuedu` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
`wuzi_id` int(11) DEFAULT NULL COMMENT '物资',
`yuedu_shuliang` int(11) DEFAULT NULL COMMENT '月度用料数量',
`yuedu_content` longtext COMMENT '月度用料介绍 ',
`yuedu_delete` int(11) DEFAULT NULL COMMENT '逻辑删除',
`yuedu_types` int(11) DEFAULT NULL COMMENT '月度用料类型 Search111 ',
`insert_time` timestamp NULL 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 `yuedu` */
insert into `yuedu`(`id`,`wuzi_id`,`yuedu_shuliang`,`yuedu_content`,`yuedu_delete`,`yuedu_types`,`insert_time`,`create_time`) values (1,1,413,'月度用料介绍1',1,1,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(2,2,30,'月度用料介绍2',1,2,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(3,3,387,'月度用料介绍3',1,2,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(4,4,213,'月度用料介绍4',1,2,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(5,5,354,'月度用料介绍5',1,1,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(6,6,102,'月度用料介绍6',1,2,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(7,7,138,'月度用料介绍7',1,1,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(8,8,254,'月度用料介绍8',1,1,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(9,9,28,'月度用料介绍9',1,2,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(10,10,317,'月度用料介绍10',1,2,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(11,11,345,'月度用料介绍11',1,2,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(12,12,149,'月度用料介绍12',1,2,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(13,13,345,'月度用料介绍13',1,1,'2023-04-10 09:38:25','2023-04-10 09:38:25'),(14,14,161,'月度用料介绍14',1,1,'2023-04-10 09:38:25','2023-04-10 09:38:25');
/*!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模块
java
/**
* 物资
* 后端接口
* @author 学长编程
* @email
* WeChat jsjbysj88
*/
@RestController
@Controller
@RequestMapping("/wuzi")
public class WuziController {
private static final Logger logger = LoggerFactory.getLogger(WuziController.class);
private static final String TABLE_NAME = "wuzi";
@Autowired
private WuziService wuziService;
@Autowired
private TokenService tokenService;
@Autowired
private CaozuorizhiService caozuorizhiService;//操作日志
@Autowired
private DictionaryService dictionaryService;//字典
@Autowired
private GonggaoService gonggaoService;//公告
@Autowired
private WuziChuruInoutService wuziChuruInoutService;//出入库
@Autowired
private WuziChuruInoutListService wuziChuruInoutListService;//出入库详情
@Autowired
private WuziYuyueService wuziYuyueService;//物资申报
@Autowired
private YonghuService yonghuService;//用户
@Autowired
private YueduService yueduService;//月度用料
@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"));
params.put("wuziDeleteStart",1);params.put("wuziDeleteEnd",1);
CommonUtil.checkMap(params);
PageUtils page = wuziService.queryPage(params);
//字典表数据转换
List<WuziView> list =(List<WuziView>)page.getList();
for(WuziView c:list){
//修改对应字典表字段
dictionaryService.dictionaryConvert(c, request);
}
caozuorizhiService.insertCaozuorizhi(String.valueOf(request.getSession().getAttribute("role")),TABLE_NAME,String.valueOf(request.getSession().getAttribute("username")),"列表查询",list.toString());
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);
WuziEntity wuzi = wuziService.selectById(id);
if(wuzi !=null){
//entity转view
WuziView view = new WuziView();
BeanUtils.copyProperties( wuzi , view );//把实体数据重构到view中
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
caozuorizhiService.insertCaozuorizhi(String.valueOf(request.getSession().getAttribute("role")),TABLE_NAME,String.valueOf(request.getSession().getAttribute("username")),"单条数据查看",view.toString());
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody WuziEntity wuzi, HttpServletRequest request){
logger.debug("save方法:,,Controller:{},,wuzi:{}",this.getClass().getName(),wuzi.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
if(false)
return R.error(511,"永远不会进入");
Wrapper<WuziEntity> queryWrapper = new EntityWrapper<WuziEntity>()
.eq("wuzi_name", wuzi.getWuziName())
.eq("wuzi_types", wuzi.getWuziTypes())
.eq("wuzi_kucun_number", wuzi.getWuziKucunNumber())
.eq("wuzi_delete", 1)
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
WuziEntity wuziEntity = wuziService.selectOne(queryWrapper);
if(wuziEntity==null){
wuzi.setWuziDelete(1);
wuzi.setInsertTime(new Date());
wuzi.setCreateTime(new Date());
wuziService.insert(wuzi);
caozuorizhiService.insertCaozuorizhi(String.valueOf(request.getSession().getAttribute("role")),TABLE_NAME,String.valueOf(request.getSession().getAttribute("username")),"新增",wuzi.toString());
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
/**
* 后端修改
*/
@RequestMapping("/update")
public R update(@RequestBody WuziEntity wuzi, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {
logger.debug("update方法:,,Controller:{},,wuzi:{}",this.getClass().getName(),wuzi.toString());
WuziEntity oldWuziEntity = wuziService.selectById(wuzi.getId());//查询原先数据
String role = String.valueOf(request.getSession().getAttribute("role"));
// if(false)
// return R.error(511,"永远不会进入");
if("".equals(wuzi.getWuziPhoto()) || "null".equals(wuzi.getWuziPhoto())){
wuzi.setWuziPhoto(null);
}
wuziService.updateById(wuzi);//根据id更新
List<String> strings = caozuorizhiService.clazzDiff(wuzi, oldWuziEntity, request,new String[]{"updateTime"});
caozuorizhiService.insertCaozuorizhi(String.valueOf(request.getSession().getAttribute("role")),TABLE_NAME,String.valueOf(request.getSession().getAttribute("username")),"修改",strings.toString());
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids, HttpServletRequest request){
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
List<WuziEntity> oldWuziList =wuziService.selectBatchIds(Arrays.asList(ids));//要删除的数据
ArrayList<WuziEntity> list = new ArrayList<>();
for(Integer id:ids){
WuziEntity wuziEntity = new WuziEntity();
wuziEntity.setId(id);
wuziEntity.setWuziDelete(2);
list.add(wuziEntity);
}
if(list != null && list.size() >0){
wuziService.updateBatchById(list);
}
caozuorizhiService.insertCaozuorizhi(String.valueOf(request.getSession().getAttribute("role")),TABLE_NAME,String.valueOf(request.getSession().getAttribute("username")),"删除",oldWuziList.toString());
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<WuziEntity> wuziList = 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){
//循环
WuziEntity wuziEntity = new WuziEntity();
// wuziEntity.setWuziName(data.get(0)); //物资名称 要改的
// wuziEntity.setWuziUuidNumber(data.get(0)); //物资编号 要改的
// wuziEntity.setWuziPhoto("");//详情和图片
// wuziEntity.setWuziTypes(Integer.valueOf(data.get(0))); //物资类型 要改的
// wuziEntity.setWuziKucunNumber(Integer.valueOf(data.get(0))); //物资库存 要改的
// wuziEntity.setWuziContent("");//详情和图片
// wuziEntity.setWuziDelete(1);//逻辑删除字段
// wuziEntity.setInsertTime(date);//时间
// wuziEntity.setCreateTime(date);//时间
wuziList.add(wuziEntity);
//把要查询是否重复的字段放入map中
//物资编号
if(seachFields.containsKey("wuziUuidNumber")){
List<String> wuziUuidNumber = seachFields.get("wuziUuidNumber");
wuziUuidNumber.add(data.get(0));//要改的
}else{
List<String> wuziUuidNumber = new ArrayList<>();
wuziUuidNumber.add(data.get(0));//要改的
seachFields.put("wuziUuidNumber",wuziUuidNumber);
}
}
//查询是否重复
//物资编号
List<WuziEntity> wuziEntities_wuziUuidNumber = wuziService.selectList(new EntityWrapper<WuziEntity>().in("wuzi_uuid_number", seachFields.get("wuziUuidNumber")).eq("wuzi_delete", 1));
if(wuziEntities_wuziUuidNumber.size() >0 ){
ArrayList<String> repeatFields = new ArrayList<>();
for(WuziEntity s:wuziEntities_wuziUuidNumber){
repeatFields.add(s.getWuziUuidNumber());
}
return R.error(511,"数据库的该表中的 [物资编号] 字段已经存在 存在数据为:"+repeatFields.toString());
}
wuziService.insertBatch(wuziList);
caozuorizhiService.insertCaozuorizhi(String.valueOf(request.getSession().getAttribute("role")),TABLE_NAME,String.valueOf(request.getSession().getAttribute("username")),"批量新增",wuziList.toString());
return R.ok();
}
}
}
}catch (Exception e){
e.printStackTrace();
return R.error(511,"批量插入数据异常,请联系管理员");
}
}
}
5.2 物资管理Service模块
java
package com.service;
import com.baomidou.mybatisplus.service.IService;
import com.utils.PageUtils;
import com.entity.WuziEntity;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.lang.Nullable;
import java.util.List;
/**
* 物资 服务类
*/
public interface WuziService extends IService<WuziEntity> {
/**
* @param params 查询参数
* @return 带分页的查询出来的数据
*/
PageUtils queryPage(Map<String, Object> params);
}
5.3 物资管理ServiceImpl模块
java
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.WuziDao;
import com.entity.WuziEntity;
import com.service.WuziService;
import com.entity.view.WuziView;
/**
* 物资 服务实现类
*/
@Service("wuziService")
@Transactional
public class WuziServiceImpl extends ServiceImpl<WuziDao, WuziEntity> implements WuziService {
@Override
public PageUtils queryPage(Map<String,Object> params) {
Page<WuziView> page =new Query<WuziView>(params).getPage();
page.setRecords(baseMapper.selectListView(page,params));
return new PageUtils(page);
}
}
5.4 物资管理Dao模块
java
package com.dao;
import com.entity.WuziEntity;
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.WuziView;
/**
* 物资 Dao 接口
*
* @author 学长编程
*WeChat jsjbysj88
*/
public interface WuziDao extends BaseMapper<WuziEntity> {
List<WuziView> selectListView(Pagination page,@Param("params")Map<String,Object> params);
}
6、论文目录结构
7、源码获取
感谢大家的阅读,如有不懂的问题可以评论区交流或私聊!
喜欢文章可以点赞、收藏、关注、评论啦
→获取源码请私信←