基于java,SpringBoot和Vue志愿者服务管理系统毕业设计,附源码
摘要
本文旨在设计和实现一个基于Java、SpringBoot和Vue的志愿者服务管理系统,以提升志愿服务活动的效率和管理效果。系统采用前后端分离架构,前端使用Vue.js框架,后端采用SpringBoot框架,通过RESTful API进行数据交互。数据库选择MySQL,并利用MyBatis Plus简化数据持久化操作。主要功能包括用户注册与登录、活动报名、服务记录管理、个人信息管理等模块。系统设计注重安全性,采用HTTPS协议和加密存储用户密码,同时通过Redis进行缓存处理,提高系统响应速度。测试方面,进行了详细的单元测试和集成测试,确保系统功能的稳定性和可靠性。最终,该系统提供了一个高效、便捷的平台,为志愿者提供更好的管理和服务体验。
功能介绍
管理员、普通用户两种用户角色;
管理员:个人中心、管理员管理、基础数据管理、公告信息管理、广场论坛管理、志愿活动管理、活动报名管理、捐赠信息管理、志愿资源管理、用户管理、轮播图管理等;
普通用户:个人中心、首页、广场论坛、志愿活动、公告通知、志愿资源等。
技术介绍
后端:Java语言的Spring Boot框架、MySQL数据库、Maven依赖管理等;
前端:Vue、element-ui、axios等。
部分代码展示
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
String role = String.valueOf(request.getSession().getAttribute("role"));
if(false)
return R.error(511,"永不会进入");
else if("用户".equals(role))
params.put("yonghuId",request.getSession().getAttribute("userId"));
params.put("huodongDeleteStart",1);params.put("huodongDeleteEnd",1);
CommonUtil.checkMap(params);
PageUtils page = huodongService.queryPage(params);
//字典表数据转换
List<HuodongView> list =(List<HuodongView>)page.getList();
for(HuodongView c:list){
//修改对应字典表字段
dictionaryService.dictionaryConvert(c, request);
}
return R.ok().put("data", page);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id, HttpServletRequest request){
logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
HuodongEntity huodong = huodongService.selectById(id);
if(huodong !=null){
//entity转view
HuodongView view = new HuodongView();
BeanUtils.copyProperties( huodong , view );//把实体数据重构到view中
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody HuodongEntity huodong, HttpServletRequest request){
logger.debug("save方法:,,Controller:{},,huodong:{}",this.getClass().getName(),huodong.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
if(false)
return R.error(511,"永远不会进入");
Wrapper<HuodongEntity> queryWrapper = new EntityWrapper<HuodongEntity>()
.eq("huodong_name", huodong.getHuodongName())
.eq("huodong_address", huodong.getHuodongAddress())
.eq("huodong_shijian", huodong.getHuodongShijian())
.eq("zan_number", huodong.getZanNumber())
.eq("cai_number", huodong.getCaiNumber())
.eq("huodong_types", huodong.getHuodongTypes())
.eq("huodong_kucun_number", huodong.getHuodongKucunNumber())
.eq("status_types", huodong.getStatusTypes())
.eq("huodong_delete", 1)
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
HuodongEntity huodongEntity = huodongService.selectOne(queryWrapper);
if(huodongEntity==null){
huodong.setZanNumber(1);
huodong.setCaiNumber(1);
huodong.setHuodongClicknum(1);
huodong.setHuodongDelete(1);
huodong.setInsertTime(new Date());
huodong.setCreateTime(new Date());
huodongService.insert(huodong);
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
/**
* 后端修改
*/
@RequestMapping("/update")
public R update(@RequestBody HuodongEntity huodong, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {
logger.debug("update方法:,,Controller:{},,huodong:{}",this.getClass().getName(),huodong.toString());
HuodongEntity oldHuodongEntity = huodongService.selectById(huodong.getId());//查询原先数据
String role = String.valueOf(request.getSession().getAttribute("role"));
if("".equals(huodong.getHuodongPhoto()) || "null".equals(huodong.getHuodongPhoto())){
huodong.setHuodongPhoto(null);
}
if("".equals(huodong.getHuodongContent()) || "null".equals(huodong.getHuodongContent())){
huodong.setHuodongContent(null);
}
huodongService.updateById(huodong);//根据id更新
return R.ok();
}
正文到此结束
- 本文标签: Java Spring Boot SSM
- 版权声明: 本站原创文章,于2024年11月19日由程序猿大波发布,转载请注明出处