0


社团管理系统数据库设计及sql代码

3.数据库设计

用户表(user)

字段

描述

类型

允许为空

备注

id

编号

Int

PK(主键)

name

姓名

Varchar(25)

password

密码

Varchar(32)

photo

头像

Varchar(100)

phone

手机号码

Char(11)

UNIQUE(唯一约束)

email

邮箱地址

Varchar(40)

UNIQUE(唯一约束)

create_time

注册时间

datetime

update_time

修改时间

datetime

state

状态

tinyint

0为禁用 1为启用

gender

性别

varchar(10)

留言表(leave_info)

字段

描述

类型

允许为空

备注

id

编号

Int

PK(主键)

content

内容

Varchar(500)

user_id

发送人id

int

FK外键

send_time

发送时间

datetime

state

处理状态

tinyint

0为未查看 1为已查看

社团表(club)

字段

描述

类型

允许为空

备注

id

编号

Int

PK(主键)

name

社团名称

varchar(20)

introduction

社团介绍

varchar(400)

category_id

社团分类编号

int

FK(外键)

member_count

社团人数

int

create_time

创建时间

datetime

update_time

修改时间

datetime

admin_id

创建人id

int

FK(外键)

user_id

社团团长id

int

FK(外键)

state

社团状态

tinyint

0为禁用 1为启用

photo

社团头像

varchar(100)

用户社团关系表(user_club)

字段

描述

类型

允许为空

备注

id

编号

Int

PK(主键)

user_id

用户id

int

FK(外键)

club_id

社团id

int

FK(外键)

role

角色

tinyint

0是成员 1是社长

join_time

加入时间

datetime

入团申请表(club_apply)

字段

描述

类型

允许为空

备注

id

编号

Int

PK(主键)

user_id

申请人id

int

FK(外键)

club_id

社团ID

int

FK(外键)

send_time

申请发送时间

datetime

apply_reason

申请理由

varchar(100)

state

申请状态

tinyint

0为未通过1为通过2为未审核

系统通知表(system_info)

字段

描述

类型

允许为空

备注

id

编号

Int

PK(主键)

title

通知标题

varchar(40)

content

通知内容

varchar(400)

create_time

创建时间

datetime

update_time

修改时间

datetime

admin_id

创建人id

int

FK(外键)

管理员表(admin)

字段

描述

类型

允许为空

备注

id

编号

Int

PK(主键)

email

登录账号

varchar(40)

password

密码

varchar(32)

photo

头像

varchar(100)

name

姓名

varchar(25)

phone

电话号码

varchar(11)

state

状态

tinyint

0为禁用 1为启用

role

角色权限

tinyint

0为普通管理员 1为超级管理员

社团费用记录表(club_fee)

字段

描述

类型

允许为空

备注

id

编号

Int

PK(主键)

club_id

社团id

int

FK(外键)

fee_name

费用名称

varchar(120)

fee_size

费用金额

varchar(20)

create_time

创建时间

datetime

update_time

修改时间

datetime

note

备注

varchar(400)

社团活动申请表(activity_apply)

字段

描述

类型

允许为空

备注

id

编号

Int

PK(主键)

user_id

申请人id

int

FK(外键)

club_id

社团ID

int

FK(外键)

send_time

申请时间

datetime

name

活动名称

varchar(40)

content

活动内容

varchar(1000)

photo

活动宣传图片

varchar(100)

start_time

活动开始时间

datetime

end_time

活动结束时间

datetime

address

活动地址

varchar(100)

first_state

第一次审核状态

tinyint

0为未通过1为已通过 2为未审核

second_state

第二次审核状态

tinyint

0为未通过1为已通过 2为未审核

社团活动表(activity)

字段

描述

类型

允许为空

备注

id

编号

Int

PK(主键)

name

活动名称

varchar(40)

club_id

社团id

int

FK(外键)

content

活动内容

varchar(1000)

photo

活动宣传图片

varchar(100)

start_time

活动开始时间

datetime

end_time

活动结束时间

datetime

address

活动地址

varchar(100)

user_id

发起人id

int

FK(外键)

join_people_count

活动参加人数

int(20)

state

活动状态

tinyint

0为结束 1为开始 2为未开始

用户活动关系表(user_activity)

字段

描述

类型

允许为空

备注

id

编号

Int

PK(主键)

user_id

用户id

int

FK(外键)

activity_id

活动id

int

FK(外键)

社团分类表(club_category)

字段

描述

类型

允许为空

备注

id

编号

Int

PK(主键)

name

分类名称

varchar(20)

note

备注

varchar(100)

  1. Sql
  2. /*
  3. Navicat Premium Data Transfer
  4. Source Server : localhost_3306
  5. Source Server Type : MySQL
  6. Source Server Version : 80031
  7. Source Host : localhost:3306
  8. Source Schema : club
  9. Target Server Type : MySQL
  10. Target Server Version : 80031
  11. File Encoding : 65001
  12. Date: 27/11/2023 11:09:54
  13. */
  14. SET NAMES utf8mb4;
  15. SET FOREIGN_KEY_CHECKS = 0;

  16. -- Table structure for activity

  17. DROP TABLE IF EXISTS activity;
  18. CREATE TABLE activity (
  19. id int(0) NOT NULL AUTO_INCREMENT,
  20. name varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  21. club_id int(0) NOT NULL,
  22. content varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  23. photo varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  24. start_time datetime(0) NOT NULL,
  25. end_time datetime(0) NOT NULL,
  26. address varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  27. user_id int(0) NOT NULL,
  28. join_people_count int(0) NOT NULL,
  29. state tinyint(0) NOT NULL,
  30. PRIMARY KEY (id) USING BTREE,
  31. INDEX club_id(club_id) USING BTREE,
  32. INDEX user_id(user_id) USING BTREE,
  33. CONSTRAINT activity_ibfk_1 FOREIGN KEY (club_id) REFERENCES club (id) ON DELETE RESTRICT ON UPDATE RESTRICT,
  34. CONSTRAINT activity_ibfk_2 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE RESTRICT ON UPDATE RESTRICT
  35. ) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

  36. -- Records of activity

  37. INSERT INTO activity VALUES (1, '活动1', 1, '活动1的内容', 'activity1.jpg', '2023-11-17 10:00:00', '2023-11-17 12:00:00', '地址1', 1, 2, 2);
  38. INSERT INTO activity VALUES (2, '活动2', 1, '活动2的内容', 'activity2.jpg', '2023-11-18 13:00:00', '2023-11-18 15:00:00', '地址2', 2, 1, 2);
  39. INSERT INTO activity VALUES (3, '活动3', 2, '活动3的内容', 'activity3.jpg', '2023-11-19 14:00:00', '2023-11-19 16:00:00', '地址3', 3, 1, 2);
  40. INSERT INTO activity VALUES (4, '活动4', 2, '活动4的内容', 'activity4.jpg', '2023-11-20 15:00:00', '2023-11-20 17:00:00', '地址4', 4, 1, 2);
  41. INSERT INTO activity VALUES (5, '活动5', 3, '活动5的内容', 'activity5.jpg', '2023-11-21 16:00:00', '2023-11-21 18:00:00', '地址5', 5, 1, 2);

  42. -- Table structure for activity_apply

  43. DROP TABLE IF EXISTS activity_apply;
  44. CREATE TABLE activity_apply (
  45. id int(0) NOT NULL AUTO_INCREMENT,
  46. user_id int(0) NOT NULL,
  47. club_id int(0) NOT NULL,
  48. send_time datetime(0) NOT NULL,
  49. first_state tinyint(0) NOT NULL,
  50. second_state tinyint(0) NOT NULL,
  51. name varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  52. content varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  53. photo varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  54. start_time datetime(0) NOT NULL,
  55. end_time datetime(0) NOT NULL,
  56. address varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  57. PRIMARY KEY (id) USING BTREE,
  58. INDEX user_id(user_id) USING BTREE,
  59. INDEX club_id(club_id) USING BTREE,
  60. CONSTRAINT activity_apply_ibfk_1 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE RESTRICT ON UPDATE RESTRICT,
  61. CONSTRAINT activity_apply_ibfk_2 FOREIGN KEY (club_id) REFERENCES club (id) ON DELETE RESTRICT ON UPDATE RESTRICT
  62. ) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

  63. -- Records of activity_apply

  64. INSERT INTO activity_apply VALUES (1, 1, 1, '2023-11-17 10:00:00', 0, 0, '活动1', '活动1的内容', 'activity1.jpg', '2023-11-17 10:00:00', '2023-11-17 12:00:00', '地址1');
  65. INSERT INTO activity_apply VALUES (2, 2, 1, '2023-11-18 11:00:00', 0, 0, '活动2', '活动2的内容', 'activity2.jpg', '2023-11-18 13:00:00', '2023-11-18 15:00:00', '地址2');
  66. INSERT INTO activity_apply VALUES (3, 3, 2, '2023-11-19 12:00:00', 0, 0, '活动3', '活动3的内容', 'activity3.jpg', '2023-11-19 14:00:00', '2023-11-19 16:00:00', '地址3');
  67. INSERT INTO activity_apply VALUES (4, 4, 2, '2023-11-20 13:00:00', 0, 0, '活动4', '活动4的内容', 'activity4.jpg', '2023-11-20 15:00:00', '2023-11-20 17:00:00', '地址4');
  68. INSERT INTO activity_apply VALUES (5, 5, 3, '2023-11-21 14:00:00', 0, 0, '活动5', '活动5的内容', 'activity5.jpg', '2023-11-21 16:00:00', '2023-11-21 18:00:00', '地址5');
  69. INSERT INTO activity_apply VALUES (6, 2, 2, '2023-11-21 22:29:32', 1, 2, '劳动最光荣', '我爱劳动,劳动最光荣', 'abc.jpg', '2023-11-30 10:00:00', '2023-12-21 10:00:00', '操场');
  70. INSERT INTO activity_apply VALUES (7, 2, 2, '2023-11-24 16:32:59', 1, 2, '劳动最光荣', '我爱劳动,劳动最光荣', 'abc.jpg', '2023-11-30 10:00:00', '2023-12-21 10:00:00', '操场');

  71. -- Table structure for admin

  72. DROP TABLE IF EXISTS admin;
  73. CREATE TABLE admin (
  74. id int(0) NOT NULL AUTO_INCREMENT,
  75. email varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  76. password varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  77. photo varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  78. name varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  79. phone varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  80. state tinyint(0) NOT NULL,
  81. role tinyint(0) NOT NULL,
  82. PRIMARY KEY (id) USING BTREE
  83. ) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

  84. -- Records of admin

  85. INSERT INTO admin VALUES (1, 'admin1@qq.com', 'e10adc3949ba59abbe56e057f20f883e', 'admin1.jpg', '管理员1', '12345678901', 1, 1);
  86. INSERT INTO admin VALUES (2, 'admin2@qq.com', 'e10adc3949ba59abbe56e057f20f883e', 'admin2.jpg', '管理员2', '12345678902', 1, 0);
  87. INSERT INTO admin VALUES (3, 'admin3@qq.com', 'e10adc3949ba59abbe56e057f20f883e', 'admin3.jpg', '管理员3', '12345678903', 1, 0);
  88. INSERT INTO admin VALUES (4, 'admin4@qq.com', 'e10adc3949ba59abbe56e057f20f883e', 'admin4.jpg', '管理员4', '12345678904', 1, 0);
  89. INSERT INTO admin VALUES (5, 'admin5@qq.com', 'e10adc3949ba59abbe56e057f20f883e', 'admin5.jpg', '管理员5', '12345678905', 1, 0);

  90. -- Table structure for club

  91. DROP TABLE IF EXISTS club;
  92. CREATE TABLE club (
  93. id int(0) NOT NULL AUTO_INCREMENT,
  94. name varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  95. introduction varchar(400) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  96. category_id int(0) NOT NULL,
  97. member_count int(0) NOT NULL,
  98. create_time datetime(0) NOT NULL,
  99. update_time datetime(0) NOT NULL,
  100. admin_id int(0) NOT NULL,
  101. user_id int(0) NOT NULL,
  102. state tinyint(0) NOT NULL,
  103. photo varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  104. PRIMARY KEY (id) USING BTREE,
  105. INDEX category_id(category_id) USING BTREE,
  106. INDEX admin_id(admin_id) USING BTREE,
  107. INDEX user_id(user_id) USING BTREE,
  108. CONSTRAINT club_ibfk_1 FOREIGN KEY (category_id) REFERENCES club_category (id) ON DELETE RESTRICT ON UPDATE RESTRICT,
  109. CONSTRAINT club_ibfk_2 FOREIGN KEY (admin_id) REFERENCES admin (id) ON DELETE RESTRICT ON UPDATE RESTRICT,
  110. CONSTRAINT club_ibfk_3 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE RESTRICT ON UPDATE RESTRICT
  111. ) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

  112. -- Records of club

  113. INSERT INTO club VALUES (1, '1社', '我们社团是一个开放,和谐的社团', 1, 100, '2023-11-17 10:00:00', '2023-11-26 22:04:17', 1, 1, 1, 'https://bigeventmy.oss-cn-chengdu.aliyuncs.com/d35e0e27-49b6-49a2-958d-1b9840aa429e.png');
  114. INSERT INTO club VALUES (2, '2社', '我们社团是一个开放,和谐的社团', 2, 120, '2023-11-18 10:00:00', '2023-11-26 16:47:09', 2, 2, 1, 'https://bigeventmy.oss-cn-chengdu.aliyuncs.com/d35e0e27-49b6-49a2-958d-1b9840aa429e.png');
  115. INSERT INTO club VALUES (3, '3社', '我们社团是一个开放,和谐的社团', 3, 150, '2023-11-19 10:00:00', '2023-11-26 16:47:09', 3, 3, 1, 'https://bigeventmy.oss-cn-chengdu.aliyuncs.com/d35e0e27-49b6-49a2-958d-1b9840aa429e.png');
  116. INSERT INTO club VALUES (4, '4社', '我们社团是一个开放,和谐的社团', 4, 180, '2023-11-20 10:00:00', '2023-11-26 16:47:09', 4, 4, 1, 'https://bigeventmy.oss-cn-chengdu.aliyuncs.com/d35e0e27-49b6-49a2-958d-1b9840aa429e.png');
  117. INSERT INTO club VALUES (5, '5社', '我们社团是一个开放,和谐的社团', 5, 200, '2023-11-21 10:00:00', '2023-11-26 16:47:09', 5, 5, 1, 'https://bigeventmy.oss-cn-chengdu.aliyuncs.com/d35e0e27-49b6-49a2-958d-1b9840aa429e.png');
  118. INSERT INTO club VALUES (9, '魔术社', '我们社团是一个开放,和谐的社团', 5, 1, '2023-11-25 22:50:44', '2023-11-26 18:02:08', 1, 6, 1, 'https://bigeventmy.oss-cn-chengdu.aliyuncs.com/d35e0e27-49b6-49a2-958d-1b9840aa429e.png');

  119. -- Table structure for club_apply

  120. DROP TABLE IF EXISTS club_apply;
  121. CREATE TABLE club_apply (
  122. id int(0) NOT NULL AUTO_INCREMENT,
  123. user_id int(0) NOT NULL,
  124. club_id int(0) NOT NULL,
  125. send_time datetime(0) NOT NULL,
  126. apply_reason varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  127. state tinyint(0) NOT NULL,
  128. PRIMARY KEY (id) USING BTREE,
  129. INDEX user_id(user_id) USING BTREE,
  130. INDEX club_id(club_id) USING BTREE,
  131. CONSTRAINT club_apply_ibfk_1 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE RESTRICT ON UPDATE RESTRICT,
  132. CONSTRAINT club_apply_ibfk_2 FOREIGN KEY (club_id) REFERENCES club (id) ON DELETE RESTRICT ON UPDATE RESTRICT
  133. ) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

  134. -- Records of club_apply

  135. INSERT INTO club_apply VALUES (1, 1, 1, '2023-11-17 10:00:00', '申请加入社团1的理由', 1);
  136. INSERT INTO club_apply VALUES (2, 2, 1, '2023-11-18 10:00:00', '申请加入社团1的理由', 1);
  137. INSERT INTO club_apply VALUES (4, 4, 2, '2023-11-20 10:00:00', '申请加入社团2的理由', 1);
  138. INSERT INTO club_apply VALUES (5, 5, 3, '2023-11-21 10:00:00', '申请加入社团3的理由', 1);
  139. INSERT INTO club_apply VALUES (6, 2, 1, '2023-11-21 10:10:00', '我想加入该社团', 1);

  140. -- Table structure for club_category

  141. DROP TABLE IF EXISTS club_category;
  142. CREATE TABLE club_category (
  143. id int(0) NOT NULL AUTO_INCREMENT,
  144. name varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  145. note varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  146. PRIMARY KEY (id) USING BTREE
  147. ) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

  148. -- Records of club_category

  149. INSERT INTO club_category VALUES (1, '人文', NULL);
  150. INSERT INTO club_category VALUES (2, '类别2', '类别2的备注');
  151. INSERT INTO club_category VALUES (3, '类别3', '类别3的备注');
  152. INSERT INTO club_category VALUES (4, '类别4', '类别4的备注');
  153. INSERT INTO club_category VALUES (5, '类别5', '类别5的备注');

  154. -- Table structure for club_fee

  155. DROP TABLE IF EXISTS club_fee;
  156. CREATE TABLE club_fee (
  157. id int(0) NOT NULL AUTO_INCREMENT,
  158. club_id int(0) NOT NULL,
  159. fee_name varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  160. fee_size varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  161. create_time datetime(0) NOT NULL,
  162. update_time datetime(0) NOT NULL,
  163. note varchar(400) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  164. PRIMARY KEY (id) USING BTREE,
  165. INDEX club_id(club_id) USING BTREE,
  166. CONSTRAINT club_fee_ibfk_1 FOREIGN KEY (club_id) REFERENCES club (id) ON DELETE RESTRICT ON UPDATE RESTRICT
  167. ) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

  168. -- Records of club_fee

  169. INSERT INTO club_fee VALUES (1, 1, '会费1', '100', '2023-11-17 10:00:00', '2023-11-17 10:00:00', '会费1的备注');
  170. INSERT INTO club_fee VALUES (2, 2, '会费2', '200', '2023-11-18 10:00:00', '2023-11-18 10:00:00', '会费2的备注');
  171. INSERT INTO club_fee VALUES (3, 3, '会费3', '300', '2023-11-19 10:00:00', '2023-11-19 10:00:00', '会费3的备注');
  172. INSERT INTO club_fee VALUES (4, 4, '会费4', '400', '2023-11-20 10:00:00', '2023-11-20 10:00:00', '会费4的备注');
  173. INSERT INTO club_fee VALUES (5, 5, '会费5', '500', '2023-11-21 10:00:00', '2023-11-21 10:00:00', '会费5的备注');

  174. -- Table structure for leave_info

  175. DROP TABLE IF EXISTS leave_info;
  176. CREATE TABLE leave_info (
  177. id int(0) NOT NULL AUTO_INCREMENT,
  178. content varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  179. user_id int(0) NOT NULL,
  180. send_time datetime(0) NOT NULL,
  181. state tinyint(0) NOT NULL,
  182. PRIMARY KEY (id) USING BTREE,
  183. INDEX user_id(user_id) USING BTREE,
  184. CONSTRAINT leave_info_ibfk_1 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE RESTRICT ON UPDATE RESTRICT
  185. ) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

  186. -- Records of leave_info

  187. INSERT INTO leave_info VALUES (1, '请假信息1', 1, '2023-11-17 10:00:00', 0);
  188. INSERT INTO leave_info VALUES (2, '请假信息2', 1, '2023-11-18 10:00:00', 0);
  189. INSERT INTO leave_info VALUES (3, '请假信息3', 2, '2023-11-19 10:00:00', 0);
  190. INSERT INTO leave_info VALUES (4, '请假信息4', 2, '2023-11-20 10:00:00', 0);
  191. INSERT INTO leave_info VALUES (5, '请假信息5', 3, '2023-11-21 10:00:00', 0);
  192. INSERT INTO leave_info VALUES (6, '没啥事我就是想给管理员聊天', 2, '2023-11-22 17:18:23', 0);
  193. INSERT INTO leave_info VALUES (7, '没啥事我就是想给管理员聊天凄凄切切', 2, '2023-11-22 23:29:35', 0);

  194. -- Table structure for system_info

  195. DROP TABLE IF EXISTS system_info;
  196. CREATE TABLE system_info (
  197. id int(0) NOT NULL AUTO_INCREMENT,
  198. title varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  199. content varchar(400) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  200. create_time datetime(0) NOT NULL,
  201. update_time datetime(0) NOT NULL,
  202. admin_id int(0) NOT NULL,
  203. PRIMARY KEY (id) USING BTREE,
  204. INDEX admin_id(admin_id) USING BTREE,
  205. CONSTRAINT system_info_ibfk_1 FOREIGN KEY (admin_id) REFERENCES admin (id) ON DELETE RESTRICT ON UPDATE RESTRICT
  206. ) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

  207. -- Records of system_info

  208. INSERT INTO system_info VALUES (1, '系统消息1', '系统消息1的内容', '2023-11-17 10:00:00', '2023-11-17 10:00:00', 1);
  209. INSERT INTO system_info VALUES (2, '系统消息2', '系统消息2的内容', '2023-11-18 10:00:00', '2023-11-18 10:00:00', 2);
  210. INSERT INTO system_info VALUES (3, '系统消息3', '系统消息3的内容', '2023-11-19 10:00:00', '2023-11-19 10:00:00', 3);
  211. INSERT INTO system_info VALUES (4, '系统消息4', '系统消息4的内容', '2023-11-20 10:00:00', '2023-11-20 10:00:00', 4);
  212. INSERT INTO system_info VALUES (5, '系统消息5', '系统消息5的内容', '2023-11-21 10:00:00', '2023-11-21 10:00:00', 5);

  213. -- Table structure for user

  214. DROP TABLE IF EXISTS user;
  215. CREATE TABLE user (
  216. id int(0) NOT NULL AUTO_INCREMENT,
  217. name varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  218. password varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  219. photo varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  220. phone char(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  221. email varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  222. create_time datetime(0) NOT NULL,
  223. update_time datetime(0) NOT NULL,
  224. state tinyint(0) NOT NULL,
  225. gender varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  226. PRIMARY KEY (id) USING BTREE,
  227. UNIQUE INDEX email(email) USING BTREE,
  228. UNIQUE INDEX phone(phone) USING BTREE
  229. ) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

  230. -- Records of user

  231. INSERT INTO user VALUES (1, '李四一', '508df4cb2f4d8f80519256258cfb975f', 'https://bigeventmy.oss-cn-chengdu.aliyuncs.com/aeecda3f-fcb0-4011-a3dd-5efdcbedebcd.jpg', '17828029118', '3191069@qq.com', '2023-11-17 10:00:00', '2023-11-25 21:49:25', 1, '男');
  232. INSERT INTO user VALUES (2, '用户二', 'e10adc3949ba59abbe56e057f20f883e', 'https://bigeventmy.oss-cn-chengdu.aliyuncs.com/aeecda3f-fcb0-4011-a3dd-5efdcbedebcd.jpg', '17828029112', 'user2@example.com', '2023-11-18 10:00:00', '2023-11-24 16:50:06', 1, '男');
  233. INSERT INTO user VALUES (3, '用户3', 'e10adc3949ba59abbe56e057f20f883e', 'https://bigeventmy.oss-cn-chengdu.aliyuncs.com/aeecda3f-fcb0-4011-a3dd-5efdcbedebcd.jpg', '12345678903', 'user3@example.com', '2023-11-19 10:00:00', '2023-11-19 10:00:00', 1, '男');
  234. INSERT INTO user VALUES (4, '用户4', 'e10adc3949ba59abbe56e057f20f883e', 'https://bigeventmy.oss-cn-chengdu.aliyuncs.com/aeecda3f-fcb0-4011-a3dd-5efdcbedebcd.jpg', '12345678904', 'user4@example.com', '2023-11-20 10:00:00', '2023-11-20 10:00:00', 1, '女');
  235. INSERT INTO user VALUES (5, '用户5', 'e10adc3949ba59abbe56e057f20f883e', 'https://bigeventmy.oss-cn-chengdu.aliyuncs.com/aeecda3f-fcb0-4011-a3dd-5efdcbedebcd.jpg', '12345678905', 'user5@example.com', '2023-11-21 10:00:00', '2023-11-21 10:00:00', 1, '男');
  236. INSERT INTO user VALUES (6, '张三', 'e10adc3949ba59abbe56e057f20f883e', 'https://bigeventmy.oss-cn-chengdu.aliyuncs.com/aeecda3f-fcb0-4011-a3dd-5efdcbedebcd.jpg', '13568920777', '2326403483@qq.com', '2023-11-20 20:06:24', '2023-11-20 20:06:24', 1, '男');
  237. INSERT INTO user VALUES (7, '张三', 'e10adc3949ba59abbe56e057f20f883e', 'https://bigeventmy.oss-cn-chengdu.aliyuncs.com/aeecda3f-fcb0-4011-a3dd-5efdcbedebcd.jpg', NULL, '2326403480@qq.com', '2023-11-22 22:57:08', '2023-11-22 22:57:08', 1, '男');

  238. -- Table structure for user_activity

  239. DROP TABLE IF EXISTS user_activity;
  240. CREATE TABLE user_activity (
  241. id int(0) NOT NULL AUTO_INCREMENT,
  242. user_id int(0) NOT NULL,
  243. activity_id int(0) NOT NULL,
  244. PRIMARY KEY (id) USING BTREE,
  245. INDEX user_id(user_id) USING BTREE,
  246. INDEX activity_id(activity_id) USING BTREE,
  247. CONSTRAINT user_activity_ibfk_1 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE RESTRICT ON UPDATE RESTRICT,
  248. CONSTRAINT user_activity_ibfk_2 FOREIGN KEY (activity_id) REFERENCES activity (id) ON DELETE RESTRICT ON UPDATE RESTRICT
  249. ) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

  250. -- Records of user_activity

  251. INSERT INTO user_activity VALUES (1, 1, 1);
  252. INSERT INTO user_activity VALUES (2, 2, 2);
  253. INSERT INTO user_activity VALUES (4, 4, 4);
  254. INSERT INTO user_activity VALUES (5, 5, 5);
  255. INSERT INTO user_activity VALUES (7, 2, 1);
  256. INSERT INTO user_activity VALUES (8, 3, 3);

  257. -- Table structure for user_club

  258. DROP TABLE IF EXISTS user_club;
  259. CREATE TABLE user_club (
  260. id int(0) NOT NULL AUTO_INCREMENT,
  261. user_id int(0) NOT NULL,
  262. club_id int(0) NOT NULL,
  263. role tinyint(0) NOT NULL,
  264. join_time datetime(0) NOT NULL,
  265. PRIMARY KEY (id) USING BTREE,
  266. INDEX user_id(user_id) USING BTREE,
  267. INDEX club_id(club_id) USING BTREE,
  268. CONSTRAINT user_club_ibfk_1 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE RESTRICT ON UPDATE RESTRICT,
  269. CONSTRAINT user_club_ibfk_2 FOREIGN KEY (club_id) REFERENCES club (id) ON DELETE RESTRICT ON UPDATE RESTRICT
  270. ) ENGINE = InnoDB AUTO_INCREMENT = 20 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

  271. -- Records of user_club

  272. INSERT INTO user_club VALUES (1, 1, 1, 1, '2023-11-17 10:00:00');
  273. INSERT INTO user_club VALUES (2, 2, 2, 1, '2023-11-18 10:00:00');
  274. INSERT INTO user_club VALUES (3, 3, 3, 1, '2023-11-19 10:00:00');
  275. INSERT INTO user_club VALUES (4, 4, 4, 1, '2023-11-20 10:00:00');
  276. INSERT INTO user_club VALUES (5, 5, 5, 1, '2023-11-21 10:00:00');
  277. INSERT INTO user_club VALUES (10, 7, 9, 0, '2023-11-25 22:50:43');
  278. INSERT INTO user_club VALUES (19, 6, 9, 1, '2023-11-26 18:03:24');
  279. SET FOREIGN_KEY_CHECKS = 1;

本文转载自: https://blog.csdn.net/m0_62432046/article/details/139127325
版权归原作者 LinZhiWei6s 所有, 如有侵权,请联系我们删除。

“社团管理系统数据库设计及sql代码”的评论:

还没有评论