——————————DescriptionStart——————————
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明






基于javaweb的SpringBoot在线心理测评系统设计和实现(java+springboot+ssm+mysql+thymeleaf+html+maven)
一、项目简述
本系统主要实现的功能有: 在线测评,在线留言,在线文章浏览。,在线公告,后台 评论管理,用户管理,测评管理,分值管理,测评结果查 询等等。
二、项目运行
环境配置: Jdk1.8 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持) 项目技术: Springboot+ SpringMVC + MyBatis + ThymeLeaf + JavaScript + JQuery + Ajax + maven等等
——————————CodeStart——————————
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| */ @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) { User user = userService.selectByPrimaryKey(id); user.setPassword("123456"); int restPwd = userService.updateByPrimaryKey(user); if (restPwd > 0) { isSuccess = true; dataMap.put("success", isSuccess); return dataMap; } } dataMap.put("success", isSuccess); return dataMap; }
} package com.pengzhen.yixinli.controller.admin;
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| 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("")) { 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; }
@ResponseBody @RequestMapping(value = "/admin/user/update", method = RequestMethod.POST) public Map<String, Object> updateUser(@RequestBody User user) {
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
@Controller public class UpdatePasswordController {
private Logger logger = LoggerFactory.getLogger(this.getClass()); @Autowired private UserService userService;
@RequestMapping("/updatePwdViwe") public String updatePwd() { if (!LoginSession.getCurrentUser().getUsername().equals("admin")) { return "client/html/index"; } return "admin/system/pwdUpdate"; }
@ResponseBody @RequestMapping("/admin/sysPwd/update") public Map<String, Object> updatePwd(@RequestBody JSONObject json) { Map<String, Object> dataMap = new HashMap<>(); boolean isSuccess = false; JSONObject data = JSON.parseObject(json.toJSONString()); String oldPassword = data.getString("oldPassword"); String password = data.getString("password"); String repassword = data.getString("repassword"); logger.info("====>" + oldPassword + "--" + password + "--" + repassword); User byUsername = userService.getByUsername(LoginSession.getCurrentUser().getUsername());
logger.info("---->" + byUsername); if (byUsername != null) { if (!byUsername.getPassword().equals(oldPassword)) { dataMap.put("scueess", isSuccess); return dataMap; }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| */ @ResponseBody @RequestMapping("/admin/notice/list") public ServerLayResult<Notice> list(@RequestParam(value = "page", defaultValue = "1") Integer page, @RequestParam(value = "limit", defaultValue = "10") Integer limit, String keyword1, String keyword2) { logger.info("" + keyword1 + "---->" + keyword2); if (keyword1 != null && keyword1 != "" || keyword2 != null && keyword2 != "") { List<Notice> notices = noticeService.selectByKeyWord(page, limit, keyword1, keyword2); ServerLayResult result = new ServerLayResult(0, "", notices.size(), notices); return result; } ServerLayResult result = new ServerLayResult(0, "", noticeService.count(), noticeService.selectAll(page, limit)); return result; }
@ResponseBody @RequestMapping("/admin/notice/del") public Map<String, Object> delNotice(@RequestParam("id") int id) { Map<String, Object> dataMap = new HashMap<>(); boolean isSuccess = noticeService.deleteByPrimaryKey(id); dataMap.put("success", isSuccess); return dataMap; }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
@Controller public class UpdatePasswordController {
private Logger logger = LoggerFactory.getLogger(this.getClass()); @Autowired private UserService userService;
@RequestMapping("/updatePwdViwe") public String updatePwd() { if (!LoginSession.getCurrentUser().getUsername().equals("admin")) { return "client/html/index"; } return "admin/system/pwdUpdate"; }
@ResponseBody @RequestMapping("/admin/sysPwd/update") public Map<String, Object> updatePwd(@RequestBody JSONObject json) { Map<String, Object> dataMap = new HashMap<>(); boolean isSuccess = false; JSONObject data = JSON.parseObject(json.toJSONString()); String oldPassword = data.getString("oldPassword"); String password = data.getString("password"); String repassword = data.getString("repassword"); logger.info("====>" + oldPassword + "--" + password + "--" + repassword); User byUsername = userService.getByUsername(LoginSession.getCurrentUser().getUsername());
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| User byUsername = userService.getByUsername(LoginSession.getCurrentUser().getUsername());
logger.info("---->" + byUsername); if (byUsername != null) { if (!byUsername.getPassword().equals(oldPassword)) { dataMap.put("scueess", isSuccess); return dataMap; } if (!password.equals(repassword)) { dataMap.put("scueess", isSuccess); return dataMap; } User user = new User(); user.setId(byUsername.getId()); user.setUsername(byUsername.getUsername()); user.setPassword(password); user.setAddress(byUsername.getAddress()); user.setEmail(byUsername.getEmail()); user.setPhone(byUsername.getPhone()); user.setTocheck(byUsername.getTocheck()); user.setUserType(byUsername.getUserType()); user.setName(byUsername.getName()); if (userService.updateByPrimaryKey(user) > 0) { isSuccess = true; dataMap.put("success", isSuccess); return dataMap; } } dataMap.put("success", isSuccess); return dataMap; } } package com.pengzhen.yixinli.controller.admin;
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=531422272105200bv
https://javayms.pages.dev?id=531422272105200bv