博主介绍:✌从事软件开发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技术建设篮球联盟管理系统,实现篮球联盟管理的信息化。则对于进一步提高篮球联盟管理发展,对篮球联盟管理系统能起到不少的促进作用。本系统能够通过互联网得到广泛的、全面的宣传,让尽可能多的用户了解和熟知篮球联盟管理系统的便捷高效,不仅为群众提供了服务,而且也推广了自己,让更多的群众了解自己。
本系统设计的现状和趋势,从需求、结构、数据库等方面的设计到系统的实现,分别为管理员和用户的实现。论文的内容从系统的设计、描述、实现、分析、测试方面来表明开发的过程。本系统根据现实情况来选择一种可行的开发方案,借助java编程语言和MySQL数据库等实现系统的全部功能,接下来对系统进行测试,测试系统是否有漏洞和测试用户权限来完善系统,最终系统完成达到相关标准。
1.2 开发技术
Java开发语言、SpringBoot、MyBatisPlus、MySQL数据库、Maven、IDEA开发工具、JDK1.8+、Vue、HTML、CSS、JS。
2、系统功能模块设计
管理员:首页、个人中心、管理员管理、用户管理、球队管理、球员管理、论坛管理、球队资讯管理、基础数据管理、轮播图信息管理。
3、功能截图
3.1 前台功能
首页
论坛
篮球资讯
球队
球员
个人中心
3.2 后台功能
登录
首页
个人中心
管理员管理
用户管理
球队管理
球员管理
论坛管理
篮球资讯管理
基础数据管理
轮播图信息管理
4、数据库表结构设计
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=18 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-07 09:06:04'),(2,'sex_types','性别类型',2,'女',NULL,NULL,'2023-04-07 09:06:04'),(3,'gonggao_types','篮球资讯类型',1,'篮球资讯类型1',NULL,NULL,'2023-04-07 09:06:04'),(4,'gonggao_types','篮球资讯类型',2,'篮球资讯类型2',NULL,NULL,'2023-04-07 09:06:04'),(5,'forum_state_types','帖子状态',1,'发帖',NULL,NULL,'2023-04-07 09:06:04'),(6,'forum_state_types','帖子状态',2,'回帖',NULL,NULL,'2023-04-07 09:06:04'),(7,'qiudui_types','球队类型',1,'男篮',NULL,NULL,'2023-04-07 09:06:04'),(8,'qiudui_types','球队类型',2,'女篮',NULL,NULL,'2023-04-07 09:06:04'),(9,'qiudui_collection_types','收藏表类型',1,'收藏',NULL,NULL,'2023-04-07 09:06:04'),(10,'qiudui_collection_types','收藏表类型',2,'赞',NULL,NULL,'2023-04-07 09:06:04'),(11,'qiudui_collection_types','收藏表类型',3,'踩',NULL,NULL,'2023-04-07 09:06:04'),(12,'qiuyuan_types','球员位置',1,'球员位置1',NULL,NULL,'2023-04-07 09:06:04'),(13,'qiuyuan_types','球员位置',2,'球员位置2',NULL,NULL,'2023-04-07 09:06:04'),(14,'qiuyuan_types','球员位置',3,'球员位置3',NULL,NULL,'2023-04-07 09:06:04'),(15,'qiuyuan_collection_types','收藏表类型',1,'收藏',NULL,NULL,'2023-04-07 09:06:04'),(16,'qiuyuan_collection_types','收藏表类型',2,'赞',NULL,NULL,'2023-04-07 09:06:04'),(17,'qiuyuan_collection_types','收藏表类型',3,'踩',NULL,NULL,'2023-04-07 09:06:04');
/*Table structure for table `forum` */
DROP TABLE IF EXISTS `forum`;
CREATE TABLE `forum` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`forum_name` varchar(200) DEFAULT NULL COMMENT '帖子标题 Search111 ',
`yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
`users_id` int(11) DEFAULT NULL COMMENT '管理员',
`forum_content` longtext COMMENT '发布内容',
`super_ids` int(11) DEFAULT NULL COMMENT '父id',
`forum_state_types` int(11) DEFAULT NULL COMMENT '帖子状态',
`insert_time` timestamp NULL DEFAULT NULL COMMENT '发帖时间',
`update_time` timestamp NULL DEFAULT NULL COMMENT '修改时间',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show2',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8 COMMENT='论坛';
/*Data for the table `forum` */
insert into `forum`(`id`,`forum_name`,`yonghu_id`,`users_id`,`forum_content`,`super_ids`,`forum_state_types`,`insert_time`,`update_time`,`create_time`) values (1,'帖子标题1',2,NULL,'发布内容1',422,1,'2023-04-07 09:06:18','2023-04-07 09:06:18','2023-04-07 09:06:18'),(2,'帖子标题2',3,NULL,'发布内容2',72,1,'2023-04-07 09:06:18','2023-04-07 09:06:18','2023-04-07 09:06:18'),(3,'帖子标题3',2,NULL,'发布内容3',94,1,'2023-04-07 09:06:18','2023-04-07 09:06:18','2023-04-07 09:06:18'),(4,'帖子标题4',3,NULL,'发布内容4',146,1,'2023-04-07 09:06:18','2023-04-07 09:06:18','2023-04-07 09:06:18'),(5,'帖子标题5',1,NULL,'发布内容5',94,1,'2023-04-07 09:06:18','2023-04-07 09:06:18','2023-04-07 09:06:18'),(6,'帖子标题6',3,NULL,'发布内容6',63,1,'2023-04-07 09:06:18','2023-04-07 09:06:18','2023-04-07 09:06:18'),(7,'帖子标题7',3,NULL,'发布内容7',204,1,'2023-04-07 09:06:18','2023-04-07 09:06:18','2023-04-07 09:06:18'),(8,'帖子标题8',2,NULL,'发布内容8',330,1,'2023-04-07 09:06:18','2023-04-07 09:06:18','2023-04-07 09:06:18'),(9,'帖子标题9',1,NULL,'发布内容9',86,1,'2023-04-07 09:06:18','2023-04-07 09:06:18','2023-04-07 09:06:18'),(10,'帖子标题10',1,NULL,'发布内容10',494,1,'2023-04-07 09:06:18','2023-04-07 09:06:18','2023-04-07 09:06:18'),(11,'帖子标题11',1,NULL,'发布内容11',391,1,'2023-04-07 09:06:18','2023-04-07 09:06:18','2023-04-07 09:06:18'),(12,'帖子标题12',1,NULL,'发布内容12',394,1,'2023-04-07 09:06:18','2023-04-07 09:06:18','2023-04-07 09:06:18'),(13,'帖子标题13',3,NULL,'发布内容13',303,1,'2023-04-07 09:06:18','2023-04-07 09:06:18','2023-04-07 09:06:18'),(14,'帖子标题14',2,NULL,'发布内容14',188,1,'2023-04-07 09:06:18','2023-04-07 09:06:18','2023-04-07 09:06:18'),(15,'帖子',1,NULL,'<p>帖子1111</p>',NULL,1,'2023-04-07 09:24:39',NULL,'2023-04-07 09:24:39'),(16,NULL,NULL,1,'手打撒',15,2,'2023-04-07 09:27:56',NULL,'2023-04-07 09:27: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',1,'2023-04-07 09:06:18','篮球资讯详情1','2023-04-07 09:06:18'),(2,'篮球资讯名称2','upload/gonggao2.jpg',1,'2023-04-07 09:06:18','篮球资讯详情2','2023-04-07 09:06:18'),(3,'篮球资讯名称3','upload/gonggao3.jpg',2,'2023-04-07 09:06:18','篮球资讯详情3','2023-04-07 09:06:18'),(4,'篮球资讯名称4','upload/gonggao4.jpg',1,'2023-04-07 09:06:18','篮球资讯详情4','2023-04-07 09:06:18'),(5,'篮球资讯名称5','upload/gonggao5.jpg',1,'2023-04-07 09:06:18','篮球资讯详情5','2023-04-07 09:06:18'),(6,'篮球资讯名称6','upload/gonggao6.jpg',1,'2023-04-07 09:06:18','篮球资讯详情6','2023-04-07 09:06:18'),(7,'篮球资讯名称7','upload/gonggao7.jpg',1,'2023-04-07 09:06:18','篮球资讯详情7','2023-04-07 09:06:18'),(8,'篮球资讯名称8','upload/gonggao8.jpg',2,'2023-04-07 09:06:18','篮球资讯详情8','2023-04-07 09:06:18'),(9,'篮球资讯名称9','upload/gonggao9.jpg',1,'2023-04-07 09:06:18','篮球资讯详情9','2023-04-07 09:06:18'),(10,'篮球资讯名称10','upload/gonggao10.jpg',1,'2023-04-07 09:06:18','篮球资讯详情10','2023-04-07 09:06:18'),(11,'篮球资讯名称11','upload/gonggao11.jpg',1,'2023-04-07 09:06:18','篮球资讯详情11','2023-04-07 09:06:18'),(12,'篮球资讯名称12','upload/gonggao12.jpg',2,'2023-04-07 09:06:18','篮球资讯详情12','2023-04-07 09:06:18'),(13,'篮球资讯名称13','upload/gonggao13.jpg',1,'2023-04-07 09:06:18','篮球资讯详情13','2023-04-07 09:06:18'),(14,'篮球资讯名称14','upload/gonggao14.jpg',1,'2023-04-07 09:06:18','篮球资讯详情14','2023-04-07 09:06:18');
/*Table structure for table `qiudui` */
DROP TABLE IF EXISTS `qiudui`;
CREATE TABLE `qiudui` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
`qiudui_name` varchar(200) DEFAULT NULL COMMENT '球队名称 Search111 ',
`qiudui_uuid_number` varchar(200) DEFAULT NULL COMMENT '球队编号',
`qiudui_photo` varchar(200) DEFAULT NULL COMMENT '球队照片',
`qiudui_jiaiolian` varchar(200) DEFAULT NULL COMMENT '球队主教练',
`qiudui_guojia` varchar(200) DEFAULT NULL COMMENT '所属国家',
`qiudui_address` varchar(200) DEFAULT NULL COMMENT '球队地点',
`zan_number` int(11) DEFAULT NULL COMMENT '赞',
`cai_number` int(11) DEFAULT NULL COMMENT '踩',
`chuangjian_time` date DEFAULT NULL COMMENT '球队创建时间',
`qiudui_types` int(11) DEFAULT NULL COMMENT '球队类型 Search111',
`qiudui_clicknum` int(11) DEFAULT NULL COMMENT '球队热度',
`qiudui_content` longtext COMMENT '球队介绍 ',
`qiudui_rongyu_content` longtext COMMENT '球队荣誉 ',
`insert_time` timestamp NULL DEFAULT NULL COMMENT '录入时间',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 photoShow',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8 COMMENT='球队';
/*Data for the table `qiudui` */
insert into `qiudui`(`id`,`qiudui_name`,`qiudui_uuid_number`,`qiudui_photo`,`qiudui_jiaiolian`,`qiudui_guojia`,`qiudui_address`,`zan_number`,`cai_number`,`chuangjian_time`,`qiudui_types`,`qiudui_clicknum`,`qiudui_content`,`qiudui_rongyu_content`,`insert_time`,`create_time`) values (1,'球队名称1','1680829578264','/upload/1680830202881.jpg','球队主教练1','所属国家1','球队地点1',93,270,'2023-04-07',2,370,'球队介绍1','球队荣誉1','2023-04-07 09:06:18','2023-04-07 09:06:18'),(2,'球队名称2','1680829578267','/upload/1680830186912.jpg','球队主教练2','所属国家2','球队地点2',76,14,'2023-04-07',2,395,'球队介绍2','球队荣誉2','2023-04-07 09:06:18','2023-04-07 09:06:18'),(3,'球队名称3','1680829578286','/upload/1680830162189.jpg','球队主教练3','所属国家3','球队地点3',124,260,'2023-04-07',1,32,'球队介绍3','球队荣誉3','2023-04-07 09:06:18','2023-04-07 09:06:18'),(4,'球队名称4','1680829578322','/upload/1680830145489.jpg','球队主教练4','所属国家4','球队地点4',123,246,'2023-04-07',1,355,'球队介绍4','球队荣誉4','2023-04-07 09:06:18','2023-04-07 09:06:18'),(5,'球队名称5','1680829578235','/upload/1680830131905.jpg','球队主教练5','所属国家5','球队地点5',368,126,'2023-04-07',1,220,'球队介绍5','球队荣誉5','2023-04-07 09:06:18','2023-04-07 09:06:18'),(6,'球队名称6','1680829578258','/upload/1680830112386.jpg','球队主教练6','所属国家6','球队地点6',100,120,'2023-04-07',2,437,'球队介绍6','球队荣誉6','2023-04-07 09:06:18','2023-04-07 09:06:18'),(7,'球队名称7','1680829578256','/upload/1680830202881.jpg','球队主教练7','所属国家7','球队地点7',399,424,'2023-04-07',1,500,'球队介绍7','球队荣誉7','2023-04-07 09:06:18','2023-04-07 09:06:18'),(8,'球队名称8','1680829578317','/upload/1680830186912.jpg','球队主教练8','所属国家8','球队地点8',242,464,'2023-04-07',1,49,'球队介绍8','球队荣誉8','2023-04-07 09:06:18','2023-04-07 09:06:18'),(9,'球队名称9','1680829578285','/upload/1680830202881.jpg','球队主教练9','所属国家9','球队地点9',45,387,'2023-04-07',1,209,'<p>球队介绍9</p>','<p>球队荣誉9</p>','2023-04-07 09:06:18','2023-04-07 09:06:18'),(10,'球队名称10','1680829578267','/upload/1680830186912.jpg','球队主教练10','所属国家10','球队地点10',126,145,'2023-04-07',1,28,'<p>球队介绍10</p>','<p>球队荣誉10</p>','2023-04-07 09:06:18','2023-04-07 09:06:18'),(11,'球队名称11','1680829578293','/upload/1680830162189.jpg','球队主教练11','所属国家11','球队地点11',271,8,'2023-04-07',2,353,'<p>球队介绍11</p>','<p>球队荣誉11</p>','2023-04-07 09:06:18','2023-04-07 09:06:18'),(12,'球队名称12','1680829578298','/upload/1680830145489.jpg','球队主教练12','所属国家12','球队地点12',74,339,'2023-04-07',2,92,'<p>球队介绍12</p>','<p>球队荣誉12</p>','2023-04-07 09:06:18','2023-04-07 09:06:18'),(13,'球队名称13','1680829578276','/upload/1680830131905.jpg','球队主教练13','所属国家13','球队地点13',342,442,'2023-04-07',1,239,'<p>球队介绍13</p>','<p>球队荣誉13</p>','2023-04-07 09:06:18','2023-04-07 09:06:18'),(14,'球队名称14','1680829578306','/upload/1680830112386.jpg','球队主教练14','所属国家14','球队地点14',362,255,'2023-04-07',2,409,'<p>球队介绍14</p>','<p>球队荣誉14</p>','2023-04-07 09:06:18','2023-04-07 09:06:18');
/*Table structure for table `qiudui_collection` */
DROP TABLE IF EXISTS `qiudui_collection`;
CREATE TABLE `qiudui_collection` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`qiudui_id` int(11) DEFAULT NULL COMMENT '球队',
`yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
`qiudui_collection_types` int(11) DEFAULT NULL COMMENT '类型',
`insert_time` timestamp NULL DEFAULT NULL COMMENT '收藏时间',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show3 photoShow',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8 COMMENT='球队收藏';
/*Data for the table `qiudui_collection` */
insert into `qiudui_collection`(`id`,`qiudui_id`,`yonghu_id`,`qiudui_collection_types`,`insert_time`,`create_time`) values (1,1,3,1,'2023-04-07 09:06:18','2023-04-07 09:06:18'),(2,2,1,1,'2023-04-07 09:06:18','2023-04-07 09:06:18'),(3,3,3,1,'2023-04-07 09:06:18','2023-04-07 09:06:18'),(4,4,2,1,'2023-04-07 09:06:18','2023-04-07 09:06:18'),(5,5,1,1,'2023-04-07 09:06:18','2023-04-07 09:06:18'),(6,6,2,1,'2023-04-07 09:06:18','2023-04-07 09:06:18'),(7,7,1,1,'2023-04-07 09:06:18','2023-04-07 09:06:18'),(8,8,1,1,'2023-04-07 09:06:18','2023-04-07 09:06:18'),(9,9,2,1,'2023-04-07 09:06:18','2023-04-07 09:06:18'),(10,10,3,1,'2023-04-07 09:06:18','2023-04-07 09:06:18'),(11,11,1,1,'2023-04-07 09:06:18','2023-04-07 09:06:18'),(12,12,2,1,'2023-04-07 09:06:18','2023-04-07 09:06:18'),(13,13,2,1,'2023-04-07 09:06:18','2023-04-07 09:06:18'),(15,14,1,1,'2023-04-07 09:25:21','2023-04-07 09:25:21'),(17,14,1,3,'2023-04-07 09:25:40','2023-04-07 09:25:40');
/*Table structure for table `qiudui_liuyan` */
DROP TABLE IF EXISTS `qiudui_liuyan`;
CREATE TABLE `qiudui_liuyan` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`qiudui_id` int(11) DEFAULT NULL COMMENT '球队',
`yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
`qiudui_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 '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 COMMENT='球队留言';
/*Data for the table `qiudui_liuyan` */
insert into `qiudui_liuyan`(`id`,`qiudui_id`,`yonghu_id`,`qiudui_liuyan_text`,`insert_time`,`reply_text`,`update_time`,`create_time`) values (1,1,2,'留言内容1','2023-04-07 09:06:18','回复信息1','2023-04-07 09:06:18','2023-04-07 09:06:18'),(2,2,2,'留言内容2','2023-04-07 09:06:18','回复信息2','2023-04-07 09:06:18','2023-04-07 09:06:18'),(3,3,2,'留言内容3','2023-04-07 09:06:18','回复信息3','2023-04-07 09:06:18','2023-04-07 09:06:18'),(4,4,3,'留言内容4','2023-04-07 09:06:18','回复信息4','2023-04-07 09:06:18','2023-04-07 09:06:18'),(5,5,2,'留言内容5','2023-04-07 09:06:18','回复信息5','2023-04-07 09:06:18','2023-04-07 09:06:18'),(6,6,3,'留言内容6','2023-04-07 09:06:18','回复信息6','2023-04-07 09:06:18','2023-04-07 09:06:18'),(7,7,1,'留言内容7','2023-04-07 09:06:18','回复信息7','2023-04-07 09:06:18','2023-04-07 09:06:18'),(8,8,2,'留言内容8','2023-04-07 09:06:18','回复信息8','2023-04-07 09:06:18','2023-04-07 09:06:18'),(9,9,1,'留言内容9','2023-04-07 09:06:18','回复信息9','2023-04-07 09:06:18','2023-04-07 09:06:18'),(10,10,1,'留言内容10','2023-04-07 09:06:18','回复信息10','2023-04-07 09:06:18','2023-04-07 09:06:18'),(11,11,2,'留言内容11','2023-04-07 09:06:18','回复信息11','2023-04-07 09:06:18','2023-04-07 09:06:18'),(12,12,2,'留言内容12','2023-04-07 09:06:18','回复信息12','2023-04-07 09:06:18','2023-04-07 09:06:18'),(13,13,1,'留言内容13','2023-04-07 09:06:18','回复信息13','2023-04-07 09:06:18','2023-04-07 09:06:18'),(14,14,3,'留言内容14','2023-04-07 09:06:18','回复信息14','2023-04-07 09:06:18','2023-04-07 09:06:18'),(15,14,1,'留言','2023-04-07 09:25:32','好的撒爱我的','2023-04-07 09:27:06','2023-04-07 09:25:32');
CREATE TABLE `qiuyuan_collection` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`qiuyuan_id` int(11) DEFAULT NULL COMMENT '球员',
`yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
`qiuyuan_collection_types` int(11) DEFAULT NULL COMMENT '类型',
`insert_time` timestamp NULL DEFAULT NULL COMMENT '收藏时间',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show3 photoShow',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 COMMENT='球员收藏';
/*Data for the table `qiuyuan_collection` */
insert into `qiuyuan_collection`(`id`,`qiuyuan_id`,`yonghu_id`,`qiuyuan_collection_types`,`insert_time`,`create_time`) values (1,1,1,1,'2023-04-07 09:06:18','2023-04-07 09:06:18'),(2,2,2,1,'2023-04-07 09:06:18','2023-04-07 09:06:18'),(3,3,1,1,'2023-04-07 09:06:18','2023-04-07 09:06:18'),(4,4,1,1,'2023-04-07 09:06:18','2023-04-07 09:06:18'),(5,5,2,1,'2023-04-07 09:06:18','2023-04-07 09:06:18'),(6,6,3,1,'2023-04-07 09:06:18','2023-04-07 09:06:18'),(7,7,3,1,'2023-04-07 09:06:18','2023-04-07 09:06:18'),(8,8,3,1,'2023-04-07 09:06:18','2023-04-07 09:06:18'),(9,9,2,1,'2023-04-07 09:06:18','2023-04-07 09:06:18'),(10,10,1,1,'2023-04-07 09:06:18','2023-04-07 09:06:18'),(12,12,1,1,'2023-04-07 09:06:18','2023-04-07 09:06:18'),(13,13,3,1,'2023-04-07 09:06:18','2023-04-07 09:06:18'),(14,14,2,1,'2023-04-07 09:06:18','2023-04-07 09:06:18'),(15,11,1,1,'2023-04-07 09:24:19','2023-04-07 09:24:19');
/*Table structure for table `qiuyuan_liuyan` */
DROP TABLE IF EXISTS `qiuyuan_liuyan`;
CREATE TABLE `qiuyuan_liuyan` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`qiuyuan_id` int(11) DEFAULT NULL COMMENT '球员',
`yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
`qiuyuan_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 '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8 COMMENT='球员留言';
/*Data for the table `qiuyuan_liuyan` */
insert into `qiuyuan_liuyan`(`id`,`qiuyuan_id`,`yonghu_id`,`qiuyuan_liuyan_text`,`insert_time`,`reply_text`,`update_time`,`create_time`) values (1,1,2,'留言内容1','2023-04-07 09:06:18','回复信息1','2023-04-07 09:06:18','2023-04-07 09:06:18'),(2,2,3,'留言内容2','2023-04-07 09:06:18','回复信息2','2023-04-07 09:06:18','2023-04-07 09:06:18'),(3,3,1,'留言内容3','2023-04-07 09:06:18','回复信息3','2023-04-07 09:06:18','2023-04-07 09:06:18'),(4,4,2,'留言内容4','2023-04-07 09:06:18','回复信息4','2023-04-07 09:06:18','2023-04-07 09:06:18'),(5,5,1,'留言内容5','2023-04-07 09:06:18','回复信息5','2023-04-07 09:06:18','2023-04-07 09:06:18'),(6,6,1,'留言内容6','2023-04-07 09:06:18','回复信息6','2023-04-07 09:06:18','2023-04-07 09:06:18'),(7,7,2,'留言内容7','2023-04-07 09:06:18','回复信息7','2023-04-07 09:06:18','2023-04-07 09:06:18'),(8,8,1,'留言内容8','2023-04-07 09:06:18','回复信息8','2023-04-07 09:06:18','2023-04-07 09:06:18'),(9,9,1,'留言内容9','2023-04-07 09:06:18','回复信息9','2023-04-07 09:06:18','2023-04-07 09:06:18'),(10,10,1,'留言内容10','2023-04-07 09:06:18','回复信息10','2023-04-07 09:06:18','2023-04-07 09:06:18'),(11,11,3,'留言内容11','2023-04-07 09:06:18','回复信息11','2023-04-07 09:06:18','2023-04-07 09:06:18'),(12,12,1,'留言内容12','2023-04-07 09:06:18','回复信息12','2023-04-07 09:06:18','2023-04-07 09:06:18'),(13,13,2,'留言内容13','2023-04-07 09:06:18','回复信息13','2023-04-07 09:06:18','2023-04-07 09:06:18'),(14,14,1,'留言内容14','2023-04-07 09:06:18','回复信息14','2023-04-07 09:06:18','2023-04-07 09:06:18');
/*Table structure for table `token` */
DROP TABLE IF EXISTS `token`;
CREATE TABLE `token` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`userid` bigint(20) NOT NULL COMMENT '儿童id',
`username` varchar(100) NOT NULL COMMENT '儿童名',
`tablename` varchar(100) DEFAULT NULL COMMENT '表名',
`role` varchar(100) DEFAULT NULL COMMENT '角色',
`token` varchar(200) NOT NULL COMMENT '密码',
`addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '新增时间',
`expiratedtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '过期时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='token表';
/*Data for the table `token` */
insert into `token`(`id`,`userid`,`username`,`tablename`,`role`,`token`,`addtime`,`expiratedtime`) values (1,1,'a1','yonghu','用户','tzwptuzu722e75vq1qx3m55gqhyaleno','2023-04-07 09:08:02','2023-04-07 10:24:06'),(2,1,'admin','users','管理员','91ju9mihlhn3vwi4357xn17fy06lvqwe','2023-04-07 09:10:10','2023-04-07 10:26:12');
/*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-07 09:06:04');
/*Table structure for table `yonghu` */
DROP TABLE IF EXISTS `yonghu`;
CREATE TABLE `yonghu` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`username` varchar(200) DEFAULT NULL COMMENT '账户',
`password` varchar(200) DEFAULT NULL COMMENT '密码',
`yonghu_name` varchar(200) DEFAULT NULL COMMENT '用户姓名 Search111 ',
`yonghu_phone` varchar(200) DEFAULT NULL COMMENT '用户手机号',
`yonghu_id_number` varchar(200) DEFAULT NULL COMMENT '用户身份证号',
`yonghu_photo` varchar(200) DEFAULT NULL COMMENT '用户头像',
`sex_types` int(11) DEFAULT NULL COMMENT '性别',
`yonghu_email` varchar(200) DEFAULT NULL COMMENT '用户邮箱',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='用户';
/*Data for the table `yonghu` */
insert into `yonghu`(`id`,`username`,`password`,`yonghu_name`,`yonghu_phone`,`yonghu_id_number`,`yonghu_photo`,`sex_types`,`yonghu_email`,`create_time`) values (1,'a1','123456','用户姓名1','17703786901','410224199010102001','upload/yonghu1.jpg',1,'1@qq.com','2023-04-07 09:06:18'),(2,'a2','123456','用户姓名2','17703786902','410224199010102002','upload/yonghu2.jpg',1,'2@qq.com','2023-04-07 09:06:18'),(3,'a3','123456','用户姓名3','17703786903','410224199010102003','upload/yonghu3.jpg',1,'3@qq.com','2023-04-07 09:06:18');
/*!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("/qiudui")
public class QiuduiController {
private static final Logger logger = LoggerFactory.getLogger(QiuduiController.class);
private static final String TABLE_NAME = "qiudui";
@Autowired
private QiuduiService qiuduiService;
@Autowired
private TokenService tokenService;
@Autowired
private DictionaryService dictionaryService;//字典
@Autowired
private ForumService forumService;//论坛
@Autowired
private GonggaoService gonggaoService;//篮球资讯
@Autowired
private QiuduiCollectionService qiuduiCollectionService;//球队收藏
@Autowired
private QiuduiLiuyanService qiuduiLiuyanService;//球队留言
@Autowired
private QiuyuanService qiuyuanService;//球员
@Autowired
private QiuyuanCollectionService qiuyuanCollectionService;//球员收藏
@Autowired
private QiuyuanLiuyanService qiuyuanLiuyanService;//球员留言
@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 = qiuduiService.queryPage(params);
//字典表数据转换
List<QiuduiView> list =(List<QiuduiView>)page.getList();
for(QiuduiView 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);
QiuduiEntity qiudui = qiuduiService.selectById(id);
if(qiudui !=null){
//entity转view
QiuduiView view = new QiuduiView();
BeanUtils.copyProperties( qiudui , view );//把实体数据重构到view中
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody QiuduiEntity qiudui, HttpServletRequest request){
logger.debug("save方法:,,Controller:{},,qiudui:{}",this.getClass().getName(),qiudui.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
if(false)
return R.error(511,"永远不会进入");
Wrapper<QiuduiEntity> queryWrapper = new EntityWrapper<QiuduiEntity>()
.eq("qiudui_name", qiudui.getQiuduiName())
.eq("qiudui_jiaiolian", qiudui.getQiuduiJiaiolian())
.eq("qiudui_guojia", qiudui.getQiuduiGuojia())
.eq("qiudui_address", qiudui.getQiuduiAddress())
.eq("zan_number", qiudui.getZanNumber())
.eq("cai_number", qiudui.getCaiNumber())
.eq("chuangjian_time", new SimpleDateFormat("yyyy-MM-dd").format(qiudui.getChuangjianTime()))
.eq("qiudui_types", qiudui.getQiuduiTypes())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
QiuduiEntity qiuduiEntity = qiuduiService.selectOne(queryWrapper);
if(qiuduiEntity==null){
qiudui.setQiuduiClicknum(1);
qiudui.setInsertTime(new Date());
qiudui.setCreateTime(new Date());
qiuduiService.insert(qiudui);
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
/**
* 后端修改
*/
@RequestMapping("/update")
public R update(@RequestBody QiuduiEntity qiudui, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {
logger.debug("update方法:,,Controller:{},,qiudui:{}",this.getClass().getName(),qiudui.toString());
QiuduiEntity oldQiuduiEntity = qiuduiService.selectById(qiudui.getId());//查询原先数据
String role = String.valueOf(request.getSession().getAttribute("role"));
// if(false)
// return R.error(511,"永远不会进入");
if("".equals(qiudui.getQiuduiPhoto()) || "null".equals(qiudui.getQiuduiPhoto())){
qiudui.setQiuduiPhoto(null);
}
qiuduiService.updateById(qiudui);//根据id更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids, HttpServletRequest request){
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
List<QiuduiEntity> oldQiuduiList =qiuduiService.selectBatchIds(Arrays.asList(ids));//要删除的数据
qiuduiService.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");
//.eq("time", new SimpleDateFormat("yyyy-MM-dd").format(new Date()))
try {
List<QiuduiEntity> qiuduiList = 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){
//循环
QiuduiEntity qiuduiEntity = new QiuduiEntity();
// qiuduiEntity.setQiuduiName(data.get(0)); //球队名称 要改的
// qiuduiEntity.setQiuduiUuidNumber(data.get(0)); //球队编号 要改的
// qiuduiEntity.setQiuduiPhoto("");//详情和图片
// qiuduiEntity.setQiuduiJiaiolian(data.get(0)); //球队主教练 要改的
// qiuduiEntity.setQiuduiGuojia(data.get(0)); //所属国家 要改的
// qiuduiEntity.setQiuduiAddress(data.get(0)); //球队地点 要改的
// qiuduiEntity.setZanNumber(Integer.valueOf(data.get(0))); //赞 要改的
// qiuduiEntity.setCaiNumber(Integer.valueOf(data.get(0))); //踩 要改的
// qiuduiEntity.setChuangjianTime(sdf.parse(data.get(0))); //球队创建时间 要改的
// qiuduiEntity.setQiuduiTypes(Integer.valueOf(data.get(0))); //球队类型 要改的
// qiuduiEntity.setQiuduiClicknum(Integer.valueOf(data.get(0))); //球队热度 要改的
// qiuduiEntity.setQiuduiContent("");//详情和图片
// qiuduiEntity.setQiuduiRongyuContent("");//详情和图片
// qiuduiEntity.setInsertTime(date);//时间
// qiuduiEntity.setCreateTime(date);//时间
qiuduiList.add(qiuduiEntity);
//把要查询是否重复的字段放入map中
//球队编号
if(seachFields.containsKey("qiuduiUuidNumber")){
List<String> qiuduiUuidNumber = seachFields.get("qiuduiUuidNumber");
qiuduiUuidNumber.add(data.get(0));//要改的
}else{
List<String> qiuduiUuidNumber = new ArrayList<>();
qiuduiUuidNumber.add(data.get(0));//要改的
seachFields.put("qiuduiUuidNumber",qiuduiUuidNumber);
}
}
//查询是否重复
//球队编号
List<QiuduiEntity> qiuduiEntities_qiuduiUuidNumber = qiuduiService.selectList(new EntityWrapper<QiuduiEntity>().in("qiudui_uuid_number", seachFields.get("qiuduiUuidNumber")));
if(qiuduiEntities_qiuduiUuidNumber.size() >0 ){
ArrayList<String> repeatFields = new ArrayList<>();
for(QiuduiEntity s:qiuduiEntities_qiuduiUuidNumber){
repeatFields.add(s.getQiuduiUuidNumber());
}
return R.error(511,"数据库的该表中的 [球队编号] 字段已经存在 存在数据为:"+repeatFields.toString());
}
qiuduiService.insertBatch(qiuduiList);
return R.ok();
}
}
}
}catch (Exception e){
e.printStackTrace();
return R.error(511,"批量插入数据异常,请联系管理员");
}
}
/**
* 个性推荐
*/
@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<QiuduiView> returnQiuduiViewList = new ArrayList<>();
//查看收藏
Map<String, Object> params1 = new HashMap<>(params);params1.put("sort","id");params1.put("yonghuId",request.getSession().getAttribute("userId"));
PageUtils pageUtils = qiuduiCollectionService.queryPage(params1);
List<QiuduiCollectionView> collectionViewsList =(List<QiuduiCollectionView>)pageUtils.getList();
Map<Integer,Integer> typeMap=new HashMap<>();//购买的类型list
for(QiuduiCollectionView collectionView:collectionViewsList){
Integer qiuduiTypes = collectionView.getQiuduiTypes();
if(typeMap.containsKey(qiuduiTypes)){
typeMap.put(qiuduiTypes,typeMap.get(qiuduiTypes)+1);
}else{
typeMap.put(qiuduiTypes,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("qiuduiTypes",type);
PageUtils pageUtils1 = qiuduiService.queryPage(params2);
List<QiuduiView> qiuduiViewList =(List<QiuduiView>)pageUtils1.getList();
returnQiuduiViewList.addAll(qiuduiViewList);
if(returnQiuduiViewList.size()>= limit) break;//返回的推荐数量大于要的数量 跳出循环
}
//正常查询出来商品,用于补全推荐缺少的数据
PageUtils page = qiuduiService.queryPage(params);
if(returnQiuduiViewList.size()<limit){//返回数量还是小于要求数量
int toAddNum = limit - returnQiuduiViewList.size();//要添加的数量
List<QiuduiView> qiuduiViewList =(List<QiuduiView>)page.getList();
for(QiuduiView qiuduiView:qiuduiViewList){
Boolean addFlag = true;
for(QiuduiView returnQiuduiView:returnQiuduiViewList){
if(returnQiuduiView.getId().intValue() ==qiuduiView.getId().intValue()) addFlag=false;//返回的数据中已存在此商品
}
if(addFlag){
toAddNum=toAddNum-1;
returnQiuduiViewList.add(qiuduiView);
if(toAddNum==0) break;//够数量了
}
}
}else {
returnQiuduiViewList = returnQiuduiViewList.subList(0, limit);
}
for(QiuduiView c:returnQiuduiViewList)
dictionaryService.dictionaryConvert(c, request);
page.setList(returnQiuduiViewList);
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 = qiuduiService.queryPage(params);
//字典表数据转换
List<QiuduiView> list =(List<QiuduiView>)page.getList();
for(QiuduiView 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);
QiuduiEntity qiudui = qiuduiService.selectById(id);
if(qiudui !=null){
//点击数量加1
qiudui.setQiuduiClicknum(qiudui.getQiuduiClicknum()+1);
qiuduiService.updateById(qiudui);
//entity转view
QiuduiView view = new QiuduiView();
BeanUtils.copyProperties( qiudui , view );//把实体数据重构到view中
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody QiuduiEntity qiudui, HttpServletRequest request){
logger.debug("add方法:,,Controller:{},,qiudui:{}",this.getClass().getName(),qiudui.toString());
Wrapper<QiuduiEntity> queryWrapper = new EntityWrapper<QiuduiEntity>()
.eq("qiudui_name", qiudui.getQiuduiName())
.eq("qiudui_uuid_number", qiudui.getQiuduiUuidNumber())
.eq("qiudui_jiaiolian", qiudui.getQiuduiJiaiolian())
.eq("qiudui_guojia", qiudui.getQiuduiGuojia())
.eq("qiudui_address", qiudui.getQiuduiAddress())
.eq("zan_number", qiudui.getZanNumber())
.eq("cai_number", qiudui.getCaiNumber())
.eq("qiudui_types", qiudui.getQiuduiTypes())
.eq("qiudui_clicknum", qiudui.getQiuduiClicknum())
// .notIn("qiudui_types", new Integer[]{102})
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
QiuduiEntity qiuduiEntity = qiuduiService.selectOne(queryWrapper);
if(qiuduiEntity==null){
qiudui.setZanNumber(1);
qiudui.setCaiNumber(1);
qiudui.setQiuduiClicknum(1);
qiudui.setInsertTime(new Date());
qiudui.setCreateTime(new Date());
qiuduiService.insert(qiudui);
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.QiuduiCollectionEntity;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.lang.Nullable;
import java.util.List;
/**
* 球队收藏 服务类
*/
public interface QiuduiCollectionService extends IService<QiuduiCollectionEntity> {
/**
* @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.QiuduiCollectionDao;
import com.entity.QiuduiCollectionEntity;
import com.service.QiuduiCollectionService;
import com.entity.view.QiuduiCollectionView;
/**
* 球队收藏 服务实现类
*/
@Service("qiuduiCollectionService")
@Transactional
public class QiuduiCollectionServiceImpl extends ServiceImpl<QiuduiCollectionDao, QiuduiCollectionEntity> implements QiuduiCollectionService {
@Override
public PageUtils queryPage(Map<String,Object> params) {
Page<QiuduiCollectionView> page =new Query<QiuduiCollectionView>(params).getPage();
page.setRecords(baseMapper.selectListView(page,params));
return new PageUtils(page);
}
}
5.4 球队管理Dao模块
package com.dao;
import com.entity.QiuduiCollectionEntity;
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.QiuduiCollectionView;
/**
* 球队收藏 Dao 接口
*
* @author
*/
public interface QiuduiCollectionDao extends BaseMapper<QiuduiCollectionEntity> {
List<QiuduiCollectionView> selectListView(Pagination page,@Param("params")Map<String,Object> params);
}
6、论文目录结构
7、源码获取
感谢大家的阅读,如有不懂的问题可以评论区交流或私聊!
喜欢文章可以点赞、收藏、关注、评论啦
→获取源码请私信←