基于Java+SpringBoot+Vue+echarts健身房管理系统设计和实现

博主介绍全网粉丝30W+,csdn特邀作者、博客专家、CSDN新星计划导师、Java领域优质创作者,博客之星、掘金/华为云/阿里云/InfoQ等平台优质作者、专注于Java技术领域和毕业项目实战

🍅文末获取源码联系🍅

👇🏻 精彩专栏推荐订阅👇🏻 不然下次找不到哟

2022-2024年最全的计算机软件毕业设计选题大全:1000个热门选题推荐✅

Java项目精品实战案例《100套》

Java微信小程序项目实战《100套》

目录

一、 前言介绍:

二 、功能设计:

三、功截截图:

四、库表设计:

五、关键代码:

六、论文参考:

七、其他案例: 

八、源码获取:


一、 前言介绍:

        大数据时代下,数据呈爆炸式地增长。为了迎合信息化时代的潮流和信息化安全的要求,利用互联网服务于其他行业,促进生产,已经是成为一种势不可挡的趋势。在健身房管理的要求下,开发一款整体式结构的健身房管理系统,将复杂的系统进行拆分,能够实现对需求的变化快速响应、系统稳定性的保障,能保证平台可持续、规模化发展的要求。

本系统的前端界面涉及的技术主要有Java,bootstrap  freemarker等等,通过这些技术可以实现前端页面的美观和动态效果使之符合广大群众的审美观,后台主要使用的技术主要有Java编程语言,MySQL数据库,JSP和Ajax异步交互,根据Ajax异步模式的健身房管理系统解决了传统管理方式所带来的人力、物力和时间上的虚耗和交流深度的限定,这让交流的过程更快捷、准确、便利,同时完成健身房管理系统的基本功能:首页、轮播图、公告、资源管理(健身资讯、资讯分类)系统用户(管理员、会员用户、教练用户)模块管理(课程类别、公共课程、私教课程、购买私教、会员卡信息、遗失物品、健身器械、商品信息、购买商品)

二 、功能设计:

根据用户对系统的需求,要求系统简单操作,能够准确,完整的对信息进行管理。健身房管理系统在对需求做解析后,整个系统主要分为两个部分:管理员和普通用户,每个模块下的分支功能不一样。对功能做出如下说明:

管理员模块:首页、轮播图、公告、资源管理(健身资讯、资讯分类)系统用户(管理员、会员用户、教练用户)模块管理(课程类别、公共课程、私教课程、购买私教、会员卡信息、遗失物品、健身器械、商品信息、购买商品)。

用户模块:首页、购买私教、会员卡信息、购买商品。

教练模块:首页、公共课程、私教课程、购买私教

 管理员用例图

系统顶层数据流:外部实体为用户,第一个流程为登录验证,用户信息表返回密码验证,是否正确,正确则登录系统,错误则评论信息,登录系统后,根据不同用户的功能选择,来读写数据库。

系统底层数据流如下图所示。

图3-5系统底层数据流图

系统功能结构图如下所示。

三、功截截图:

 

 

 

四、库表设计:

/*
Navicat MySQL Data Transfer

Source Server         : localhost
Source Server Version : 50727
Source Host           : localhost:3306
Source Database       : cs_54933

Target Server Type    : MYSQL
Target Server Version : 50727
File Encoding         : 65001

Date: 2023-07-25 07:33:51
*/

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for access_token
-- ----------------------------
DROP TABLE IF EXISTS `access_token`;
CREATE TABLE `access_token` (
  `token_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '临时访问牌ID',
  `token` varchar(64) DEFAULT NULL COMMENT '临时访问牌',
  `info` text,
  `maxage` int(2) NOT NULL DEFAULT '2' COMMENT '最大寿命:默认2小时',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间:',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间:',
  `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户编号:',
  PRIMARY KEY (`token_id`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=105 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='登陆访问时长';

-- ----------------------------
-- Table structure for article
-- ----------------------------
DROP TABLE IF EXISTS `article`;
CREATE TABLE `article` (
  `article_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT COMMENT '文章id:[0,8388607]',
  `title` varchar(125) NOT NULL DEFAULT '' COMMENT '标题:[0,125]用于文章和html的title标签中',
  `type` varchar(64) NOT NULL DEFAULT '0' COMMENT '文章分类:[0,1000]用来搜索指定类型的文章',
  `hits` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '点击数:[0,1000000000]访问这篇文章的人次',
  `praise_len` int(11) NOT NULL DEFAULT '0' COMMENT '点赞数',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间:',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间:',
  `source` varchar(255) DEFAULT NULL COMMENT '来源:[0,255]文章的出处',
  `url` varchar(255) DEFAULT NULL COMMENT '来源地址:[0,255]用于跳转到发布该文章的网站',
  `tag` varchar(255) DEFAULT NULL COMMENT '标签:[0,255]用于标注文章所属相关内容,多个标签用空格隔开',
  `content` longtext COMMENT '正文:文章的主体内容',
  `img` varchar(255) DEFAULT NULL COMMENT '封面图',
  `description` text COMMENT '文章描述',
  PRIMARY KEY (`article_id`,`title`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='文章:用于内容管理系统的文章';

-- ----------------------------
-- Table structure for article_type
-- ----------------------------
DROP TABLE IF EXISTS `article_type`;
CREATE TABLE `article_type` (
  `type_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT COMMENT '分类ID:[0,10000]',
  `display` smallint(4) unsigned NOT NULL DEFAULT '100' COMMENT '显示顺序:[0,1000]决定分类显示的先后顺序',
  `name` varchar(16) NOT NULL DEFAULT '' COMMENT '分类名称:[2,16]',
  `father_id` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '上级分类ID:[0,32767]',
  `description` varchar(255) DEFAULT NULL COMMENT '描述:[0,255]描述该分类的作用',
  `icon` text COMMENT '分类图标:',
  `url` varchar(255) DEFAULT NULL COMMENT '外链地址:[0,255]如果该分类是跳转到其他网站的情况下,就在该URL上设置',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间:',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间:',
  PRIMARY KEY (`type_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='文章分类';

-- ----------------------------
-- Table structure for auth
-- ----------------------------
DROP TABLE IF EXISTS `auth`;
CREATE TABLE `auth` (
  `auth_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '授权ID:',
  `user_group` varchar(64) DEFAULT NULL COMMENT '用户组:',
  `mod_name` varchar(64) DEFAULT NULL COMMENT '模块名:',
  `table_name` varchar(64) DEFAULT NULL COMMENT '表名:',
  `page_title` varchar(255) DEFAULT NULL COMMENT '页面标题:',
  `path` varchar(255) DEFAULT NULL COMMENT '路由路径:',
  `position` varchar(32) DEFAULT NULL COMMENT '位置:',
  `mode` varchar(32) NOT NULL DEFAULT '_blank' COMMENT '跳转方式:',
  `add` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '是否可增加:',
  `del` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '是否可删除:',
  `set` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '是否可修改:',
  `get` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '是否可查看:',
  `field_add` text COMMENT '添加字段:',
  `field_set` text COMMENT '修改字段:',
  `field_get` text COMMENT '查询字段:',
  `table_nav_name` varchar(500) DEFAULT NULL COMMENT '跨表导航名称:',
  `table_nav` varchar(500) DEFAULT NULL COMMENT '跨表导航:',
  `option` text COMMENT '配置:',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间:',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间:',
  PRIMARY KEY (`auth_id`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=197 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='用户权限管理';

-- ----------------------------
-- Table structure for coach_user
-- ----------------------------
DROP TABLE IF EXISTS `coach_user`;
CREATE TABLE `coach_user` (
  `coach_user_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '教练用户ID',
  `coach_no` varchar(64) NOT NULL COMMENT '教练编号',
  `coach_name` varchar(64) DEFAULT NULL COMMENT '教练姓名',
  `examine_state` varchar(16) NOT NULL DEFAULT '已通过' COMMENT '审核状态',
  `recommend` int(11) NOT NULL DEFAULT '0' COMMENT '智能推荐',
  `user_id` int(11) NOT NULL DEFAULT '0' COMMENT '用户ID',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`coach_user_id`),
  UNIQUE KEY `coach_no` (`coach_no`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='教练用户';

-- ----------------------------
-- Table structure for collect
-- ----------------------------
DROP TABLE IF EXISTS `collect`;
CREATE TABLE `collect` (
  `collect_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '收藏ID:',
  `user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '收藏人ID:',
  `source_table` varchar(255) DEFAULT NULL COMMENT '来源表:',
  `source_field` varchar(255) DEFAULT NULL COMMENT '来源字段:',
  `source_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '来源ID:',
  `title` varchar(255) DEFAULT NULL COMMENT '标题:',
  `img` varchar(255) DEFAULT NULL COMMENT '封面:',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间:',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间:',
  PRIMARY KEY (`collect_id`) USING BTREE
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='收藏';

-- ----------------------------
-- Table structure for comment
-- ----------------------------
DROP TABLE IF EXISTS `comment`;
CREATE TABLE `comment` (
  `comment_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '评论ID:',
  `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '评论人ID:',
  `reply_to_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '回复评论ID:空为0',
  `content` longtext COMMENT '内容:',
  `nickname` varchar(255) DEFAULT NULL COMMENT '昵称:',
  `avatar` varchar(255) DEFAULT NULL COMMENT '头像地址:[0,255]',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间:',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间:',
  `source_table` varchar(255) DEFAULT NULL COMMENT '来源表:',
  `source_field` varchar(255) DEFAULT NULL COMMENT '来源字段:',
  `source_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '来源ID:',
  PRIMARY KEY (`comment_id`) USING BTREE
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='评论';

-- ----------------------------
-- Table structure for course_category
-- ----------------------------
DROP TABLE IF EXISTS `course_category`;
CREATE TABLE `course_category` (
  `course_category_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '课程类别ID',
  `course_category` varchar(64) DEFAULT NULL COMMENT '课程类别',
  `recommend` int(11) NOT NULL DEFAULT '0' COMMENT '智能推荐',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`course_category_id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COMMENT='课程类别';

-- ----------------------------
-- Table structure for fitness_equipment
-- ----------------------------
DROP TABLE IF EXISTS `fitness_equipment`;
CREATE TABLE `fitness_equipment` (
  `fitness_equipment_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '健身器械ID',
  `device_no` varchar(64) DEFAULT NULL COMMENT '器械编号',
  `device_name` varchar(64) DEFAULT NULL COMMENT '器械名称',
  `picture` varchar(255) DEFAULT NULL COMMENT '图片',
  `device_status` varchar(64) DEFAULT NULL COMMENT '器械状态',
  `device_description` text COMMENT '器械说明',
  `details` longtext COMMENT '详情',
  `hits` int(11) NOT NULL DEFAULT '0' COMMENT '点击数',
  `praise_len` int(11) NOT NULL DEFAULT '0' COMMENT '点赞数',
  `recommend` int(11) NOT NULL DEFAULT '0' COMMENT '智能推荐',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`fitness_equipment_id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COMMENT='健身器械';

-- ----------------------------
-- Table structure for hits
-- ----------------------------
DROP TABLE IF EXISTS `hits`;
CREATE TABLE `hits` (
  `hits_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '点赞ID:',
  `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '点赞人:',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间:',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间:',
  `source_table` varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT '来源表:',
  `source_field` varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT '来源字段:',
  `source_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '来源ID:',
  PRIMARY KEY (`hits_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC COMMENT='用户点击';

-- ----------------------------
-- Table structure for lost_items
-- ----------------------------
DROP TABLE IF EXISTS `lost_items`;
CREATE TABLE `lost_items` (
  `lost_items_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '遗失物品ID',
  `serial_number` varchar(64) DEFAULT NULL COMMENT '物品编号',
  `item_name` varchar(64) DEFAULT NULL COMMENT '物品名称',
  `pickup_date` date DEFAULT NULL COMMENT '捡到日期',
  `pick_up_the_place` varchar(64) DEFAULT NULL COMMENT '捡到地点',
  `state` varchar(64) DEFAULT NULL COMMENT '状态',
  `hits` int(11) NOT NULL DEFAULT '0' COMMENT '点击数',
  `praise_len` int(11) NOT NULL DEFAULT '0' COMMENT '点赞数',
  `recommend` int(11) NOT NULL DEFAULT '0' COMMENT '智能推荐',
  `timer_title` varchar(64) DEFAULT NULL COMMENT '计时器标题',
  `timing_start_time` datetime DEFAULT NULL COMMENT '计时开始时间',
  `timing_end_time` datetime DEFAULT NULL COMMENT '计时结束时间',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`lost_items_id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COMMENT='遗失物品';

-- ----------------------------
-- Table structure for membership_card_information
-- ----------------------------
DROP TABLE IF EXISTS `membership_card_information`;
CREATE TABLE `membership_card_information` (
  `membership_card_information_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '会员卡信息ID',
  `member_number` int(11) DEFAULT '0' COMMENT '会员编号',
  `member_name` varchar(64) DEFAULT NULL COMMENT '会员姓名',
  `membership_card_number` varchar(64) DEFAULT NULL COMMENT '会员卡号',
  `membership_card_type` varchar(64) DEFAULT NULL COMMENT '会员卡类型',
  `price` varchar(64) DEFAULT NULL COMMENT '价格',
  `card_handling_time` date DEFAULT NULL COMMENT '办卡时间',
  `expiration_time` date DEFAULT NULL COMMENT '到期时间',
  `recommend` int(11) NOT NULL DEFAULT '0' COMMENT '智能推荐',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`membership_card_information_id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COMMENT='会员卡信息';

-- ----------------------------
-- Table structure for member_users
-- ----------------------------
DROP TABLE IF EXISTS `member_users`;
CREATE TABLE `member_users` (
  `member_users_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '会员用户ID',
  `member_no` varchar(64) NOT NULL COMMENT '会员编号',
  `member_name` varchar(64) DEFAULT NULL COMMENT '会员姓名',
  `examine_state` varchar(16) NOT NULL DEFAULT '已通过' COMMENT '审核状态',
  `recommend` int(11) NOT NULL DEFAULT '0' COMMENT '智能推荐',
  `user_id` int(11) NOT NULL DEFAULT '0' COMMENT '用户ID',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`member_users_id`),
  UNIQUE KEY `member_no` (`member_no`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='会员用户';

-- ----------------------------
-- Table structure for notice
-- ----------------------------
DROP TABLE IF EXISTS `notice`;
CREATE TABLE `notice` (
  `notice_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT COMMENT '公告id:',
  `title` varchar(125) NOT NULL DEFAULT '' COMMENT '标题:',
  `content` longtext COMMENT '正文:',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间:',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间:',
  PRIMARY KEY (`notice_id`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='公告';

-- ----------------------------
-- Table structure for praise
-- ----------------------------
DROP TABLE IF EXISTS `praise`;
CREATE TABLE `praise` (
  `praise_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '点赞ID:',
  `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '点赞人:',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间:',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间:',
  `source_table` varchar(255) DEFAULT NULL COMMENT '来源表:',
  `source_field` varchar(255) DEFAULT NULL COMMENT '来源字段:',
  `source_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '来源ID:',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '点赞状态:1为点赞,0已取消',
  PRIMARY KEY (`praise_id`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='点赞';

-- ----------------------------
-- Table structure for private_education_courses
-- ----------------------------
DROP TABLE IF EXISTS `private_education_courses`;
CREATE TABLE `private_education_courses` (
  `private_education_courses_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '私教课程ID',
  `coach_no` int(11) DEFAULT '0' COMMENT '教练编号',
  `coach_name` varchar(64) DEFAULT NULL COMMENT '教练姓名',
  `course_no` varchar(64) DEFAULT NULL COMMENT '课程编号',
  `course_name` varchar(64) DEFAULT NULL COMMENT '课程名称',
  `course_classification` varchar(64) DEFAULT NULL COMMENT '课程分类',
  `course_price` int(11) DEFAULT '0' COMMENT '课程价格',
  `course_time` varchar(64) DEFAULT NULL COMMENT '课程时间',
  `number_of_class_hours` varchar(64) DEFAULT NULL COMMENT '课时数量',
  `fitness_location` varchar(64) DEFAULT NULL COMMENT '健身地点',
  `picture` varchar(255) DEFAULT NULL COMMENT '图片',
  `fitness_points` text COMMENT '健身要点',
  `course_content` text COMMENT '课程内容',
  `hits` int(11) NOT NULL DEFAULT '0' COMMENT '点击数',
  `praise_len` int(11) NOT NULL DEFAULT '0' COMMENT '点赞数',
  `recommend` int(11) NOT NULL DEFAULT '0' COMMENT '智能推荐',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`private_education_courses_id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COMMENT='私教课程';

-- ----------------------------
-- Table structure for product_information
-- ----------------------------
DROP TABLE IF EXISTS `product_information`;
CREATE TABLE `product_information` (
  `product_information_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '商品信息ID',
  `article_no` varchar(64) DEFAULT NULL COMMENT '商品编号',
  `trade_name` varchar(64) DEFAULT NULL COMMENT '商品名称',
  `picture` varchar(255) DEFAULT NULL COMMENT '图片',
  `brand` varchar(64) DEFAULT NULL COMMENT '品牌',
  `specifications` varchar(64) DEFAULT NULL COMMENT '规格',
  `price` int(11) DEFAULT '0' COMMENT '价格',
  `details` longtext COMMENT '详情',
  `hits` int(11) NOT NULL DEFAULT '0' COMMENT '点击数',
  `praise_len` int(11) NOT NULL DEFAULT '0' COMMENT '点赞数',
  `recommend` int(11) NOT NULL DEFAULT '0' COMMENT '智能推荐',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`product_information_id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COMMENT='商品信息';

-- ----------------------------
-- Table structure for public_courses
-- ----------------------------
DROP TABLE IF EXISTS `public_courses`;
CREATE TABLE `public_courses` (
  `public_courses_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '公共课程ID',
  `coach_no` int(11) DEFAULT '0' COMMENT '教练编号',
  `coach_name` varchar(64) DEFAULT NULL COMMENT '教练姓名',
  `course_no` varchar(64) DEFAULT NULL COMMENT '课程编号',
  `course_name` varchar(64) DEFAULT NULL COMMENT '课程名称',
  `course_category` varchar(64) DEFAULT NULL COMMENT '课程类别',
  `course_price` int(11) DEFAULT '0' COMMENT '课程价格',
  `course_time` varchar(64) DEFAULT NULL COMMENT '课程时间',
  `fitness_location` varchar(64) DEFAULT NULL COMMENT '健身地点',
  `picture` varchar(255) DEFAULT NULL COMMENT '图片',
  `course_content` text COMMENT '课程内容',
  `hits` int(11) NOT NULL DEFAULT '0' COMMENT '点击数',
  `praise_len` int(11) NOT NULL DEFAULT '0' COMMENT '点赞数',
  `recommend` int(11) NOT NULL DEFAULT '0' COMMENT '智能推荐',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`public_courses_id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COMMENT='公共课程';

-- ----------------------------
-- Table structure for purchase_goods
-- ----------------------------
DROP TABLE IF EXISTS `purchase_goods`;
CREATE TABLE `purchase_goods` (
  `purchase_goods_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '购买商品ID',
  `order_number` varchar(64) DEFAULT NULL COMMENT '订单号',
  `article_no` varchar(64) DEFAULT NULL COMMENT '商品编号',
  `trade_name` varchar(64) DEFAULT NULL COMMENT '商品名称',
  `brand` varchar(64) DEFAULT NULL COMMENT '品牌',
  `specifications` varchar(64) DEFAULT NULL COMMENT '规格',
  `price` varchar(64) DEFAULT NULL COMMENT '价格',
  `member` int(11) DEFAULT '0' COMMENT '会员',
  `member_name` varchar(64) DEFAULT NULL COMMENT '会员姓名',
  `purchase_quantity` varchar(64) DEFAULT NULL COMMENT '购买数量',
  `total_price` varchar(64) DEFAULT NULL COMMENT '总价',
  `pay_state` varchar(16) NOT NULL DEFAULT '未支付' COMMENT '支付状态',
  `pay_type` varchar(16) DEFAULT '' COMMENT '支付类型: 微信、支付宝、网银',
  `recommend` int(11) NOT NULL DEFAULT '0' COMMENT '智能推荐',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`purchase_goods_id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COMMENT='购买商品';

-- ----------------------------
-- Table structure for purchase_private_education
-- ----------------------------
DROP TABLE IF EXISTS `purchase_private_education`;
CREATE TABLE `purchase_private_education` (
  `purchase_private_education_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '购买私教ID',
  `order_number` varchar(64) DEFAULT NULL COMMENT '订单号',
  `coach_no` int(11) DEFAULT '0' COMMENT '教练编号',
  `coach_name` varchar(64) DEFAULT NULL COMMENT '教练姓名',
  `course_no` varchar(64) DEFAULT NULL COMMENT '课程编号',
  `course_name` varchar(64) DEFAULT NULL COMMENT '课程名称',
  `course_classification` varchar(64) DEFAULT NULL COMMENT '课程分类',
  `course_price` varchar(64) DEFAULT NULL COMMENT '课程价格',
  `course_time` varchar(64) DEFAULT NULL COMMENT '课程时间',
  `member` int(11) DEFAULT '0' COMMENT '会员',
  `member_name` varchar(64) DEFAULT NULL COMMENT '会员姓名',
  `time_of_appointment` datetime DEFAULT NULL COMMENT '预约时间',
  `examine_state` varchar(16) NOT NULL DEFAULT '未审核' COMMENT '审核状态',
  `examine_reply` varchar(16) DEFAULT '' COMMENT '审核回复',
  `pay_state` varchar(16) NOT NULL DEFAULT '未支付' COMMENT '支付状态',
  `pay_type` varchar(16) DEFAULT '' COMMENT '支付类型: 微信、支付宝、网银',
  `recommend` int(11) NOT NULL DEFAULT '0' COMMENT '智能推荐',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`purchase_private_education_id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COMMENT='购买私教';

-- ----------------------------
-- Table structure for slides
-- ----------------------------
DROP TABLE IF EXISTS `slides`;
CREATE TABLE `slides` (
  `slides_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '轮播图ID:',
  `title` varchar(64) DEFAULT NULL COMMENT '标题:',
  `content` varchar(255) DEFAULT NULL COMMENT '内容:',
  `url` varchar(255) DEFAULT NULL COMMENT '链接:',
  `img` varchar(255) DEFAULT NULL COMMENT '轮播图:',
  `hits` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '点击量:',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间:',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间:',
  PRIMARY KEY (`slides_id`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='轮播图';

-- ----------------------------
-- Table structure for upload
-- ----------------------------
DROP TABLE IF EXISTS `upload`;
CREATE TABLE `upload` (
  `upload_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '上传ID',
  `name` varchar(64) DEFAULT NULL COMMENT '文件名',
  `path` varchar(255) DEFAULT NULL COMMENT '访问路径',
  `file` varchar(255) DEFAULT NULL COMMENT '文件路径',
  `display` varchar(255) DEFAULT NULL COMMENT '显示顺序',
  `father_id` int(11) DEFAULT '0' COMMENT '父级ID',
  `dir` varchar(255) DEFAULT NULL COMMENT '文件夹',
  `type` varchar(32) DEFAULT NULL COMMENT '文件类型',
  PRIMARY KEY (`upload_id`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='文件上传';

-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
  `user_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT COMMENT '用户ID:[0,8388607]用户获取其他与用户相关的数据',
  `state` smallint(1) unsigned NOT NULL DEFAULT '1' COMMENT '账户状态:[0,10](1可用|2异常|3已冻结|4已注销)',
  `user_group` varchar(32) DEFAULT NULL COMMENT '所在用户组:[0,32767]决定用户身份和权限',
  `login_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '上次登录时间:',
  `phone` varchar(11) DEFAULT NULL COMMENT '手机号码:[0,11]用户的手机号码,用于找回密码时或登录时',
  `phone_state` smallint(1) unsigned NOT NULL DEFAULT '0' COMMENT '手机认证:[0,1](0未认证|1审核中|2已认证)',
  `username` varchar(16) NOT NULL DEFAULT '' COMMENT '用户名:[0,16]用户登录时所用的账户名称',
  `nickname` varchar(16) DEFAULT '' COMMENT '昵称:[0,16]',
  `password` varchar(64) NOT NULL DEFAULT '' COMMENT '密码:[0,32]用户登录所需的密码,由6-16位数字或英文组成',
  `email` varchar(64) DEFAULT '' COMMENT '邮箱:[0,64]用户的邮箱,用于找回密码时或登录时',
  `email_state` smallint(1) unsigned NOT NULL DEFAULT '0' COMMENT '邮箱认证:[0,1](0未认证|1审核中|2已认证)',
  `avatar` varchar(255) DEFAULT NULL COMMENT '头像地址:[0,255]',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间:',
  PRIMARY KEY (`user_id`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='用户账户:用于保存用户登录信息';

-- ----------------------------
-- Table structure for user_group
-- ----------------------------
DROP TABLE IF EXISTS `user_group`;
CREATE TABLE `user_group` (
  `group_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT COMMENT '用户组ID:[0,8388607]',
  `display` smallint(4) unsigned NOT NULL DEFAULT '100' COMMENT '显示顺序:[0,1000]',
  `name` varchar(16) NOT NULL DEFAULT '' COMMENT '名称:[0,16]',
  `description` varchar(255) DEFAULT NULL COMMENT '描述:[0,255]描述该用户组的特点或权限范围',
  `source_table` varchar(255) DEFAULT NULL COMMENT '来源表:',
  `source_field` varchar(255) DEFAULT NULL COMMENT '来源字段:',
  `source_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '来源ID:',
  `register` smallint(1) unsigned DEFAULT '0' COMMENT '注册位置:',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间:',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间:',
  PRIMARY KEY (`group_id`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='用户组:用于用户前端身份和鉴权';

五、关键代码:

/**
 * 用户账户:用于保存用户登录信息(User)表控制层
 */
@Slf4j
@RestController
@RequestMapping("user")
public class UserController extends BaseController<User, UserService> {
    /**
     * 服务对象
     */
    @Autowired
    public UserController(UserService service) {
        setService(service);
    }

    /**
     * Token服务
     */
    @Autowired
    private AccessTokenService tokenService;

    @Autowired
    private UserGroupService userGroupService;

    /**
     * 注册
     * @param user
     * @return
     */
    @PostMapping("register")
    public Map<String, Object> signUp(@RequestBody User user) {
        // 查询用户
        Map<String, String> query = new HashMap<>();
        query.put("username",user.getUsername());
        List list = service.select(query, new HashMap<>()).getResultList();
        if (list.size()>0){
            return error(30000, "用户已存在");
        }
        user.setUserId(null);
        user.setPassword(service.encryption(user.getPassword()));
        service.save(user);
        return success(1);
    }

    /**
     * 找回密码
     * @param form
     * @return
     */
    @PostMapping("forget_password")
    public Map<String, Object> forgetPassword(@RequestBody User form,HttpServletRequest request) {
        JSONObject ret = new JSONObject();
        String username = form.getUsername();
        String code = form.getCode();
        String password = form.getPassword();
        // 判断条件
        if(code == null || code.length() == 0){
            return error(30000, "验证码不能为空");
        }
        if(username == null || username.length() == 0){
            return error(30000, "用户名不能为空");
        }
        if(password == null || password.length() == 0){
            return error(30000, "密码不能为空");
        }

        // 查询用户
        Map<String, String> query = new HashMap<>();
        query.put("username",username);
        Query select = service.select(query, service.readConfig(request));
        List list = select.getResultList();
        if (list.size() > 0) {
            User o = (User) list.get(0);
            JSONObject query2 = new JSONObject();
            JSONObject form2 = new JSONObject();
            // 修改用户密码
            query2.put("user_id",o.getUserId());
            form2.put("password",service.encryption(password));
            service.update(query, service.readConfig(request), form2);
            return success(1);
        }
        return error(70000,"用户不存在");
    }

    /**
     * 登录
     * @param data
     * @param httpServletRequest
     * @return
     */
    @PostMapping("login")
    public Map<String, Object> login(@RequestBody Map<String, String> data, HttpServletRequest httpServletRequest) {
        log.info("[执行登录接口]");

        String username = data.get("username");
        String email = data.get("email");
        String phone = data.get("phone");
        String password = data.get("password");

        List resultList = null;
        Map<String, String> map = new HashMap<>();
        if(username != null && "".equals(username) == false){
            map.put("username", username);
            resultList = service.select(map, new HashMap<>()).getResultList();
        }
        else if(email != null && "".equals(email) == false){
            map.put("email", email);
            resultList = service.select(map, new HashMap<>()).getResultList();
        }
        else if(phone != null && "".equals(phone) == false){
            map.put("phone", phone);
            resultList = service.select(map, new HashMap<>()).getResultList();
        }else{
            return error(30000, "账号或密码不能为空");
        }
        if (resultList == null || password == null) {
            return error(30000, "账号或密码不能为空");
        }
        //判断是否有这个用户
        if (resultList.size()<=0){
            return error(30000,"用户不存在");
        }

        User byUsername = (User) resultList.get(0);


        Map<String, String> groupMap = new HashMap<>();
        groupMap.put("name",byUsername.getUserGroup());
        List groupList = userGroupService.select(groupMap, new HashMap<>()).getResultList();
        if (groupList.size()<1){
            return error(30000,"用户组不存在");
        }

        UserGroup userGroup = (UserGroup) groupList.get(0);

        //查询用户审核状态
        if (!StringUtils.isEmpty(userGroup.getSourceTable())){
            String sql = "select examine_state from "+ userGroup.getSourceTable() +" WHERE user_id = " + byUsername.getUserId();
            String res = String.valueOf(service.runCountSql(sql).getSingleResult());
            if (res==null){
                return error(30000,"用户不存在");
            }
            if (!res.equals("已通过")){
                return error(30000,"该用户审核未通过");
            }
        }

        //查询用户状态
        if (byUsername.getState()!=1){
            return error(30000,"用户非可用状态,不能登录");
        }

        String md5password = service.encryption(password);
        if (byUsername.getPassword().equals(md5password)) {
            // 存储Token到数据库
            AccessToken accessToken = new AccessToken();
            accessToken.setToken(UUID.randomUUID().toString().replaceAll("-", ""));
            accessToken.setUser_id(byUsername.getUserId());
            tokenService.save(accessToken);

            // 返回用户信息
            JSONObject user = JSONObject.parseObject(JSONObject.toJSONString(byUsername));
            user.put("token", accessToken.getToken());
            JSONObject ret = new JSONObject();
            ret.put("obj",user);
            return success(ret);
        } else {
            return error(30000, "账号或密码不正确");
        }
    }

    /**
     * 修改密码
     * @param data
     * @param request
     * @return
     */
    @PostMapping("change_password")
    public Map<String, Object> change_password(@RequestBody Map<String, String> data, HttpServletRequest request){
        // 根据Token获取UserId
        String token = request.getHeader("x-auth-token");
        Integer userId = tokenGetUserId(token);
        // 根据UserId和旧密码获取用户
        Map<String, String> query = new HashMap<>();
        String o_password = data.get("o_password");
        query.put("user_id" ,String.valueOf(userId));
        query.put("password" ,service.encryption(o_password));
        Query ret = service.count(query, service.readConfig(request));
        List list = ret.getResultList();
        Object s = list.get(0);
        int count = Integer.parseInt(list.get(0).toString());
        if(count > 0){
            // 修改密码
            Map<String,Object> form = new HashMap<>();
            form.put("password",service.encryption(data.get("password")));
            service.update(query,service.readConfig(request),form);
            return success(1);
        }
        return error(10000,"密码修改失败!");
    }

    /**
     * 登录态
     * @param request
     * @return
     */
    @GetMapping("state")
    public Map<String, Object> state(HttpServletRequest request) {
        JSONObject ret = new JSONObject();
        // 获取状态
        String token = request.getHeader("x-auth-token");

        // 根据登录态获取用户ID
        Integer userId = tokenGetUserId(token);

        log.info("[返回userId] {}",userId);
        if(userId == null || userId == 0){
            return error(10000,"用户未登录!");
        }

        // 根据用户ID获取用户
        Map<String,String> query = new HashMap<>();
        query.put("user_id" ,String.valueOf(userId));

        // 根据用户ID获取
        Query select = service.select(query,service.readConfig(request));
        List resultList = select.getResultList();
        if (resultList.size() > 0) {
            JSONObject user = JSONObject.parseObject(JSONObject.toJSONString(resultList.get(0)));
            user.put("token",token);
            ret.put("obj",user);
            return success(ret);
        } else {
            return error(10000,"用户未登录!");
        }
    }

    /**
     * @param request
     * @return
     */
    @GetMapping("quit")
    public Map<String, Object> quit(HttpServletRequest request) {
        String token = request.getHeader("x-auth-token");
        JSONObject ret = new JSONObject();
        Map<String, String> query = new HashMap<>(16);
        query.put("token", token);
        try{
            tokenService.delete(query,service.readConfig(request));
        }catch (Exception e){
            e.printStackTrace();
        }
        return success("退出登录成功!");
    }

    /**
     * 获取登录用户ID
     * @param token
     * @return
     */
    public Integer tokenGetUserId(String token) {
        log.info("[获取的token] {}",token);
        // 根据登录态获取用户ID
        if(token == null || "".equals(token)){
            return 0;
        }
        Map<String, String> query = new HashMap<>(16);
        query.put("token", token);
        AccessToken byToken = tokenService.findOne(query);
        if(byToken == null){
            return 0;
        }
        return byToken.getUser_id();
    }

    /**
     * 重写add
     * @return
     */
    @PostMapping("/add")
    @Transactional
    public Map<String, Object> add(HttpServletRequest request) throws IOException {
        Map<String,Object> map = service.readBody(request.getReader());
        map.put("password",service.encryption(String.valueOf(map.get("password"))));
        service.insert(map);
        return success(1);
    }

}

六、论文参考:

七、其他案例: 

 

 

 

八、源码获取:

大家点赞、收藏、关注、评论啦 、查看👇🏻获取联系方式👇🏻

 精彩专栏推荐订阅下方专栏👇🏻

2022-2024年最全的计算机软件毕业设计选题大全:1000个热门选题推荐✅

Java项目精品实战案例《100套》

Java微信小程序项目实战《100套》

  • 69
    点赞
  • 105
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 58
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 58
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

java李杨勇

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值