基于微信小程序的青少年素质教育培训系统设计与实现-计算机毕业设计源码+LW文档

小程序开发说明

开发语言: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 AUTO_INCREMENT=1648964400963 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 */;

INSERT INTO `storeup` VALUES (1648964342185,’2022-04-03 05:39:01′,1648964299666,34,’jiaoxuexinxi’,’课程名称4′,’upload/jiaoxuexinxi_kechengtupian4.jpg’,’1′,NULL),(1648964400962,’2022-04-03 05:40:00′,1648964299666,1648964187595,’jiaoxuexinxi’,’xxxx’,’upload/1648964183386.png’,’1′,NULL);

/*!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=4 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,1648964148538,’222′,’jiaoshi’,’教师’,’dzw1i1xxfrbbjkweez1bvz4hxe88x6d5′,’2022-04-03 05:35:53′,’2022-04-03 06:41:08′),(2,1,’abo’,’users’,’管理员’,’8b2i8y9mg6tcdzp5p710tsuwtfcbamv2′,’2022-04-03 05:36:58′,’2022-04-03 06:36:58′),(3,1648964299666,’111′,’xuesheng’,’学生’,’2eeyu5biiv7o4i8tqm7dcjv1l108xokf’,’2022-04-03 05:38:43′,’2022-04-03 06:42:07′);

/*!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-04-03 03:19:50′);

/*!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 ‘创建时间’,

  `xuehao` varchar(200) NOT NULL COMMENT ‘学号’,

  `mima` varchar(200) NOT NULL COMMENT ‘密码’,

  `xingming` varchar(200) NOT NULL COMMENT ‘姓名’,

  `xingbie` varchar(200) DEFAULT NULL COMMENT ‘性别’,

  `shouji` varchar(200) DEFAULT NULL COMMENT ‘手机’,

  `touxiang` varchar(200) DEFAULT NULL COMMENT ‘头像’,

  PRIMARY KEY (`id`),

  UNIQUE KEY `xuehao` (`xuehao`)

) ENGINE=InnoDB AUTO_INCREMENT=1648964299667 DEFAULT CHARSET=utf8 COMMENT=’学生’;

/*!40101 SET character_set_client = @saved_cs_client */;

— Dumping data for table `xuesheng`

LOCK TABLES `xuesheng` WRITE;

/*!40000 ALTER TABLE `xuesheng` DISABLE KEYS */;

INSERT INTO `xuesheng` VALUES (11,’2022-04-03 03:19:49′,’学号1′,’123456′,’姓名1′,’男’,’13823888881′,’upload/xuesheng_touxiang1.jpg’),(12,’2022-04-03 03:19:49′,’学号2′,’123456′,’姓名2′,’男’,’13823888882′,’upload/xuesheng_touxiang2.jpg’),(13,’2022-04-03 03:19:49′,’学号3′,’123456′,’姓名3′,’男’,’13823888883′,’upload/xuesheng_touxiang3.jpg’),(14,’2022-04-03 03:19:49′,’学号4′,’123456′,’姓名4′,’男’,’13823888884′,’upload/xuesheng_touxiang4.jpg’),(15,’2022-04-03 03:19:49′,’学号5′,’123456′,’姓名5′,’男’,’13823888885′,’upload/xuesheng_touxiang5.jpg’),(16,’2022-04-03 03:19:49′,’学号6′,’123456′,’姓名6′,’男’,’13823888886′,’upload/xuesheng_touxiang6.jpg’),(1648964299666,’2022-04-03 05:38:19′,’111′,’111′,’张三’,’男’,’18154541454′,’upload/1648964372486.png’);

/*!40000 ALTER TABLE `xuesheng` ENABLE KEYS */;

UNLOCK TABLES;

/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

代码:

/**

 * 登录相关

 */

@RequestMapping(“users”)

@RestController

public class UserController{

@Autowired

private UserService userService;

@Autowired

private TokenService tokenService;

/**

* 登录

*/

@IgnoreAuth

@PostMapping(value = “/login”)

public R login(String username, String password, String captcha, HttpServletRequest request) {

UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq(“username”, username));

if(user==null || !user.getPassword().equals(password)) {

return R.error(“账号或密码不正确”);

}

String token = tokenService.generateToken(user.getId(),username, “users”, user.getRole());

return R.ok().put(“token”, token);

}

/**

* 注册

*/

@IgnoreAuth

@PostMapping(value = “/register”)

public R register(@RequestBody UserEntity user){

//    ValidatorUtils.validateEntity(user);

    if(userService.selectOne(new EntityWrapper<UserEntity>().eq(“username”, user.getUsername())) !=null) {

    return R.error(“用户已存在”);

    }

        userService.insert(user);

        return R.ok();

    }

/**

* 退出

*/

@GetMapping(value = “logout”)

public R logout(HttpServletRequest request) {

request.getSession().invalidate();

return R.ok(“退出成功”);

}

/**

     * 密码重置

     */

    @IgnoreAuth

@RequestMapping(value = “/resetPass”)

    public R resetPass(String username, HttpServletRequest request){

    UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq(“username”, username));

    if(user==null) {

    return R.error(“账号不存在”);

    }

    user.setPassword(“123456”);

        userService.update(user,null);

        return R.ok(“密码已重置为:123456”);

    }

/**

     * 列表

     */

    @RequestMapping(“/page”)

    public R page(@RequestParam Map<String, Object> params,UserEntity user){

        EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();

    PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params));

        return R.ok().put(“data”, page);

    }

/**

     * 列表

     */

    @RequestMapping(“/list”)

    public R list( UserEntity user){

        EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();

      ew.allEq(MPUtil.allEQMapPre( user, “user”)); 

        return R.ok().put(“data”, userService.selectListView(ew));

    }

    /**

     * 信息

     */

    @RequestMapping(“/info/{id}”)

    public R info(@PathVariable(“id”) String id){

        UserEntity user = userService.selectById(id);

        return R.ok().put(“data”, user);

    }

    

    /**

     * 获取用户的session用户信息

     */

    @RequestMapping(“/session”)

    public R getCurrUser(HttpServletRequest request){

    Long id = (Long)request.getSession().getAttribute(“userId”);

        UserEntity user = userService.selectById(id);

        return R.ok().put(“data”, user);

    }

资源下载: