Java computer graduation project is based on springboot+vue mental health communication website

Get resources at the end of the article, collect and follow them to avoid getting lost

Article directory

  • Preface
  • 1. Research background
  • 2. Research significance
  • 3. Mainly used technologies
  • 4. Research content
  • 5. Core code
  • 6. Article Table of Contents

Foreword

With the development of social economy, medical and health care has made great progress, and mental health education occupies an increasingly important position. What is mental health: Mental health, in a broad sense, refers to an efficient and satisfactory, sustainable mental state. In a narrow sense, mental health refers to the complete and coordinated process of people’s basic psychological activities, that is, the integrity and coordination of cognition, emotion, will, behavior, and personality, and the ability to adapt to society and keep pace with society.
20.23% of college students across the country have varying degrees of psychological disorders or even mental illness, 25% of college students need mental health services, and 10% have obvious symptoms of psychological disorders and are in urgent need of psychological counseling and psychological treatment. Psychological disorders have become the biggest threat to the physical and mental health of today’s college students. Mental health education is very necessary.
The development of mental health education makes the system more convenient for students, and also promotes mental health education to become more systematic and orderly. The system interface is friendly and easy to operate. Specifically, in terms of system design, it adopts B/S structure, designed on Java technology dynamic page, and stored in Mysql database. It is a very excellent mental health education system.

1. Research background

With the rapid development of the information age, the advantages and popularity of the Internet, the continuous improvement of people’s living standards, and busy working hours, the development of mental health education has become necessary. The mental health education system mainly uses computers to increase students’ choices through information management required for article information management. It also facilitates timely inquiry and modification of student information and timely understanding of mental health education information. The mental health education system brings more choices to students. The system collaborates with database software to meet students’ needs.
The mental health education system conducts demand analysis from functions, data processes, feasibility, and operating environment. The database and functions of mental health education are designed in detail, the main interface design and related component design are analyzed, and the specific implementation of mental health education is introduced. Obtain data from the database, write data to the database, realize the system to directly perform various database queries, insertions, deletions, updates and other operations on the database, and add dynamic content to the web page, thereby realizing various basic functions required for mental health education. Function.

2. Research significance

Nowadays, with the popularity of mobile students, WeChat is known as the new favorite for chat communication because of its simplicity, convenience and good student experience. It has also been used by more businesses for promotion. By the end of 2017, the number of WeChat students exceeded 1 billion. More and more companies, including banks, securities, express delivery services, e-commerce, etc., have launched corresponding service platforms on the WeChat platform to adapt to students’ new behavioral habits. The scientific research social network platform on the WeChat platform is imperative. The application of computer technology in modern management has made computers an important tool for people to apply modern technology. It can effectively solve the problem of convenient student management and improve efficiency. Provide students with the most comprehensive and professional data management information to help them understand the latest detailed information. Also, with the help of WeChat, it can better meet the needs of students and save students time to achieve the purpose of saving time and efficiency.

3. Mainly used technologies

environmental needs
1. Running environment: It is best to use java jdk 1.8, which is currently the most stable JDK and the most used JDK version.
2. IDE environment: IDEA and Eclipse are both available. Recommend IDEA;
3. Tomcat environment: Tomcat7/Tomcat8/Tomcat9 versions are available
4. Hardware environment: windows 7/8/10 1G memory or more; or Mac OS;
5. Database: MySql version 5.7;
6. Whether it is a Maven project: yes;
technology stack
Backend: Spring + SpringMVC + Mybatis + Springboot
Front-end: vue + CSS + JavaScript + jQuery + elementui

Instructions for use
Use Navicat or other tools to create a database with the corresponding name in mysql and import the project’s sql file;
Use IDEA/Eclipse/MyEclipse to import the project, modify the configuration, and run the project;
Change the database configuration in the applicationContext.xml configuration file in the project to your own configuration, and then run;
After running successfully, enter in the browser: http://localhost:8080/project name

4. Research content








5. Core code

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.MPUtil;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.ValidatorUtils;

/**
 * Login related
 */
@RequestMapping("users")
@RestController
public class UserController{<!-- -->
\t
@Autowired
private UserService userService;
\t
@Autowired
private TokenService tokenService;

/**
\t * Log in
*/
@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("Account or password is incorrect");
}
String token = tokenService.generateToken(user.getId(),username, "users", user.getRole());
return R.ok().put("token", token);
}
\t
/**
\t * register
*/
@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("User already exists");
    }
        userService.insert(user);
        return R.ok();
    }

/**
\t * quit
*/
@GetMapping(value = "logout")
public R logout(HttpServletRequest request) {<!-- -->
request.getSession().invalidate();
return R.ok("Exit successfully");
}
\t
/**
     * reset Password
     */
    @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("Account does not exist");
    }
    user.setPassword("123456");
        userService.update(user,null);
        return R.ok("Password has been reset to: 123456");
    }
\t
/**
     * list
     */
    @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);
    }

/**
     * list
     */
    @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));
    }

    /**
     * information
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") String id){<!-- -->
        UserEntity user = userService.selectById(id);
        return R.ok().put("data", user);
    }
    
    /**
     * Get the user's session user information
     */
    @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);
    }

    /**
     * save
     */
    @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("User already exists");
    }
        userService.insert(user);
        return R.ok();
    }

    /**
     * Revise
     */
    @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 & amp; & amp; u.getId()!=user.getId() & amp; & amp; u.getUsername().equals(user.getUsername())) {<!-- -->
    return R.error("Username already exists.");
    }
        userService.updateById(user);//Update all
        return R.ok();
    }

    /**
     * delete
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){<!-- -->
        userService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }
}

6. Article directory

1System Overview 1
1.1 Research background 1
1.2 Research purpose 1
1.3 System design ideas 1
2Related technologies 3
2.1 MYSQL database 3
2.2 B/S structure 3
2.3 Introduction to Spring Boot Framework 4
2.4 VUE Framework 4
3 System Analysis 5
3.1 Feasibility analysis 5
3.1.1 Technical feasibility 5
3.1.2 Economic feasibility 5
3.1.3 Operational feasibility 5
3.2 System performance analysis 6
3.2.1 System security 6
3.2.2 Data integrity 6
3.3 System interface analysis 6
3.4 System flow and logic 8
4System Outline Design 9
4.1 Overview 9
4.2 System structure 10
4.3. Database design 11
4.3.1 Database entities 11
4.3.2 Database design table 13
5 system detailed implementation 17
5.1 Implementation of the administrator module 17
5.2 Implementation of user module 19
6 System Test 21
6.1 Concept and meaning 21
6.2 Features 22
6.3 Importance 22
6.4 Test methods 23
6.5 Functional testing 23
6.6 Usability testing 24
6.7 Performance Test 24
6.8 Test Analysis 24
6.9 Test result analysis 25
Conclusion 25
Acknowledgments 26
Reference 26