博主介绍:✌从事软件开发10年之余,专注于Java技术领域、Python人工智能及数据挖掘、小程序项目开发和Android项目开发等。CSDN、掘金、华为云、InfoQ、阿里云等平台优质作者✌
🍅文末获取源码联系🍅
👇🏻 精彩专栏推荐订阅👇🏻 不然下次找不到哟
————————————————
计算机毕业设计《1000套》✌
目录
1、项目介绍及开发技术
1.1 项目介绍
计算机网络发展到现在已经好几十年了,在理论上面已经有了很丰富的基础,并且在现实生活中也到处都在使用,可以说,经过几十年的发展,互联网技术已经把地域信息的隔阂给消除了,让整个世界都可以即时通话和联系,极大的方便了人们的生活。所以说,信息管理用计算机技术来进行设计,不仅在管理方面更加的系统化,操作性强,最重要的是关于数据的保存和使用都能节约大量的时间,该系统非常的好用。
信息管理管理数据的工具是MySQL,编码的语言是Java,运用的框架是Spring Boot框架。该系统为了让你更好的了解知名作家。
信息管理不仅能让操作人员使用更加地方便,并且设计的也很合理,能有效的避免误操作,让数据在录入的环节就符合设计需要,极大的规避了源头性的输入误差,顺利的让数据变得更加可控并且可靠,让出错的几率降到最低。
1.2 开发技术
Java开发语言、SpringBoot、MyBatisPlus、MySQL数据库、Maven、IDEA开发工具、JDK1.8+、Vue、HTML、CSS、JS。
2、系统功能设计结构图
3、功能截图
3.1 前台功能
作家信息:用户在作品岗位界面中需要名称和其对应的描述信息。
作品: 用户在作品界面中查看作品信息。
论坛: 用户在论坛界面查看论坛的信息。
3.2 后台功能
作家管理:管理员在招聘管理界面中可以对界面中显示的所有数据进行导出,可以对招聘信息的招聘状态进行查看,可以添加新的招聘信息等。
作品管理:管理员在作品管理界面中查看,可以导出作品信息,新增作品信息等。
用户管理:管理员在用户管理界面中新增用户,并设置用户的角色,可以删除用户。
论坛管理: 管理员在论坛管理界面查看论坛可以对论坛的数据进行导出,可以添加新论坛的信息,可以编辑论坛信息,删除论坛信息。
4、数据库表结构设计
/*
SQLyog Ultimate v11.3 (64 bit)
MySQL - 5.7.32-log : Database - zhimingzuojiaguanlixit
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`zhimingzuojiaguanlixit` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `zhimingzuojiaguanlixit`;
/*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=16 DEFAULT CHARSET=utf8 COMMENT='字典';
/*Data for the table `dictionary` */
insert into `dictionary`(`id`,`dic_code`,`dic_name`,`code_index`,`index_name`,`super_id`,`beizhu`,`create_time`) values (1,'sex_types','性别类型',1,'男',NULL,NULL,'2023-02-24 13:42:03'),(2,'sex_types','性别类型',2,'女',NULL,NULL,'2023-02-24 13:42:03'),(3,'zuojia_types','获得的奖项',1,'诺奖',NULL,NULL,'2023-02-24 13:42:03'),(4,'zuojia_types','获得的奖项',2,'矛盾文学奖',NULL,NULL,'2023-02-24 13:42:03'),(5,'zuojia_types','获得的奖项',3,'人民文学奖',NULL,NULL,'2023-02-24 13:42:03'),(6,'zuojia_types','获得的奖项',4,'鲁迅文学奖',NULL,NULL,'2023-02-24 13:42:03'),(7,'zuopin_types','作品类型',1,'作品类型1',NULL,NULL,'2023-02-24 13:42:03'),(8,'zuopin_types','作品类型',2,'作品类型2',NULL,NULL,'2023-02-24 13:42:03'),(9,'zuopin_types','作品类型',3,'作品类型3',NULL,NULL,'2023-02-24 13:42:03'),(10,'zuopin_types','作品类型',4,'作品类型4',NULL,NULL,'2023-02-24 13:42:03'),(11,'zuojia_collection_types','收藏表类型',1,'收藏',NULL,NULL,'2023-02-24 13:42:03'),(12,'forum_state_types','帖子状态',1,'发帖',NULL,NULL,'2023-02-24 13:42:03'),(13,'forum_state_types','帖子状态',2,'回帖',NULL,NULL,'2023-02-24 13:42:03'),(14,'gonggao_types','公告类型',1,'公告类型1',NULL,NULL,'2023-02-24 13:42:03'),(15,'gonggao_types','公告类型',2,'公告类型2',NULL,NULL,'2023-02-24 13:42:03');
/*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` text 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=7 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',4,1,'2023-02-24 13:42:28','2023-02-24 13:42:28','2023-02-24 13:42:28'),(2,'帖子标题2',3,NULL,'发布内容2',279,1,'2023-02-24 13:42:28','2023-02-24 13:42:28','2023-02-24 13:42:28'),(3,'帖子标题3',3,NULL,'发布内容3',107,1,'2023-02-24 13:42:28','2023-02-24 13:42:28','2023-02-24 13:42:28'),(4,'帖子标题4',2,NULL,'发布内容4',423,1,'2023-02-24 13:42:28','2023-02-24 13:42:28','2023-02-24 13:42:28'),(5,'帖子标题5',2,NULL,'发布内容5',330,1,'2023-02-24 13:42:28','2023-02-24 13:42:28','2023-02-24 13:42:28'),(6,'帖子',1,NULL,'帖子',NULL,1,'2023-02-24 14:31:22',NULL,'2023-02-24 14:31:22');
/*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` text COMMENT '公告详情 ',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 nameShow',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 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-02-24 13:42:28','公告详情1','2023-02-24 13:42:28'),(2,'公告名称2','upload/gonggao2.jpg',2,'2023-02-24 13:42:28','公告详情2','2023-02-24 13:42:28'),(3,'公告名称3','upload/gonggao3.jpg',1,'2023-02-24 13:42:28','公告详情3','2023-02-24 13:42:28'),(4,'公告名称4','upload/gonggao4.jpg',1,'2023-02-24 13:42:28','公告详情4','2023-02-24 13:42:28'),(5,'公告名称5','upload/gonggao5.jpg',1,'2023-02-24 13:42:28','公告详情5','2023-02-24 13:42:28');
/*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','用户','jl5gr6wjp7y5do88g1w5er019iix7w55','2023-02-24 10:17:28','2023-02-24 16:07:30'),(2,1,'admin','users','管理员','aou572168urqzlfyf8tckkzjlo8wcz65','2023-02-24 10:40:05','2023-02-24 15:33:07');
/*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=3 DEFAULT CHARSET=utf8 COMMENT='用户表';
/*Data for the table `users` */
insert into `users`(`id`,`username`,`password`,`role`,`addtime`) values (1,'admin','admin','管理员','2022-05-01 00:00:00');
/*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-02-24 13:42:28'),(2,'a2','123456','用户姓名2','17703786902','410224199010102002','upload/yonghu2.jpg',1,'2@qq.com','2023-02-24 13:42:28'),(3,'a3','123456','用户姓名3','17703786903','410224199010102003','upload/yonghu3.jpg',2,'3@qq.com','2023-02-24 13:42:28');
/*Table structure for table `zuojia` */
DROP TABLE IF EXISTS `zuojia`;
CREATE TABLE `zuojia` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
`zuojia_name` varchar(200) DEFAULT NULL COMMENT '作家姓名 Search111 ',
`zuojia_uuid_number` varchar(200) DEFAULT NULL COMMENT '作家编号',
`zuojia_photo` varchar(200) DEFAULT NULL COMMENT '作家照片',
`zuojia_types` int(11) DEFAULT NULL COMMENT '获得的奖项 Search111',
`zuojia_minzu` varchar(200) DEFAULT NULL COMMENT '民族',
`zuojia_jiguan` varchar(200) DEFAULT NULL COMMENT '作家籍贯',
`chusheng_time` timestamp NULL DEFAULT NULL COMMENT '出生年',
`huojiang_time` timestamp NULL DEFAULT NULL COMMENT '获奖时间',
`zuojia_daibia` varchar(200) DEFAULT NULL COMMENT '代表作',
`zuojia_content` text COMMENT '作家介绍 ',
`zuojia_delete` int(11) DEFAULT NULL COMMENT '逻辑删除',
`insert_time` timestamp NULL DEFAULT NULL COMMENT '录入时间',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 photoShow',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COMMENT='作家';
/*Data for the table `zuojia` */
insert into `zuojia`(`id`,`zuojia_name`,`zuojia_uuid_number`,`zuojia_photo`,`zuojia_types`,`zuojia_minzu`,`zuojia_jiguan`,`chusheng_time`,`huojiang_time`,`zuojia_daibia`,`zuojia_content`,`zuojia_delete`,`insert_time`,`create_time`) values (1,'作家姓名1','1677217348995','/upload/1677219915240.jpg',4,'民族1','作家籍贯1','2023-02-24 13:42:28','2023-02-24 13:42:28','代表作1','<p>作家介绍1</p>',1,'2023-02-24 13:42:28','2023-02-24 13:42:28'),(2,'作家姓名2','1677217349069','/upload/1677219799195.jpg',1,'民族2','作家籍贯2','2023-02-24 13:42:28','2023-02-24 13:42:28','代表作2','<p>作家介绍2</p>',1,'2023-02-24 13:42:28','2023-02-24 13:42:28'),(3,'作家姓名3','1677217349015','/upload/1677219788911.jpeg',1,'民族3','作家籍贯3','2023-02-24 13:42:28','2023-02-24 13:42:28','代表作3','<p>作家介绍3</p>',1,'2023-02-24 13:42:28','2023-02-24 13:42:28'),(4,'作家姓名4','1677217349026','/upload/1677219778953.jpg',1,'民族4','作家籍贯4','2023-02-24 13:42:28','2023-02-24 13:42:28','代表作4','<p>作家介绍4</p>',1,'2023-02-24 13:42:28','2023-02-24 13:42:28'),(5,'作家姓名5','1677217349071','/upload/1677219768852.jpg',4,'民族5','作家籍贯5','2023-02-24 13:42:28','2023-02-24 13:42:28','代表作5','<p>作家介绍5</p>',1,'2023-02-24 13:42:28','2023-02-24 13:42:28'),(6,'啊啊啊','1677220419772','/upload/1677220442467.jpg',2,'汉','加','2023-02-24 14:33:55','2023-02-24 14:33:59','无','<p>好</p>',2,'2023-02-24 14:34:07','2023-02-24 14:34:07');
/*Table structure for table `zuojia_collection` */
DROP TABLE IF EXISTS `zuojia_collection`;
CREATE TABLE `zuojia_collection` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`zuojia_id` int(11) DEFAULT NULL COMMENT '作家',
`yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
`zuojia_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=12 DEFAULT CHARSET=utf8 COMMENT='作家收藏';
/*Data for the table `zuojia_collection` */
insert into `zuojia_collection`(`id`,`zuojia_id`,`yonghu_id`,`zuojia_collection_types`,`insert_time`,`create_time`) values (2,2,2,1,'2023-02-24 13:42:28','2023-02-24 13:42:28'),(3,3,2,1,'2023-02-24 13:42:28','2023-02-24 13:42:28'),(11,5,1,1,'2023-02-24 14:32:07','2023-02-24 14:32:07');
/*Table structure for table `zuojia_liuyan` */
DROP TABLE IF EXISTS `zuojia_liuyan`;
CREATE TABLE `zuojia_liuyan` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`zuojia_id` int(11) DEFAULT NULL COMMENT '作家',
`yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
`zuojia_liuyan_text` text COMMENT '留言内容',
`insert_time` timestamp NULL DEFAULT NULL COMMENT '留言时间',
`reply_text` text COMMENT '回复内容',
`update_time` timestamp NULL DEFAULT NULL COMMENT '回复时间',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='留言';
/*Data for the table `zuojia_liuyan` */
insert into `zuojia_liuyan`(`id`,`zuojia_id`,`yonghu_id`,`zuojia_liuyan_text`,`insert_time`,`reply_text`,`update_time`,`create_time`) values (1,1,1,'留言内容1','2023-02-24 13:42:28','回复信息1','2023-02-24 13:42:28','2023-02-24 13:42:28'),(2,2,3,'留言内容2','2023-02-24 13:42:28','回复信息2','2023-02-24 13:42:28','2023-02-24 13:42:28'),(3,3,1,'留言内容3','2023-02-24 13:42:28','回复信息3','2023-02-24 13:42:28','2023-02-24 13:42:28'),(4,4,2,'留言内容4','2023-02-24 13:42:28','回复信息4','2023-02-24 13:42:28','2023-02-24 13:42:28'),(5,5,2,'留言内容5','2023-02-24 13:42:28','回复信息5','2023-02-24 13:42:28','2023-02-24 13:42:28');
/*Table structure for table `zuopin` */
DROP TABLE IF EXISTS `zuopin`;
CREATE TABLE `zuopin` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
`zuojia_id` int(11) DEFAULT NULL COMMENT '作家',
`zuopin_name` varchar(200) DEFAULT NULL COMMENT '作品名称 Search111 ',
`zuopin_uuid_number` varchar(200) DEFAULT NULL COMMENT '作品编号',
`zuopin_photo` varchar(200) DEFAULT NULL COMMENT '作品封面',
`zuopin_types` int(11) DEFAULT NULL COMMENT '作品类型 Search111',
`fabu_time` timestamp NULL DEFAULT NULL COMMENT '发布时间',
`zuopin_content` text COMMENT '作品介绍 ',
`zuopin_delete` int(11) DEFAULT NULL COMMENT '逻辑删除',
`insert_time` timestamp NULL DEFAULT NULL COMMENT '录入时间',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 photoShow',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COMMENT='作品';
/*Data for the table `zuopin` */
insert into `zuopin`(`id`,`zuojia_id`,`zuopin_name`,`zuopin_uuid_number`,`zuopin_photo`,`zuopin_types`,`fabu_time`,`zuopin_content`,`zuopin_delete`,`insert_time`,`create_time`) values (1,1,'作品名称1','1677217349056','/upload/1677219992890.jpg',2,'2023-02-24 13:42:28','<p>作品介绍1</p>',1,'2023-02-24 13:42:28','2023-02-24 13:42:28'),(2,2,'作品名称2','1677217349032','/upload/1677219982210.jpg',2,'2023-02-24 13:42:28','<p>作品介绍2</p>',1,'2023-02-24 13:42:28','2023-02-24 13:42:28'),(3,3,'作品名称3','1677217349083','/upload/1677219969027.jpg',1,'2023-02-24 13:42:28','<p>作品介绍3</p>',1,'2023-02-24 13:42:28','2023-02-24 13:42:28'),(4,4,'作品名称4','1677217349039','/upload/1677219948396.jpg',3,'2023-02-24 13:42:28','<p>作品介绍4</p>',1,'2023-02-24 13:42:28','2023-02-24 13:42:28'),(5,5,'作品名称5','1677217348996','/upload/1677219938684.jpg',3,'2023-02-24 13:42:28','<p>作品介绍5</p>',1,'2023-02-24 13:42:28','2023-02-24 13:42:28'),(6,1,'丫丫','1677220477590','/upload/1677220490887.jpg',2,'2023-02-24 14:34:47','<p>丫丫</p>',1,'2023-02-24 14:34:55','2023-02-24 14:34:55');
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
5、关键代码
5.1 作家Controller模块
/**
* 作家
* 后端接口
* @author 学长编程
* @email
* WeChat jsjbysj88
*/
@RestController
@Controller
@RequestMapping("/zuojia")
public class ZuojiaController {
private static final Logger logger = LoggerFactory.getLogger(ZuojiaController.class);
private static final String TABLE_NAME = "zuojia";
@Autowired
private ZuojiaService zuojiaService;
@Autowired
private TokenService tokenService;
@Autowired
private DictionaryService dictionaryService;
@Autowired
private ZuojiaCollectionService zuojiaCollectionService;
//级联表非注册的service
//注册表service
@Autowired
private YonghuService yonghuService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
String role = String.valueOf(request.getSession().getAttribute("role"));
if(false)
return R.error(511,"永不会进入");
else if("用户".equals(role))
params.put("yonghuId",request.getSession().getAttribute("userId"));
params.put("zuojiaDeleteStart",1);params.put("zuojiaDeleteEnd",1);
CommonUtil.checkMap(params);
PageUtils page = zuojiaService.queryPage(params);
//字典表数据转换
List<ZuojiaView> list =(List<ZuojiaView>)page.getList();
for(ZuojiaView 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);
ZuojiaEntity zuojia = zuojiaService.selectById(id);
if(zuojia !=null){
//entity转view
ZuojiaView view = new ZuojiaView();
BeanUtils.copyProperties( zuojia , view );//把实体数据重构到view中
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody ZuojiaEntity zuojia, HttpServletRequest request){
logger.debug("save方法:,,Controller:{},,zuojia:{}",this.getClass().getName(),zuojia.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
if(false)
return R.error(511,"永远不会进入");
Wrapper<ZuojiaEntity> queryWrapper = new EntityWrapper<ZuojiaEntity>()
.eq("zuojia_name", zuojia.getZuojiaName())
.eq("zuojia_types", zuojia.getZuojiaTypes())
.eq("zuojia_minzu", zuojia.getZuojiaMinzu())
.eq("zuojia_jiguan", zuojia.getZuojiaJiguan())
.eq("zuojia_daibia", zuojia.getZuojiaDaibia())
.eq("zuojia_delete", zuojia.getZuojiaDelete())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
ZuojiaEntity zuojiaEntity = zuojiaService.selectOne(queryWrapper);
if(zuojiaEntity==null){
zuojia.setZuojiaDelete(1);
zuojia.setInsertTime(new Date());
zuojia.setCreateTime(new Date());
zuojiaService.insert(zuojia);
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
/**
* 后端修改
*/
@RequestMapping("/update")
public R update(@RequestBody ZuojiaEntity zuojia, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {
logger.debug("update方法:,,Controller:{},,zuojia:{}",this.getClass().getName(),zuojia.toString());
ZuojiaEntity oldZuojiaEntity = zuojiaService.selectById(zuojia.getId());//查询原先数据
String role = String.valueOf(request.getSession().getAttribute("role"));
// if(false)
// return R.error(511,"永远不会进入");
//根据字段查询是否有相同数据
Wrapper<ZuojiaEntity> queryWrapper = new EntityWrapper<ZuojiaEntity>()
.notIn("id",zuojia.getId())
.andNew()
.eq("zuojia_name", zuojia.getZuojiaName())
.eq("zuojia_types", zuojia.getZuojiaTypes())
.eq("zuojia_minzu", zuojia.getZuojiaMinzu())
.eq("zuojia_jiguan", zuojia.getZuojiaJiguan())
.eq("zuojia_daibia", zuojia.getZuojiaDaibia())
.eq("zuojia_delete", zuojia.getZuojiaDelete())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
ZuojiaEntity zuojiaEntity = zuojiaService.selectOne(queryWrapper);
if("".equals(zuojia.getZuojiaPhoto()) || "null".equals(zuojia.getZuojiaPhoto())){
zuojia.setZuojiaPhoto(null);
}
if(zuojiaEntity==null){
zuojiaService.updateById(zuojia);//根据id更新
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids, HttpServletRequest request){
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
List<ZuojiaEntity> oldZuojiaList =zuojiaService.selectBatchIds(Arrays.asList(ids));//要删除的数据
ArrayList<ZuojiaEntity> list = new ArrayList<>();
for(Integer id:ids){
ZuojiaEntity zuojiaEntity = new ZuojiaEntity();
zuojiaEntity.setId(id);
zuojiaEntity.setZuojiaDelete(2);
list.add(zuojiaEntity);
}
if(list != null && list.size() >0){
zuojiaService.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");
try {
List<ZuojiaEntity> zuojiaList = 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){
//循环
ZuojiaEntity zuojiaEntity = new ZuojiaEntity();
// zuojiaEntity.setZuojiaName(data.get(0)); //作家姓名 要改的
// zuojiaEntity.setZuojiaUuidNumber(data.get(0)); //作家编号 要改的
// zuojiaEntity.setZuojiaPhoto("");//详情和图片
// zuojiaEntity.setZuojiaTypes(Integer.valueOf(data.get(0))); //获得的奖项 要改的
// zuojiaEntity.setZuojiaMinzu(data.get(0)); //民族 要改的
// zuojiaEntity.setZuojiaJiguan(data.get(0)); //作家籍贯 要改的
// zuojiaEntity.setChushengTime(sdf.parse(data.get(0))); //出生年 要改的
// zuojiaEntity.setHuojiangTime(sdf.parse(data.get(0))); //获奖时间 要改的
// zuojiaEntity.setZuojiaDaibia(data.get(0)); //代表作 要改的
// zuojiaEntity.setZuojiaContent("");//详情和图片
// zuojiaEntity.setZuojiaDelete(1);//逻辑删除字段
// zuojiaEntity.setInsertTime(date);//时间
// zuojiaEntity.setCreateTime(date);//时间
zuojiaList.add(zuojiaEntity);
//把要查询是否重复的字段放入map中
//作家编号
if(seachFields.containsKey("zuojiaUuidNumber")){
List<String> zuojiaUuidNumber = seachFields.get("zuojiaUuidNumber");
zuojiaUuidNumber.add(data.get(0));//要改的
}else{
List<String> zuojiaUuidNumber = new ArrayList<>();
zuojiaUuidNumber.add(data.get(0));//要改的
seachFields.put("zuojiaUuidNumber",zuojiaUuidNumber);
}
}
//查询是否重复
//作家编号
List<ZuojiaEntity> zuojiaEntities_zuojiaUuidNumber = zuojiaService.selectList(new EntityWrapper<ZuojiaEntity>().in("zuojia_uuid_number", seachFields.get("zuojiaUuidNumber")).eq("zuojia_delete", 1));
if(zuojiaEntities_zuojiaUuidNumber.size() >0 ){
ArrayList<String> repeatFields = new ArrayList<>();
for(ZuojiaEntity s:zuojiaEntities_zuojiaUuidNumber){
repeatFields.add(s.getZuojiaUuidNumber());
}
return R.error(511,"数据库的该表中的 [作家编号] 字段已经存在 存在数据为:"+repeatFields.toString());
}
zuojiaService.insertBatch(zuojiaList);
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 = zuojiaService.queryPage(params);
//字典表数据转换
List<ZuojiaView> list =(List<ZuojiaView>)page.getList();
for(ZuojiaView 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);
ZuojiaEntity zuojia = zuojiaService.selectById(id);
if(zuojia !=null){
//entity转view
ZuojiaView view = new ZuojiaView();
BeanUtils.copyProperties( zuojia , view );//把实体数据重构到view中
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody ZuojiaEntity zuojia, HttpServletRequest request){
logger.debug("add方法:,,Controller:{},,zuojia:{}",this.getClass().getName(),zuojia.toString());
Wrapper<ZuojiaEntity> queryWrapper = new EntityWrapper<ZuojiaEntity>()
.eq("zuojia_name", zuojia.getZuojiaName())
.eq("zuojia_uuid_number", zuojia.getZuojiaUuidNumber())
.eq("zuojia_types", zuojia.getZuojiaTypes())
.eq("zuojia_minzu", zuojia.getZuojiaMinzu())
.eq("zuojia_jiguan", zuojia.getZuojiaJiguan())
.eq("zuojia_daibia", zuojia.getZuojiaDaibia())
.eq("zuojia_delete", zuojia.getZuojiaDelete())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
ZuojiaEntity zuojiaEntity = zuojiaService.selectOne(queryWrapper);
if(zuojiaEntity==null){
zuojia.setZuojiaDelete(1);
zuojia.setInsertTime(new Date());
zuojia.setCreateTime(new Date());
zuojiaService.insert(zuojia);
return R.ok();
}else {
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<ZuojiaView> returnZuojiaViewList = new ArrayList<>();
//查询订单
Map<String, Object> params1 = new HashMap<>(params);
params1.put("sort","id");
params1.put("yonghuId",request.getSession().getAttribute("userId"));
PageUtils pageUtils = zuojiaCollectionService.queryPage(params1);
List<ZuojiaCollectionView> orderViewsList =(List<ZuojiaCollectionView>)pageUtils.getList();
Map<Integer,Integer> typeMap=new HashMap<>();//购买的类型list
for(ZuojiaCollectionView orderView:orderViewsList){
Integer shicidaquanTypes = orderView.getZuojiaTypes();
if(typeMap.containsKey(shicidaquanTypes)){
typeMap.put(shicidaquanTypes,typeMap.get(shicidaquanTypes)+1);
}else{
typeMap.put(shicidaquanTypes,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("zuojiaTypes",type);
PageUtils pageUtils1 = zuojiaService.queryPage(params2);
List<ZuojiaView> shicidaquanViewList =(List<ZuojiaView>)pageUtils1.getList();
returnZuojiaViewList.addAll(shicidaquanViewList);
if(returnZuojiaViewList.size()>= limit) break;//返回的推荐数量大于要的数量 跳出循环
}
//正常查询出来商品,用于补全推荐缺少的数据
PageUtils page = zuojiaService.queryPage(params);
if(returnZuojiaViewList.size()<limit){//返回数量还是小于要求数量
int toAddNum = limit - returnZuojiaViewList.size();//要添加的数量
List<ZuojiaView> shicidaquanViewList =(List<ZuojiaView>)page.getList();
for(ZuojiaView shicidaquanView:shicidaquanViewList){
Boolean addFlag = true;
for(ZuojiaView returnShicidaquanView:returnZuojiaViewList){
if(returnShicidaquanView.getId().intValue() ==shicidaquanView.getId().intValue()) addFlag=false;//返回的数据中已存在此商品
}
if(addFlag){
toAddNum=toAddNum-1;
returnZuojiaViewList.add(shicidaquanView);
if(toAddNum==0) break;//够数量了
}
}
}else {
returnZuojiaViewList = returnZuojiaViewList.subList(0, limit);
}
for(ZuojiaView c:returnZuojiaViewList)
dictionaryService.dictionaryConvert(c, request);
page.setList(returnZuojiaViewList);
return R.ok().put("data", page);
}
}
5.2 作家Service模块
package com.service;
import com.baomidou.mybatisplus.service.IService;
import com.utils.PageUtils;
import com.entity.ZuojiaEntity;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.lang.Nullable;
import java.util.List;
/**
* 作家 服务类
*/
public interface ZuojiaService extends IService<ZuojiaEntity> {
/**
* @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.ZuojiaDao;
import com.entity.ZuojiaEntity;
import com.service.ZuojiaService;
import com.entity.view.ZuojiaView;
/**
* 作家 服务实现类
*/
@Service("zuojiaService")
@Transactional
public class ZuojiaServiceImpl extends ServiceImpl<ZuojiaDao, ZuojiaEntity> implements ZuojiaService {
@Override
public PageUtils queryPage(Map<String,Object> params) {
Page<ZuojiaView> page =new Query<ZuojiaView>(params).getPage();
page.setRecords(baseMapper.selectListView(page,params));
return new PageUtils(page);
}
}
5.4 作家Dao模块
package com.dao;
import com.entity.ZuojiaEntity;
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.ZuojiaView;
/**
* 作家 Dao 接口
*
* @author
*/
public interface ZuojiaDao extends BaseMapper<ZuojiaEntity> {
List<ZuojiaView> selectListView(Pagination page,@Param("params")Map<String,Object> params);
}
6、论文目录结构
7、源码获取
感谢大家的阅读,如有不懂的问题可以评论区交流或私聊!
喜欢文章可以点赞、收藏、关注、评论啦
→获取源码请私信←