数据表完善

This commit is contained in:
筱锋xiao_lfeng 2024-01-01 14:52:00 +08:00
parent dd329ec53b
commit 60a3ccd29d
No known key found for this signature in database
GPG Key ID: F693AA12AABBFA87
21 changed files with 920 additions and 22 deletions

View File

@ -4,7 +4,7 @@
## 功能简介
<img src="https://i-cdn.akass.cn/2023/12/658eca572c274.png!wp60" alt="638d793b19a56b406d31b7f333371991" style="zoom: 45%;" />
![](https://i-cdn.akass.cn/2023/12/6590ef4dc968c.png!wp60)
> 该系统由四个核心组成部分构成:登录模块、功能模块、数据交换、页面展示
> 登录部件:确保用户安全接入系统
@ -14,11 +14,41 @@
本项目旨在构建一款综合性系统,通过四个核心部分的协同工作,实现政府、企业、社区与大学生之间的信息共享与合作。通过该系统,大学生可以更便捷地参与各类社会活动,获得创新创业机会,完成行业培训,参与社会实践和公益活动。同时,各社会组织也能更轻松地找到合适的大学生资源,促进双向合作,打破信息壁垒,实现资源的共享和优化。通过数据交换保障信息的高效安全传输,通过优化界面展示提高用户体验,本项目旨在为大学生和社会组织提供一个便捷、高效、安全的合作平台。
### 概要描述
本系统服务的客户群体涵盖学生、老师、企业、政府相关部门以及各类机构。系统功能主要以双向参与为特点,为学生提供多方位支持。对政府而言,系统可用于社会实践和义工服务,帮助招募志愿者,并推送文章和政策解读以培养青年思想。对企业,系统支持创新创业合作,提供悬赏解决方案,申请孵化和资金支持,以及进行行业培训和职业发展。生态环保与可持续发展方面,企业可发布成果并征求解决方案。系统还服务社区,支持公益活动和各类文艺活动。其他主体如医疗结构和培训机构可通过平台宣讲知识、技能并发布相关服务。系统的多功能性旨在促进各方合作、交流与发展。
### 特点描述
本系统的显著特点在于其多功能性和双向参与机制。首先,系统通过覆盖学生、老师、企业、政府和各类机构等广泛客户群体,构建了一个全方位的服务平台。其次,系统支持政府举办社会实践和义工服务活动,同时提供文章推送和政策解读,以培养青年思想,将个人发展与国家命运紧密联系。对企业而言,系统不仅提供创新创业合作平台,还支持行业培训和职业发展,促使学生更好地理解实际岗位需求。生态环保与可持续发展方面,企业可以在平台上发布成果并吸引学生参与创新思考。此外,系统服务社区,鼓励学生参与公益和文艺活动,强化社区凝聚力。最后,系统还对其他主体如医疗结构和培训机构提供宣讲知识、技能的机会,实现全方位的社会资源对接。这一综合性的特点使得系统成为一个有力的创新与合作平台,为各方搭建交流桥梁,推动社会各领域的共同发展。
### 架构说明
> 根据提供功能模块叙述,将上述模块进行划分,可主要划分为如下模块
- 招募模块
- 文章模块
- 题解模块
- 孵化模块
- 交友模块
- 活动模块
- 服务模块
- 交易模块
![](https://i-cdn.akass.cn/2023/12/659022ba205f2.jpg!wp60)
## 数据库架构
## 数据库架构设计
### 数据表组织
![exported_from_idea](https://i-cdn.akass.cn/2024/01/65925b1189b20.jpg!wp60)
### 数据表设计
```mysql
-- 用户数据表
-- srd_user
create table srd_user
(
@ -32,14 +62,14 @@ create table srd_user
verify tinyint(1) default 0 not null comment '用户是否校验',
password varchar(100) not null comment '密码',
old_password varchar(100) null comment '旧密码',
ram bigint unsigned null comment '所属用户(不为空则为子用户)',
created_at timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
updated_at timestamp null comment '信息修改时间',
ban tinyint(1) default 0 not null comment '是否被封禁',
permission json null comment '权限组',
contact_qq varchar(15) null comment 'qq号',
contact_wechat varchar(30) null comment '微信号',
contact_organization varchar(100) null comment '企业/组织/学校',
organization_type tinyint unsigned null comment '其他/学校/政府/企业/组织',
organization_list bigint unsigned not null comment '所属列表',
constraint srd_user_email_uindex
unique (email),
constraint srd_user_username_uindex
@ -48,14 +78,461 @@ create table srd_user
comment '用户数据表';
```
```mysql
-- RAM用户
-- srd_user_ram
create table srd_user_ram
(
id bigint unsigned auto_increment comment '主键'
primary key,
user_id bigint unsigned not null comment '主用户ID',
username varchar(40) not null comment '用户名',
nickname varchar(20) null comment '昵称',
email varchar(50) not null comment '邮箱',
tel_country_area int default 86 not null comment '电话国家区号',
tel varchar(20) not null comment '电话',
password varchar(100) not null comment '密码',
created_at timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
updated_at timestamp null comment '更新时间',
ban tinyint(1) default 0 not null comment '是否禁用',
permission json null comment '权限组',
contact_qq varchar(15) null comment '联系QQ',
contact_wechat varchar(30) null comment '联系微信',
constraint srd_user_ram_email_uindex
unique (email),
constraint srd_user_ram_username_uindex
unique (username),
constraint srd_user_ram_srd_user_id_fk
foreign key (user_id) references srd_user (id)
on delete cascade
);
```
```mysql
-- 用户Token
-- srd_user_token
create table srd_user_token
(
id bigint unsigned auto_increment comment '令牌主键'
primary key,
user_type tinyint(1) default 0 not null comment '用户类型',
user_id bigint unsigned not null comment '用户id',
token varchar(50) not null comment '令牌',
expired_at timestamp not null comment '过期时间',
created_at timestamp not null comment '创建时间',
ip varchar(45) null comment 'IP地址',
user_agent varchar(255) null comment '用户UA'
)
comment '用户Token';
```
```mysql
-- 学校类型
-- srd_resources_school_type
create table srd_resources_school_type
(
id int unsigned auto_increment comment '学校类型主键'
primary key,
name varchar(100) not null comment '类型名字',
created_at timestamp not null comment '创建时间',
updated_at timestamp not null comment '修改时间'
)
comment '学校类型';
```
```mysql
-- 学校数据库
-- srd_resources_school
create table srd_resources_school
(
id bigint unsigned auto_increment comment '学校主键'
primary key,
name varchar(255) not null comment '学校名称',
type int unsigned null comment '学校类型',
locate_province varchar(255) not null comment '省份',
locate_city varchar(255) not null comment '城市',
locate_area varchar(255) not null comment '所在地区',
locate_lat double not null comment '所在纬度',
locate_lng double not null comment '所在经度',
created_at timestamp not null comment '创建时间',
updated_at timestamp not null comment '更新时间',
constraint srd_resources_school_srd_resources_school_type_id_fk
foreign key (type) references srd_resources_school_type (id)
on delete set null
)
comment '学校数据库';
```
```mysql
-- 企业类型
-- srd_resources_organization_type
create table srd_resources_organization_type
(
id int unsigned auto_increment comment '类型主键'
primary key,
name varchar(100) not null comment '类型名称',
created_at timestamp not null comment '创建时间',
updated_at timestamp not null comment '修改时间'
)
comment '企业类型';
```
```mysql
-- 企业列表
-- srd_resources_organization
create table srd_resources_organization
(
id bigint unsigned not null comment '企业主键'
primary key,
name varchar(255) not null comment '企业全名',
code_credit varchar(18) not null comment '统一社会信用代码',
code_agency varchar(10) null comment '组织机构代码',
type int unsigned null comment '企业类型',
company_created_at timestamp not null comment '营业期限(起始)',
company_updated_at timestamp not null comment '营业期限(结束)',
created_at timestamp not null comment '创建时间',
updated_at timestamp not null comment '修改时间',
constraint srd_resources_company_srd_resources_company_type_id_fk
foreign key (type) references srd_resources_organization_type (id)
on delete set null
)
comment '企业列表';
```
```mysql
-- 校验码
-- srd_verify_code
create table srd_verify_code
(
id bigint unsigned auto_increment comment '主键'
primary key,
type tinyint unsigned not null comment '类型0:邮箱1:手机)',
contact varchar(50) not null comment '联系方式',
code varchar(12) not null comment '校验码',
expired_at timestamp not null comment '过期时间',
created_at timestamp not null comment '创建时间'
)
comment '校验码';
```
```mysql
-- 分类
-- srd_classify
create table srd_classify
(
id int unsigned auto_increment comment '分类主键'
primary key,
name varchar(10) not null comment '分类名字',
created_at timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
updated_at timestamp null comment '更新时间'
)
comment '分类';
```
```mysql
-- 话题
-- srd_topic
create table srd_topic
(
id bigint unsigned auto_increment comment '主键'
primary key,
user_id bigint unsigned null comment '话题创建人RAM用户创建以主用户为准',
name varchar(20) not null comment '话题名字',
created_at timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
updated_at timestamp null comment '修改时间',
constraint srd_topic_srd_user_id_fk
foreign key (user_id) references srd_user (id)
on delete set null
)
comment '话题';
```
```mysql
-- 文章
-- srd_article
create table srd_article
(
id bigint unsigned auto_increment comment '主键'
primary key,
user_type tinyint unsigned not null comment '普通/组织/RAM',
user_id bigint unsigned not null comment '用户主键',
title varchar(50) not null comment '文章标题',
classify json not null comment '文章类型',
topic bigint unsigned null comment '话题',
`desc` varchar(100) null comment '描述',
article longtext not null comment '文章正文',
state tinyint unsigned default '0' not null comment '状态',
created_at timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
updated_at timestamp null comment '更新时间',
deleted_at timestamp null comment '删除时间',
constraint srd_article_srd_topic_id_fk
foreign key (topic) references srd_topic (id)
on delete set null
)
comment '文章';
```
```mysql
-- 评论
-- srd_comment
create table srd_comment
(
id bigint unsigned auto_increment comment '组件'
primary key,
comment_type int unsigned not null comment '评论类别',
comment_id bigint unsigned not null comment '对应评论类别的主键',
user_type tinyint(1) not null comment '用户类型',
user_id bigint unsigned not null comment '用户主键',
comment text not null comment '评论',
replay bigint unsigned null comment '回复',
created_at timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
updated_at timestamp null comment '修改时间',
constraint srd_comment_srd_comment_id_fk
foreign key (replay) references srd_comment (id)
on delete cascade
)
comment '评论';
```
```mysql
-- 招募类型
-- srd_recruit_type
create table srd_recruit_type
(
id int unsigned auto_increment comment '主键'
primary key,
user_id bigint unsigned null comment '词条创建者',
name varchar(20) not null comment '词条名字',
created_at timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
updated_at timestamp null comment '修改时间',
constraint srd_recruit_type_srd_user_id_fk
foreign key (user_id) references srd_user (id)
on delete set null
)
comment '招募类型';
```
```mysql
-- 招募
-- srd_recruit
create table srd_recruit
(
id bigint unsigned auto_increment comment '组件'
primary key,
user_type tinyint(1) not null comment '用户类型',
user_id bigint unsigned not null comment '用户主键',
title varchar(50) not null comment '招募标题',
type int unsigned null comment '招募类型',
classify json null comment '分类',
`desc` longtext not null comment '招募描述',
number int default 1 not null comment '招募人数',
recruited json null comment '已招入用户',
price_type tinyint(1) default 0 not null comment '是否有金额',
price_start int not null comment '起始价格',
price_end int not null comment '结束价格',
created_at timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
updated_at timestamp null comment '修改时间',
constraint srd_recruit_srd_recruit_type_id_fk
foreign key (type) references srd_recruit_type (id)
on delete set null
)
comment '招募';
```
```mysql
-- 项目孵化
-- srd_incubation
create table srd_incubation
(
id bigint unsigned auto_increment comment '主键'
primary key,
user_id bigint unsigned not null comment '用户主键',
name varchar(50) not null comment '项目名称',
type int unsigned not null comment '类别',
`desc` longtext not null comment '详细描述',
state tinyint default 0 not null comment '当前状态',
company bigint unsigned null comment '签约企业',
contract text null comment '签约合同',
mooney int null comment '经济',
created_at timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
updated_at timestamp null comment '修改时间',
signing_at timestamp null comment '签名时间',
constraint srd_incubation_srd_resources_organization_id_fk
foreign key (company) references srd_resources_organization (id),
constraint srd_incubation_srd_user_id_fk
foreign key (user_id) references srd_user (id)
)
comment '项目孵化';
```
```mysql
-- 交友
-- srd_user_friend
create table srd_user_friend
(
id bigint unsigned auto_increment comment '主键'
primary key,
user_id bigint unsigned not null comment '用户主键',
friend_id bigint unsigned not null comment '好友',
state tinyint(1) default 0 not null comment '对方是否同意',
created_at timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
updated_at timestamp null comment '修改时间',
constraint srd_user_friend_srd_user_id_fk
foreign key (user_id) references srd_user (id)
on delete cascade,
constraint srd_user_friend_srd_user_id_fk_2
foreign key (friend_id) references srd_user (id)
on delete cascade
)
comment '交友';
```
```mysql
-- 题解类型
-- srd_solve_problem_type
create table srd_solve_problem_type
(
id int unsigned auto_increment
primary key,
name varchar(20) not null comment '类型名字',
`desc` varchar(255) null comment '类型描述',
created_at timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
updated_at timestamp null comment '修改时间'
)
comment '题解类型';
```
```mysql
-- 题解模块
-- srd_solve_problem
create table srd_solve_problem
(
id bigint unsigned auto_increment comment '组件'
primary key,
user_id bigint unsigned not null comment '用户主键',
title varchar(50) not null comment '题解标题',
type int unsigned null comment '题解类型',
`desc` longtext not null comment '题解描述',
money double default 0 not null comment '题解金额',
solve_by bigint unsigned null comment '解决用户',
created_at timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
updated_at timestamp null comment '修改时间',
solved_at timestamp null comment '解决时间',
constraint srd_solve_problem_srd_solve_problem_type_id_fk
foreign key (type) references srd_solve_problem_type (id)
on delete set null,
constraint srd_solve_problem_srd_user_id_fk
foreign key (solve_by) references srd_user (id),
constraint srd_solve_problem_srd_user_id_fk_2
foreign key (user_id) references srd_user (id)
)
comment '题解模块';
```
```mysql
-- 交流
-- srd_talk
create table srd_talk
(
id bigint unsigned auto_increment
primary key,
user_id bigint unsigned not null comment '用户主键',
topic bigint unsigned null comment '话题',
talk mediumtext not null comment '聊天',
replay bigint unsigned null comment '回复',
created_at timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
constraint srd_talk_srd_talk_id_fk
foreign key (replay) references srd_talk (id)
on delete set null,
constraint srd_talk_srd_topic_id_fk
foreign key (topic) references srd_topic (id)
on delete set null,
constraint srd_talk_srd_user_id_fk
foreign key (user_id) references srd_user (id)
on delete cascade
)
comment '交流';
```
## 用户模块
> 用户模块分级示意图
## 整体架构
> 整体架构图如下图所示
![](https://i-cdn.akass.cn/2023/12/6590ffb4c722e.jpg)
## 用户整体架构设计
> 用户架构分配图(区分用户区别)
![用户分级](https://i-cdn.akass.cn/2023/12/658fa3b9f2441.jpg)
### 说明
1. 自主注册与非自主注册用户主要区别在于是否在网站上注册(另外,注册
1. 自主注册与非自主注册用户主要区别在于是否在网站上注册
2. 用户注册需要进行用户激活校验,需要用户进行邮件内容校验
3. 用户操作较为敏感的信息,需要进行邮箱校验码进行验证,验证通过后允许操作
4. RAM用户的权限不应该超过普通用户所具有的权限另外管理员用户不允许有RAM用户的权限
5. 普通用户进行权限组切换的时候需要检查名下所有RAM用户若存在RAM用户需要进行移除`切换权限组时候不允许存在RAM用户`
### 用户授权
> 用户授权采用授权 token 的形式进行授权,在用户执行登陆或注册的时候执行生成 token 并且校验所生成的 token 是否重复(务必保证生成的 token 在数据表中处于唯一状态)
Token令牌对应格式`(补)(Timestamp)-^[0-9A-Za-z-_]{20}$-^[0-9]{14}$`
其中 `(补)` 对应时间戳timestamp位数不为14的情况下
`(timestamp)` 为时间戳函数,截至目前时间戳位数处于 13 位
令牌总计字节一共 **50**
用户进行登陆和注册的时候,在操作执行完毕之后进行 Token 创建并且绑定给用户表,还需要将用户的 ip 地址和 userAgent 信息上传到数据库,以确保 token 的有效性。请注意由于目前互联网环境用户很可能在访问网站的时候出现很多个IP进行访问对于跨地域时候尤其明显。所以进行 token 校验时候需要仅需检查 userAgent 是否一致即可,作出大致判断,无需详细检查\<UserAgent也可复制\>的。)
### 用户组别
![](https://i-cdn.akass.cn/2023/12/6590272384eb8.jpg!wp60)
对于组织用户,除学校组织单独组织数据表,其余所有组织以 organization 数据表为准
## 组织用户架构设计
组织用户设计中允许一位主干进行账号注册操作即组织注册登记。主干账号登记后允许主干账号开设RAM子账号。RAM账号的开设不得多于100个账号不含100个
> 组织用户注册授权模式
![](https://i-cdn.akass.cn/2023/12/6590413a11ba5.jpg!wp60)
## 模块设计
### 文章模块
![](https://i-cdn.akass.cn/2023/12/6590499e6e880.jpg!wp60)
### 招募模块
![](https://i-cdn.akass.cn/2023/12/6590f5b00f6d9.jpg!wp60)
### 孵化模块
![](https://i-cdn.akass.cn/2023/12/6590f9163e267.jpg!wp60)
### 服务模块
> 服务模块为一大板块,其中包含了 `题解模块、活动模块、交友模块、推广模块等` 子模块
![](https://i-cdn.akass.cn/2023/12/6590fe79d2b13.jpg)

View File

@ -0,0 +1,69 @@
### 客户群体
- 学生
- 老师
- 企业
- 政府相关部门
- 各类机构
### 功能详述
> 本系统功能大多是双向的,即有学生参与;
>
> 针对不同主体的功能,会有重复
>
> 社会资源对接系统以下简称“平台”
#### 针对政府的相关功能
##### 社会实践和义工服务
- 政府举办各种活动需要一定的现场维护人员、活动组织人员等,企业可通过本平台发布信息招募志愿者,学生可报名参与
##### 文章推送和政策解读
- 政府可通过本平台推送最新政策形式,为新青年进行解读,培养青年与时俱进的思想,结合自身实际,将个人前途与国家命运联系起来
#### 针对企业的相关功能
##### 创新创业合作
- 企业结合自身发展中所遇到的科技问题,可在本平台上进行悬赏解决方案,吸引学生的兴趣和关注
- 学生如果有较好的创新项目,可向企业申请孵化和资金支持
- 学生可与优秀企业家、优秀校友进行联系,投递自己的项目,进行深入交流和实践
##### 行业培训和职业发展
- 大多学生仅仅通过学校是无法明晰自己的专业在未来的岗位是如何的,并且学校教授的专业知识技能与实际岗位要求的专业知识技能存在一定差异性,所以企业可组织行业培训、职业认识等活动来帮助学生来认识、参观相关的岗位
- 学生也可以自己申请参观企业,结合自身问题与企业面对面交流,对于扩展企业知名度、提升企业影响力具有很大作用
##### 生态环保与可持续发展
- 各类企业在响应国家节能减排政策时,可结合自身实际,在本平台发布自身成果,并征求新的节能减排解决方案,吸纳广大学生的创新思想
- 政府、企业可组织节能减排讲座来向学生宣讲
##### 企业文化和艺术活动
- 企业会组织年会、庆功会等活动,但是缺乏相关技能人才导致节目单一,针对这种情况,企业可发布招募,具有相关技能(如舞蹈唱歌)的学生可报名参加
#### 针对社区的相关功能
##### 公益活动
- 居委会等基层自治组织经常开展公益活动,来帮助老年人、残疾人等,学生可通过本平台报名参加
##### 社区活动
- 各类文艺活动,风土人情、民间风俗等
#### 针对其他主体的相关功能
##### 医疗结构
- 通过本平台,医疗机构可宣讲医学知识技能,如“防艾”、“急救措施”、“科学健身”等
##### 培训机构
- 考研、考公、各类专业就业班均可通过本平台发布机构相关服务,展示服务质量效果,吸引学生兴趣

View File

@ -0,0 +1,22 @@
-- 文章
-- srd_article
create table srd_article
(
id bigint unsigned auto_increment comment '主键'
primary key,
user_type tinyint unsigned not null comment '普通/组织/RAM',
user_id bigint unsigned not null comment '用户主键',
title varchar(50) not null comment '文章标题',
classify json not null comment '文章类型',
topic bigint unsigned null comment '话题',
`desc` varchar(100) null comment '描述',
article longtext not null comment '文章正文',
state tinyint unsigned default '0' not null comment '状态',
created_at timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
updated_at timestamp null comment '更新时间',
deleted_at timestamp null comment '删除时间',
constraint srd_article_srd_topic_id_fk
foreign key (topic) references srd_topic (id)
on delete set null
)
comment '文章';

View File

@ -0,0 +1,11 @@
-- 分类
-- srd_classify
create table srd_classify
(
id int unsigned auto_increment comment '分类主键'
primary key,
name varchar(10) not null comment '分类名字',
created_at timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
updated_at timestamp null comment '更新时间'
)
comment '分类';

View File

@ -0,0 +1,19 @@
-- 评论
-- srd_comment
create table srd_comment
(
id bigint unsigned auto_increment comment '组件'
primary key,
comment_type int unsigned not null comment '评论类别',
comment_id bigint unsigned not null comment '对应评论类别的主键',
user_type tinyint(1) not null comment '用户类型',
user_id bigint unsigned not null comment '用户主键',
comment text not null comment '评论',
replay bigint unsigned null comment '回复',
created_at timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
updated_at timestamp null comment '修改时间',
constraint srd_comment_srd_comment_id_fk
foreign key (replay) references srd_comment (id)
on delete cascade
)
comment '评论';

View File

@ -0,0 +1,23 @@
-- 项目孵化
-- srd_incubation
create table srd_incubation
(
id bigint unsigned auto_increment comment '主键'
primary key,
user_id bigint unsigned not null comment '用户主键',
name varchar(50) not null comment '项目名称',
type int unsigned not null comment '类别',
`desc` longtext not null comment '详细描述',
state tinyint default 0 not null comment '当前状态',
company bigint unsigned null comment '签约企业',
contract text null comment '签约合同',
mooney int null comment '经济',
created_at timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
updated_at timestamp null comment '修改时间',
signing_at timestamp null comment '签名时间',
constraint srd_incubation_srd_resources_organization_id_fk
foreign key (company) references srd_resources_organization (id),
constraint srd_incubation_srd_user_id_fk
foreign key (user_id) references srd_user (id)
)
comment '项目孵化';

View File

@ -0,0 +1,24 @@
-- 招募
-- srd_recruit
create table srd_recruit
(
id bigint unsigned auto_increment comment '组件'
primary key,
user_type tinyint(1) not null comment '用户类型',
user_id bigint unsigned not null comment '用户主键',
title varchar(50) not null comment '招募标题',
type int unsigned null comment '招募类型',
classify json null comment '分类',
`desc` longtext not null comment '招募描述',
number int default 1 not null comment '招募人数',
recruited json null comment '已招入用户',
price_type tinyint(1) default 0 not null comment '是否有金额',
price_start int not null comment '起始价格',
price_end int not null comment '结束价格',
created_at timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
updated_at timestamp null comment '修改时间',
constraint srd_recruit_srd_recruit_type_id_fk
foreign key (type) references srd_recruit_type (id)
on delete set null
)
comment '招募';

View File

@ -0,0 +1,15 @@
-- 招募类型
-- srd_recruit_type
create table srd_recruit_type
(
id int unsigned auto_increment comment '主键'
primary key,
user_id bigint unsigned null comment '词条创建者',
name varchar(20) not null comment '词条名字',
created_at timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
updated_at timestamp null comment '修改时间',
constraint srd_recruit_type_srd_user_id_fk
foreign key (user_id) references srd_user (id)
on delete set null
)
comment '招募类型';

View File

@ -0,0 +1,19 @@
-- 企业列表
-- srd_resources_organization
create table srd_resources_organization
(
id bigint unsigned not null comment '企业主键'
primary key,
name varchar(255) not null comment '企业全名',
code_credit varchar(18) not null comment '统一社会信用代码',
code_agency varchar(10) null comment '组织机构代码',
type int unsigned null comment '企业类型',
company_created_at timestamp not null comment '营业期限(起始)',
company_updated_at timestamp not null comment '营业期限(结束)',
created_at timestamp not null comment '创建时间',
updated_at timestamp not null comment '修改时间',
constraint srd_resources_company_srd_resources_company_type_id_fk
foreign key (type) references srd_resources_organization_type (id)
on delete set null
)
comment '企业列表';

View File

@ -0,0 +1,11 @@
-- 企业类型
-- srd_resources_organization_type
create table srd_resources_organization_type
(
id int unsigned auto_increment comment '类型主键'
primary key,
name varchar(100) not null comment '类型名称',
created_at timestamp not null comment '创建时间',
updated_at timestamp not null comment '修改时间'
)
comment '企业类型';

View File

@ -0,0 +1,20 @@
-- 学校数据库
-- srd_resources_school
create table srd_resources_school
(
id bigint unsigned auto_increment comment '学校主键'
primary key,
name varchar(255) not null comment '学校名称',
type int unsigned null comment '学校类型',
locate_province varchar(255) not null comment '省份',
locate_city varchar(255) not null comment '城市',
locate_area varchar(255) not null comment '所在地区',
locate_lat double not null comment '所在纬度',
locate_lng double not null comment '所在经度',
created_at timestamp not null comment '创建时间',
updated_at timestamp not null comment '更新时间',
constraint srd_resources_school_srd_resources_school_type_id_fk
foreign key (type) references srd_resources_school_type (id)
on delete set null
)
comment '学校数据库';

View File

@ -0,0 +1,11 @@
-- 学校类型
-- srd_resources_school_type
create table srd_resources_school_type
(
id int unsigned auto_increment comment '学校类型主键'
primary key,
name varchar(100) not null comment '类型名字',
created_at timestamp not null comment '创建时间',
updated_at timestamp not null comment '修改时间'
)
comment '学校类型';

View File

@ -0,0 +1,25 @@
-- 题解模块
-- srd_solve_problem
create table srd_solve_problem
(
id bigint unsigned auto_increment comment '组件'
primary key,
user_id bigint unsigned not null comment '用户主键',
title varchar(50) not null comment '题解标题',
type int unsigned null comment '题解类型',
`desc` longtext not null comment '题解描述',
money double default 0 not null comment '题解金额',
solve_by bigint unsigned null comment '解决用户',
created_at timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
updated_at timestamp null comment '修改时间',
solved_at timestamp null comment '解决时间',
constraint srd_solve_problem_srd_solve_problem_type_id_fk
foreign key (type) references srd_solve_problem_type (id)
on delete set null,
constraint srd_solve_problem_srd_user_id_fk
foreign key (solve_by) references srd_user (id),
constraint srd_solve_problem_srd_user_id_fk_2
foreign key (user_id) references srd_user (id)
)
comment '题解模块';

View File

@ -0,0 +1,12 @@
-- 题解类型
-- srd_solve_problem_type
create table srd_solve_problem_type
(
id int unsigned auto_increment
primary key,
name varchar(20) not null comment '类型名字',
`desc` varchar(255) null comment '类型描述',
created_at timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
updated_at timestamp null comment '修改时间'
)
comment '题解类型';

23
mysql/table/srd_talk.sql Normal file
View File

@ -0,0 +1,23 @@
-- 交流
-- srd_talk
create table srd_talk
(
id bigint unsigned auto_increment
primary key,
user_id bigint unsigned not null comment '用户主键',
topic bigint unsigned null comment '话题',
talk mediumtext not null comment '聊天',
replay bigint unsigned null comment '回复',
created_at timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
constraint srd_talk_srd_talk_id_fk
foreign key (replay) references srd_talk (id)
on delete set null,
constraint srd_talk_srd_topic_id_fk
foreign key (topic) references srd_topic (id)
on delete set null,
constraint srd_talk_srd_user_id_fk
foreign key (user_id) references srd_user (id)
on delete cascade
)
comment '交流';

15
mysql/table/srd_topic.sql Normal file
View File

@ -0,0 +1,15 @@
-- 话题
-- srd_topic
create table srd_topic
(
id bigint unsigned auto_increment comment '主键'
primary key,
user_id bigint unsigned null comment '话题创建人RAM用户创建以主用户为准',
name varchar(20) not null comment '话题名字',
created_at timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
updated_at timestamp null comment '修改时间',
constraint srd_topic_srd_user_id_fk
foreign key (user_id) references srd_user (id)
on delete set null
)
comment '话题';

28
mysql/table/srd_user.sql Normal file
View File

@ -0,0 +1,28 @@
-- 用户数据表
-- srd_user
create table srd_user
(
id bigint unsigned auto_increment comment '用户主键'
primary key,
username varchar(40) not null comment '用户名',
nickname varchar(20) null comment '昵称',
email varchar(50) not null comment '邮箱',
tel_country_area int default 86 not null comment '电话所属国区',
tel varchar(20) not null comment '电话号码',
verify tinyint(1) default 0 not null comment '用户是否校验',
password varchar(100) not null comment '密码',
old_password varchar(100) null comment '旧密码',
created_at timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
updated_at timestamp null comment '信息修改时间',
ban tinyint(1) default 0 not null comment '是否被封禁',
permission json null comment '权限组',
contact_qq varchar(15) null comment 'qq号',
contact_wechat varchar(30) null comment '微信号',
organization_type tinyint unsigned null comment '其他/学校/政府/企业/组织',
organization_list bigint unsigned not null comment '所属列表',
constraint srd_user_email_uindex
unique (email),
constraint srd_user_username_uindex
unique (username)
)
comment '用户数据表';

View File

@ -0,0 +1,19 @@
-- 交友
-- srd_user_friend
create table srd_user_friend
(
id bigint unsigned auto_increment comment '主键'
primary key,
user_id bigint unsigned not null comment '用户主键',
friend_id bigint unsigned not null comment '好友',
state tinyint(1) default 0 not null comment '对方是否同意',
created_at timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
updated_at timestamp null comment '修改时间',
constraint srd_user_friend_srd_user_id_fk
foreign key (user_id) references srd_user (id)
on delete cascade,
constraint srd_user_friend_srd_user_id_fk_2
foreign key (friend_id) references srd_user (id)
on delete cascade
)
comment '交友';

View File

@ -0,0 +1,27 @@
-- RAM用户
-- srd_user_ram
create table srd_user_ram
(
id bigint unsigned auto_increment comment '主键'
primary key,
user_id bigint unsigned not null comment '主用户ID',
username varchar(40) not null comment '用户名',
nickname varchar(20) null comment '昵称',
email varchar(50) not null comment '邮箱',
tel_country_area int default 86 not null comment '电话国家区号',
tel varchar(20) not null comment '电话',
password varchar(100) not null comment '密码',
created_at timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
updated_at timestamp null comment '更新时间',
ban tinyint(1) default 0 not null comment '是否禁用',
permission json null comment '权限组',
contact_qq varchar(15) null comment '联系QQ',
contact_wechat varchar(30) null comment '联系微信',
constraint srd_user_ram_email_uindex
unique (email),
constraint srd_user_ram_username_uindex
unique (username),
constraint srd_user_ram_srd_user_id_fk
foreign key (user_id) references srd_user (id)
on delete cascade
);

View File

@ -0,0 +1,15 @@
-- 用户Token
-- srd_user_token
create table srd_user_token
(
id bigint unsigned auto_increment comment '令牌主键'
primary key,
user_type tinyint(1) default 0 not null comment '用户类型',
user_id bigint unsigned not null comment '用户id',
token varchar(50) not null comment '令牌',
expired_at timestamp not null comment '过期时间',
created_at timestamp not null comment '创建时间',
ip varchar(45) null comment 'IP地址',
user_agent varchar(255) null comment '用户UA'
)
comment '用户Token';

View File

@ -0,0 +1,13 @@
-- 校验码
-- srd_verify_code
create table srd_verify_code
(
id bigint unsigned auto_increment comment '主键'
primary key,
type tinyint unsigned not null comment '类型0:邮箱1:手机)',
contact varchar(50) not null comment '联系方式',
code varchar(12) not null comment '校验码',
expired_at timestamp not null comment '过期时间',
created_at timestamp not null comment '创建时间'
)
comment '校验码';