博主介紹:?從事軟件開發(fā)10年之余,專注于Java技術(shù)領(lǐng)域、Python人工智能及數(shù)據(jù)挖掘、小程序項(xiàng)目開發(fā)和Android項(xiàng)目開發(fā)等。CSDN、掘金、華為云、InfoQ、阿里云等平臺(tái)優(yōu)質(zhì)作者?
??文末獲取源碼聯(lián)系??
???? 精彩專欄推薦訂閱???? 不然下次找不到喲
————————————————
計(jì)算機(jī)畢業(yè)設(shè)計(jì)《1000套》?
目錄
1、項(xiàng)目介紹及開發(fā)技術(shù)
1.1 項(xiàng)目介紹
1.2 開發(fā)技術(shù)
2、系統(tǒng)功能設(shè)計(jì)結(jié)構(gòu)圖
3、功能截圖
4、數(shù)據(jù)庫表結(jié)構(gòu)設(shè)計(jì)
5、關(guān)鍵代碼
5.1 文物Controller模塊?
5.2 文物Service模塊?
5.3 文物ServiceImpl模塊
5.4 文物Dao模塊
6、論文目錄結(jié)構(gòu)
7、源碼獲取
1、項(xiàng)目介紹及開發(fā)技術(shù)
1.1 項(xiàng)目介紹
傳統(tǒng)辦法管理信息首先需要花費(fèi)的時(shí)間比較多,其次數(shù)據(jù)出錯(cuò)率比較高,而且對(duì)錯(cuò)誤的數(shù)據(jù)進(jìn)行更改也比較困難,最后,檢索數(shù)據(jù)費(fèi)事費(fèi)力。因此,在計(jì)算機(jī)上安裝紅色革命文物征集管理系統(tǒng)軟件來發(fā)揮其高效地信息處理的作用,可以規(guī)范信息管理流程,讓管理工作可以系統(tǒng)化和程序化,同時(shí),紅色革命文物征集管理系統(tǒng)的有效運(yùn)用可以幫助管理人員準(zhǔn)確快速地處理信息。
紅色革命文物征集管理系統(tǒng)在對(duì)開發(fā)工具的選擇上也很慎重,為了便于開發(fā)實(shí)現(xiàn),選擇的開發(fā)工具為Eclipse,選擇的數(shù)據(jù)庫工具為Mysql。以此搭建開發(fā)環(huán)境實(shí)現(xiàn)紅色革命文物征集管理系統(tǒng)的功能。其中管理員管理用戶,新聞公告。
紅色革命文物征集管理系統(tǒng)是一款運(yùn)用軟件開發(fā)技術(shù)設(shè)計(jì)實(shí)現(xiàn)的應(yīng)用系統(tǒng),在信息處理上可以達(dá)到快速的目的,不管是針對(duì)數(shù)據(jù)添加,數(shù)據(jù)維護(hù)和統(tǒng)計(jì),以及數(shù)據(jù)查詢等處理要求,紅色革命文物征集管理系統(tǒng)都可以輕松應(yīng)對(duì)。
1.2 開發(fā)技術(shù)
Java開發(fā)語言、SpringBoot、MyBatisPlus、MySQL數(shù)據(jù)庫、Maven、IDEA開發(fā)工具、JDK1.8+、Vue、HTML、CSS、JS。
2、系統(tǒng)功能設(shè)計(jì)結(jié)構(gòu)圖
3、功能截圖
用戶信息:用戶信息的查詢管理,可以刪除用戶信息、修改用戶信息、新增用戶信息,還進(jìn)行了對(duì)用戶名稱的模糊查詢的條件。
?文物信息管理:查看已發(fā)布的文物信息數(shù)據(jù),修改文物信息,文物信息作廢,即可刪除,還進(jìn)行了對(duì)文物信息名稱的模糊查詢 文物信息信息的類型查詢等等一些條件。
論壇信息管理:根據(jù)論壇信息進(jìn)行條件查詢,還可以對(duì)論壇信息進(jìn)行新增、修改、查詢操作等等。
公告信息管理:?根據(jù)公告信息進(jìn)行新增、修改、查詢操作等等。
4、數(shù)據(jù)庫表結(jié)構(gòu)設(shè)計(jì)
CREATE DATABASE /*!32312 IF NOT EXISTS*/`hongshegemingwenwu` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `hongshegemingwenwu`;
/*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 '配置參數(shù)名稱',
`value` varchar(100) DEFAULT NULL COMMENT '配置參數(shù)值',
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 '創(chuàng)建時(shí)間',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=17 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,'wenwu_types','文物類型',1,'文物類型1',NULL,NULL,'2023-04-07 09:28:32'),(2,'wenwu_types','文物類型',2,'文物類型2',NULL,NULL,'2023-04-07 09:28:32'),(3,'wenwu_types','文物類型',3,'文物類型3',NULL,NULL,'2023-04-07 09:28:32'),(4,'wenwu_yesno_types','信息審核',1,'待審核',NULL,NULL,'2023-04-07 09:28:32'),(5,'wenwu_yesno_types','信息審核',2,'同意',NULL,NULL,'2023-04-07 09:28:32'),(6,'wenwu_yesno_types','信息審核',3,'拒絕',NULL,NULL,'2023-04-07 09:28:32'),(7,'wenwu_collection_types','收藏表類型',1,'收藏',NULL,NULL,'2023-04-07 09:28:32'),(8,'wenwu_collection_types','收藏表類型',2,'贊',NULL,NULL,'2023-04-07 09:28:32'),(9,'wenwu_collection_types','收藏表類型',3,'踩',NULL,NULL,'2023-04-07 09:28:32'),(10,'news_types','公告類型',1,'公告類型1',NULL,NULL,'2023-04-07 09:28:32'),(11,'news_types','公告類型',2,'公告類型2',NULL,NULL,'2023-04-07 09:28:32'),(12,'news_types','公告類型',3,'公告類型3',NULL,NULL,'2023-04-07 09:28:32'),(13,'sex_types','性別類型',1,'男',NULL,NULL,'2023-04-07 09:28:32'),(14,'sex_types','性別類型',2,'女',NULL,NULL,'2023-04-07 09:28:32'),(15,'forum_state_types','帖子狀態(tài)',1,'發(fā)帖',NULL,NULL,'2023-04-07 09:28:32'),(16,'forum_state_types','帖子狀態(tài)',2,'回帖',NULL,NULL,'2023-04-07 09:28:32');
/*Table structure for table `forum` */
DROP TABLE IF EXISTS `forum`;
CREATE TABLE `forum` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主鍵',
`forum_name` varchar(200) DEFAULT NULL COMMENT '帖子標(biāo)題 Search111 ',
`yonghu_id` int(11) DEFAULT NULL COMMENT '用戶',
`gongzuo_id` int(11) DEFAULT NULL COMMENT '工作人員',
`users_id` int(11) DEFAULT NULL COMMENT '管理員',
`forum_content` longtext COMMENT '發(fā)布內(nèi)容',
`super_ids` int(11) DEFAULT NULL COMMENT '父id',
`forum_state_types` int(11) DEFAULT NULL COMMENT '帖子狀態(tài)',
`insert_time` timestamp NULL DEFAULT NULL COMMENT '發(fā)帖時(shí)間',
`update_time` timestamp NULL DEFAULT NULL COMMENT '修改時(shí)間',
`create_time` timestamp NULL DEFAULT NULL COMMENT '創(chuàng)建時(shí)間 show2',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8 COMMENT='論壇';
/*Data for the table `forum` */
insert into `forum`(`id`,`forum_name`,`yonghu_id`,`gongzuo_id`,`users_id`,`forum_content`,`super_ids`,`forum_state_types`,`insert_time`,`update_time`,`create_time`) values (1,'帖子標(biāo)題1',1,NULL,NULL,'發(fā)布內(nèi)容1',487,1,'2023-04-07 09:28:45','2023-04-07 09:28:45','2023-04-07 09:28:45'),(2,'帖子標(biāo)題2',3,NULL,NULL,'發(fā)布內(nèi)容2',462,1,'2023-04-07 09:28:45','2023-04-07 09:28:45','2023-04-07 09:28:45'),(3,'帖子標(biāo)題3',1,NULL,NULL,'發(fā)布內(nèi)容3',49,1,'2023-04-07 09:28:45','2023-04-07 09:28:45','2023-04-07 09:28:45'),(4,'帖子標(biāo)題4',2,NULL,NULL,'發(fā)布內(nèi)容4',403,1,'2023-04-07 09:28:45','2023-04-07 09:28:45','2023-04-07 09:28:45'),(5,'帖子標(biāo)題5',3,NULL,NULL,'發(fā)布內(nèi)容5',427,1,'2023-04-07 09:28:45','2023-04-07 09:28:45','2023-04-07 09:28:45'),(6,'帖子標(biāo)題6',1,NULL,NULL,'發(fā)布內(nèi)容6',253,1,'2023-04-07 09:28:45','2023-04-07 09:28:45','2023-04-07 09:28:45'),(7,'帖子標(biāo)題7',2,NULL,NULL,'發(fā)布內(nèi)容7',306,1,'2023-04-07 09:28:45','2023-04-07 09:28:45','2023-04-07 09:28:45'),(8,'帖子標(biāo)題8',1,NULL,NULL,'發(fā)布內(nèi)容8',470,1,'2023-04-07 09:28:45','2023-04-07 09:28:45','2023-04-07 09:28:45'),(9,'帖子標(biāo)題9',2,NULL,NULL,'發(fā)布內(nèi)容9',406,1,'2023-04-07 09:28:45','2023-04-07 09:28:45','2023-04-07 09:28:45'),(10,'帖子標(biāo)題10',3,NULL,NULL,'發(fā)布內(nèi)容10',344,1,'2023-04-07 09:28:45','2023-04-07 09:28:45','2023-04-07 09:28:45'),(11,'帖子標(biāo)題11',3,NULL,NULL,'發(fā)布內(nèi)容11',400,1,'2023-04-07 09:28:45','2023-04-07 09:28:45','2023-04-07 09:28:45'),(13,'帖子標(biāo)題13',2,NULL,NULL,'發(fā)布內(nèi)容13',4,1,'2023-04-07 09:28:45','2023-04-07 09:28:45','2023-04-07 09:28:45'),(14,'帖子標(biāo)題14',1,NULL,NULL,'發(fā)布內(nèi)容14',16,1,'2023-04-07 09:28:45','2023-04-07 09:28:45','2023-04-07 09:28:45'),(15,NULL,1,NULL,NULL,'可以刪除自己發(fā)布的貼子和評(píng)論',14,2,'2023-04-07 09:36:34',NULL,'2023-04-07 09:36:34'),(17,NULL,NULL,1,NULL,'2222222222222',14,2,'2023-04-07 09:40:49',NULL,'2023-04-07 09:40:49'),(18,NULL,NULL,NULL,1,'333333333333333333333333333',14,2,'2023-04-07 09:42:00',NULL,'2023-04-07 09:42:00');
/*Table structure for table `gongzuo` */
DROP TABLE IF EXISTS `gongzuo`;
CREATE TABLE `gongzuo` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主鍵',
`username` varchar(200) DEFAULT NULL COMMENT '賬戶',
`password` varchar(200) DEFAULT NULL COMMENT '密碼',
`gongzuo_name` varchar(200) DEFAULT NULL COMMENT '工作人員名稱 Search111 ',
`gongzuo_phone` varchar(200) DEFAULT NULL COMMENT '工作人員手機(jī)號(hào)',
`gongzuo_id_number` varchar(200) DEFAULT NULL COMMENT '工作人員身份證號(hào)',
`gongzuo_photo` varchar(200) DEFAULT NULL COMMENT '工作人員頭像',
`sex_types` int(11) DEFAULT NULL COMMENT '性別 Search111',
`gongzuo_email` varchar(200) DEFAULT NULL COMMENT '工作人員郵箱',
`gongzuo_delete` int(11) DEFAULT NULL COMMENT '邏輯刪除',
`insert_time` timestamp NULL DEFAULT NULL COMMENT '添加時(shí)間',
`create_time` timestamp NULL DEFAULT NULL COMMENT '創(chuàng)建時(shí)間',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='工作人員';
/*Data for the table `gongzuo` */
insert into `gongzuo`(`id`,`username`,`password`,`gongzuo_name`,`gongzuo_phone`,`gongzuo_id_number`,`gongzuo_photo`,`sex_types`,`gongzuo_email`,`gongzuo_delete`,`insert_time`,`create_time`) values (1,'a1','123456','工作人員名稱1','17703786901','410224199010102001','upload/gongzuo1.jpg',2,'1@qq.com',1,'2023-04-07 09:28:45','2023-04-07 09:28:45'),(2,'a2','123456','工作人員名稱2','17703786902','410224199010102002','upload/gongzuo2.jpg',1,'2@qq.com',1,'2023-04-07 09:28:45','2023-04-07 09:28:45'),(3,'a3','123456','工作人員名稱3','17703786903','410224199010102003','upload/gongzuo3.jpg',1,'3@qq.com',1,'2023-04-07 09:28:45','2023-04-07 09:28:45');
/*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 '公告標(biāo)題 Search111 ',
`news_types` int(11) DEFAULT NULL COMMENT '公告類型 Search111 ',
`news_photo` varchar(200) DEFAULT NULL COMMENT '公告圖片',
`insert_time` timestamp NULL DEFAULT NULL COMMENT '添加時(shí)間',
`news_content` longtext COMMENT '公告詳情',
`create_time` timestamp NULL DEFAULT NULL COMMENT '創(chuàng)建時(shí)間 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,'公告標(biāo)題1',1,'upload/news1.jpg','2023-04-07 09:28:45','公告詳情1','2023-04-07 09:28:45'),(2,'公告標(biāo)題2',2,'upload/news2.jpg','2023-04-07 09:28:45','公告詳情2','2023-04-07 09:28:45'),(3,'公告標(biāo)題3',2,'upload/news3.jpg','2023-04-07 09:28:45','公告詳情3','2023-04-07 09:28:45'),(4,'公告標(biāo)題4',2,'upload/news4.jpg','2023-04-07 09:28:45','公告詳情4','2023-04-07 09:28:45'),(5,'公告標(biāo)題5',2,'upload/news5.jpg','2023-04-07 09:28:45','公告詳情5','2023-04-07 09:28:45'),(6,'公告標(biāo)題6',1,'upload/news6.jpg','2023-04-07 09:28:45','公告詳情6','2023-04-07 09:28:45'),(7,'公告標(biāo)題7',3,'upload/news7.jpg','2023-04-07 09:28:45','公告詳情7','2023-04-07 09:28:45'),(8,'公告標(biāo)題8',1,'upload/news8.jpg','2023-04-07 09:28:45','公告詳情8','2023-04-07 09:28:45'),(9,'公告標(biāo)題9',3,'upload/news9.jpg','2023-04-07 09:28:45','公告詳情9','2023-04-07 09:28:45'),(10,'公告標(biāo)題10',1,'upload/news10.jpg','2023-04-07 09:28:45','公告詳情10','2023-04-07 09:28:45'),(11,'公告標(biāo)題11',3,'upload/news11.jpg','2023-04-07 09:28:45','公告詳情11','2023-04-07 09:28:45'),(12,'公告標(biāo)題12',2,'upload/news12.jpg','2023-04-07 09:28:45','公告詳情12','2023-04-07 09:28:45'),(13,'公告標(biāo)題13',3,'upload/news13.jpg','2023-04-07 09:28:45','公告詳情13','2023-04-07 09:28:45'),(14,'公告標(biāo)題14',1,'upload/news14.jpg','2023-04-07 09:28:45','公告詳情14','2023-04-07 09:28:45');
/*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 '新增時(shí)間',
`expiratedtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '過期時(shí)間',
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,'a1','yonghu','用戶','8rjci29p7yu0gx86tbcv0jk2v84vkxnh','2023-04-07 09:33:49','2023-04-07 10:35:38'),(2,1,'a1','gongzuo','工作人員','khgb9ao6wn18pdarjzs53zny7qju8fjt','2023-04-07 09:38:09','2023-04-07 10:38:09'),(3,1,'admin','users','管理員','9yzjrlaw3b8k3ttjm2rroeykz4ode5qp','2023-04-07 09:40:57','2023-04-07 10:43:46');
/*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 '醫(yī)院名',
`password` varchar(100) NOT NULL COMMENT '密碼',
`role` varchar(100) DEFAULT '管理員' COMMENT '角色',
`addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '新增時(shí)間',
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-07 09:28:32');
/*Table structure for table `wenwu` */
DROP TABLE IF EXISTS `wenwu`;
CREATE TABLE `wenwu` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主鍵 ',
`yonghu_id` int(11) DEFAULT NULL COMMENT '用戶',
`wenwu_uuid_number` varchar(200) DEFAULT NULL COMMENT '文物編號(hào)',
`wenwu_name` varchar(200) DEFAULT NULL COMMENT '文物牌號(hào) Search111 ',
`wenwu_photo` varchar(200) DEFAULT NULL COMMENT '文物圖片',
`wenwu_types` int(11) DEFAULT NULL COMMENT '文物類型 Search111',
`wenwu_clicknum` int(11) DEFAULT NULL COMMENT '文物熱度',
`zan_number` int(11) DEFAULT NULL COMMENT '贊',
`cai_number` int(11) DEFAULT NULL COMMENT '踩',
`wenwu_content` longtext COMMENT '文物介紹 ',
`wenwu_yesno_types` int(11) DEFAULT NULL COMMENT '信息審核 Search111',
`wenwu_yesno_text` longtext COMMENT '審核結(jié)果 ',
`wenwu_delete` int(11) DEFAULT NULL COMMENT '邏輯刪除',
`insert_time` timestamp NULL DEFAULT NULL COMMENT '錄入時(shí)間',
`create_time` timestamp NULL DEFAULT NULL COMMENT '創(chuàng)建時(shí)間 show1 show2 photoShow',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8 COMMENT='文物';
/*Data for the table `wenwu` */
insert into `wenwu`(`id`,`yonghu_id`,`wenwu_uuid_number`,`wenwu_name`,`wenwu_photo`,`wenwu_types`,`wenwu_clicknum`,`zan_number`,`cai_number`,`wenwu_content`,`wenwu_yesno_types`,`wenwu_yesno_text`,`wenwu_delete`,`insert_time`,`create_time`) values (1,3,'1680830925119','文物牌號(hào)1','upload/wenwu1.jpg',2,4,284,389,'文物介紹1',1,NULL,1,'2023-04-07 09:28:45','2023-04-07 09:28:45'),(2,1,'1680830925164','文物牌號(hào)2','upload/wenwu2.jpg',2,37,151,405,'文物介紹2',1,NULL,1,'2023-04-07 09:28:45','2023-04-07 09:28:45'),(3,3,'1680830925137','文物牌號(hào)3','upload/wenwu3.jpg',1,118,460,186,'文物介紹3',1,NULL,1,'2023-04-07 09:28:45','2023-04-07 09:28:45'),(4,2,'1680830925164','文物牌號(hào)4','upload/wenwu4.jpg',2,428,143,78,'文物介紹4',1,NULL,1,'2023-04-07 09:28:45','2023-04-07 09:28:45'),(5,2,'1680830925180','文物牌號(hào)5','upload/wenwu5.jpg',2,135,99,348,'文物介紹5',2,'通過',1,'2023-04-07 09:28:45','2023-04-07 09:28:45'),(6,3,'1680830925167','文物牌號(hào)6','upload/wenwu6.jpg',1,40,257,430,'文物介紹6',2,'通過',1,'2023-04-07 09:28:45','2023-04-07 09:28:45'),(7,1,'1680830925186','文物牌號(hào)7','upload/wenwu7.jpg',1,151,145,151,'文物介紹7',2,'通過',1,'2023-04-07 09:28:45','2023-04-07 09:28:45'),(8,2,'1680830925193','文物牌號(hào)8','upload/wenwu1.jpg',3,325,62,270,'文物介紹8',2,'通過',1,'2023-04-07 09:28:45','2023-04-07 09:28:45'),(9,1,'1680830925131','文物牌號(hào)9','upload/wenwu2.jpg',1,453,368,493,'文物介紹9',2,'通過',1,'2023-04-07 09:28:45','2023-04-07 09:28:45'),(10,1,'1680830925121','文物牌號(hào)10','upload/wenwu3.jpg',1,258,71,125,'文物介紹10',2,'通過',1,'2023-04-07 09:28:45','2023-04-07 09:28:45'),(11,1,'1680830925151','文物牌號(hào)11','upload/wenwu4.jpg',2,149,89,385,'文物介紹11',2,'通過',1,'2023-04-07 09:28:45','2023-04-07 09:28:45'),(12,2,'1680830925152','文物牌號(hào)12','upload/wenwu5.jpg',1,124,482,349,'文物介紹12',2,'審核通過的數(shù)據(jù)會(huì)在前臺(tái)展示粗來',1,'2023-04-07 09:28:45','2023-04-07 09:28:45'),(13,2,'1680830925186','文物牌號(hào)13','upload/wenwu6.jpg',2,200,473,10,'文物介紹13',3,'123',1,'2023-04-07 09:28:45','2023-04-07 09:28:45'),(14,1,'1680830925138','文物牌號(hào)14','upload/wenwu7.jpg',2,433,287,320,'文物介紹14',2,'111112',1,'2023-04-07 09:28:45','2023-04-07 09:28:45');
/*Table structure for table `wenwu_collection` */
DROP TABLE IF EXISTS `wenwu_collection`;
CREATE TABLE `wenwu_collection` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主鍵',
`wenwu_id` int(11) DEFAULT NULL COMMENT '文物',
`yonghu_id` int(11) DEFAULT NULL COMMENT '用戶',
`wenwu_collection_types` int(11) DEFAULT NULL COMMENT '類型',
`insert_time` timestamp NULL DEFAULT NULL COMMENT '收藏時(shí)間',
`create_time` timestamp NULL DEFAULT NULL COMMENT '創(chuàng)建時(shí)間 show3 photoShow',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8 COMMENT='文物收藏';
/*Data for the table `wenwu_collection` */
insert into `wenwu_collection`(`id`,`wenwu_id`,`yonghu_id`,`wenwu_collection_types`,`insert_time`,`create_time`) values (1,1,2,1,'2023-04-07 09:28:45','2023-04-07 09:28:45'),(2,2,1,1,'2023-04-07 09:28:45','2023-04-07 09:28:45'),(4,4,1,1,'2023-04-07 09:28:45','2023-04-07 09:28:45'),(5,5,1,1,'2023-04-07 09:28:45','2023-04-07 09:28:45'),(6,6,2,1,'2023-04-07 09:28:45','2023-04-07 09:28:45'),(7,7,1,1,'2023-04-07 09:28:45','2023-04-07 09:28:45'),(12,12,3,1,'2023-04-07 09:28:45','2023-04-07 09:28:45'),(15,5,1,2,'2023-04-07 09:35:41','2023-04-07 09:35:41'),(16,9,1,2,'2023-04-07 09:36:15','2023-04-07 09:36:15'),(17,6,1,1,'2023-04-07 09:36:18','2023-04-07 09:36:18'),(18,6,1,3,'2023-04-07 09:36:20','2023-04-07 09:36:20');
/*Table structure for table `wenwu_liuyan` */
DROP TABLE IF EXISTS `wenwu_liuyan`;
CREATE TABLE `wenwu_liuyan` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主鍵',
`wenwu_id` int(11) DEFAULT NULL COMMENT '文物',
`yonghu_id` int(11) DEFAULT NULL COMMENT '用戶',
`wenwu_liuyan_text` longtext COMMENT '留言內(nèi)容',
`insert_time` timestamp NULL DEFAULT NULL COMMENT '留言時(shí)間',
`reply_text` longtext COMMENT '回復(fù)內(nèi)容',
`update_time` timestamp NULL DEFAULT NULL COMMENT '回復(fù)時(shí)間',
`create_time` timestamp NULL DEFAULT NULL COMMENT '創(chuàng)建時(shí)間 show3 listShow',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 COMMENT='文物留言';
/*Data for the table `wenwu_liuyan` */
insert into `wenwu_liuyan`(`id`,`wenwu_id`,`yonghu_id`,`wenwu_liuyan_text`,`insert_time`,`reply_text`,`update_time`,`create_time`) values (1,1,3,'留言內(nèi)容1','2023-04-07 09:28:45','回復(fù)信息1','2023-04-07 09:28:45','2023-04-07 09:28:45'),(2,2,1,'留言內(nèi)容2','2023-04-07 09:28:45','回復(fù)信息2','2023-04-07 09:28:45','2023-04-07 09:28:45'),(3,3,1,'留言內(nèi)容3','2023-04-07 09:28:45','回復(fù)信息3','2023-04-07 09:28:45','2023-04-07 09:28:45'),(4,4,2,'留言內(nèi)容4','2023-04-07 09:28:45','回復(fù)信息4','2023-04-07 09:28:45','2023-04-07 09:28:45'),(5,5,3,'留言內(nèi)容5','2023-04-07 09:28:45','回復(fù)信息5','2023-04-07 09:28:45','2023-04-07 09:28:45'),(6,6,3,'留言內(nèi)容6','2023-04-07 09:28:45','回復(fù)信息6','2023-04-07 09:28:45','2023-04-07 09:28:45'),(7,7,1,'留言內(nèi)容7','2023-04-07 09:28:45','回復(fù)信息7','2023-04-07 09:28:45','2023-04-07 09:28:45'),(8,8,1,'留言內(nèi)容8','2023-04-07 09:28:45','回復(fù)信息8','2023-04-07 09:28:45','2023-04-07 09:28:45'),(9,9,1,'留言內(nèi)容9','2023-04-07 09:28:45','回復(fù)信息9','2023-04-07 09:28:45','2023-04-07 09:28:45'),(10,10,3,'留言內(nèi)容10','2023-04-07 09:28:45','回復(fù)信息10','2023-04-07 09:28:45','2023-04-07 09:28:45'),(11,11,3,'留言內(nèi)容11','2023-04-07 09:28:45','回復(fù)信息11','2023-04-07 09:28:45','2023-04-07 09:28:45'),(12,12,2,'留言內(nèi)容12','2023-04-07 09:28:45','回復(fù)信息12','2023-04-07 09:28:45','2023-04-07 09:28:45'),(13,13,3,'留言內(nèi)容13','2023-04-07 09:28:45','回復(fù)信息13','2023-04-07 09:28:45','2023-04-07 09:28:45'),(15,5,1,'登錄后才能進(jìn)入數(shù)據(jù)詳情頁 進(jìn)行點(diǎn)贊留言收藏等操作','2023-04-07 09:36:08',NULL,NULL,'2023-04-07 09:36:08');
/*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 '用戶手機(jī)號(hào)',
`yonghu_id_number` varchar(200) DEFAULT NULL COMMENT '用戶身份證號(hào)',
`yonghu_photo` varchar(200) DEFAULT NULL COMMENT '用戶頭像',
`sex_types` int(11) DEFAULT NULL COMMENT '性別 Search111',
`yonghu_email` varchar(200) DEFAULT NULL COMMENT '用戶郵箱',
`yonghu_delete` int(11) DEFAULT NULL COMMENT '邏輯刪除',
`insert_time` timestamp NULL DEFAULT NULL COMMENT '添加時(shí)間',
`create_time` timestamp NULL DEFAULT NULL COMMENT '創(chuàng)建時(shí)間',
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`,`yonghu_delete`,`insert_time`,`create_time`) values (1,'a1','123456','用戶名稱1','17703786901','410224199010102001','upload/yonghu1.jpg',2,'1@qq.com',1,'2023-04-07 09:28:45','2023-04-07 09:28:45'),(2,'a2','123456','用戶名稱2','17703786902','410224199010102002','upload/yonghu2.jpg',2,'2@qq.com',1,'2023-04-07 09:28:45','2023-04-07 09:28:45'),(3,'a3','123456','用戶名稱3','17703786903','410224199010102003','upload/yonghu3.jpg',2,'3@qq.com',1,'2023-04-07 09:28:45','2023-04-07 09:28:45');
/*!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、關(guān)鍵代碼
5.1 文物Controller模塊?
/**
* 文物
* 后端接口
* @author 學(xué)長編程
* @email
* WeChat jsjbysj88
*/
@RestController
@Controller
@RequestMapping("/wenwu")
public class WenwuController {
private static final Logger logger = LoggerFactory.getLogger(WenwuController.class);
private static final String TABLE_NAME = "wenwu";
@Autowired
private WenwuService wenwuService;
@Autowired
private TokenService tokenService;
@Autowired
private DictionaryService dictionaryService;//字典
@Autowired
private ForumService forumService;//論壇
@Autowired
private GongzuoService gongzuoService;//工作人員
@Autowired
private NewsService newsService;//公告資訊
@Autowired
private WenwuCollectionService wenwuCollectionService;//文物收藏
@Autowired
private WenwuLiuyanService wenwuLiuyanService;//文物留言
@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,"永不會(huì)進(jìn)入");
else if("用戶".equals(role))
params.put("yonghuId",request.getSession().getAttribute("userId"));
else if("工作人員".equals(role))
params.put("gongzuoId",request.getSession().getAttribute("userId"));
params.put("wenwuDeleteStart",1);params.put("wenwuDeleteEnd",1);
CommonUtil.checkMap(params);
PageUtils page = wenwuService.queryPage(params);
//字典表數(shù)據(jù)轉(zhuǎn)換
List<WenwuView> list =(List<WenwuView>)page.getList();
for(WenwuView c:list){
//修改對(duì)應(yīng)字典表字段
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);
WenwuEntity wenwu = wenwuService.selectById(id);
if(wenwu !=null){
//entity轉(zhuǎn)view
WenwuView view = new WenwuView();
BeanUtils.copyProperties( wenwu , view );//把實(shí)體數(shù)據(jù)重構(gòu)到view中
//級(jí)聯(lián)表 用戶
//級(jí)聯(lián)表
YonghuEntity yonghu = yonghuService.selectById(wenwu.getYonghuId());
if(yonghu != null){
BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "yonghuId"});//把級(jí)聯(lián)的數(shù)據(jù)添加到view中,并排除id和創(chuàng)建時(shí)間字段,當(dāng)前表的級(jí)聯(lián)注冊(cè)表
view.setYonghuId(yonghu.getId());
}
//修改對(duì)應(yīng)字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到數(shù)據(jù)");
}
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody WenwuEntity wenwu, HttpServletRequest request){
logger.debug("save方法:,,Controller:{},,wenwu:{}",this.getClass().getName(),wenwu.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
if(false)
return R.error(511,"永遠(yuǎn)不會(huì)進(jìn)入");
else if("用戶".equals(role))
wenwu.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
Wrapper<WenwuEntity> queryWrapper = new EntityWrapper<WenwuEntity>()
.eq("yonghu_id", wenwu.getYonghuId())
.eq("wenwu_name", wenwu.getWenwuName())
.eq("wenwu_types", wenwu.getWenwuTypes())
.eq("zan_number", wenwu.getZanNumber())
.eq("cai_number", wenwu.getCaiNumber())
.in("wenwu_yesno_types", new Integer[]{1,2})
.eq("wenwu_delete", 1)
;
logger.info("sql語句:"+queryWrapper.getSqlSegment());
WenwuEntity wenwuEntity = wenwuService.selectOne(queryWrapper);
if(wenwuEntity==null){
wenwu.setWenwuClicknum(1);
wenwu.setWenwuYesnoTypes(1);
wenwu.setWenwuDelete(1);
wenwu.setInsertTime(new Date());
wenwu.setCreateTime(new Date());
wenwuService.insert(wenwu);
return R.ok();
}else {
if(wenwuEntity.getWenwuYesnoTypes()==1)
return R.error(511,"有相同的待審核的數(shù)據(jù)");
else if(wenwuEntity.getWenwuYesnoTypes()==2)
return R.error(511,"有相同的審核通過的數(shù)據(jù)");
else
return R.error(511,"表中有相同數(shù)據(jù)");
}
}
/**
* 后端修改
*/
@RequestMapping("/update")
public R update(@RequestBody WenwuEntity wenwu, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {
logger.debug("update方法:,,Controller:{},,wenwu:{}",this.getClass().getName(),wenwu.toString());
WenwuEntity oldWenwuEntity = wenwuService.selectById(wenwu.getId());//查詢?cè)葦?shù)據(jù)
String role = String.valueOf(request.getSession().getAttribute("role"));
// if(false)
// return R.error(511,"永遠(yuǎn)不會(huì)進(jìn)入");
// else if("用戶".equals(role))
// wenwu.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
if("".equals(wenwu.getWenwuPhoto()) || "null".equals(wenwu.getWenwuPhoto())){
wenwu.setWenwuPhoto(null);
}
wenwuService.updateById(wenwu);//根據(jù)id更新
return R.ok();
}
/**
* 審核
*/
@RequestMapping("/shenhe")
public R shenhe(@RequestBody WenwuEntity wenwuEntity, HttpServletRequest request){
logger.debug("shenhe方法:,,Controller:{},,wenwuEntity:{}",this.getClass().getName(),wenwuEntity.toString());
WenwuEntity oldWenwu = wenwuService.selectById(wenwuEntity.getId());//查詢?cè)葦?shù)據(jù)
// if(wenwuEntity.getWenwuYesnoTypes() == 2){//通過
// wenwuEntity.setWenwuTypes();
// }else if(wenwuEntity.getWenwuYesnoTypes() == 3){//拒絕
// wenwuEntity.setWenwuTypes();
// }
wenwuService.updateById(wenwuEntity);//審核
return R.ok();
}
/**
* 刪除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids, HttpServletRequest request){
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
List<WenwuEntity> oldWenwuList =wenwuService.selectBatchIds(Arrays.asList(ids));//要?jiǎng)h除的數(shù)據(jù)
ArrayList<WenwuEntity> list = new ArrayList<>();
for(Integer id:ids){
WenwuEntity wenwuEntity = new WenwuEntity();
wenwuEntity.setId(id);
wenwuEntity.setWenwuDelete(2);
list.add(wenwuEntity);
}
if(list != null && list.size() >0){
wenwuService.updateBatchById(list);
}
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<WenwuEntity> wenwuList = 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,"找不到上傳文件,請(qǐng)聯(lián)系管理員");
}else{
List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//讀取xls文件
dataList.remove(0);//刪除第一行,因?yàn)榈谝恍惺翘崾? for(List<String> data:dataList){
//循環(huán)
WenwuEntity wenwuEntity = new WenwuEntity();
// wenwuEntity.setYonghuId(Integer.valueOf(data.get(0))); //用戶 要改的
// wenwuEntity.setWenwuUuidNumber(data.get(0)); //文物編號(hào) 要改的
// wenwuEntity.setWenwuName(data.get(0)); //文物名稱 要改的
// wenwuEntity.setWenwuPhoto("");//詳情和圖片
// wenwuEntity.setWenwuTypes(Integer.valueOf(data.get(0))); //文物類型 要改的
// wenwuEntity.setWenwuClicknum(Integer.valueOf(data.get(0))); //文物熱度 要改的
// wenwuEntity.setZanNumber(Integer.valueOf(data.get(0))); //贊 要改的
// wenwuEntity.setCaiNumber(Integer.valueOf(data.get(0))); //踩 要改的
// wenwuEntity.setWenwuContent("");//詳情和圖片
// wenwuEntity.setWenwuYesnoTypes(Integer.valueOf(data.get(0))); //信息審核 要改的
// wenwuEntity.setWenwuYesnoText(data.get(0)); //審核結(jié)果 要改的
// wenwuEntity.setWenwuDelete(1);//邏輯刪除字段
// wenwuEntity.setInsertTime(date);//時(shí)間
// wenwuEntity.setCreateTime(date);//時(shí)間
wenwuList.add(wenwuEntity);
//把要查詢是否重復(fù)的字段放入map中
//文物編號(hào)
if(seachFields.containsKey("wenwuUuidNumber")){
List<String> wenwuUuidNumber = seachFields.get("wenwuUuidNumber");
wenwuUuidNumber.add(data.get(0));//要改的
}else{
List<String> wenwuUuidNumber = new ArrayList<>();
wenwuUuidNumber.add(data.get(0));//要改的
seachFields.put("wenwuUuidNumber",wenwuUuidNumber);
}
}
//查詢是否重復(fù)
//文物編號(hào)
List<WenwuEntity> wenwuEntities_wenwuUuidNumber = wenwuService.selectList(new EntityWrapper<WenwuEntity>().in("wenwu_uuid_number", seachFields.get("wenwuUuidNumber")).eq("wenwu_delete", 1));
if(wenwuEntities_wenwuUuidNumber.size() >0 ){
ArrayList<String> repeatFields = new ArrayList<>();
for(WenwuEntity s:wenwuEntities_wenwuUuidNumber){
repeatFields.add(s.getWenwuUuidNumber());
}
return R.error(511,"數(shù)據(jù)庫的該表中的 [文物編號(hào)] 字段已經(jīng)存在 存在數(shù)據(jù)為:"+repeatFields.toString());
}
wenwuService.insertBatch(wenwuList);
return R.ok();
}
}
}
}catch (Exception e){
e.printStackTrace();
return R.error(511,"批量插入數(shù)據(jù)異常,請(qǐng)聯(lián)系管理員");
}
}
/**
* 個(gè)性推薦
*/
@IgnoreAuth
@RequestMapping("/gexingtuijian")
public R gexingtuijian(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("gexingtuijian方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
CommonUtil.checkMap(params);
List<WenwuView> returnWenwuViewList = new ArrayList<>();
//查看收藏
Map<String, Object> params1 = new HashMap<>(params);params1.put("sort","id");params1.put("yonghuId",request.getSession().getAttribute("userId"));
PageUtils pageUtils = wenwuCollectionService.queryPage(params1);
List<WenwuCollectionView> collectionViewsList =(List<WenwuCollectionView>)pageUtils.getList();
Map<Integer,Integer> typeMap=new HashMap<>();//購買的類型list
for(WenwuCollectionView collectionView:collectionViewsList){
Integer wenwuTypes = collectionView.getWenwuTypes();
if(typeMap.containsKey(wenwuTypes)){
typeMap.put(wenwuTypes,typeMap.get(wenwuTypes)+1);
}else{
typeMap.put(wenwuTypes,1);
}
}
List<Integer> typeList = new ArrayList<>();//排序后的有序的類型 按最多到最少
typeMap.entrySet().stream().sorted((o1, o2) -> o2.getValue() - o1.getValue()).forEach(e -> typeList.add(e.getKey()));//排序
Integer limit = Integer.valueOf(String.valueOf(params.get("limit")));
for(Integer type:typeList){
Map<String, Object> params2 = new HashMap<>(params);params2.put("wenwuTypes",type);
PageUtils pageUtils1 = wenwuService.queryPage(params2);
List<WenwuView> wenwuViewList =(List<WenwuView>)pageUtils1.getList();
returnWenwuViewList.addAll(wenwuViewList);
if(returnWenwuViewList.size()>= limit) break;//返回的推薦數(shù)量大于要的數(shù)量 跳出循環(huán)
}
//正常查詢出來商品,用于補(bǔ)全推薦缺少的數(shù)據(jù)
PageUtils page = wenwuService.queryPage(params);
if(returnWenwuViewList.size()<limit){//返回?cái)?shù)量還是小于要求數(shù)量
int toAddNum = limit - returnWenwuViewList.size();//要添加的數(shù)量
List<WenwuView> wenwuViewList =(List<WenwuView>)page.getList();
for(WenwuView wenwuView:wenwuViewList){
Boolean addFlag = true;
for(WenwuView returnWenwuView:returnWenwuViewList){
if(returnWenwuView.getId().intValue() ==wenwuView.getId().intValue()) addFlag=false;//返回的數(shù)據(jù)中已存在此商品
}
if(addFlag){
toAddNum=toAddNum-1;
returnWenwuViewList.add(wenwuView);
if(toAddNum==0) break;//夠數(shù)量了
}
}
}else {
returnWenwuViewList = returnWenwuViewList.subList(0, limit);
}
for(WenwuView c:returnWenwuViewList)
dictionaryService.dictionaryConvert(c, request);
page.setList(returnWenwuViewList);
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@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 = wenwuService.queryPage(params);
//字典表數(shù)據(jù)轉(zhuǎn)換
List<WenwuView> list =(List<WenwuView>)page.getList();
for(WenwuView c:list)
dictionaryService.dictionaryConvert(c, request); //修改對(duì)應(yīng)字典表字段
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);
WenwuEntity wenwu = wenwuService.selectById(id);
if(wenwu !=null){
//點(diǎn)擊數(shù)量加1
wenwu.setWenwuClicknum(wenwu.getWenwuClicknum()+1);
wenwuService.updateById(wenwu);
//entity轉(zhuǎn)view
WenwuView view = new WenwuView();
BeanUtils.copyProperties( wenwu , view );//把實(shí)體數(shù)據(jù)重構(gòu)到view中
//級(jí)聯(lián)表
YonghuEntity yonghu = yonghuService.selectById(wenwu.getYonghuId());
if(yonghu != null){
BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});//把級(jí)聯(lián)的數(shù)據(jù)添加到view中,并排除id和創(chuàng)建時(shí)間字段
view.setYonghuId(yonghu.getId());
}
//修改對(duì)應(yīng)字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到數(shù)據(jù)");
}
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody WenwuEntity wenwu, HttpServletRequest request){
logger.debug("add方法:,,Controller:{},,wenwu:{}",this.getClass().getName(),wenwu.toString());
Wrapper<WenwuEntity> queryWrapper = new EntityWrapper<WenwuEntity>()
.eq("yonghu_id", wenwu.getYonghuId())
.eq("wenwu_uuid_number", wenwu.getWenwuUuidNumber())
.eq("wenwu_name", wenwu.getWenwuName())
.eq("wenwu_types", wenwu.getWenwuTypes())
.eq("wenwu_clicknum", wenwu.getWenwuClicknum())
.eq("zan_number", wenwu.getZanNumber())
.eq("cai_number", wenwu.getCaiNumber())
.in("wenwu_yesno_types", new Integer[]{1,2})
.eq("wenwu_yesno_text", wenwu.getWenwuYesnoText())
.eq("wenwu_delete", wenwu.getWenwuDelete())
// .notIn("wenwu_types", new Integer[]{102})
;
logger.info("sql語句:"+queryWrapper.getSqlSegment());
WenwuEntity wenwuEntity = wenwuService.selectOne(queryWrapper);
if(wenwuEntity==null){
wenwu.setWenwuClicknum(1);
wenwu.setZanNumber(1);
wenwu.setCaiNumber(1);
wenwu.setWenwuYesnoTypes(1);
wenwu.setWenwuDelete(1);
wenwu.setInsertTime(new Date());
wenwu.setCreateTime(new Date());
wenwuService.insert(wenwu);
return R.ok();
}else {
if(wenwuEntity.getWenwuYesnoTypes()==1)
return R.error(511,"有相同的待審核的數(shù)據(jù)");
else if(wenwuEntity.getWenwuYesnoTypes()==2)
return R.error(511,"有相同的審核通過的數(shù)據(jù)");
else
return R.error(511,"表中有相同數(shù)據(jù)");
}
}
}
5.2 文物Service模塊?
package com.service;
import com.baomidou.mybatisplus.service.IService;
import com.utils.PageUtils;
import com.entity.WenwuEntity;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.lang.Nullable;
import java.util.List;
/**
* 文物 服務(wù)類
*/
public interface WenwuService extends IService<WenwuEntity> {
/**
* @param params 查詢參數(shù)
* @return 帶分頁的查詢出來的數(shù)據(jù)
*/
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.WenwuDao;
import com.entity.WenwuEntity;
import com.service.WenwuService;
import com.entity.view.WenwuView;
/**
* 文物 服務(wù)實(shí)現(xiàn)類
*/
@Service("wenwuService")
@Transactional
public class WenwuServiceImpl extends ServiceImpl<WenwuDao, WenwuEntity> implements WenwuService {
@Override
public PageUtils queryPage(Map<String,Object> params) {
Page<WenwuView> page =new Query<WenwuView>(params).getPage();
page.setRecords(baseMapper.selectListView(page,params));
return new PageUtils(page);
}
}
5.4 文物Dao模塊
package com.dao;
import com.entity.WenwuEntity;
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.WenwuView;
/**
* 文物 Dao 接口
*
* @author
*/
public interface WenwuDao extends BaseMapper<WenwuEntity> {
List<WenwuView> selectListView(Pagination page,@Param("params")Map<String,Object> params);
}
6、論文目錄結(jié)構(gòu)
7、源碼獲取
感謝大家的閱讀,如有不懂的問題可以評(píng)論區(qū)交流或私聊!
喜歡文章可以點(diǎn)贊、收藏、關(guān)注、評(píng)論啦文章來源:http://www.zghlxwxcb.cn/news/detail-814702.html
→獲取源碼請(qǐng)私信←文章來源地址http://www.zghlxwxcb.cn/news/detail-814702.html
到了這里,關(guān)于計(jì)算機(jī)畢業(yè)設(shè)計(jì) 基于SpringBoot的紅色革命文物征集管理系統(tǒng)的設(shè)計(jì)與實(shí)現(xiàn) Java實(shí)戰(zhàn)項(xiàng)目 附源碼+文檔+視頻講解的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!