Java项目实战II基于微信小程序的校运会管理系统(开发文档+数据库+源码)

目录

一、前言

二、技术介绍

三、系统实现

四、核心代码

五、源码获取


全栈码农以及毕业设计实战开发,CSDN平台Java领域新星创作者,专注于大学生项目实战开发、讲解和毕业答疑辅导

一、前言

在充满活力与激情的校园生活中,校运会不仅是展示学生体育风采的重要舞台,也是增强班级凝聚力、推动校园文化建设的关键活动。然而,传统校运会的管理方式往往依赖于纸质报名、人工统计等繁琐流程,不仅效率低下,还容易出错。为了提升校运会管理的便捷性和准确性,我们决定设计和实现一个基于微信小程序的校运会管理系统。

该系统充分利用微信小程序的即时通讯和便捷操作特性,为师生提供一个集报名、赛程查询、成绩发布于一体的综合管理平台。通过该系统,学生可以轻松完成报名流程,实时查看比赛赛程和成绩信息;教师则可以高效地管理报名数据、安排比赛日程,并实时更新比赛结果。

我们坚信,这一系统的推出将极大地提升校运会管理的效率和准确性,为师生带来更加便捷、高效的校运会体验,同时也为校园文化的传承与发展注入新的活力。

二、技术介绍

语言:Java

使用框架:Spring Boot

前端技术:JS、Vue 、css3

开发工具:IDEA/Eclipse

数据库:MySQL 5.7/8.0

数据库管理工具:phpstudy/Navicat

JDK版本:jdk1.8

Maven: apache-maven 3.8.1-bin

前端环境:Node.Js 12\14\16

三、系统实现

四、核心代码

复制代码
package com.controller;
 
 
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.Map;
 
import javax.servlet.http.HttpServletRequest;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
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.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
 
import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.TokenEntity;
import com.entity.UserEntity;
import com.service.TokenService;
import com.service.UserService;
import com.utils.CommonUtil;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.ValidatorUtils;
 
/**
 * 登录相关
 */
@RequestMapping("users")
@RestController
public class UserController{
	
	@Autowired
	private UserService userService;
	
	@Autowired
	private TokenService tokenService;
 
	/**
	 * 登录
	 */
	@IgnoreAuth
	@PostMapping(value = "/login")
	public R login(String username, String password, String captcha, HttpServletRequest request) {
		UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
		if(user==null || !user.getPassword().equals(password)) {
			return R.error("账号或密码不正确");
		}
		String token = tokenService.generateToken(user.getId(),username, "users", user.getRole());
		return R.ok().put("token", token);
	}
	
	/**
	 * 注册
	 */
	@IgnoreAuth
	@PostMapping(value = "/register")
	public R register(@RequestBody UserEntity user){
//    	ValidatorUtils.validateEntity(user);
    	if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
    		return R.error("用户已存在");
    	}
        userService.insert(user);
        return R.ok();
    }
 
	/**
	 * 退出
	 */
	@GetMapping(value = "logout")
	public R logout(HttpServletRequest request) {
		request.getSession().invalidate();
		return R.ok("退出成功");
	}
	
	/**
     * 密码重置
     */
    @IgnoreAuth
	@RequestMapping(value = "/resetPass")
    public R resetPass(String username, HttpServletRequest request){
    	UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
    	if(user==null) {
    		return R.error("账号不存在");
    	}
    	user.setPassword("123456");
        userService.update(user,null);
        return R.ok("密码已重置为:123456");
    }
	
	/**
     * 列表
     */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,UserEntity user){
        EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
    	PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params));
        return R.ok().put("data", page);
    }
 
	/**
     * 列表
     */
    @RequestMapping("/list")
    public R list( UserEntity user){
       	EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
      	ew.allEq(MPUtil.allEQMapPre( user, "user")); 
        return R.ok().put("data", userService.selectListView(ew));
    }
 
    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") String id){
        UserEntity user = userService.selectById(id);
        return R.ok().put("data", user);
    }
    
    /**
     * 获取用户的session用户信息
     */
    @RequestMapping("/session")
    public R getCurrUser(HttpServletRequest request){
    	Long id = (Long)request.getSession().getAttribute("userId");
        UserEntity user = userService.selectById(id);
        return R.ok().put("data", user);
    }
 
    /**
     * 保存
     */
    @PostMapping("/save")
    public R save(@RequestBody UserEntity user){
//    	ValidatorUtils.validateEntity(user);
    	if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
    		return R.error("用户已存在");
    	}
        userService.insert(user);
        return R.ok();
    }
 
    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody UserEntity user){
//        ValidatorUtils.validateEntity(user);
        userService.updateById(user);//全部更新
        return R.ok();
    }
 
    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        userService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }
}

五、源码获取

感谢大家点赞、收藏、关注、评论

相关推荐
IT果果日记2 小时前
人大金仓使用Flink-CDC
大数据·数据库·后端
yugi9878382 小时前
MATLAB 实现平板裂纹扩展模拟、气孔/夹杂物分析
开发语言·matlab
青山师2 小时前
Java注解深度解析:从元数据机制到框架开发基石
java·开发语言·注解·javase·java面试·后端开发·java核心
AI人工智能+电脑小能手2 小时前
【大白话说Java面试题】【Java基础篇】第35题:怎样声明一个类不会被继承?什么场景下会用
java·开发语言·后端·面试
2301_782040452 小时前
JavaScript中Map在频繁增删键值对场景下的稳定性
jvm·数据库·python
游乐码2 小时前
c#特殊语法
开发语言·c#
升鲜宝供应链及收银系统源代码服务2 小时前
升鲜宝云仓供应链管理系统 数据库数据字典设计 (一)---升鲜宝生鲜配送供应链管理系统
java·生鲜配送源代码·供应链源代码·生鲜供应链源代码·企业erp源代码·云仓供应链管理系统
无限进步_2 小时前
【C++】AVL树完全解析:从平衡因子到四种旋转
c语言·开发语言·数据结构·c++·后端·算法·github
大厂数码评测员2 小时前
2026 年家庭菜谱记录工具怎么选:从功能边界和小程序代码实现看免费与付费差异
java·开发语言·apache
twc8292 小时前
从架构视角梳理全链路压测的核心业务链路
java·大数据·软件测试·架构·性能测试·全链路压测