• Java-基于SSM的体育竞赛成绩管理系统


    项目背景

    体育竞赛是各种体育体育项目比赛的总称。是在裁判员的主持下,按统一的规则要求,组织与实施的体育员个体或体育队之间的竞技较量,是竞技体育与社会发生关联,并作用于社会的媒介,随着网络市场的不断成熟,带动了体育竞赛成绩管理系统的发展,它彻底改变了过去传统的管理方式,不仅使体育竞赛成绩管理难度变低了,这种个性化的网上交流特别注重交互协调经营与管理的相互配合,激发了管理人员的创造性与主动性,对体育竞赛成绩管理系统管理而言非常有利。
    本体育竞赛成绩管理系统采用的数据库是Mysql,使用JSP技术开发。在设计过程中,充分保证了系统代码的良好可读性、实用性、易扩展性、通用性、便于后期维护、操作方便以及页面简洁等特点。

    功能设计

    功能模块图

    体育竞赛成绩管理系统的功能模块图
    在这里插入图片描述
    数据库是整个软件程序设计中最核心的环节,因此开发的首要问题就是确定数据库的数量以及结构式的创建。上面已经介绍,本论文将使用Mysql技术实现对数据库的管理,以保证它的可用性、一致性、保密性和完整性。有些非法运动员可能会对系统数据库进行攻击,以获取数据库中的资料,Mysql可以起到很好的保护作用。
    创建数据库之前,要对系统的数据进行概念模型设计,设计实体含有哪些属性,实体直接的关联是什么样的,根据概念设计,获取到下图的系统整体ER图,
    运动员管理:运动员账号、密码、运动员姓名、性别、年龄、照片、手机、地址实体E-R图。
    在这里插入图片描述
    裁判员管理:裁判员账号、密码、裁判员姓名、性别、年龄、照片E-R图
    在这里插入图片描述
    比赛项目管理:项目编号、项目名称、项目类型、主办单位、承办单位、比赛日期、比赛地点、项目详情、照片E-R图
    在这里插入图片描述

    功能截图

    管理员输入个人的账号、密码登录系统,这时候系统的数据库就会在进行查找相关的信息,如果我们输入的账号、密码不正确,数据库就会提示出错误的信息提示,同时会提示管理员重新输入输入自己的账号、密码和验证码,直到账号密码输入成功后,会提登录成功的信息。
    在这里插入图片描述
    首页:管理员查看首页详情个人中心、运动员管理、裁判员管理、公告信息管理、公告类型管理、项目类型管理、比赛项目管理、项目报名管理、比赛赛程管理、比赛成绩管理、颁发证书管理。
    在这里插入图片描述
    运动员管理:管理员在运动员信息管理页面可以查看运动员账号、密码、运动员姓名、性别、年龄、照片、手机、地址等信息,进行查看操作
    在这里插入图片描述
    裁判员管理:通过点击裁判员信息可以进行查看裁判员账号、密码、裁判员姓名、性别、年龄、照片等信息内容,进行添加、删除、修改详情操作
    在这里插入图片描述
    公告信息管理:管理员通过列表发布公告信息,进行进行修改或删除操作
    在这里插入图片描述
    比赛项目管理:通过点击比赛项目管理进入列表,可以查看项目编号、项目名称、项目类型、主办单位、承办单位、比赛日期、比赛地点、项目详情、照片等信息,进行添加、删除或修改操作
    在这里插入图片描述
    颁发证书管理:管理员通过颁发证书进行添加、修改操作
    在这里插入图片描述

    相关代码

    数据库配置
    # Tomcat
    server:
        tomcat:
            uri-encoding: UTF-8
        port: 8080
        servlet:
            context-path: /springbootr1tjf
    
    spring:
        datasource:
            driverClassName: com.mysql.jdbc.Driver
            url: jdbc:mysql://127.0.0.1:3306/springbootr1tjf?useUnicode=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8
            username: root
            password: 123456
    
    #        driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
    #        url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=springbootr1tjf
    #        username: sa
    #        password: 123456
    
        servlet:
          multipart:
            max-file-size: 10MB
            max-request-size: 10MB
        resources:
          static-locations: classpath:static/,file:static/
    
    #mybatis
    mybatis-plus:
      mapper-locations: classpath*:mapper/*.xml
      #实体扫描,多个package用逗号或者分号分隔
      typeAliasesPackage: com.entity
      global-config:
        #主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
        id-type: 1
        #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
        field-strategy: 2
        #驼峰下划线转换
        db-column-underline: true
        #刷新mapper 调试神器
        refresh-mapper: true
        #逻辑删除配置
        logic-delete-value: -1
        logic-not-delete-value: 0
        #自定义SQL注入器
        sql-injector: com.baomidou.mybatisplus.mapper.LogicSqlInjector
      configuration:
        map-underscore-to-camel-case: true
        cache-enabled: false
        call-setters-on-nulls: true
        #springboot 项目mybatis plus 设置 jdbcTypeForNull (oracle数据库需配置JdbcType.NULL, 默认是Other)
        jdbc-type-for-null: 'null' 
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    控制层(controller)
    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.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);
        	UserEntity u = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername()));
        	if(u!=null && u.getId()!=user.getId() && u.getUsername().equals(user.getUsername())) {
        		return R.error("用户名已存在。");
        	}
            userService.updateById(user);//全部更新
            return R.ok();
        }
    
        /**
         * 删除
         */
        @RequestMapping("/delete")
        public R delete(@RequestBody Long[] ids){
            userService.deleteBatchIds(Arrays.asList(ids));
            return R.ok();
        }
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172
    • 173
    业务层(Service)
    
    package com.service;
    
    import java.util.List;
    import java.util.Map;
    
    import org.apache.ibatis.annotations.Param;
    
    import com.baomidou.mybatisplus.mapper.Wrapper;
    import com.baomidou.mybatisplus.service.IService;
    import com.entity.UserEntity;
    import com.utils.PageUtils;
    
    
    /**
     * 系统用户
     */
    public interface UserService extends IService<UserEntity> {
     	PageUtils queryPage(Map<String, Object> params);
        
       	List<UserEntity> selectListView(Wrapper<UserEntity> wrapper);
       	
       	PageUtils queryPage(Map<String, Object> params,Wrapper<UserEntity> wrapper);
    	   	
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    数据访问层(Dao)
    package com.dao;
    
    import java.util.List;
    
    import org.apache.ibatis.annotations.Param;
    
    import com.baomidou.mybatisplus.mapper.BaseMapper;
    import com.baomidou.mybatisplus.mapper.Wrapper;
    import com.baomidou.mybatisplus.plugins.pagination.Pagination;
    import com.entity.UserEntity;
    
    /**
     * 用户
     */
    public interface UserDao extends BaseMapper<UserEntity> {
    	
    	List<UserEntity> selectListView(@Param("ew") Wrapper<UserEntity> wrapper);
    
    	List<UserEntity> selectListView(Pagination page,@Param("ew") Wrapper<UserEntity> wrapper);
    	
    }
    
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
  • 相关阅读:
    【Tomcat】在SpringBoot项目中,Tomcat是如何处理HTTP请求的
    传统燃油车迎来“诺基亚时刻”,油站行业或将加速上演“大逃亡”
    ORA-07445: exception encountered: core dump [kdxlin()+4088]---惜分飞
    苍穹外卖 -- day10- Spring Task- 订单状态定时处理- WebSocket- 来单提醒- 客户催单
    今天起,Windows可以一键召唤GPT-4了
    Nvidia GPU 入门教程之 11 数据中心 GPU 的对决:A100 与 V100S
    CentOS配网报错:network is unreachable
    我们来聊聊锁升级吧
    ANR Application Not Responding
    IP地址、子网掩码、默认网关介绍及例题计算
  • 原文地址:https://blog.csdn.net/weixin_52721608/article/details/126656480