文末获取源码
开发环境
项目编号:Java+MySQL ssm275老年人健康饮食管理系统#毕业设计
开发语言:Java
开发工具:IDEA /Eclipse
数据库:MYSQL5.7
应用服务:Tomcat7/Tomcat8
使用框架:ssm+vue
项目介绍
随着时代的发展,人们的生活水平有了直线的提升,相对于的人们对健康也越来越看重,如何能够更好的健康饮食成为了很多人在吃饱吃好的同时追求的另外一种饮食方式,尤其是随着生活水平的提高,“三高”的现象越来越严重,这种生活方式和饮食方法严重的影响了人们的生活水平的提高,为了能够更好的能人们健康饮食我开发了本系统。
本系统采用了SSM技术,将所有业务模块采用以浏览器交互的模式,选择MySQL作为系统的数据库,开发工具选择eclipse来进行系统的设计。基本实现了老年人健康饮食管理系统应有的主要功能模块,本系统有用户登录,个人中心,用户管理,系统公告管理,饮食搭配管理,饮食类型管理,活动信息管理,活动报名管理,论坛管理,留言板管理,系统管理等内容。
系统截图
关键代码
package com.controller;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
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.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth;
import com.entity.HuodongxinxiEntity;
import com.entity.view.HuodongxinxiView;
import com.service.HuodongxinxiService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.CommonUtil;
/**
* 活动信息
* 后端接口
* @author
* @email
* @date 2021-03-03 16:50:30
*/
@RestController
@RequestMapping("/huodongxinxi")
public class HuodongxinxiController {
@Autowired
private HuodongxinxiService huodongxinxiService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,HuodongxinxiEntity huodongxinxi, HttpServletRequest request){
EntityWrapper<HuodongxinxiEntity> ew = new EntityWrapper<HuodongxinxiEntity>();
PageUtils page = huodongxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, huodongxinxi), params), params));
request.setAttribute("data", page);
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,HuodongxinxiEntity huodongxinxi, HttpServletRequest request){
EntityWrapper<HuodongxinxiEntity> ew = new EntityWrapper<HuodongxinxiEntity>();
PageUtils page = huodongxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, huodongxinxi), params), params));
request.setAttribute("data", page);
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( HuodongxinxiEntity huodongxinxi){
EntityWrapper<HuodongxinxiEntity> ew = new EntityWrapper<HuodongxinxiEntity>();
ew.allEq(MPUtil.allEQMapPre( huodongxinxi, "huodongxinxi"));
return R.ok().put("data", huodongxinxiService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(HuodongxinxiEntity huodongxinxi){
EntityWrapper< HuodongxinxiEntity> ew = new EntityWrapper< HuodongxinxiEntity>();
ew.allEq(MPUtil.allEQMapPre( huodongxinxi, "huodongxinxi"));
HuodongxinxiView huodongxinxiView = huodongxinxiService.selectView(ew);
return R.ok("查询活动信息成功").put("data", huodongxinxiView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
HuodongxinxiEntity huodongxinxi = huodongxinxiService.selectById(id);
return R.ok().put("data", huodongxinxi);
}
/**
* 前端详情
*/
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
HuodongxinxiEntity huodongxinxi = huodongxinxiService.selectById(id);
return R.ok().put("data", huodongxinxi);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody HuodongxinxiEntity huodongxinxi, HttpServletRequest request){
huodongxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(huodongxinxi);
huodongxinxiService.insert(huodongxinxi);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody HuodongxinxiEntity huodongxinxi, HttpServletRequest request){
huodongxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(huodongxinxi);
huodongxinxiService.insert(huodongxinxi);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody HuodongxinxiEntity huodongxinxi, HttpServletRequest request){
//ValidatorUtils.validateEntity(huodongxinxi);
huodongxinxiService.updateById(huodongxinxi);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
huodongxinxiService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 提醒接口
*/
@RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type,@RequestParam Map<String, Object> map) {
map.put("column", columnName);
map.put("type", type);
if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
Date remindStartDate = null;
Date remindEndDate = null;
if(map.get("remindstart")!=null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime();
map.put("remindstart", sdf.format(remindStartDate));
}
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
}
}
Wrapper<HuodongxinxiEntity> wrapper = new EntityWrapper<HuodongxinxiEntity>();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
int count = huodongxinxiService.selectCount(wrapper);
return R.ok().put("count", count);
}
}