源码获取:关注文末gongzhonghao,输入013领取下载链接
开发工具:IDEA, mysql5.7
技术:springboot+mybatis-plus
健康管理包括:健康体检、健康评估、健康促进和健康服务四大部分。具体来说健康管理就是由健康管理顾问根据个人的性别、年龄、身体状况、居住环境、医疗服务的使用情况以及职业特性等综合因素,制定一些饮食保健以及营养学的建议,实施特定的干预措施和心理暗示,人体的健康状况进行合理的调整与休息,有效地改善亚健康出现的疲劳、头痛、失眠等不适症状。同时,健康管理机构根据个人在疾病的潜在危险因素,从而有效地对潜在的疾病实行预防、治疗及控制。
package com.sports.controller;
import com.alibaba.fastjson.JSONArray;
import com.sports.common.ServerResponse;
import com.sports.entity.SportEquipment;
import com.sports.exception.EquipmentException;
import com.sports.service.impl.EquipmentServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import sun.misc.BASE64Encoder;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
@RestController
@RequestMapping("/equipment/")
@CrossOrigin(origins="*",maxAge=3600)
public class EquipmentController {
@Autowired
EquipmentServiceImpl equipmentService;
/**
* 运动器材的添加
*/
@RequestMapping(value = "addSE.do", method = RequestMethod.POST)
@Transactional(rollbackFor = EquipmentException.class)
public ServerResponse addSE(@RequestParam("file") MultipartFile file ,SportEquipment sportEquipment)throws Exception{
if(!file.isEmpty()) {
BASE64Encoder encoder = new BASE64Encoder();
String image = encoder.encode(file.getBytes());
// SportEquipment sportEquipment = new SportEquipment();
sportEquipment.setEquipmentName(sportEquipment.getEquipmentName());
sportEquipment.setEquipmentDescription(sportEquipment.getEquipmentDescription());
sportEquipment.setEquipmentImage(image);
return equipmentService.addSE(sportEquipment);
}else {
return null;
}
}
/**
* 运动器材的查询
*/
@RequestMapping(value = "selectSE.do", method = RequestMethod.POST)
@Transactional(rollbackFor = EquipmentException.class)
@ResponseBody
public JSONArray selectSE(SportEquipment sportEquipment)throws Exception{
JSONArray jsonArray=equipmentService.selectSE(sportEquipment);
return jsonArray;
}
/**
* 运动器材的删除
*/
@RequestMapping(value = "deleteSE.do", method = RequestMethod.POST)
@Transactional(rollbackFor = EquipmentException.class)
@ResponseBody
public String deleteSE(SportEquipment sportEquipment){
return equipmentService.deleteSE(sportEquipment);
}
/**
* 运动器才的更新功能
*/
@RequestMapping(value = "selectById.do", method = RequestMethod.POST)
@Transactional(rollbackFor = EquipmentException.class)
@ResponseBody
public SportEquipment selectById(SportEquipment sportEquipment)throws Exception{
SportEquipment sportEquipment1=equipmentService.selectById(sportEquipment);
return sportEquipment1;
}
@RequestMapping(value = "updateSE.do",method = RequestMethod.POST)
@Transactional(rollbackFor = EquipmentException.class)
public ServerResponse updateSE( MultipartFile file,HttpSession session, SportEquipment sportEquipment)throws Exception{
ServerResponse<SportEquipment> response =equipmentService.updateSE(file,sportEquipment);
return response;
}
/**
* 器材图片的展示
*/
// @RequestMapping(value = "getImage.do",method = RequestMethod.GET)
// @Transactional(rollbackFor = EquipmentException.class)
// @ResponseBody
@GetMapping("getImage.do")
public void getImage(@RequestParam("id") Integer id, HttpServletResponse response) throws Exception{
equipmentService.getImage(id,response);
}
}
package com.sports.controller;
import com.sports.common.ServerResponse;
import com.sports.entity.FitnessVenues;
import com.sports.service.impl.FitnessVenuesServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@RestController
@RequestMapping(“/fitnessvenues/”)
@CrossOrigin(origins=“*”,maxAge=3600)
public class FitnessVenuesController {
@Autowired
FitnessVenuesServiceImpl fitnessVenuesService;
/**
*健身场馆的添加
* @param files
* @param fitnessVenues
* @return
* @throws Exception
*/
@RequestMapping(value = "addFitnessVenues.do", method = RequestMethod.POST)
public ServerResponse addFitnessVenues(@RequestParam(value = "files") MultipartFile[] files, FitnessVenues fitnessVenues)throws Exception{
return fitnessVenuesService.addFitnessVenues(files, fitnessVenues);
}
/**
* 健身场馆的查询 根据name
* @param fitnessVenues
* @return
* @throws Exception
*/
@RequestMapping(value = "selectFitnessVenues.do", method = RequestMethod.POST)
@ResponseBody
public ServerResponse selectFitnessVenues(FitnessVenues fitnessVenues)throws Exception{
return fitnessVenuesService.selectFitnessVenues(fitnessVenues);
}
/**
* 健身场馆的查询 根据type
* @param fitnessVenues
* @return
* @throws Exception
*/
@RequestMapping(value = "selectFitnessVenuesByType.do", method = RequestMethod.POST)
@ResponseBody
public ServerResponse selectFitnessVenuesByType(FitnessVenues fitnessVenues)throws Exception{
return fitnessVenuesService.selectFitnessVenuesByType(fitnessVenues);
}
/**
* 健身场馆的查询 根据type value
* @param fitnessVenues
* @return
* @throws Exception
*/
@RequestMapping(value = "selectFitnessVenuesByTypeValue.do", method = RequestMethod.POST)
@ResponseBody
public ServerResponse selectFitnessVenuesByTypeValue(FitnessVenues fitnessVenues)throws Exception{
return fitnessVenuesService.selectFitnessVenuesByTypeValue(fitnessVenues);
}
/**
* 场馆的删除
* @param fitnessVenues
* @return
*/
@RequestMapping(value = "deleteFitnessVenues.do", method = RequestMethod.POST)
@ResponseBody
public String deleteFitnessVenues(FitnessVenues fitnessVenues){
return fitnessVenuesService.deleteFitnessVenues(fitnessVenues);
}
/**
* 根据id 获取图片的url
* @param fitnessVenues
* @return
* @throws Exception
*/
@RequestMapping(value = "getImagesUrl.do", method = RequestMethod.POST)
@ResponseBody
public ServerResponse getImagesUrl(FitnessVenues fitnessVenues)throws Exception{
return fitnessVenuesService.getImageUrl(fitnessVenues);
}
}