基于javaweb的SpringBoot准妈妈孕期交流平台(java+springboot+mybatis+vue+elementui+mysql)

运行环境

Java≥8、MySQL≥5.7、Node.js≥14

开发工具

后端:eclipse/idea/myeclipse/sts等均可配置运行
前端:WebStorm/VSCode/HBuilderX等均可

❗没学过node.js的不要搞前后端分离项目

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

001524072608

011524072608

021524072608

031524072608

041524072608

061524072608

071524072608

581524062608

591524062608

基于javaweb的SpringBoot准妈妈孕期交流平台(java+springboot+mybatis+vue+elementui+mysql)

项目介绍

基于Springboot Vue准妈妈孕期交流平台

角色:管理员、用户两种种角色,分为前后台;

用户:用户通过用户登录页面可以填写用户名和密码等信息进行登录操作,用户登录成功后,进入首页可以查看早教知识、待产经验分享、怀孕常识、月子食谱、好物推荐、圈子交流、个人中心、专家交流等功能模块,进行相对应操作;

管理员:管理员登录进入准妈妈孕期交流平台可以查看首页、个人中心、用户管理、早教知识管理、待产经验分享管理、怀孕常识管理、月子食谱管理、好物推荐管理、好物类型管理、圈子交流、系统管理等信息。

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。

2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;

3.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;

4.数据库:MySql 5.7/8.0版本均可;

5.是否Maven项目:是;

技术栈

后端:SpringBoot+Mybaits

前端:Vue+ElementUI+Layui+HTML+CSS+JS

使用说明

项目运行:

  1. 使用Navicat或者其它工具,在mysql中创建对应sql文件名称的数据库,并导入项目的sql文件;

  2. 使用IDEA/Eclipse/MyEclipse导入项目,导入成功后请执行maven clean;maven install命令;

  3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;

4.运行项目,在浏览器中输入地址:

前台地址:http://localhost:8080/springboottof36/front/index.html

普通用户:用户1/123456

后台地址:http://localhost:8080/springboottof36/admin/dist/index.html#/login

管理员:abo/abo

普通用户:用户1/123456

系统结构图:

 首页展示:

 早教知识展示:

用户登录展示:

个人中心信息展示:

 后台管理专家交流:

用户信息管理:

后台个人中心展示:

好物推荐展示:

用户管理详情控制层:

@Controller

public class UserController {

@Autowired

private UserService userService;

@RequestMapping(“/userUi”)

public String userUI() {

if (!LoginSession.getCurrentUser().getUsername().equals(“admin”)) {

return “client/html/index”;

return “admin/user/userList”;

@ResponseBody

@RequestMapping(“/admin/user/tableList”)

public ServerLayResult userList(@RequestParam(value = “page”, defaultValue = “1”) Integer page,

@RequestParam(value = “limit”, defaultValue = “10”) Integer limit,

@RequestParam(value = “keyword”, defaultValue = “”) String keyword) {

if (keyword == null || keyword.equals(“”)) {

//封装Json数据对象

ServerLayResult result = new ServerLayResult(0, “”, userService.count(), userService.selectAll(page, limit));

return result;

} else if (keyword != null) {

ServerLayResult result = new ServerLayResult(0, “”, userService.selectByUsername(keyword, page, limit).size(),

userService.selectByUsername(keyword, page, limit));

return result;

return null;

@ResponseBody

@RequestMapping(“/admin/user/del”)

public Map<String, Object> del(@RequestParam(“id”) Integer id) {

Map<String, Object> dataMap = new HashMap<>();

Boolean isSuccess = false;

if (id != null && id != 0) {

int del = userService.deleteByPrimaryKey(id);

if (del > 0) {

isSuccess = true;

dataMap.put(“success”, isSuccess);

return dataMap;

dataMap.put(“success”, isSuccess);

return dataMap;

/**

  • 更新用户信息

  • @param user

  • @return

*/

@ResponseBody

@RequestMapping(value = “/admin/user/update”, method = RequestMethod.POST)

public Map<String, Object> updateUser(@RequestBody User user) {

Map<String, Object> dataMap = new HashMap<>();

Boolean isSuccess = false;

if (user != null) {

//根据用户对象的id 查询用户的密码,防止密码丢失

User user1 = userService.selectByPrimaryKey(user.getId());

//再次封装进对象中

if (user1 != null) {

user.setPassword(user1.getPassword());

//更新对象

int update = userService.updateByPrimaryKey(user);

if (update > 0) {

isSuccess = true;

dataMap.put(“success”, isSuccess);

return dataMap;

dataMap.put(“success”, isSuccess);

return dataMap;

/**

  • 重置用户密码

  • @param id

  • @return

*/

@ResponseBody

@RequestMapping(“/admin/user/resetPwd”)

public Map<String, Object> restPwd(@RequestParam(“id”) Integer id) {

Map<String, Object> dataMap = new HashMap<>();

Boolean isSuccess = false;

if (id != null && id > 0) {

//根据id查询出用户

User user = userService.selectByPrimaryKey(id);

//开始重置密码,重置密码使用的Spring提供的工具类进行对密码123456进行加密

user.setPassword(DigestUtils.md5DigestAsHex(“123456”.getBytes()));

//调用更新方法

int restPwd = userService.updateByPrimaryKey(user);

if (restPwd > 0) {

isSuccess = true;

dataMap.put(“success”, isSuccess);

return dataMap;

dataMap.put(“success”, isSuccess);

return dataMap;

后台文章管理控制层: 

@Controller

public class ArticleController {

private Logger logger = LoggerFactory.getLogger(this.getClass());

@Autowired

private ArticleService articleService;

@Autowired

private LabelService labelService;

@RequestMapping(“/articleUi”)

public String articleListUi() {

if (!LoginSession.getCurrentUser().getUsername().equals(“admin”)) {

return “client/html/index”;

return “admin/article/list”;

@RequestMapping(“/articleUiAdd”)

public String articleAddUi() {

if (!LoginSession.getCurrentUser().getUsername().equals(“admin”)) {

return “client/html/index”;

return “admin/article/listform”;

/**

  • 后台文章列表

  • @param page 当前页

  • @param limit 每页多少条

  • @param keyword1 关键字查询

  • @param keyword2

  • @param keyword3

  • @return

*/

@ResponseBody

@RequestMapping(“/admin/article/list”)

public ServerLayResult

list(@RequestParam(value = “page”, defaultValue = “1”) Integer page,

@RequestParam(value = “limit”, defaultValue = “10”) Integer limit,

String keyword1, String keyword2, String keyword3) {

if (keyword1 != null && keyword2 != “” || keyword2 != null && keyword2 != “” || keyword3 != null && keyword3 != “”) {

List

articles = articleService.selectByKeyWord(page, limit, keyword1, keyword2, keyword3);

ServerLayResult result = new ServerLayResult(0, “”, articles.size(), articles);

return result;

//封装数据

ServerLayResult result = new ServerLayResult(0, “”, articleService.count(), articleService.selectAll(page, limit));

return result;

/**

  • 根据ID删除

  • @param id

  • @return

*/

@ResponseBody

@RequestMapping(“/admin/article/del”)

public Map<String, Object> delArticle(@RequestParam(“id”) int id) {

Map<String, Object> dataMap = new HashMap<>();

boolean isSuccess = articleService.deleteByPrimaryKey(id);

dataMap.put(“success”, isSuccess);

return dataMap;

/**

  • 前台响应json数据

  • 解析保存

  • @param article

  • @return

*/

@ResponseBody

@RequestMapping(“/admin/article/add”)

public Map<String, Object> addArticle(@RequestBody JSONObject article) {

JSONObject json = JSON.parseObject(article.toJSONString());

String author = json.getString(“author”);

Integer label = json.getInteger(“label”);

String title = json.getString(“title”);

String content = json.getString(“content”);

String status = json.getString(“status”);

int temp = 0;

if (status != null) {

if (status.equals(“on”)) {

temp = 1;

Label label1 = new Label();

label1.setId(label);

Article articles = new Article();

articles.setAuthor(author);

articles.setContent(content);

articles.setTitle(title);

articles.setStatus(temp);

articles.setCreateTime(new Date());

articles.setLabel(label1);

logger.info(article + “”);

boolean isSuccess = articleService.insert(articles);

Map<String, Object> dataMap = new HashMap<>();

dataMap.put(“success”, isSuccess);

return dataMap;

/**

  • 根据前台响应的json对象封装后通过业务方法保存到数据库

  • @param article

  • @return

*/

@ResponseBody

@RequestMapping(“/admin/article/update”)

public Map<String, Object> updateArticle(@RequestBody JSONObject article) {

JSONObject json = JSON.parseObject(article.toJSONString());

String author = json.getString(“author”);

Integer label = json.getInteger(“label”);

Integer id = json.getInteger(“id”);

String title = json.getString(“title”);

String content = json.getString(“content”);

String status = json.getString(“status”);

int temp = 0;

if (status != null) {

if (status.equals(“on”)) {

temp = 1;

Label label1 = new Label();

label1.setId(label);

Article articles = new Article();

articles.setId(id);

articles.setAuthor(author);

articles.setContent(content);

articles.setTitle(title);

articles.setStatus(temp);

articles.setCreateTime(new Date());

articles.setLabel(label1);

logger.info(article + “”);

boolean isSuccess = articleService.updateByPrimaryKey(articles);

Map<String, Object> dataMap = new HashMap<>();

dataMap.put(“success”, isSuccess);

return dataMap;

 后台留言详情控制器:

/**

  • 后台留言控制器

*/

@Controller

public class LeacotController {

@Autowired

private LeacotService leacotService;

@Autowired

private ReplyService replyService;

@RequestMapping(“/leacotsView”)

public String leacotUi() {

if (!LoginSession.getCurrentUser().getUsername().equals(“admin”)) {

return “client/html/index”;

return “admin/leacots/leacotsList”;

/**

  • 用户留言列表

  • @param page

  • @param limit

  • @param keyword1

  • @return

*/

@ResponseBody

@RequestMapping(“/admin/leacots/list”)

public ServerLayResult leacotsList(@RequestParam(value = “page”, defaultValue = “1”) Integer page,

@RequestParam(value = “limit”, defaultValue = “10”) Integer limit, String keyword1) {

if (keyword1 != null) {

List leacots = leacotService.selectByKeyWord(page, limit, keyword1);

ServerLayResult result = new ServerLayResult(0, “”, leacots.size(), leacots);

return result;

ServerLayResult result = new ServerLayResult(0, “”, leacotService

.count(), leacotService.selectAll(page, limit));

return result;

/**

  • 根据ID删除 并且删除关联

  • @param id

  • @return

*/

@ResponseBody

@RequestMapping(“/admin/leacots/del”)

public Map<String, Object> del(@RequestParam(“id”) int id) {

Map<String, Object> dataMap = new HashMap<>();

boolean isSuccess = false;

Leacot leacot = leacotService.selectByPrimaryKey(id);

//删除关联

if (leacot != null) {

boolean delReply = replyService.deleteByPrimaryKey(leacot.getId());

if (delReply) {

boolean delete = leacotService.deleteByPrimaryKey(id);

isSuccess = true;

dataMap.put(“success”, isSuccess);

return dataMap;

dataMap.put(“success”, isSuccess);

return dataMap;

/**

  • {id: “4”, leacotsUser: “test”, content: “测试留言内容”, replyContent: “fsafsf”, status: “on”}

  • @param json

  • @return

*/

@ResponseBody

@RequestMapping(“/admin/leacots/update”)

public Map<String, Object> update(@RequestBody JSONObject json) {

Map<String, Object> dataMap = new HashMap<>();

boolean isSuccess = false;

JSONObject data = JSON.parseObject(json.toJSONString());

Integer id = data.getInteger(“id”);

String leacotsUser = data.getString(“leacotsUser”);

String content = data.getString(“content”);

//回复内容

String replyContent = data.getString(“replyContent”);

//回复状态

String status = data.getString(“status”);

int temp = 0;

if (status != null) {

if (status.equals(“on”)) {

temp = 1;

//默认从session获得replyUser

Reply reply = new Reply(id, replyContent, new Date(), “admin”);

//更新回复表

boolean updateReply = replyService.updateByPrimaryKey(reply);

Leacot leacot = new Leacot(id, content, new Date(), leacotsUser, reply, temp);

//更新留言表

boolean updateLeacot = leacotService.updateByPrimaryKey(leacot);

if (updateLeacot && updateReply) {

isSuccess = true;

dataMap.put(“success”, isSuccess);

return dataMap;

dataMap.put(“success”, isSuccess);

return dataMap;


项目链接:
https://javayms.github.io?id=291524512608201nb
https://javayms.pages.dev?id=291524512608201nb