博主介绍:✌从事软件开发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 项目介绍
使用旧方法对车辆违章信息管理系统的信息进行系统化管理已经不再让人们信赖了,把现在的网络信息技术运用在车辆违章信息管理系统的管理上面可以解决许多信息管理上面的难题,比如处理数据时间很长,数据存在错误不能及时纠正等问题。这次开发的车辆违章信息管理系统对车辆管理、车辆扣分管理、车辆违章管理、字典管理、公告管理、留言板管理、用户管理、资讯管理、管理员管理等进行集中化处理。经过前面自己查阅的网络知识,加上自己在学校课堂上学习的知识,决定开发系统选择小程序模式这种高效率的模式完成系统功能开发。这种模式让操作员基于浏览器的方式进行网站访问,采用的主流的Java语言这种面向对象的语言进行车辆违章信息管理系统程序的开发,在数据库的选择上面,选择功能强大的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*/`cheliangweizhang` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `cheliangweizhang`;
/*Table structure for table `cheliang` */
DROP TABLE IF EXISTS `cheliang`;
CREATE TABLE `cheliang` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
`yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
`cheliang_name` varchar(200) DEFAULT NULL COMMENT '车辆名称 Search111 ',
`cheliang_uuid_number` varchar(200) DEFAULT NULL COMMENT '车辆编号',
`cheliang_photo` varchar(200) DEFAULT NULL COMMENT '车辆照片',
`cheliang_types` int(11) DEFAULT NULL COMMENT '车辆类型 Search111',
`cheliang_chepai` varchar(200) DEFAULT NULL COMMENT '车牌号',
`cheliang_yanse` varchar(200) DEFAULT NULL COMMENT '车辆颜色',
`cheliang_pinpai` varchar(200) DEFAULT NULL COMMENT '品牌',
`cheliang_chezuo` varchar(200) DEFAULT NULL COMMENT '车座',
`cheliang_content` longtext COMMENT '车辆备注',
`insert_time` timestamp NULL DEFAULT NULL COMMENT '录入时间',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show3 listShow',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 COMMENT='车辆';
/*Data for the table `cheliang` */
insert into `cheliang`(`id`,`yonghu_id`,`cheliang_name`,`cheliang_uuid_number`,`cheliang_photo`,`cheliang_types`,`cheliang_chepai`,`cheliang_yanse`,`cheliang_pinpai`,`cheliang_chezuo`,`cheliang_content`,`insert_time`,`create_time`) values (1,1,'车辆名称1','1679894899611','upload/cheliang1.jpg',2,'车牌号1','车辆颜色1','品牌1','车座1','车辆备注1','2023-03-27 13:28:19','2023-03-27 13:28:19'),(2,1,'车辆名称2','1679894899678','upload/cheliang2.jpg',3,'车牌号2','车辆颜色2','品牌2','车座2','车辆备注2','2023-03-27 13:28:19','2023-03-27 13:28:19'),(3,1,'车辆名称3','1679894899668','upload/cheliang3.jpg',1,'车牌号3','车辆颜色3','品牌3','车座3','车辆备注3','2023-03-27 13:28:19','2023-03-27 13:28:19'),(4,1,'车辆名称4','1679894899631','upload/cheliang4.jpg',4,'车牌号4','车辆颜色4','品牌4','车座4','车辆备注4','2023-03-27 13:28:19','2023-03-27 13:28:19'),(5,1,'车辆名称5','1679894899628','upload/cheliang5.jpg',4,'车牌号5','车辆颜色5','品牌5','车座5','车辆备注5','2023-03-27 13:28:19','2023-03-27 13:28:19'),(6,1,'车辆名称6','1679894899677','upload/cheliang6.jpg',4,'车牌号6','车辆颜色6','品牌6','车座6','车辆备注6','2023-03-27 13:28:19','2023-03-27 13:28:19'),(7,1,'车辆名称7','1679894899704','upload/cheliang7.jpg',4,'车牌号7','车辆颜色7','品牌7','车座7','车辆备注7','2023-03-27 13:28:19','2023-03-27 13:28:19'),(8,2,'车辆名称8','1679894899706','upload/cheliang8.jpg',1,'车牌号8','车辆颜色8','品牌8','车座8','车辆备注8','2023-03-27 13:28:19','2023-03-27 13:28:19'),(9,2,'车辆名称9','1679894899691','upload/cheliang9.jpg',2,'车牌号9','车辆颜色9','品牌9','车座9','车辆备注9','2023-03-27 13:28:19','2023-03-27 13:28:19'),(10,2,'车辆名称10','1679894899648','upload/cheliang10.jpg',1,'车牌号10','车辆颜色10','品牌10','车座10','车辆备注10','2023-03-27 13:28:19','2023-03-27 13:28:19'),(11,2,'车辆名称11','1679894899630','upload/cheliang11.jpg',4,'车牌号11','车辆颜色11','品牌11','车座11','车辆备注11','2023-03-27 13:28:19','2023-03-27 13:28:19'),(12,3,'车辆名称12','1679894899641','upload/cheliang12.jpg',2,'车牌号12','车辆颜色12','品牌12','车座12','车辆备注12','2023-03-27 13:28:19','2023-03-27 13:28:19'),(13,3,'车辆名称13','1679894899684','upload/cheliang13.jpg',1,'车牌号13','车辆颜色13','品牌13','车座13','车辆备注13','2023-03-27 13:28:19','2023-03-27 13:28:19'),(14,3,'车辆名称14','1679894899659','upload/cheliang14.jpg',3,'车牌号14','车辆颜色14','品牌14','车座14','车辆备注14','2023-03-27 13:28:19','2023-03-27 13:28:19'),(15,4,'车辆名称111','1679897040287','/upload/1679897049489.jpg',3,'豫A888888','白色','比亚迪','5座','<p>和京津冀军</p>','2023-03-27 14:04:32','2023-03-27 14:04:32');
/*Table structure for table `cheliang_koufen` */
DROP TABLE IF EXISTS `cheliang_koufen`;
CREATE TABLE `cheliang_koufen` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
`cheliang_id` int(11) DEFAULT NULL COMMENT '车辆',
`yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
`cheliang_koufen_uuid_number` varchar(200) DEFAULT NULL COMMENT '车辆扣分编号',
`cheliang_koufen_types` int(11) DEFAULT NULL COMMENT '扣分类型 Search111',
`cheliang_koufen_content` longtext COMMENT '扣分缘由',
`koufen_time` timestamp NULL DEFAULT NULL COMMENT '扣分时间',
`cheliang_koufen_number` 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=16 DEFAULT CHARSET=utf8 COMMENT='车辆扣分';
/*Data for the table `cheliang_koufen` */
insert into `cheliang_koufen`(`id`,`cheliang_id`,`yonghu_id`,`cheliang_koufen_uuid_number`,`cheliang_koufen_types`,`cheliang_koufen_content`,`koufen_time`,`cheliang_koufen_number`,`insert_time`,`create_time`) values (1,1,1,'1679894899670',4,'扣分缘由1','2023-03-27 13:28:19',2,'2023-03-27 13:28:19','2023-03-27 13:28:19'),(2,2,1,'1679894899670',1,'扣分缘由2','2023-03-27 13:28:19',2,'2023-03-27 13:28:19','2023-03-27 13:28:19'),(3,3,1,'1679894899650',3,'扣分缘由3','2023-03-27 13:28:19',2,'2023-03-27 13:28:19','2023-03-27 13:28:19'),(4,4,1,'1679894899638',1,'扣分缘由4','2023-03-27 13:28:19',1,'2023-03-27 13:28:19','2023-03-27 13:28:19'),(5,5,1,'1679894899641',1,'扣分缘由5','2023-03-27 13:28:19',1,'2023-03-27 13:28:19','2023-03-27 13:28:19'),(6,6,1,'1679894899646',4,'扣分缘由6','2023-03-27 13:28:19',1,'2023-03-27 13:28:19','2023-03-27 13:28:19'),(7,7,1,'1679894899719',4,'扣分缘由7','2023-03-27 13:28:19',1,'2023-03-27 13:28:19','2023-03-27 13:28:19'),(8,8,2,'1679894899703',2,'扣分缘由8','2023-03-27 13:28:19',2,'2023-03-27 13:28:19','2023-03-27 13:28:19'),(9,9,2,'1679894899689',2,'扣分缘由9','2023-03-27 13:28:19',3,'2023-03-27 13:28:19','2023-03-27 13:28:19'),(10,10,2,'1679894899701',3,'扣分缘由10','2023-03-27 13:28:19',3,'2023-03-27 13:28:19','2023-03-27 13:28:19'),(11,11,3,'1679894899629',3,'扣分缘由11','2023-03-27 13:28:19',3,'2023-03-27 13:28:19','2023-03-27 13:28:19'),(12,12,3,'1679894899687',2,'扣分缘由12','2023-03-27 13:28:19',3,'2023-03-27 13:28:19','2023-03-27 13:28:19'),(13,13,3,'1679894899686',1,'扣分缘由13','2023-03-27 13:28:19',4,'2023-03-27 13:28:19','2023-03-27 13:28:19'),(14,14,3,'1679894899641',2,'扣分缘由14','2023-03-27 13:28:19',4,'2023-03-27 13:28:19','2023-03-27 13:28:19'),(15,15,4,'1679897077027',3,'<p>和京津冀军</p>','2023-03-27 14:04:44',3,'2023-03-27 14:04:47','2023-03-27 14:04:47');
/*Table structure for table `cheliang_weizhang` */
DROP TABLE IF EXISTS `cheliang_weizhang`;
CREATE TABLE `cheliang_weizhang` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
`cheliang_id` int(11) DEFAULT NULL COMMENT '车辆',
`yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
`cheliang_weizhang_uuid_number` varchar(200) DEFAULT NULL COMMENT '车辆违章编号',
`cheliang_weizhang_name` varchar(200) DEFAULT NULL COMMENT '违章标题 Search111 ',
`cheliang_weizhang_photo` varchar(200) DEFAULT NULL COMMENT '违章照片',
`cheliang_weizhang_video` varchar(200) DEFAULT NULL COMMENT '违章视频',
`cheliang_weizhang_types` int(11) DEFAULT NULL COMMENT '车辆违章类型 Search111',
`cheliang_weizhang_content` longtext COMMENT '违章缘由',
`weizhang_time` timestamp NULL DEFAULT NULL COMMENT '违章时间',
`cheliang_weizhang_zhuangtai_types` int(11) DEFAULT NULL COMMENT '违章状态 Search111',
`cheliang_weizhang_shensu_content` longtext COMMENT '申诉理由',
`cheliang_weizhang_yesno_types` int(11) DEFAULT NULL COMMENT '申诉状态 Search111',
`cheliang_weizhang_yesno_text` longtext COMMENT '申诉回复',
`cheliang_weizhang_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=21 DEFAULT CHARSET=utf8 COMMENT='车辆违章';
/*Data for the table `cheliang_weizhang` */
insert into `cheliang_weizhang`(`id`,`cheliang_id`,`yonghu_id`,`cheliang_weizhang_uuid_number`,`cheliang_weizhang_name`,`cheliang_weizhang_photo`,`cheliang_weizhang_video`,`cheliang_weizhang_types`,`cheliang_weizhang_content`,`weizhang_time`,`cheliang_weizhang_zhuangtai_types`,`cheliang_weizhang_shensu_content`,`cheliang_weizhang_yesno_types`,`cheliang_weizhang_yesno_text`,`cheliang_weizhang_shenhe_time`,`insert_time`,`create_time`) values (1,1,1,'1679894899712','违章标题1','upload/cheliang_weizhang1.jpg','upload/video.mp4',1,'违章缘由1','2023-03-27 13:28:19',2,'申诉理由1',1,NULL,NULL,'2023-03-27 13:28:19','2023-03-27 13:28:19'),(2,2,1,'1679894899641','违章标题2','upload/cheliang_weizhang2.jpg','upload/video.mp4',3,'违章缘由2','2023-03-27 13:28:19',5,'申诉理由2',1,NULL,NULL,'2023-03-27 13:28:19','2023-03-27 13:28:19'),(3,3,1,'1679894899723','违章标题3','upload/cheliang_weizhang3.jpg','upload/video.mp4',3,'违章缘由3','2023-03-27 13:28:19',2,'申诉理由3',1,NULL,NULL,'2023-03-27 13:28:19','2023-03-27 13:28:19'),(4,4,1,'1679894899693','违章标题4','upload/cheliang_weizhang4.jpg','upload/video.mp4',4,'违章缘由4','2023-03-27 13:28:19',2,'申诉理由4',1,NULL,NULL,'2023-03-27 13:28:19','2023-03-27 13:28:19'),(5,5,1,'1679894899626','违章标题5','upload/cheliang_weizhang5.jpg','upload/video.mp4',3,'违章缘由5','2023-03-27 13:28:19',1,'申诉理由5',1,NULL,NULL,'2023-03-27 13:28:19','2023-03-27 13:28:19'),(6,6,1,'1679894899682','违章标题6','upload/cheliang_weizhang6.jpg','upload/video.mp4',1,'违章缘由6','2023-03-27 13:28:19',2,'申诉理由6',1,NULL,NULL,'2023-03-27 13:28:19','2023-03-27 13:28:19'),(7,7,1,'1679894899685','违章标题7','upload/cheliang_weizhang7.jpg','upload/video.mp4',2,'违章缘由7','2023-03-27 13:28:19',6,'申诉理由7',1,NULL,NULL,'2023-03-27 13:28:19','2023-03-27 13:28:19'),(8,8,2,'1679894899704','违章标题8','upload/cheliang_weizhang8.jpg','upload/video.mp4',4,'违章缘由8','2023-03-27 13:28:19',1,'申诉理由8',1,NULL,NULL,'2023-03-27 13:28:19','2023-03-27 13:28:19'),(9,9,2,'1679894899713','违章标题9','upload/cheliang_weizhang9.jpg','upload/video.mp4',1,'违章缘由9','2023-03-27 13:28:19',6,'申诉理由9',1,NULL,NULL,'2023-03-27 13:28:19','2023-03-27 13:28:19'),(10,10,2,'1679894899639','违章标题10','upload/cheliang_weizhang10.jpg','upload/video.mp4',2,'违章缘由10','2023-03-27 13:28:19',2,'申诉理由10',1,NULL,NULL,'2023-03-27 13:28:19','2023-03-27 13:28:19'),(11,11,3,'1679894899683','违章标题11','upload/cheliang_weizhang11.jpg','upload/video.mp4',4,'违章缘由11','2023-03-27 13:28:19',1,'申诉理由11',1,NULL,NULL,'2023-03-27 13:28:19','2023-03-27 13:28:19'),(12,12,3,'1679894899655','违章标题12','upload/cheliang_weizhang12.jpg','upload/video.mp4',3,'违章缘由12','2023-03-27 13:28:19',2,'申诉理由12',1,NULL,NULL,'2023-03-27 13:28:19','2023-03-27 13:28:19'),(13,13,3,'1679894899704','违章标题13','upload/cheliang_weizhang13.jpg','upload/video.mp4',1,'违章缘由13','2023-03-27 13:28:19',6,'申诉理由13',1,NULL,NULL,'2023-03-27 13:28:19','2023-03-27 13:28:19'),(14,14,3,'1679894899703','违章标题14','upload/cheliang_weizhang14.jpg','upload/video.mp4',2,'违章缘由14','2023-03-27 13:28:19',5,'申诉理由14',1,NULL,NULL,'2023-03-27 13:28:19','2023-03-27 13:28:19'),(15,1,1,'1679895533061','违章1111','/upload/1679895545499.jpg','/upload/1679895549104.mp4',3,'<p>个单双杠事故十多个大师傅待审核</p>','2023-03-27 13:39:16',2,'',NULL,NULL,NULL,'2023-03-27 13:39:17','2023-03-27 13:39:17'),(16,1,1,'1679895533061','违章1111','/upload/1679895545499.jpg','/upload/1679895549104.mp4',3,'<p>个单双杠事故十多个大师傅待审核</p>','2023-03-27 13:39:16',6,'刚刚好很好很好',3,'很好健健康康','2023-03-27 13:51:44','2023-03-27 13:39:17','2023-03-27 13:39:17'),(17,1,1,'1679895533061','违章1111','/upload/1679895545499.jpg','/upload/1679895549104.mp4',3,'<p>个单双杠事故十多个大师傅待审核</p>','2023-03-27 13:39:16',1,NULL,NULL,NULL,NULL,'2023-03-27 13:39:17','2023-03-27 13:39:17'),(18,1,1,'1679895533061','违章1111','/upload/1679895545499.jpg','/upload/1679895549104.mp4',3,'<p>个单双杠事故十多个大师傅待审核</p>','2023-03-27 13:39:16',6,NULL,NULL,NULL,NULL,'2023-03-27 13:39:17','2023-03-27 13:39:17'),(19,1,1,'1679895533061','违章1111','/upload/1679895545499.jpg','/upload/1679895549104.mp4',3,'<p>个单双杠事故十多个大师傅待审核</p>','2023-03-27 13:39:16',5,'句斤斤计较军',2,'哼哼唧唧军军','2023-03-27 14:06:06','2023-03-27 13:39:17','2023-03-27 13:39:17'),(20,15,4,'1679897135458','违章1111','/upload/1679897143826.jpg','/upload/1679897146910.mp4',2,'<p>和京津冀军</p>','2023-03-21 00:00:00',1,'',NULL,'',NULL,'2023-03-27 14:05:54','2023-03-27 14:05:54');
/*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,'轮播图1111','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=29 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,'gonggao_types','公告类型',1,'公告类型1',NULL,NULL,'2023-03-27 13:26:51'),(2,'gonggao_types','公告类型',2,'公告类型2',NULL,NULL,'2023-03-27 13:26:51'),(3,'sex_types','性别类型',1,'男',NULL,NULL,'2023-03-27 13:26:51'),(4,'sex_types','性别类型',2,'女',NULL,NULL,'2023-03-27 13:26:51'),(5,'zixun_types','资讯类型',1,'资讯类型1',NULL,NULL,'2023-03-27 13:26:51'),(6,'zixun_types','资讯类型',2,'资讯类型2',NULL,NULL,'2023-03-27 13:26:51'),(7,'cheliang_types','车辆类型',1,'大型车',NULL,NULL,'2023-03-27 13:26:51'),(8,'cheliang_types','车辆类型',2,'中型车',NULL,NULL,'2023-03-27 13:26:51'),(9,'cheliang_types','车辆类型',3,'小型车',NULL,NULL,'2023-03-27 13:26:51'),(10,'cheliang_types','车辆类型',4,'面包车',NULL,NULL,'2023-03-27 13:26:51'),(11,'cheliang_weizhang_types','车辆违章类型',1,'违章类型1',NULL,NULL,'2023-03-27 13:26:51'),(12,'cheliang_weizhang_types','车辆违章类型',2,'违章类型2',NULL,NULL,'2023-03-27 13:26:51'),(13,'cheliang_weizhang_types','车辆违章类型',3,'违章类型3',NULL,NULL,'2023-03-27 13:26:51'),(14,'cheliang_weizhang_types','车辆违章类型',4,'违章类型4',NULL,NULL,'2023-03-27 13:26:51'),(15,'cheliang_weizhang_zhuangtai_types','违章状态',1,'未处理',NULL,NULL,'2023-03-27 13:26:51'),(16,'cheliang_weizhang_zhuangtai_types','违章状态',2,'已确认',NULL,NULL,'2023-03-27 13:26:51'),(17,'cheliang_weizhang_zhuangtai_types','违章状态',3,'已申诉',NULL,NULL,'2023-03-27 13:26:51'),(18,'cheliang_weizhang_zhuangtai_types','违章状态',4,'申诉被拒',NULL,NULL,'2023-03-27 13:26:51'),(19,'cheliang_weizhang_zhuangtai_types','违章状态',5,'申诉同意',NULL,NULL,'2023-03-27 13:26:51'),(20,'cheliang_weizhang_zhuangtai_types','违章状态',6,'已扣分',NULL,NULL,'2023-03-27 13:26:51'),(21,'cheliang_weizhang_yesno_types','申诉回复',1,'待审核',NULL,NULL,'2023-03-27 13:26:51'),(22,'cheliang_weizhang_yesno_types','申诉回复',2,'同意申诉',NULL,NULL,'2023-03-27 13:26:51'),(23,'cheliang_weizhang_yesno_types','申诉回复',3,'申诉拒绝',NULL,NULL,'2023-03-27 13:26:51'),(24,'cheliang_koufen_types','扣分类型',1,'扣分类型1',NULL,NULL,'2023-03-27 13:26:51'),(25,'cheliang_koufen_types','扣分类型',2,'扣分类型2',NULL,NULL,'2023-03-27 13:26:51'),(26,'cheliang_koufen_types','扣分类型',3,'扣分类型3',NULL,NULL,'2023-03-27 13:26:51'),(27,'cheliang_koufen_types','扣分类型',4,'扣分类型4',NULL,NULL,'2023-03-27 13:26:51'),(28,'zixun_types','资讯类型',3,'资讯类型3',NULL,'','2023-03-27 14:03:56');
/*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-03-27 13:28:19','公告详情1','2023-03-27 13:28:19'),(2,'公告名称2','upload/gonggao2.jpg',2,'2023-03-27 13:28:19','公告详情2','2023-03-27 13:28:19'),(3,'公告名称3','upload/gonggao3.jpg',1,'2023-03-27 13:28:19','公告详情3','2023-03-27 13:28:19'),(4,'公告名称4','upload/gonggao4.jpg',2,'2023-03-27 13:28:19','公告详情4','2023-03-27 13:28:19'),(5,'公告名称5','upload/gonggao5.jpg',2,'2023-03-27 13:28:19','公告详情5','2023-03-27 13:28:19'),(6,'公告名称6','upload/gonggao6.jpg',1,'2023-03-27 13:28:19','公告详情6','2023-03-27 13:28:19'),(7,'公告名称7','upload/gonggao7.jpg',1,'2023-03-27 13:28:19','公告详情7','2023-03-27 13:28:19'),(8,'公告名称8','upload/gonggao8.jpg',1,'2023-03-27 13:28:19','公告详情8','2023-03-27 13:28:19'),(9,'公告名称9','upload/gonggao9.jpg',2,'2023-03-27 13:28:19','公告详情9','2023-03-27 13:28:19'),(10,'公告名称10','upload/gonggao10.jpg',1,'2023-03-27 13:28:19','公告详情10','2023-03-27 13:28:19'),(11,'公告名称11','upload/gonggao11.jpg',1,'2023-03-27 13:28:19','公告详情11','2023-03-27 13:28:19'),(12,'公告名称12','upload/gonggao12.jpg',2,'2023-03-27 13:28:19','公告详情12','2023-03-27 13:28:19'),(13,'公告名称13','upload/gonggao13.jpg',2,'2023-03-27 13:28:19','公告详情13','2023-03-27 13:28:19'),(14,'公告名称14','upload/gonggao14.jpg',1,'2023-03-27 13:28:19','公告详情14','2023-03-27 13:28:19');
/*Table structure for table `liuyan` */
DROP TABLE IF EXISTS `liuyan`;
CREATE TABLE `liuyan` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
`yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
`liuyan_name` varchar(200) DEFAULT NULL COMMENT '留言标题 Search111 ',
`liuyan_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 '创建时间 show2 nameShow',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 COMMENT='留言板';
/*Data for the table `liuyan` */
insert into `liuyan`(`id`,`yonghu_id`,`liuyan_name`,`liuyan_text`,`insert_time`,`reply_text`,`update_time`,`create_time`) values (1,3,'留言标题1','留言内容1','2023-03-27 13:28:19','回复信息1','2023-03-27 13:28:19','2023-03-27 13:28:19'),(2,2,'留言标题2','留言内容2','2023-03-27 13:28:19','回复信息2','2023-03-27 13:28:19','2023-03-27 13:28:19'),(3,2,'留言标题3','留言内容3','2023-03-27 13:28:19','回复信息3','2023-03-27 13:28:19','2023-03-27 13:28:19'),(4,3,'留言标题4','留言内容4','2023-03-27 13:28:19','回复信息4','2023-03-27 13:28:19','2023-03-27 13:28:19'),(5,1,'留言标题5','留言内容5','2023-03-27 13:28:19','回复信息5','2023-03-27 13:28:19','2023-03-27 13:28:19'),(6,2,'留言标题6','留言内容6','2023-03-27 13:28:19','回复信息6','2023-03-27 13:28:19','2023-03-27 13:28:19'),(7,2,'留言标题7','留言内容7','2023-03-27 13:28:19','回复信息7','2023-03-27 13:28:19','2023-03-27 13:28:19'),(8,1,'留言标题8','留言内容8','2023-03-27 13:28:19','回复信息8','2023-03-27 13:28:19','2023-03-27 13:28:19'),(9,1,'留言标题9','留言内容9','2023-03-27 13:28:19','回复信息9','2023-03-27 13:28:19','2023-03-27 13:28:19'),(10,1,'留言标题10','留言内容10','2023-03-27 13:28:19','回复信息10','2023-03-27 13:28:19','2023-03-27 13:28:19'),(11,1,'留言标题11','留言内容11','2023-03-27 13:28:19','回复信息11','2023-03-27 13:28:19','2023-03-27 13:28:19'),(12,2,'留言标题12','留言内容12','2023-03-27 13:28:19','回复信息12','2023-03-27 13:28:19','2023-03-27 13:28:19'),(13,1,'留言标题13','留言内容13','2023-03-27 13:28:19','回复信息13','2023-03-27 13:28:19','2023-03-27 13:28:19'),(14,2,'留言标题14','留言内容14','2023-03-27 13:28:19','回复信息14','2023-03-27 13:28:19','2023-03-27 13:28:19'),(15,4,'标题111','广东省广东省和','2023-03-27 14:00:24','呵呵叫姐姐','2023-03-27 14:06:34','2023-03-27 14:00:24');
/*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=4 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','管理员','ah9hb07nwgtp4ysqhn4ja93xc69e19i8','2023-03-27 13:31:20','2023-03-27 15:09:02'),(2,1,'a1','yonghu','用户','7o9seuv2qajm9gqz6ytge7uwqg6xvlv7','2023-03-27 13:40:32','2023-03-27 15:03:02'),(3,4,'a5','yonghu','用户','nmn7iqj5hxlj6wibz6jqpnm8irbxc5o3','2023-03-27 14:00:11','2023-03-27 15:00:11');
/*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-27 13:26:51');
/*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 '用户邮箱',
`new_money` decimal(10,2) DEFAULT NULL COMMENT '余额 ',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 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`,`new_money`,`create_time`) values (1,'a1','123456','用户姓名1','17703786901','410224199010102001','upload/yonghu1.jpg',1,'1@qq.com','471.00','2023-03-27 13:28:19'),(2,'a2','123456','用户姓名2','17703786902','410224199010102002','upload/yonghu2.jpg',2,'2@qq.com','789.71','2023-03-27 13:28:19'),(3,'a3','123456','用户姓名3','17703786903','410224199010102003','upload/yonghu3.jpg',2,'3@qq.com','73.91','2023-03-27 13:28:19'),(4,'a5','123456','张5','17788889999','444555666699999999','upload/1679896892814.jpg',2,'5@qq.com','0.00','2023-03-27 14:00:06');
/*Table structure for table `zixun` */
DROP TABLE IF EXISTS `zixun`;
CREATE TABLE `zixun` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
`zixun_name` varchar(200) DEFAULT NULL COMMENT '资讯名称 Search111 ',
`zixun_photo` varchar(200) DEFAULT NULL COMMENT '资讯图片 ',
`zixun_types` int(11) NOT NULL COMMENT '资讯类型 Search111 ',
`insert_time` timestamp NULL DEFAULT NULL COMMENT '资讯发布时间 ',
`zixun_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 `zixun` */
insert into `zixun`(`id`,`zixun_name`,`zixun_photo`,`zixun_types`,`insert_time`,`zixun_content`,`create_time`) values (1,'资讯名称1','upload/zixun1.jpg',1,'2023-03-27 13:28:19','资讯详情1','2023-03-27 13:28:19'),(2,'资讯名称2','upload/zixun2.jpg',2,'2023-03-27 13:28:19','资讯详情2','2023-03-27 13:28:19'),(3,'资讯名称3','upload/zixun3.jpg',2,'2023-03-27 13:28:19','资讯详情3','2023-03-27 13:28:19'),(4,'资讯名称4','upload/zixun4.jpg',2,'2023-03-27 13:28:19','资讯详情4','2023-03-27 13:28:19'),(5,'资讯名称5','upload/zixun5.jpg',1,'2023-03-27 13:28:19','资讯详情5','2023-03-27 13:28:19'),(6,'资讯名称6','upload/zixun6.jpg',2,'2023-03-27 13:28:19','资讯详情6','2023-03-27 13:28:19'),(7,'资讯名称7','upload/zixun7.jpg',2,'2023-03-27 13:28:19','资讯详情7','2023-03-27 13:28:19'),(8,'资讯名称8','upload/zixun8.jpg',1,'2023-03-27 13:28:19','资讯详情8','2023-03-27 13:28:19'),(9,'资讯名称9','upload/zixun9.jpg',2,'2023-03-27 13:28:19','资讯详情9','2023-03-27 13:28:19'),(10,'资讯名称10','upload/zixun10.jpg',2,'2023-03-27 13:28:19','资讯详情10','2023-03-27 13:28:19'),(11,'资讯名称11','upload/zixun11.jpg',1,'2023-03-27 13:28:19','资讯详情11','2023-03-27 13:28:19'),(12,'资讯名称12','upload/zixun12.jpg',1,'2023-03-27 13:28:19','资讯详情12','2023-03-27 13:28:19'),(13,'资讯名称13','upload/zixun13.jpg',1,'2023-03-27 13:28:19','资讯详情13','2023-03-27 13:28:19'),(14,'资讯名称14','upload/zixun14.jpg',1,'2023-03-27 13:28:19','<p>资讯详情14哼哼唧唧</p>','2023-03-27 13:28:19');
/*!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("/cheliangWeizhang")
public class CheliangWeizhangController {
private static final Logger logger = LoggerFactory.getLogger(CheliangWeizhangController.class);
private static final String TABLE_NAME = "cheliangWeizhang";
@Autowired
private CheliangWeizhangService cheliangWeizhangService;
@Autowired
private TokenService tokenService;
@Autowired
private CheliangService cheliangService;//车辆
@Autowired
private CheliangKoufenService cheliangKoufenService;//车辆扣分
@Autowired
private DictionaryService dictionaryService;//字典
@Autowired
private GonggaoService gonggaoService;//公告
@Autowired
private LiuyanService liuyanService;//留言板
@Autowired
private YonghuService yonghuService;//用户
@Autowired
private ZixunService zixunService;//资讯
@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 = cheliangWeizhangService.queryPage(params);
//字典表数据转换
List<CheliangWeizhangView> list =(List<CheliangWeizhangView>)page.getList();
for(CheliangWeizhangView 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);
CheliangWeizhangEntity cheliangWeizhang = cheliangWeizhangService.selectById(id);
if(cheliangWeizhang !=null){
//entity转view
CheliangWeizhangView view = new CheliangWeizhangView();
BeanUtils.copyProperties( cheliangWeizhang , view );//把实体数据重构到view中
//级联表 车辆
//级联表
CheliangEntity cheliang = cheliangService.selectById(cheliangWeizhang.getCheliangId());
if(cheliang != null){
BeanUtils.copyProperties( cheliang , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表
view.setCheliangId(cheliang.getId());
}
//级联表 用户
//级联表
YonghuEntity yonghu = yonghuService.selectById(cheliangWeizhang.getYonghuId());
if(yonghu != null){
BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表
view.setYonghuId(yonghu.getId());
}
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody CheliangWeizhangEntity cheliangWeizhang, HttpServletRequest request){
logger.debug("save方法:,,Controller:{},,cheliangWeizhang:{}",this.getClass().getName(),cheliangWeizhang.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
if(false)
return R.error(511,"永远不会进入");
else if("用户".equals(role))
cheliangWeizhang.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
CheliangEntity cheliangEntity = cheliangService.selectById(cheliangWeizhang.getCheliangId());
cheliangWeizhang.setYonghuId(cheliangEntity.getYonghuId());
// cheliangWeizhang.setCheliangWeizhangYesnoTypes(1);
cheliangWeizhang.setCheliangWeizhangZhuangtaiTypes(1);//违章状态1 未处理
cheliangWeizhang.setInsertTime(new Date());
cheliangWeizhang.setCreateTime(new Date());
cheliangWeizhangService.insert(cheliangWeizhang);
return R.ok();
}
/**
* 后端修改
*/
@RequestMapping("/update")
public R update(@RequestBody CheliangWeizhangEntity cheliangWeizhang, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {
logger.debug("update方法:,,Controller:{},,cheliangWeizhang:{}",this.getClass().getName(),cheliangWeizhang.toString());
CheliangWeizhangEntity oldCheliangWeizhangEntity = cheliangWeizhangService.selectById(cheliangWeizhang.getId());//查询原先数据
String role = String.valueOf(request.getSession().getAttribute("role"));
// if(false)
// return R.error(511,"永远不会进入");
// else if("用户".equals(role))
// cheliangWeizhang.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
if("".equals(cheliangWeizhang.getCheliangWeizhangPhoto()) || "null".equals(cheliangWeizhang.getCheliangWeizhangPhoto())){
cheliangWeizhang.setCheliangWeizhangPhoto(null);
}
if("".equals(cheliangWeizhang.getCheliangWeizhangVideo()) || "null".equals(cheliangWeizhang.getCheliangWeizhangVideo())){
cheliangWeizhang.setCheliangWeizhangVideo(null);
}
cheliangWeizhangService.updateById(cheliangWeizhang);//根据id更新
return R.ok();
}
/**
* 审核
*/
@RequestMapping("/shenhe")
public R shenhe(@RequestBody CheliangWeizhangEntity cheliangWeizhangEntity, HttpServletRequest request){
logger.debug("shenhe方法:,,Controller:{},,cheliangWeizhangEntity:{}",this.getClass().getName(),cheliangWeizhangEntity.toString());
CheliangWeizhangEntity oldCheliangWeizhang = cheliangWeizhangService.selectById(cheliangWeizhangEntity.getId());//查询原先数据
if(cheliangWeizhangEntity.getCheliangWeizhangYesnoTypes() == 2){//通过
cheliangWeizhangEntity.setCheliangWeizhangZhuangtaiTypes(5);
}else if(cheliangWeizhangEntity.getCheliangWeizhangYesnoTypes() == 3){//拒绝
cheliangWeizhangEntity.setCheliangWeizhangZhuangtaiTypes(4);
}
cheliangWeizhangEntity.setCheliangWeizhangShenheTime(new Date());//回复时间
cheliangWeizhangService.updateById(cheliangWeizhangEntity);//审核
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids, HttpServletRequest request){
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
List<CheliangWeizhangEntity> oldCheliangWeizhangList =cheliangWeizhangService.selectBatchIds(Arrays.asList(ids));//要删除的数据
cheliangWeizhangService.deleteBatchIds(Arrays.asList(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");
try {
List<CheliangWeizhangEntity> cheliangWeizhangList = 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){
//循环
CheliangWeizhangEntity cheliangWeizhangEntity = new CheliangWeizhangEntity();
// cheliangWeizhangEntity.setCheliangId(Integer.valueOf(data.get(0))); //车辆 要改的
// cheliangWeizhangEntity.setYonghuId(Integer.valueOf(data.get(0))); //用户 要改的
// cheliangWeizhangEntity.setCheliangWeizhangUuidNumber(data.get(0)); //车辆违章编号 要改的
// cheliangWeizhangEntity.setCheliangWeizhangName(data.get(0)); //违章标题 要改的
// cheliangWeizhangEntity.setCheliangWeizhangPhoto("");//详情和图片
// cheliangWeizhangEntity.setCheliangWeizhangVideo(data.get(0)); //违章视频 要改的
// cheliangWeizhangEntity.setCheliangWeizhangTypes(Integer.valueOf(data.get(0))); //车辆违章类型 要改的
// cheliangWeizhangEntity.setCheliangWeizhangContent("");//详情和图片
// cheliangWeizhangEntity.setWeizhangTime(sdf.parse(data.get(0))); //违章时间 要改的
// cheliangWeizhangEntity.setCheliangWeizhangZhuangtaiTypes(Integer.valueOf(data.get(0))); //违章状态 要改的
// cheliangWeizhangEntity.setCheliangWeizhangShensuContent("");//详情和图片
// cheliangWeizhangEntity.setCheliangWeizhangYesnoTypes(Integer.valueOf(data.get(0))); //申诉状态 要改的
// cheliangWeizhangEntity.setCheliangWeizhangYesnoText(data.get(0)); //申诉回复 要改的
// cheliangWeizhangEntity.setCheliangWeizhangShenheTime(sdf.parse(data.get(0))); //回复时间 要改的
// cheliangWeizhangEntity.setInsertTime(date);//时间
// cheliangWeizhangEntity.setCreateTime(date);//时间
cheliangWeizhangList.add(cheliangWeizhangEntity);
//把要查询是否重复的字段放入map中
//车辆违章编号
if(seachFields.containsKey("cheliangWeizhangUuidNumber")){
List<String> cheliangWeizhangUuidNumber = seachFields.get("cheliangWeizhangUuidNumber");
cheliangWeizhangUuidNumber.add(data.get(0));//要改的
}else{
List<String> cheliangWeizhangUuidNumber = new ArrayList<>();
cheliangWeizhangUuidNumber.add(data.get(0));//要改的
seachFields.put("cheliangWeizhangUuidNumber",cheliangWeizhangUuidNumber);
}
}
//查询是否重复
//车辆违章编号
List<CheliangWeizhangEntity> cheliangWeizhangEntities_cheliangWeizhangUuidNumber = cheliangWeizhangService.selectList(new EntityWrapper<CheliangWeizhangEntity>().in("cheliang_weizhang_uuid_number", seachFields.get("cheliangWeizhangUuidNumber")));
if(cheliangWeizhangEntities_cheliangWeizhangUuidNumber.size() >0 ){
ArrayList<String> repeatFields = new ArrayList<>();
for(CheliangWeizhangEntity s:cheliangWeizhangEntities_cheliangWeizhangUuidNumber){
repeatFields.add(s.getCheliangWeizhangUuidNumber());
}
return R.error(511,"数据库的该表中的 [车辆违章编号] 字段已经存在 存在数据为:"+repeatFields.toString());
}
cheliangWeizhangService.insertBatch(cheliangWeizhangList);
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 = cheliangWeizhangService.queryPage(params);
//字典表数据转换
List<CheliangWeizhangView> list =(List<CheliangWeizhangView>)page.getList();
for(CheliangWeizhangView 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);
CheliangWeizhangEntity cheliangWeizhang = cheliangWeizhangService.selectById(id);
if(cheliangWeizhang !=null){
//entity转view
CheliangWeizhangView view = new CheliangWeizhangView();
BeanUtils.copyProperties( cheliangWeizhang , view );//把实体数据重构到view中
//级联表
CheliangEntity cheliang = cheliangService.selectById(cheliangWeizhang.getCheliangId());
if(cheliang != null){
BeanUtils.copyProperties( cheliang , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
view.setCheliangId(cheliang.getId());
}
//级联表
YonghuEntity yonghu = yonghuService.selectById(cheliangWeizhang.getYonghuId());
if(yonghu != null){
BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
view.setYonghuId(yonghu.getId());
}
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody CheliangWeizhangEntity cheliangWeizhang, HttpServletRequest request){
logger.debug("add方法:,,Controller:{},,cheliangWeizhang:{}",this.getClass().getName(),cheliangWeizhang.toString());
Wrapper<CheliangWeizhangEntity> queryWrapper = new EntityWrapper<CheliangWeizhangEntity>()
.eq("cheliang_id", cheliangWeizhang.getCheliangId())
.eq("yonghu_id", cheliangWeizhang.getYonghuId())
.eq("cheliang_weizhang_uuid_number", cheliangWeizhang.getCheliangWeizhangUuidNumber())
.eq("cheliang_weizhang_name", cheliangWeizhang.getCheliangWeizhangName())
.eq("cheliang_weizhang_video", cheliangWeizhang.getCheliangWeizhangVideo())
.eq("cheliang_weizhang_types", cheliangWeizhang.getCheliangWeizhangTypes())
.eq("cheliang_weizhang_zhuangtai_types", cheliangWeizhang.getCheliangWeizhangZhuangtaiTypes())
.in("cheliang_weizhang_yesno_types", new Integer[]{1,2})
.eq("cheliang_weizhang_yesno_text", cheliangWeizhang.getCheliangWeizhangYesnoText())
// .notIn("cheliang_weizhang_types", new Integer[]{102})
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
CheliangWeizhangEntity cheliangWeizhangEntity = cheliangWeizhangService.selectOne(queryWrapper);
if(cheliangWeizhangEntity==null){
cheliangWeizhang.setCheliangWeizhangYesnoTypes(1);
cheliangWeizhang.setInsertTime(new Date());
cheliangWeizhang.setCreateTime(new Date());
cheliangWeizhangService.insert(cheliangWeizhang);
return R.ok();
}else {
if(cheliangWeizhangEntity.getCheliangWeizhangYesnoTypes()==1)
return R.error(511,"有相同的待审核的数据");
else if(cheliangWeizhangEntity.getCheliangWeizhangYesnoTypes()==2)
return R.error(511,"有相同的审核通过的数据");
else
return R.error(511,"表中有相同数据");
}
}
}
5.2 车辆违章Service模块
package com.service;
import com.baomidou.mybatisplus.service.IService;
import com.utils.PageUtils;
import com.entity.CheliangWeizhangEntity;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.lang.Nullable;
import java.util.List;
/**
* 车辆违章 服务类
*/
public interface CheliangWeizhangService extends IService<CheliangWeizhangEntity> {
/**
* @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.CheliangWeizhangDao;
import com.entity.CheliangWeizhangEntity;
import com.service.CheliangWeizhangService;
import com.entity.view.CheliangWeizhangView;
/**
* 车辆违章 服务实现类
*/
@Service("cheliangWeizhangService")
@Transactional
public class CheliangWeizhangServiceImpl extends ServiceImpl<CheliangWeizhangDao, CheliangWeizhangEntity> implements CheliangWeizhangService {
@Override
public PageUtils queryPage(Map<String,Object> params) {
Page<CheliangWeizhangView> page =new Query<CheliangWeizhangView>(params).getPage();
page.setRecords(baseMapper.selectListView(page,params));
return new PageUtils(page);
}
}
5.4 车辆违章Dao模块
package com.dao;
import com.entity.CheliangWeizhangEntity;
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.CheliangWeizhangView;
/**
* 车辆违章 Dao 接口
*
* @author
*/
public interface CheliangWeizhangDao extends BaseMapper<CheliangWeizhangEntity> {
List<CheliangWeizhangView> selectListView(Pagination page,@Param("params")Map<String,Object> params);
}
6、论文目录结构
7、源码获取
感谢大家的阅读,如有不懂的问题可以评论区交流或私聊!
喜欢文章可以点赞、收藏、关注、评论啦
→获取源码请私信←