"设计与实现基于SpringBoot的校园失物招领网站/平台/系统的计算机毕业设计:Java实战项目附带源码,文档和视频讲解"
博主介绍:✌从事软件开发10年之余,专注于Java技术领域、Python人工智能及数据挖掘、小程序项目开发和Android项目开发等。****、掘金、华为云、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 项目介绍
互联网日益成熟,走进千家万户,改变多个行业传统的工作方式。校园失物招领平台管理以失物信息和寻物启事为基础,借由发展迅猛的互联网平台实现校园失物招领管理的信息化,简化旧时校园失物招领所需的纸质记录这一繁杂过程,从而大幅提高校园失物招领信息获取与传播速度。
1.2 开发技术
Java开发语言、SpringBoot框架、MyBatisPlus、MySQL5.7数据库、Navicat数据库工具、Maven3.3.9包、IDEA开发工具、JDK1.8+、Vue。
2、系统功能设计结构
管理员:首页、个人中心、管理员管理、操作日志管理、基础数据管理、留言板管理、公告信息管理、失物信息管理、寻物启事管理、用户管理、轮播图管理。
用户:首页、个人中心、留言板、失物信息管理、寻物启事管理。
3、功能截图
3.1 前台功能
前端注册
前端登录
前端首页
留言板
公告信息
失物信息
寻物启事
个人中心
3.2 后台功能
登录
首页
个人中心
管理员管理
操作日志管理
基础数据管理
留言板管理
公告信息管理
失物信息管理
寻物启事管理
用户管理
轮播图管理
4、数据库表结构设计
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=4952 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 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=19 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 11:30:56'),(2,'sex_types','性别类型',2,'女',NULL,NULL,'2023-04-10 11:30:56'),(3,'jinyong_types','账户状态',1,'启用',NULL,NULL,'2023-04-10 11:30:56'),(4,'jinyong_types','账户状态',2,'禁用',NULL,NULL,'2023-04-10 11:30:56'),(5,'renlingzhuangtai_types','认领状态',1,'未认领',NULL,NULL,'2023-04-10 11:30:56'),(6,'renlingzhuangtai_types','认领状态',2,'已认领',NULL,NULL,'2023-04-10 11:30:56'),(7,'shiwuzhaoling_types','物品类型',1,'物品类型1',NULL,NULL,'2023-04-10 11:30:56'),(8,'shiwuzhaoling_types','物品类型',2,'物品类型2',NULL,NULL,'2023-04-10 11:30:56'),(9,'shiwuzhaoling_types','物品类型',3,'物品类型3',NULL,NULL,'2023-04-10 11:30:56'),(10,'shiwuzhaoling_yuyue_yesno_types','审核',1,'未审核',NULL,NULL,'2023-04-10 11:30:56'),(11,'shiwuzhaoling_yuyue_yesno_types','审核',2,'通过',NULL,NULL,'2023-04-10 11:30:56'),(12,'shiwuzhaoling_yuyue_yesno_types','审核',3,'拒绝',NULL,NULL,'2023-04-10 11:30:56'),(13,'news_types','公告类型',1,'公告类型1',NULL,NULL,'2023-04-10 11:30:56'),(14,'news_types','公告类型',2,'公告类型2',NULL,NULL,'2023-04-10 11:30:56'),(15,'news_types','公告类型',3,'公告类型3',NULL,NULL,'2023-04-10 11:30:56'),(16,'zhaohuizhuangtai_types','找回状态',1,'未找回',NULL,NULL,'2023-04-10 11:30:56'),(17,'zhaohuizhuangtai_types','找回状态',2,'已找回',NULL,NULL,'2023-04-10 11:30:56'),(18,'shiwuzhaoling_types','物品类型',4,'物品类型4',NULL,'','2023-04-10 14:06:33');
/*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-04-10 11:32:27','回复信息1','2023-04-10 11:32:27','2023-04-10 11:32:27'),(2,3,'留言标题2','留言内容2','2023-04-10 11:32:27','回复信息2','2023-04-10 11:32:27','2023-04-10 11:32:27'),(3,1,'留言标题3','留言内容3','2023-04-10 11:32:27','回复信息3','2023-04-10 11:32:27','2023-04-10 11:32:27'),(4,2,'留言标题4','留言内容4','2023-04-10 11:32:27','回复信息4','2023-04-10 11:32:27','2023-04-10 11:32:27'),(5,1,'留言标题5','留言内容5','2023-04-10 11:32:27','回复信息5','2023-04-10 11:32:27','2023-04-10 11:32:27'),(6,2,'留言标题6','留言内容6','2023-04-10 11:32:27','回复信息6','2023-04-10 11:32:27','2023-04-10 11:32:27'),(7,2,'留言标题7','留言内容7','2023-04-10 11:32:27','回复信息7','2023-04-10 11:32:27','2023-04-10 11:32:27'),(8,1,'留言标题8','留言内容8','2023-04-10 11:32:27','回复信息8','2023-04-10 11:32:27','2023-04-10 11:32:27'),(9,1,'留言标题9','留言内容9','2023-04-10 11:32:27','回复信息9','2023-04-10 11:32:27','2023-04-10 11:32:27'),(10,1,'留言标题10','留言内容10','2023-04-10 11:32:27','回复信息10','2023-04-10 11:32:27','2023-04-10 11:32:27'),(11,2,'留言标题11','留言内容11','2023-04-10 11:32:27','回复信息11','2023-04-10 11:32:27','2023-04-10 11:32:27'),(12,3,'留言标题12','留言内容12','2023-04-10 11:32:27','回复信息12','2023-04-10 11:32:27','2023-04-10 11:32:27'),(13,1,'留言标题13','留言内容13','2023-04-10 11:32:27','回复信息13','2023-04-10 11:32:27','2023-04-10 11:32:27'),(14,3,'留言标题14','留言内容14','2023-04-10 11:32:27','回复信息14','2023-04-10 11:32:27','2023-04-10 11:32:27'),(15,4,'标题撒发放','过大噶十多个和','2023-04-10 14:03:00','换个哈哈哈','2023-04-10 14:06:41','2023-04-10 14:03:00');
/*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 11:32:27','公告详情1','2023-04-10 11:32:27'),(2,'公告标题2',1,'upload/news2.jpg','2023-04-10 11:32:27','公告详情2','2023-04-10 11:32:27'),(3,'公告标题3',2,'upload/news3.jpg','2023-04-10 11:32:27','公告详情3','2023-04-10 11:32:27'),(4,'公告标题4',1,'upload/news4.jpg','2023-04-10 11:32:27','公告详情4','2023-04-10 11:32:27'),(5,'公告标题5',2,'upload/news5.jpg','2023-04-10 11:32:27','公告详情5','2023-04-10 11:32:27'),(6,'公告标题6',3,'upload/news6.jpg','2023-04-10 11:32:27','公告详情6','2023-04-10 11:32:27'),(7,'公告标题7',2,'upload/news7.jpg','2023-04-10 11:32:27','公告详情7','2023-04-10 11:32:27'),(8,'公告标题8',2,'upload/news8.jpg','2023-04-10 11:32:27','公告详情8','2023-04-10 11:32:27'),(9,'公告标题9',2,'upload/news9.jpg','2023-04-10 11:32:27','公告详情9','2023-04-10 11:32:27'),(10,'公告标题10',3,'upload/news10.jpg','2023-04-10 11:32:27','公告详情10','2023-04-10 11:32:27'),(11,'公告标题11',1,'upload/news11.jpg','2023-04-10 11:32:27','公告详情11','2023-04-10 11:32:27'),(12,'公告标题12',2,'upload/news12.jpg','2023-04-10 11:32:27','公告详情12','2023-04-10 11:32:27'),(13,'公告标题13',1,'upload/news13.jpg','2023-04-10 11:32:27','公告详情13','2023-04-10 11:32:27'),(14,'公告标题14',2,'upload/news14.jpg','2023-04-10 11:32:27','<p>公告详情14回答说个事孤独颂歌</p>','2023-04-10 11:32:27');
/*Table structure for table `shiwuzhaoling` */
DROP TABLE IF EXISTS `shiwuzhaoling`;
CREATE TABLE `shiwuzhaoling` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`shiwuzhaoling_uuid_number` varchar(200) DEFAULT NULL COMMENT '失物编号',
`shiwuzhaoling_name` varchar(200) DEFAULT NULL COMMENT '物品名称 Search111',
`shiwuzhaoling_types` int(11) DEFAULT NULL COMMENT '物品类型 Search111',
`renlingzhuangtai_types` int(11) DEFAULT NULL COMMENT '认领状态 Search111',
`yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
`shiwuzhaoling_photo` varchar(200) DEFAULT NULL COMMENT '物品图片',
`shiwuzhaoling_time` timestamp NULL DEFAULT NULL COMMENT '拾遗时间',
`shiwuzhaoling_dizhi` varchar(200) DEFAULT NULL COMMENT '拾遗地址 Search111',
`shiwuzhaoling_content` text COMMENT '详情',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 photoShow',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 COMMENT='失物信息';
/*Data for the table `shiwuzhaoling` */
insert into `shiwuzhaoling`(`id`,`shiwuzhaoling_uuid_number`,`shiwuzhaoling_name`,`shiwuzhaoling_types`,`renlingzhuangtai_types`,`yonghu_id`,`shiwuzhaoling_photo`,`shiwuzhaoling_time`,`shiwuzhaoling_dizhi`,`shiwuzhaoling_content`,`create_time`) values (1,'1681097547381','物品名称1',2,1,2,'upload/shiwuzhaoling1.jpg','2023-04-10 11:32:27','拾遗地址1','详情1','2023-04-10 11:32:27'),(2,'1681097547375','物品名称2',1,2,1,'upload/shiwuzhaoling2.jpg','2023-04-10 11:32:27','拾遗地址2','详情2','2023-04-10 11:32:27'),(3,'1681097547319','物品名称3',1,1,1,'upload/shiwuzhaoling3.jpg','2023-04-10 11:32:27','拾遗地址3','详情3','2023-04-10 11:32:27'),(4,'1681097547329','物品名称4',1,1,3,'upload/shiwuzhaoling4.jpg','2023-04-10 11:32:27','拾遗地址4','详情4','2023-04-10 11:32:27'),(5,'1681097547318','物品名称5',2,1,2,'upload/shiwuzhaoling5.jpg','2023-04-10 11:32:27','拾遗地址5','详情5','2023-04-10 11:32:27'),(6,'1681097547325','物品名称6',2,1,1,'upload/shiwuzhaoling6.jpg','2023-04-10 11:32:27','拾遗地址6','详情6','2023-04-10 11:32:27'),(7,'1681097547371','物品名称7',2,1,3,'upload/shiwuzhaoling7.jpg','2023-04-10 11:32:27','拾遗地址7','详情7','2023-04-10 11:32:27'),(8,'1681097547304','物品名称8',1,1,2,'upload/shiwuzhaoling8.jpg','2023-04-10 11:32:27','拾遗地址8','详情8','2023-04-10 11:32:27'),(9,'1681097547385','物品名称9',2,1,2,'upload/shiwuzhaoling9.jpg','2023-04-10 11:32:27','拾遗地址9','详情9','2023-04-10 11:32:27'),(10,'1681097547375','物品名称10',1,1,3,'upload/shiwuzhaoling10.jpg','2023-04-10 11:32:27','拾遗地址10','详情10','2023-04-10 11:32:27'),(11,'1681097547339','物品名称11',3,2,1,'upload/shiwuzhaoling11.jpg','2023-04-10 11:32:27','拾遗地址11','详情11','2023-04-10 11:32:27'),(12,'1681097547331','物品名称12',3,1,1,'upload/shiwuzhaoling12.jpg','2023-04-10 11:32:27','拾遗地址12','详情12','2023-04-10 11:32:27'),(13,'1681097547330','物品名称13',1,1,3,'upload/shiwuzhaoling13.jpg','2023-04-10 11:32:27','拾遗地址13','详情13广大发给','2023-04-10 11:32:27'),(14,'1681097547368','物品名称14',3,2,1,'upload/shiwuzhaoling14.jpg','2023-04-10 11:32:27','拾遗地址14','详情14','2023-04-10 11:32:27'),(15,'1681106622402','物品1111',1,1,4,'upload/1681106631201.jpg','2023-04-10 15:00:00','地址111','嘎大师的撒发','2023-04-10 14:04:03');
/*Table structure for table `shiwuzhaoling_yuyue` */
DROP TABLE IF EXISTS `shiwuzhaoling_yuyue`;
CREATE TABLE `shiwuzhaoling_yuyue` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`shiwuzhaoling_id` int(11) DEFAULT NULL COMMENT '失物id',
`yonghu_id` int(11) DEFAULT NULL COMMENT '认领用户',
`shiwuzhaoling_yuyue_text` text COMMENT '认领凭证',
`shiwuzhaoling_yuyue_yesno_types` int(11) DEFAULT NULL COMMENT '审核',
`shiwuzhaoling_yuyue_yesno_text` 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 `shiwuzhaoling_yuyue` */
insert into `shiwuzhaoling_yuyue`(`id`,`shiwuzhaoling_id`,`yonghu_id`,`shiwuzhaoling_yuyue_text`,`shiwuzhaoling_yuyue_yesno_types`,`shiwuzhaoling_yuyue_yesno_text`,`insert_time`,`create_time`) values (1,1,3,'认领凭证1',1,NULL,'2023-04-10 11:32:27','2023-04-10 11:32:27'),(2,2,2,'认领凭证2',1,NULL,'2023-04-10 11:32:27','2023-04-10 11:32:27'),(3,3,1,'认领凭证3',1,NULL,'2023-04-10 11:32:27','2023-04-10 11:32:27'),(4,4,2,'认领凭证4',1,NULL,'2023-04-10 11:32:27','2023-04-10 11:32:27'),(5,5,3,'认领凭证5',1,NULL,'2023-04-10 11:32:27','2023-04-10 11:32:27'),(6,6,3,'认领凭证6',1,NULL,'2023-04-10 11:32:27','2023-04-10 11:32:27'),(7,7,2,'认领凭证7',1,NULL,'2023-04-10 11:32:27','2023-04-10 11:32:27'),(8,8,1,'认领凭证8',1,NULL,'2023-04-10 11:32:27','2023-04-10 11:32:27'),(9,9,1,'认领凭证9',1,NULL,'2023-04-10 11:32:27','2023-04-10 11:32:27'),(10,10,1,'认领凭证12',3,'是打发点三分大赛','2023-04-10 11:32:27','2023-04-10 11:32:27'),(11,11,1,'认领凭证11',1,NULL,'2023-04-10 11:32:27','2023-04-10 11:32:27'),(12,12,2,'认领凭证12',1,NULL,'2023-04-10 11:32:27','2023-04-10 11:32:27'),(13,13,2,'认领凭证12',3,'和第三个十多个','2023-04-10 11:32:27','2023-04-10 11:32:27'),(14,14,2,'认领凭证14',2,'哼哼唧唧','2023-04-10 11:32:27','2023-04-10 11:32:27'),(16,13,3,'认领凭证12',2,'高大上放荡','2023-04-10 13:03:39','2023-04-10 13:03:39'),(17,13,4,'个水电费第三方收发',1,NULL,'2023-04-10 14:03:11','2023-04-10 14:03:11');
/*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=5 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','管理员','coshuee1z4c8k8nyyn90uh4f98cd5hh8','2023-04-10 11:50:44','2023-04-10 15:10:21'),(2,3,'a3','yonghu','用户','e5k26vdv7sus82j02j4hr3ulwwubs8zn','2023-04-10 13:03:28','2023-04-10 14:03:28'),(3,4,'a5','yonghu','用户','miiv4had44j1nsykwp0ocu05znxbbmec','2023-04-10 14:02:37','2023-04-10 15:02:37'),(4,1,'a1','yonghu','用户','g2rc9vgll9wmv1ra3disbthpfs35s6es','2023-04-10 14:05:23','2023-04-10 15:05:24');
/*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 11:30:56');
/*Table structure for table `xunwuqishi` */
DROP TABLE IF EXISTS `xunwuqishi`;
CREATE TABLE `xunwuqishi` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`xunwuqishi_name` varchar(200) DEFAULT NULL COMMENT '物品名称 Search111',
`shiwuzhaoling_types` int(11) DEFAULT NULL COMMENT '物品类型 Search111',
`zhaohuizhuangtai_types` int(11) DEFAULT NULL COMMENT '找回状态 Search111',
`xunwuqishi_photo` varchar(200) DEFAULT NULL COMMENT '物品图片',
`xunwuqishi_time` timestamp NULL DEFAULT NULL COMMENT '丢失时间',
`yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
`xunwuqishi_dizhi` varchar(200) DEFAULT NULL COMMENT '丢失地址',
`xunwuqishi_content` text COMMENT '详情',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 photoShow',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8 COMMENT='寻物启事';
/*Data for the table `xunwuqishi` */
insert into `xunwuqishi`(`id`,`xunwuqishi_name`,`shiwuzhaoling_types`,`zhaohuizhuangtai_types`,`xunwuqishi_photo`,`xunwuqishi_time`,`yonghu_id`,`xunwuqishi_dizhi`,`xunwuqishi_content`,`create_time`) values (1,'物品名称1',2,2,'upload/xunwuqishi1.jpg','2023-04-10 11:32:27',3,'丢失地址1','详情1','2023-04-10 11:32:27'),(2,'物品名称2',1,2,'upload/xunwuqishi2.jpg','2023-04-10 11:32:27',2,'丢失地址2','详情2','2023-04-10 11:32:27'),(3,'物品名称3',2,2,'upload/xunwuqishi3.jpg','2023-04-10 11:32:27',3,'丢失地址3','详情3','2023-04-10 11:32:27'),(4,'物品名称4',1,2,'upload/xunwuqishi4.jpg','2023-04-10 11:32:27',3,'丢失地址4','详情4','2023-04-10 11:32:27'),(5,'物品名称5',3,2,'upload/xunwuqishi5.jpg','2023-04-10 11:32:27',2,'丢失地址5','详情5','2023-04-10 11:32:27'),(6,'物品名称6',2,2,'upload/xunwuqishi6.jpg','2023-04-10 11:32:27',1,'丢失地址6','详情6','2023-04-10 11:32:27'),(7,'物品名称7',1,1,'upload/xunwuqishi7.jpg','2023-04-10 11:32:27',1,'丢失地址7','详情7','2023-04-10 11:32:27'),(8,'物品名称8',1,1,'upload/xunwuqishi8.jpg','2023-04-10 11:32:27',3,'丢失地址8','详情8','2023-04-10 11:32:27'),(9,'物品名称9',1,2,'upload/xunwuqishi9.jpg','2023-04-10 11:32:27',3,'丢失地址9','详情9','2023-04-10 11:32:27'),(10,'物品名称10',1,2,'upload/xunwuqishi10.jpg','2023-04-10 11:32:27',1,'丢失地址10','详情10','2023-04-10 11:32:27'),(11,'物品名称11',2,1,'upload/xunwuqishi11.jpg','2023-04-10 11:32:27',2,'丢失地址11','详情11','2023-04-10 11:32:27'),(12,'物品名称12',1,2,'upload/xunwuqishi12.jpg','2023-04-10 11:32:27',3,'丢失地址12','详情12','2023-04-10 11:32:27'),(13,'物品名称13',2,2,'upload/xunwuqishi13.jpg','2023-04-10 11:32:27',1,'丢失地址13','详情13','2023-04-10 11:32:27'),(14,'物品名称14',1,1,'upload/xunwuqishi14.jpg','2023-04-10 11:32:27',2,'丢失地址14','详情14','2023-04-10 11:32:27'),(16,'物品杀神风',3,1,'upload/1681106687257.jpg','2023-04-10 14:04:39',4,'地址都是干湿讽德诵功','回复是感受到覆盖合肥市和','2023-04-10 14:04:58');
/*Table structure for table `xunwuqishi_liuyan` */
DROP TABLE IF EXISTS `xunwuqishi_liuyan`;
CREATE TABLE `xunwuqishi_liuyan` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`xunwuqishi_id` int(11) DEFAULT NULL COMMENT '物品',
`yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
`xunwuqishi_liuyan_text` text COMMENT '留言内容',
`reply_text` text COMMENT '回复内容',
`insert_time` timestamp NULL DEFAULT NULL COMMENT '留言时间',
`update_time` timestamp NULL DEFAULT NULL COMMENT '回复时间',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show3 listShow',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8 COMMENT='寻物启事留言';
/*Data for the table `xunwuqishi_liuyan` */
insert into `xunwuqishi_liuyan`(`id`,`xunwuqishi_id`,`yonghu_id`,`xunwuqishi_liuyan_text`,`reply_text`,`insert_time`,`update_time`,`create_time`) values (1,1,3,'留言内容1','回复信息1','2023-04-10 11:32:27','2023-04-10 11:32:27','2023-04-10 11:32:27'),(2,2,3,'留言内容2','回复信息2','2023-04-10 11:32:27','2023-04-10 11:32:27','2023-04-10 11:32:27'),(3,3,1,'留言内容3','回复信息3','2023-04-10 11:32:27','2023-04-10 11:32:27','2023-04-10 11:32:27'),(4,4,2,'留言内容4','回复信息4','2023-04-10 11:32:27','2023-04-10 11:32:27','2023-04-10 11:32:27'),(5,5,1,'留言内容5','回复信息5','2023-04-10 11:32:27','2023-04-10 11:32:27','2023-04-10 11:32:27'),(6,6,3,'留言内容6','回复信息6','2023-04-10 11:32:27','2023-04-10 11:32:27','2023-04-10 11:32:27'),(7,7,2,'留言内容7','回复信息7','2023-04-10 11:32:27','2023-04-10 11:32:27','2023-04-10 11:32:27'),(8,8,3,'留言内容8','回复信息8','2023-04-10 11:32:27','2023-04-10 11:32:27','2023-04-10 11:32:27'),(9,9,1,'留言内容9','回复信息9','2023-04-10 11:32:27','2023-04-10 11:32:27','2023-04-10 11:32:27'),(10,10,3,'留言内容10','回复信息10','2023-04-10 11:32:27','2023-04-10 11:32:27','2023-04-10 11:32:27'),(11,11,1,'留言内容11','回复信息11','2023-04-10 11:32:27','2023-04-10 11:32:27','2023-04-10 11:32:27'),(12,12,2,'留言内容12','回复信息12高公公','2023-04-10 11:32:27','2023-04-10 13:33:09','2023-04-10 11:32:27'),(13,13,2,'留言内容13','回复信息13个哈哈哈','2023-04-10 11:32:27','2023-04-10 14:05:46','2023-04-10 11:32:27'),(14,14,1,'留言内容14','回复信息14','2023-04-10 11:32:27','2023-04-10 11:32:27','2023-04-10 11:32:27'),(16,11,4,'和第三方的是个哈哈',NULL,'2023-04-10 14:03:34',NULL,'2023-04-10 14:03:34');
/*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_uuid_number` varchar(200) DEFAULT NULL COMMENT '用户编号 Search111 ',
`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 '用户邮箱',
`jinyong_types` int(11) DEFAULT NULL COMMENT '账户状态 Search111 ',
`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_uuid_number`,`yonghu_name`,`yonghu_phone`,`yonghu_id_number`,`yonghu_photo`,`sex_types`,`yonghu_email`,`jinyong_types`,`create_time`) values (1,'a1','123456','1681097547302','用户姓名1','17703786901','410224199010102001','upload/yonghu1.jpg',2,'1@qq.com',1,'2023-04-10 11:32:27'),(2,'a2','123456','1681097547330','用户姓名2','17703786902','410224199010102002','upload/yonghu2.jpg',1,'2@qq.com',1,'2023-04-10 11:32:27'),(3,'a3','123456','1681097547308','用户姓名3','17703786903','410224199010102003','upload/yonghu3.jpg',2,'3@qq.com',1,'2023-04-10 11:32:27'),(4,'a5','123456','1681106552230','张5','17788889999','444555888899999999','upload/1681106564008.jpg',1,'5@qq.com',2,'2023-04-10 14:02:32');
/*!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模块
package com.controller;
import java.io.File;
import java.math.BigDecimal;
import java.net.URL;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.JSONObject;
import java.util.*;
import org.springframework.beans.BeanUtils;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.ContextLoader;
import javax.servlet.ServletContext;
import com.service.TokenService;
import com.utils.*;
import java.lang.reflect.InvocationTargetException;
import com.service.DictionaryService;
import org.apache.commons.lang3.StringUtils;
import com.annotation.IgnoreAuth;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.*;
import com.entity.view.*;
import com.service.*;
import com.utils.PageUtils;
import com.utils.R;
import com.alibaba.fastjson.*;
/**
* 失物信息
* 后端接口
* @author
* @email
*/
@RestController
@Controller
@RequestMapping("/shiwuzhaoling")
public class ShiwuzhaolingController {
private static final Logger logger = LoggerFactory.getLogger(ShiwuzhaolingController.class);
private static final String TABLE_NAME = "shiwuzhaoling";
@Autowired
private ShiwuzhaolingService shiwuzhaolingService;
@Autowired
private TokenService tokenService;
@Autowired
private CaozuorizhiService caozuorizhiService;//操作日志
@Autowired
private DictionaryService dictionaryService;//字典
@Autowired
private LiuyanService liuyanService;//留言板
@Autowired
private NewsService newsService;//公告信息
@Autowired
private ShiwuzhaolingYuyueService shiwuzhaolingYuyueService;//失物认领
@Autowired
private XunwuqishiService xunwuqishiService;//寻物启事
@Autowired
private XunwuqishiLiuyanService xunwuqishiLiuyanService;//寻物启事留言
@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 = shiwuzhaolingService.queryPage(params);
//字典表数据转换
List<ShiwuzhaolingView> list =(List<ShiwuzhaolingView>)page.getList();
for(ShiwuzhaolingView 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);
ShiwuzhaolingEntity shiwuzhaoling = shiwuzhaolingService.selectById(id);
if(shiwuzhaoling !=null){
//entity转view
ShiwuzhaolingView view = new ShiwuzhaolingView();
BeanUtils.copyProperties( shiwuzhaoling , view );//把实体数据重构到view中
//级联表 用户
//级联表
YonghuEntity yonghu = yonghuService.selectById(shiwuzhaoling.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);
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 ShiwuzhaolingEntity shiwuzhaoling, HttpServletRequest request){
logger.debug("save方法:,,Controller:{},,shiwuzhaoling:{}",this.getClass().getName(),shiwuzhaoling.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
if(false)
return R.error(511,"永远不会进入");
else if("用户".equals(role))
shiwuzhaoling.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
Wrapper<ShiwuzhaolingEntity> queryWrapper = new EntityWrapper<ShiwuzhaolingEntity>()
.eq("shiwuzhaoling_name", shiwuzhaoling.getShiwuzhaolingName())
.eq("shiwuzhaoling_types", shiwuzhaoling.getShiwuzhaolingTypes())
.eq("renlingzhuangtai_types", shiwuzhaoling.getRenlingzhuangtaiTypes())
.eq("yonghu_id", shiwuzhaoling.getYonghuId())
.eq("shiwuzhaoling_dizhi", shiwuzhaoling.getShiwuzhaolingDizhi())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
ShiwuzhaolingEntity shiwuzhaolingEntity = shiwuzhaolingService.selectOne(queryWrapper);
if(shiwuzhaolingEntity==null){
shiwuzhaoling.setCreateTime(new Date());
shiwuzhaolingService.insert(shiwuzhaoling);
caozuorizhiService.insertCaozuorizhi(String.valueOf(request.getSession().getAttribute("role")),TABLE_NAME,String.valueOf(request.getSession().getAttribute("username")),"新增",shiwuzhaoling.toString());
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
/**
* 后端修改
*/
@RequestMapping("/update")
public R update(@RequestBody ShiwuzhaolingEntity shiwuzhaoling, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {
logger.debug("update方法:,,Controller:{},,shiwuzhaoling:{}",this.getClass().getName(),shiwuzhaoling.toString());
ShiwuzhaolingEntity oldShiwuzhaolingEntity = shiwuzhaolingService.selectById(shiwuzhaoling.getId());//查询原先数据
String role = String.valueOf(request.getSession().getAttribute("role"));
// if(false)
// return R.error(511,"永远不会进入");
// else if("用户".equals(role))
// shiwuzhaoling.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
if("".equals(shiwuzhaoling.getShiwuzhaolingPhoto()) || "null".equals(shiwuzhaoling.getShiwuzhaolingPhoto())){
shiwuzhaoling.setShiwuzhaolingPhoto(null);
}
shiwuzhaolingService.updateById(shiwuzhaoling);//根据id更新
List<String> strings = caozuorizhiService.clazzDiff(shiwuzhaoling, oldShiwuzhaolingEntity, 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<ShiwuzhaolingEntity> oldShiwuzhaolingList =shiwuzhaolingService.selectBatchIds(Arrays.asList(ids));//要删除的数据
shiwuzhaolingService.deleteBatchIds(Arrays.asList(ids));
caozuorizhiService.insertCaozuorizhi(String.valueOf(request.getSession().getAttribute("role")),TABLE_NAME,String.valueOf(request.getSession().getAttribute("username")),"删除",oldShiwuzhaolingList.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<ShiwuzhaolingEntity> shiwuzhaolingList = 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){
//循环
ShiwuzhaolingEntity shiwuzhaolingEntity = new ShiwuzhaolingEntity();
// shiwuzhaolingEntity.setShiwuzhaolingUuidNumber(data.get(0)); //失物编号 要改的
// shiwuzhaolingEntity.setShiwuzhaolingName(data.get(0)); //物品名称 要改的
// shiwuzhaolingEntity.setShiwuzhaolingTypes(Integer.valueOf(data.get(0))); //物品类型 要改的
// shiwuzhaolingEntity.setRenlingzhuangtaiTypes(Integer.valueOf(data.get(0))); //认领状态 要改的
// shiwuzhaolingEntity.setYonghuId(Integer.valueOf(data.get(0))); //用户 要改的
// shiwuzhaolingEntity.setShiwuzhaolingPhoto("");//详情和图片
// shiwuzhaolingEntity.setShiwuzhaolingTime(sdf.parse(data.get(0))); //拾遗时间 要改的
// shiwuzhaolingEntity.setShiwuzhaolingDizhi(data.get(0)); //拾遗地址 要改的
// shiwuzhaolingEntity.setShiwuzhaolingContent("");//详情和图片
// shiwuzhaolingEntity.setCreateTime(date);//时间
shiwuzhaolingList.add(shiwuzhaolingEntity);
//把要查询是否重复的字段放入map中
//失物编号
if(seachFields.containsKey("shiwuzhaolingUuidNumber")){
List<String> shiwuzhaolingUuidNumber = seachFields.get("shiwuzhaolingUuidNumber");
shiwuzhaolingUuidNumber.add(data.get(0));//要改的
}else{
List<String> shiwuzhaolingUuidNumber = new ArrayList<>();
shiwuzhaolingUuidNumber.add(data.get(0));//要改的
seachFields.put("shiwuzhaolingUuidNumber",shiwuzhaolingUuidNumber);
}
}
//查询是否重复
//失物编号
List<ShiwuzhaolingEntity> shiwuzhaolingEntities_shiwuzhaolingUuidNumber = shiwuzhaolingService.selectList(new EntityWrapper<ShiwuzhaolingEntity>().in("shiwuzhaoling_uuid_number", seachFields.get("shiwuzhaolingUuidNumber")));
if(shiwuzhaolingEntities_shiwuzhaolingUuidNumber.size() >0 ){
ArrayList<String> repeatFields = new ArrayList<>();
for(ShiwuzhaolingEntity s:shiwuzhaolingEntities_shiwuzhaolingUuidNumber){
repeatFields.add(s.getShiwuzhaolingUuidNumber());
}
return R.error(511,"数据库的该表中的 [失物编号] 字段已经存在 存在数据为:"+repeatFields.toString());
}
shiwuzhaolingService.insertBatch(shiwuzhaolingList);
caozuorizhiService.insertCaozuorizhi(String.valueOf(request.getSession().getAttribute("role")),TABLE_NAME,String.valueOf(request.getSession().getAttribute("username")),"批量新增",shiwuzhaolingList.toString());
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 = shiwuzhaolingService.queryPage(params);
//字典表数据转换
List<ShiwuzhaolingView> list =(List<ShiwuzhaolingView>)page.getList();
for(ShiwuzhaolingView 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("/detail/{id}")
public R detail(@PathVariable("id") Long id, HttpServletRequest request){
logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
ShiwuzhaolingEntity shiwuzhaoling = shiwuzhaolingService.selectById(id);
if(shiwuzhaoling !=null){
//entity转view
ShiwuzhaolingView view = new ShiwuzhaolingView();
BeanUtils.copyProperties( shiwuzhaoling , view );//把实体数据重构到view中
//级联表
YonghuEntity yonghu = yonghuService.selectById(shiwuzhaoling.getYonghuId());
if(yonghu != null){
BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
view.setYonghuId(yonghu.getId());
}
//修改对应字典表字段
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("/add")
public R add(@RequestBody ShiwuzhaolingEntity shiwuzhaoling, HttpServletRequest request){
logger.debug("add方法:,,Controller:{},,shiwuzhaoling:{}",this.getClass().getName(),shiwuzhaoling.toString());
Wrapper<ShiwuzhaolingEntity> queryWrapper = new EntityWrapper<ShiwuzhaolingEntity>()
.eq("shiwuzhaoling_uuid_number", shiwuzhaoling.getShiwuzhaolingUuidNumber())
.eq("shiwuzhaoling_name", shiwuzhaoling.getShiwuzhaolingName())
.eq("shiwuzhaoling_types", shiwuzhaoling.getShiwuzhaolingTypes())
.eq("renlingzhuangtai_types", shiwuzhaoling.getRenlingzhuangtaiTypes())
.eq("yonghu_id", shiwuzhaoling.getYonghuId())
.eq("shiwuzhaoling_dizhi", shiwuzhaoling.getShiwuzhaolingDizhi())
// .notIn("shiwuzhaoling_types", new Integer[]{102})
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
ShiwuzhaolingEntity shiwuzhaolingEntity = shiwuzhaolingService.selectOne(queryWrapper);
if(shiwuzhaolingEntity==null){
shiwuzhaoling.setCreateTime(new Date());
shiwuzhaolingService.insert(shiwuzhaoling);
caozuorizhiService.insertCaozuorizhi(String.valueOf(request.getSession().getAttribute("role")),TABLE_NAME,String.valueOf(request.getSession().getAttribute("username")),"前台新增",shiwuzhaoling.toString());
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.ShiwuzhaolingEntity;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.lang.Nullable;
import java.util.List;
/**
* 失物信息 服务类
*/
public interface ShiwuzhaolingService extends IService<ShiwuzhaolingEntity> {
/**
* @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.ShiwuzhaolingDao;
import com.entity.ShiwuzhaolingEntity;
import com.service.ShiwuzhaolingService;
import com.entity.view.ShiwuzhaolingView;
/**
* 失物信息 服务实现类
*/
@Service("shiwuzhaolingService")
@Transactional
public class ShiwuzhaolingServiceImpl extends ServiceImpl<ShiwuzhaolingDao, ShiwuzhaolingEntity> implements ShiwuzhaolingService {
@Override
public PageUtils queryPage(Map<String,Object> params) {
Page<ShiwuzhaolingView> page =new Query<ShiwuzhaolingView>(params).getPage();
page.setRecords(baseMapper.selectListView(page,params));
return new PageUtils(page);
}
}
5.4 失物招领管理Dao模块
package com.dao;
import com.entity.ShiwuzhaolingEntity;
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.ShiwuzhaolingView;
/**
* 失物信息 Dao 接口
*
* @author
*/
public interface ShiwuzhaolingDao extends BaseMapper<ShiwuzhaolingEntity> {
List<ShiwuzhaolingView> selectListView(Pagination page,@Param("params")Map<String,Object> params);
}
6、论文目录结构
7、源码获取
感谢大家的阅读,如有不懂的问题可以评论区交流或私聊!
喜欢文章可以点赞、收藏、关注、评论啦
→获取源码请私信←
上一篇: 不安的青春,放荡的年华
下一篇: 积极付出必有回报,踏入字节的故事还在继续