源码获取:关注文末gongzhonghao,输入013领取下载链接
开发工具:IDEA, mysql5.7
技术:springboot+mybatis-plus
健康管理包括:健康体检、健康评估、健康促进和健康服务四大部分。具体来说健康管理就是由健康管理顾问根据个人的性别、年龄、身体状况、居住环境、医疗服务的使用情况以及职业特性等综合因素,制定一些饮食保健以及营养学的建议,实施特定的干预措施和心理暗示,人体的健康状况进行合理的调整与休息,有效地改善亚健康出现的疲劳、头痛、失眠等不适症状。同时,健康管理机构根据个人在疾病的潜在危险因素,从而有效地对潜在的疾病实行预防、治疗及控制。
package com.sports.controller;
import com.alibaba.fastjson.JSONObject;
import com.sports.common.Const;
import com.sports.common.ServerResponse;
import com.sports.entity.User;
import com.sports.exception.UserException;
import com.sports.service.AdminUserService;
import com.sports.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping("/admin/")
@CrossOrigin(origins="*",maxAge=3600)
public class AdminController {
@Autowired
AdminUserService adminUserService;
@Autowired
private UserService userService;
/**
* 管理员登录
*/
@RequestMapping(value = "login.do", method = RequestMethod.POST)
@Transactional(rollbackFor = UserException.class)
public ServerResponse login(String username, String password, HttpSession session) {
ServerResponse response = adminUserService.login(username, password);
if (response.isSuccess()) {
session.setAttribute(Const.CURRENT_USER, response.getData());
//以秒为单位,即在没有活动30分钟后,session将失效
session.setMaxInactiveInterval(Const.SessionExtime.SESSION_EX_TIME);
}
return response;
}
/**
* 登出
*
*/
@RequestMapping(value = "logout.do",method = RequestMethod.GET)
@Transactional(rollbackFor = UserException.class)
public ServerResponse logout(HttpSession session){
session.removeAttribute(Const.CURRENT_USER);
return ServerResponse.createBySuccess();
}
/**
* 用户管理——删除用户
*/
@RequestMapping(value = "deleteUser.do", method = RequestMethod.DELETE)
@Transactional(rollbackFor = UserException.class)
public Map<String,Object> deleteUser(String userId) {
Map<String, Object> map=new HashMap<String, Object>();
adminUserService.userDelete(userId);
map.put("message", "删除成功");
return map;
}
}
package com.sports.controller; import com.alibaba.fastjson.JSONArray; import com.sports.common.ServerResponse; import com.sports.entity.Course; import com.sports.service.impl.CourseServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @RestController @RequestMapping("/course/") @CrossOrigin(origins="*",maxAge=3600) public class CourseController { @Autowired private CourseServiceImpl courseService; /** * 获取年龄段 进行回显 * @return */ @RequestMapping(value = "ageGroupList.do",method = RequestMethod.GET) @ResponseBody public JSONArray ageGroupList(){ JSONArray jsonArray = courseService.ageGroupList(); return jsonArray; } /** * 课程的添加 * @param file * @param course * @return * @throws Exception */ @RequestMapping(value = "addCourse.do", method = RequestMethod.POST) public ServerResponse addCourse(@RequestParam(value = "file") MultipartFile file, Course course)throws Exception{ return courseService.addCourse(file, course); } /** * 课程的查询 根据name * @param course * @return * @throws Exception */ @RequestMapping(value = "selectCourseByName.do", method = RequestMethod.POST) @ResponseBody public ServerResponse selectCourseByName(Course course)throws Exception{ return courseService.selectByName(course); } @RequestMapping(value = "selectCourseByType.do",method =RequestMethod.POST ) @ResponseBody public ServerResponse selectCourseByType(Course course) throws Exception{ return courseService.selectByType(course); } /** * 根据id 获取视频url * @param course * @return * @throws Exception */ @RequestMapping(value = "getVideoUrl.do", method = RequestMethod.POST) @ResponseBody public ServerResponse getVideoUrl(Course course)throws Exception{ return courseService.getVideoUrl(course); } /** * 课程的删除 * @param course * @return */ @RequestMapping(value = "deleteCourseById.do",method = RequestMethod.POST) @ResponseBody public String deleteCourse (Course course){ return courseService.deleteCourse(course); } }