开发语言:Java
框架:ssm
JDK版本:JDK1.8
服务器:tomcat7
数据库:mysql 5.7(一定要5.7版本)
数据库工具:Navicat11
开发软件:eclipse/myeclipse/idea
Maven包:Maven3.3.9
浏览器:谷歌浏览器
小程序框架:uniapp
小程序开发软件:HBuilder X
小程序运行软件:微信开发者
数据库:
DROP TABLE IF EXISTS `storeup`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `storeup` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT ‘主键’,
`addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT ‘创建时间’,
`userid` bigint(20) NOT NULL COMMENT ‘用户id’,
`refid` bigint(20) DEFAULT NULL COMMENT ‘收藏id’,
`tablename` varchar(200) DEFAULT NULL COMMENT ‘表名’,
`name` varchar(200) NOT NULL COMMENT ‘收藏名称’,
`picture` varchar(200) NOT NULL COMMENT ‘收藏图片’,
`type` varchar(200) DEFAULT ‘1’ COMMENT ‘类型(1:收藏,21:赞,22:踩)’,
`inteltype` varchar(200) DEFAULT NULL COMMENT ‘推荐类型’,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT=’收藏表’;
/*!40101 SET character_set_client = @saved_cs_client */;
—
— Dumping data for table `storeup`
—
LOCK TABLES `storeup` WRITE;
/*!40000 ALTER TABLE `storeup` DISABLE KEYS */;
/*!40000 ALTER TABLE `storeup` ENABLE KEYS */;
UNLOCK TABLES;
—
— Table structure for table `token`
—
DROP TABLE IF EXISTS `token`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
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=2 DEFAULT CHARSET=utf8 COMMENT=’token表’;
/*!40101 SET character_set_client = @saved_cs_client */;
—
— Dumping data for table `token`
—
LOCK TABLES `token` WRITE;
/*!40000 ALTER TABLE `token` DISABLE KEYS */;
INSERT INTO `token` VALUES (1,11,’学生学号1′,’xuesheng’,’学生’,’g8llculzf2r3san38bg6am1x7fajz65u’,’2022-02-21 08:47:37′,’2022-02-21 09:47:37′);
/*!40000 ALTER TABLE `token` ENABLE KEYS */;
UNLOCK TABLES;
—
— Table structure for table `users`
—
DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
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=’用户表’;
/*!40101 SET character_set_client = @saved_cs_client */;
—
— Dumping data for table `users`
—
LOCK TABLES `users` WRITE;
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
INSERT INTO `users` VALUES (1,’abo’,’abo’,’管理员’,’2022-02-21 08:35:17′);
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
UNLOCK TABLES;
—
— Table structure for table `xuesheng`
—
DROP TABLE IF EXISTS `xuesheng`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `xuesheng` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT ‘主键’,
`addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT ‘创建时间’,
`xueshengxuehao` varchar(200) DEFAULT NULL COMMENT ‘学生学号’,
`xueshengxingming` varchar(200) DEFAULT NULL COMMENT ‘学生姓名’,
`mima` varchar(200) DEFAULT NULL COMMENT ‘密码’,
`xingbie` varchar(200) DEFAULT NULL COMMENT ‘性别’,
`lianxidianhua` varchar(200) DEFAULT NULL COMMENT ‘联系电话’,
PRIMARY KEY (`id`),
UNIQUE KEY `xueshengxuehao` (`xueshengxuehao`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8 COMMENT=’学生’;
/*!40101 SET character_set_client = @saved_cs_client */;
—
— Dumping data for table `xuesheng`
—
逻辑代码:
/**
* 后端列表
*/
@RequestMapping(“/page”)
public R page(@RequestParam Map<String, Object> params,ShenqingjiangshiEntity shenqingjiangshi,
HttpServletRequest request){
String tableName = request.getSession().getAttribute(“tableName”).toString();
if(tableName.equals(“xuesheng”)) {
shenqingjiangshi.setXueshengxuehao((String)request.getSession().getAttribute(“username”));
}
EntityWrapper<ShenqingjiangshiEntity> ew = new EntityWrapper<ShenqingjiangshiEntity>();
PageUtils page = shenqingjiangshiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, shenqingjiangshi), params), params));
return R.ok().put(“data”, page);
}
/**
* 前端列表
*/
@RequestMapping(“/list”)
public R list(@RequestParam Map<String, Object> params,ShenqingjiangshiEntity shenqingjiangshi,
HttpServletRequest request){
EntityWrapper<ShenqingjiangshiEntity> ew = new EntityWrapper<ShenqingjiangshiEntity>();
PageUtils page = shenqingjiangshiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, shenqingjiangshi), params), params));
return R.ok().put(“data”, page);
}
/**
* 列表
*/
@RequestMapping(“/lists”)
public R list( ShenqingjiangshiEntity shenqingjiangshi){
EntityWrapper<ShenqingjiangshiEntity> ew = new EntityWrapper<ShenqingjiangshiEntity>();
ew.allEq(MPUtil.allEQMapPre( shenqingjiangshi, “shenqingjiangshi”));
return R.ok().put(“data”, shenqingjiangshiService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping(“/query”)
public R query(ShenqingjiangshiEntity shenqingjiangshi){
EntityWrapper< ShenqingjiangshiEntity> ew = new EntityWrapper< ShenqingjiangshiEntity>();
ew.allEq(MPUtil.allEQMapPre( shenqingjiangshi, “shenqingjiangshi”));
ShenqingjiangshiView shenqingjiangshiView = shenqingjiangshiService.selectView(ew);
return R.ok(“查询申请讲师成功”).put(“data”, shenqingjiangshiView);
}
/**
* 后端详情
*/
@RequestMapping(“/info/{id}”)
public R info(@PathVariable(“id”) Long id){
ShenqingjiangshiEntity shenqingjiangshi = shenqingjiangshiService.selectById(id);
return R.ok().put(“data”, shenqingjiangshi);
}
/**
* 前端详情
*/
@RequestMapping(“/detail/{id}”)
public R detail(@PathVariable(“id”) Long id){
ShenqingjiangshiEntity shenqingjiangshi = shenqingjiangshiService.selectById(id);
return R.ok().put(“data”, shenqingjiangshi);
}
/**
* 后端保存
*/
@RequestMapping(“/save”)
public R save(@RequestBody ShenqingjiangshiEntity shenqingjiangshi, HttpServletRequest request){
shenqingjiangshi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(shenqingjiangshi);
shenqingjiangshiService.insert(shenqingjiangshi);
return R.ok();
}