基于微信小程序的大学生心理测试+后台管理
项目背景
随着社会经济的发展,医疗卫生事业取得了巨大进步,在健康中心理健康占据越来越重要的地位,什么是心理健康:心理健康,从广义上讲,是指一种高效而满意的、持续的心理状态。从狭义上讲,心理健康是指人的基本心理活动的过程内容完整、协调一致,即认识、情感、意志、行为、人格完整和协调,能适应社会,与社会保持同步。
全国有20.23%的大学生存在不同程度的心理障碍甚至心理疾患,25%的大学生需要精神卫生服务,10%有明显的心理障碍症状,急需心理咨询与心理治疗。心理障碍已成为当今大学生身心健康的最大威胁。心理测试显得十分必要,
心理测试开发使系统能够更加方便学生捷,同时也促使心理测试变的更加系统化、有序化。系统界面较友好,易于操作。具体在系统设计上,客户端使用微信开发者,后台也使用java技术在动态页面上进行了设计,Mysql数据库,是一个非常优秀的大学生心理测试系统小程序。
关键词: 大学生心理测试系统小程序;微信开发者 java语言 Mysql 数据库 SSM框架
功能设计
功能模块图
系统结构图
管理端结构图
功能截图
学生端功能模块
学生注册,在学生注册页面可以填写账号、姓名、性别、年龄、手机、邮箱等信息,进行注册
学生登录,在学生登录页面填写账号、密码进行登录
首页、学生登录到心理测试可以查看首页、职业职位、活动项目、交流论坛、我的等内容
我的,在我的页面可以查看个人信息、职业职位、职位申请、活动项目、活动报名、我的收藏管理、考试记录、试卷列表、心理疏导、我要发贴、我的发贴等信息进行查看
学生信息,在学生信息页面可以编辑账号、姓名、性别、年龄、手机、邮箱、照片等信息,并可根据需要进行添加、删除、修改进行保存
职业职位,在职业职位页面可以查看标题、企业、部门、职位、学历、薪资、封面、电话、地址等信息进行收藏、点赞、申请操作
活动项目,在活动项目页面可以查看活动、类型、时长、时间、地点、封面、详情等信息进行收藏、点赞、申请操作,进行收藏、点赞、报名
用户信息,在用户信息页面可以查看账号、姓名、性别、年龄、手机、邮箱、照片等进行添加、修改、删除
管理员服务端功能界面
管理员通过填写账号、密码、角色进行登录
管理员进入到界面,通过界面的任务大厅,登录成功后进入到系统可以进行查看首页、个人中心、学生管理、职业职位管理、职位申请管理、活动类型管理、活动项目管理、活动报名管理、试卷管理、试题管理、交流论坛、系统管理等功能模块,进行相对应操作,管理员对个人中心进行操作填写原密码、新密码、确认密码并进行添加、删除、修改以及查看
学生管理,管理员通过学生信息页面查看账号、姓名、性别、年龄、手机、邮箱、照片等进行详情、修改、删除操作
职业职位管理,管理员通过职业职位管理页面查看标题、企业、部门、职位、学历、薪资、封面、电话、地址等进行详情、修改、删除操作
职位申请管理,管理员通过职位申请管理页面进行查看审核、详情、修改、删除操作
活动项目管理,管理员通过活动项目管理页面查看活动、类型、时长、时间、地点、封面、详情等进行详情、修改、删除操作
试题管理,管理员通过试题管理页面查看试题、类型、分数、分析、排序等进行详情、修改、删除、提交操作
系统管理,管理员通过系统管理页面查看系统公告、心理疏导、轮播图管理等进行发布公告、回复、上传图片等进行添加、删除、修改以及查看并对整个系统进行维护等操作
相关代码
数据库配置
validationQuery=SELECT 1jdbc_url=jdbc:mysql://127.0.0.1:3306/ssm834t3?useUnicode=true&characterEncoding=UTF-8&tinyInt1isBit=falsejdbc_username=rootjdbc_password=123456#jdbc_url=jdbc:sqlserver://127.0.0.1:1433;DatabaseName=ssm834t3#jdbc_username=sa#jdbc_password=123456
控制层(controller)
package com.controller;import java.util.Arrays;import java.util.Calendar;import java.util.Date;import java.util.Map;import javax.servlet.http.HttpServletRequest;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.GetMapping;import org.springframework.web.bind.annotation.PathVariable;import org.springframework.web.bind.annotation.PostMapping;import org.springframework.web.bind.annotation.RequestBody;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RequestParam;import org.springframework.web.bind.annotation.ResponseBody;import org.springframework.web.bind.annotation.RestController;import com.annotation.IgnoreAuth;import com.baomidou.mybatisplus.mapper.EntityWrapper;import com.entity.TokenEntity;import com.entity.UserEntity;import com.service.TokenService;import com.service.UserService;import com.utils.CommonUtil;import com.utils.MD5Util;import com.utils.MPUtil;import com.utils.PageUtils;import com.utils.R;import com.utils.ValidatorUtils;/ * 登录相关 */@RequestMapping("users")@RestControllerpublic class UserController{@Autowiredprivate UserService userService;@Autowiredprivate 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); } / * 保存 */ @PostMapping("/save") public R save(@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(); } / * 修改 */ @RequestMapping("/update") public R update(@RequestBody UserEntity user){// ValidatorUtils.validateEntity(user); UserEntity u = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())); if(u!=null && u.getId()!=user.getId() && u.getUsername().equals(user.getUsername())) { return R.error("用户名已存在。"); } userService.updateById(user);//全部更新 return R.ok(); } / * 删除 */ @RequestMapping("/delete") public R delete(@RequestBody Long[] ids){ userService.deleteBatchIds(Arrays.asList(ids)); return R.ok(); }}
业务层(Service)
package com.service;import java.util.List;import java.util.Map;import org.apache.ibatis.annotations.Param;import com.baomidou.mybatisplus.mapper.Wrapper;import com.baomidou.mybatisplus.service.IService;import com.entity.UserEntity;import com.utils.PageUtils;/ * 系统用户 */public interface UserService extends IService<UserEntity> { PageUtils queryPage(Map<String, Object> params);List<UserEntity> selectListView(Wrapper<UserEntity> wrapper); PageUtils queryPage(Map<String, Object> params,Wrapper<UserEntity> wrapper); }
数据访问层(Dao)
package com.dao;import java.util.List;import org.apache.ibatis.annotations.Param;import com.baomidou.mybatisplus.mapper.BaseMapper;import com.baomidou.mybatisplus.mapper.Wrapper;import com.baomidou.mybatisplus.plugins.pagination.Pagination;import com.entity.UserEntity;/ * 用户 */public interface UserDao extends BaseMapper<UserEntity> {List<UserEntity> selectListView(@Param("ew") Wrapper<UserEntity> wrapper);List<UserEntity> selectListView(Pagination page,@Param("ew") Wrapper<UserEntity> wrapper);}
开发者涨薪指南
48位大咖的思考法则、工作方式、逻辑体系字库吧