更新数据库,增加apifox实体json

This commit is contained in:
2025-10-06 16:19:35 +08:00
parent 1970865acb
commit a3e8687b31
20 changed files with 936 additions and 29 deletions

View File

@@ -0,0 +1,64 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "LoginDomain",
"description": "登录域对象",
"type": "object",
"properties": {
"user": {
"description": "用户信息",
"example": null
},
"userInfo": {
"description": "用户详细信息",
"example": null
},
"roles": {
"type": "array",
"description": "用户角色列表",
"items": {},
"example": []
},
"permissions": {
"type": "array",
"description": "用户权限列表",
"items": {},
"example": []
},
"menus": {
"type": "array",
"description": "用户菜单列表",
"items": {},
"example": []
},
"token": {
"type": "string",
"description": "JWT令牌",
"example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
},
"tokenExpireTime": {
"type": "string",
"format": "date-time",
"description": "令牌过期时间",
"example": "2025-10-06T16:00:00Z"
},
"loginTime": {
"type": "string",
"format": "date-time",
"description": "登录时间",
"example": "2025-10-05T16:00:00Z"
},
"ipAddress": {
"type": "string",
"format": "ipv4",
"description": "登录IP地址",
"example": "192.168.1.100"
},
"loginType": {
"type": "string",
"description": "登录类型",
"enum": ["email", "username", "phone", "wechat"],
"example": "username"
}
},
"required": ["token", "loginTime", "loginType"]
}

View File

@@ -0,0 +1,56 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "LoginParam",
"description": "登录参数",
"type": "object",
"properties": {
"email": {
"type": "string",
"format": "email",
"description": "邮箱",
"example": "user@example.com"
},
"username": {
"type": "string",
"description": "用户名",
"minLength": 1,
"maxLength": 50,
"example": "admin"
},
"phone": {
"type": "string",
"pattern": "^1[3-9]\\d{9}$",
"description": "手机号",
"example": "13800138000"
},
"wechatID": {
"type": "string",
"description": "微信ID",
"example": "wx_123456789"
},
"password": {
"type": "string",
"description": "密码",
"minLength": 6,
"maxLength": 20,
"example": "123456"
},
"captcha": {
"type": "string",
"description": "验证码",
"example": "1234"
},
"loginType": {
"type": "string",
"description": "登录类型",
"enum": ["email", "username", "phone", "wechat"],
"example": "username"
},
"rememberMe": {
"type": "boolean",
"description": "记住我",
"example": false
}
},
"required": ["password", "loginType"]
}

View File

@@ -0,0 +1,38 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "BaseDTO",
"description": "基础数据传输对象",
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "主键ID",
"example": "1234567890123456789"
},
"createTime": {
"type": "string",
"format": "date-time",
"description": "创建时间",
"example": "2025-10-05T16:00:00Z"
},
"updateTime": {
"type": "string",
"format": "date-time",
"description": "更新时间",
"example": "2025-10-05T16:30:00Z"
},
"deleteTime": {
"type": "string",
"format": "date-time",
"description": "删除时间",
"example": null
},
"deleted": {
"type": "boolean",
"description": "是否删除",
"default": false,
"example": false
}
},
"required": ["id", "createTime", "updateTime", "deleted"]
}

View File

@@ -0,0 +1,50 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "TbSysDept",
"description": "系统部门信息",
"type": "object",
"allOf": [
{
"$ref": "BaseDTO.json"
},
{
"type": "object",
"properties": {
"deptID": {
"type": "string",
"description": "部门ID",
"example": "1234567890123456789"
},
"parentID": {
"type": "string",
"description": "父部门ID",
"example": "1234567890123456789"
},
"name": {
"type": "string",
"description": "部门名称",
"minLength": 1,
"maxLength": 50,
"example": "技术部"
},
"description": {
"type": "string",
"description": "部门描述",
"maxLength": 200,
"example": "技术开发部门"
},
"creator": {
"type": "string",
"description": "创建人",
"example": "admin"
},
"updater": {
"type": "string",
"description": "更新人",
"example": "admin"
}
},
"required": ["deptID", "name"]
}
]
}

View File

@@ -0,0 +1,37 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "TbSysDeptRole",
"description": "部门角色关联信息",
"type": "object",
"allOf": [
{
"$ref": "BaseDTO.json"
},
{
"type": "object",
"properties": {
"deptID": {
"type": "string",
"description": "部门ID",
"example": "1234567890123456789"
},
"roleID": {
"type": "string",
"description": "角色ID",
"example": "1234567890123456789"
},
"creator": {
"type": "string",
"description": "创建人",
"example": "admin"
},
"updater": {
"type": "string",
"description": "更新人",
"example": "admin"
}
},
"required": ["deptID", "roleID"]
}
]
}

View File

@@ -0,0 +1,76 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "TbSysLoginLog",
"description": "系统登录日志信息",
"type": "object",
"allOf": [
{
"$ref": "BaseDTO.json"
},
{
"type": "object",
"properties": {
"userID": {
"type": "string",
"description": "用户ID",
"example": "1234567890123456789"
},
"username": {
"type": "string",
"description": "用户名",
"example": "admin"
},
"ipAddress": {
"type": "string",
"format": "ipv4",
"description": "登录IP地址",
"example": "192.168.1.100"
},
"ipSource": {
"type": "string",
"description": "IP来源",
"example": "北京市"
},
"browser": {
"type": "string",
"description": "浏览器类型",
"example": "Chrome"
},
"os": {
"type": "string",
"description": "操作系统",
"example": "Windows 10"
},
"password": {
"type": "string",
"description": "登录密码",
"example": "******"
},
"loginTime": {
"type": "string",
"format": "date-time",
"description": "登录时间",
"example": "2025-10-05T16:00:00Z"
},
"status": {
"type": "integer",
"description": "登录状态(0-失败,1-成功)",
"enum": [0, 1],
"example": 1
},
"errorCount": {
"type": "integer",
"description": "错误次数",
"minimum": 0,
"example": 0
},
"message": {
"type": "string",
"description": "登录消息",
"example": "登录成功"
}
},
"required": ["userID", "username", "ipAddress", "loginTime", "status"]
}
]
}

View File

@@ -0,0 +1,72 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "TbSysMenu",
"description": "系统菜单信息",
"type": "object",
"allOf": [
{
"$ref": "BaseDTO.json"
},
{
"type": "object",
"properties": {
"menuID": {
"type": "string",
"description": "菜单ID",
"example": "1234567890123456789"
},
"parentID": {
"type": "string",
"description": "父菜单ID",
"example": "1234567890123456789"
},
"name": {
"type": "string",
"description": "菜单名称",
"minLength": 1,
"maxLength": 50,
"example": "用户管理"
},
"description": {
"type": "string",
"description": "菜单描述",
"maxLength": 200,
"example": "用户管理菜单"
},
"url": {
"type": "string",
"description": "菜单URL",
"example": "/user/manage"
},
"icon": {
"type": "string",
"description": "菜单图标",
"example": "user"
},
"orderNum": {
"type": "integer",
"description": "菜单顺序",
"minimum": 0,
"example": 1
},
"type": {
"type": "integer",
"description": "菜单类型(0-目录,1-菜单,2-按钮)",
"enum": [0, 1, 2],
"example": 1
},
"creator": {
"type": "string",
"description": "创建人",
"example": "admin"
},
"updater": {
"type": "string",
"description": "更新人",
"example": "admin"
}
},
"required": ["menuID", "name", "type"]
}
]
}

View File

@@ -0,0 +1,37 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "TbSysMenuPermission",
"description": "菜单权限关联信息",
"type": "object",
"allOf": [
{
"$ref": "BaseDTO.json"
},
{
"type": "object",
"properties": {
"menuID": {
"type": "string",
"description": "菜单ID",
"example": "1234567890123456789"
},
"permissionID": {
"type": "string",
"description": "权限ID",
"example": "1234567890123456789"
},
"creator": {
"type": "string",
"description": "创建人",
"example": "admin"
},
"updater": {
"type": "string",
"description": "更新人",
"example": "admin"
}
},
"required": ["menuID", "permissionID"]
}
]
}

View File

@@ -0,0 +1,52 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "TbSysPermission",
"description": "系统权限信息",
"type": "object",
"allOf": [
{
"$ref": "BaseDTO.json"
},
{
"type": "object",
"properties": {
"permissionID": {
"type": "string",
"description": "权限ID",
"example": "1234567890123456789"
},
"name": {
"type": "string",
"description": "权限名称",
"minLength": 1,
"maxLength": 50,
"example": "用户管理"
},
"description": {
"type": "string",
"description": "权限描述",
"maxLength": 200,
"example": "用户管理权限"
},
"code": {
"type": "string",
"description": "权限编码",
"minLength": 1,
"maxLength": 50,
"example": "user:manage"
},
"creator": {
"type": "string",
"description": "创建人",
"example": "admin"
},
"updater": {
"type": "string",
"description": "更新人",
"example": "admin"
}
},
"required": ["permissionID", "name", "code"]
}
]
}

View File

@@ -0,0 +1,45 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "TbSysRole",
"description": "系统角色信息",
"type": "object",
"allOf": [
{
"$ref": "BaseDTO.json"
},
{
"type": "object",
"properties": {
"roleID": {
"type": "string",
"description": "角色ID",
"example": "1234567890123456789"
},
"name": {
"type": "string",
"description": "角色名称",
"minLength": 1,
"maxLength": 50,
"example": "管理员"
},
"description": {
"type": "string",
"description": "角色描述",
"maxLength": 200,
"example": "系统管理员角色"
},
"creator": {
"type": "string",
"description": "创建人",
"example": "admin"
},
"updater": {
"type": "string",
"description": "更新人",
"example": "admin"
}
},
"required": ["roleID", "name"]
}
]
}

View File

@@ -0,0 +1,37 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "TbSysRolePermission",
"description": "角色权限关联信息",
"type": "object",
"allOf": [
{
"$ref": "BaseDTO.json"
},
{
"type": "object",
"properties": {
"roleID": {
"type": "string",
"description": "角色ID",
"example": "1234567890123456789"
},
"permissionID": {
"type": "string",
"description": "权限ID",
"example": "1234567890123456789"
},
"creator": {
"type": "string",
"description": "创建人",
"example": "admin"
},
"updater": {
"type": "string",
"description": "更新人",
"example": "admin"
}
},
"required": ["roleID", "permissionID"]
}
]
}

View File

@@ -0,0 +1,54 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "TbSysUser",
"description": "系统用户信息",
"type": "object",
"allOf": [
{
"$ref": "BaseDTO.json"
},
{
"type": "object",
"properties": {
"username": {
"type": "string",
"description": "用户名",
"minLength": 1,
"maxLength": 50,
"example": "admin"
},
"password": {
"type": "string",
"description": "密码",
"minLength": 6,
"maxLength": 20,
"example": "123456"
},
"email": {
"type": "string",
"format": "email",
"description": "邮箱",
"example": "admin@example.com"
},
"phone": {
"type": "string",
"pattern": "^1[3-9]\\d{9}$",
"description": "手机号",
"example": "13800138000"
},
"wechatID": {
"type": "string",
"description": "微信号",
"example": "wx_123456789"
},
"status": {
"type": "integer",
"description": "用户状态",
"enum": [0, 1],
"example": 1
}
},
"required": ["username", "password", "email", "phone", "status"]
}
]
}

View File

@@ -0,0 +1,63 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "TbSysUserInfo",
"description": "用户详细信息",
"type": "object",
"allOf": [
{
"$ref": "BaseDTO.json"
},
{
"type": "object",
"properties": {
"userID": {
"type": "string",
"description": "用户ID",
"example": "1234567890123456789"
},
"avatar": {
"type": "string",
"description": "头像",
"example": "https://example.com/avatar.jpg"
},
"gender": {
"type": "integer",
"description": "性别(0-未知,1-女,2-男)",
"enum": [0, 1, 2],
"example": 1
},
"familyName": {
"type": "string",
"description": "姓",
"maxLength": 50,
"example": "张"
},
"givenName": {
"type": "string",
"description": "名",
"maxLength": 50,
"example": "三"
},
"fullName": {
"type": "string",
"description": "全名",
"maxLength": 100,
"example": "张三"
},
"idCard": {
"type": "string",
"description": "身份证号",
"pattern": "^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$",
"example": "110101199001011234"
},
"address": {
"type": "string",
"description": "地址",
"maxLength": 200,
"example": "北京市朝阳区"
}
},
"required": ["userID"]
}
]
}

View File

@@ -0,0 +1,37 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "TbSysUserRole",
"description": "用户角色关联信息",
"type": "object",
"allOf": [
{
"$ref": "BaseDTO.json"
},
{
"type": "object",
"properties": {
"userID": {
"type": "string",
"description": "用户ID",
"example": "1234567890123456789"
},
"roleID": {
"type": "string",
"description": "角色ID",
"example": "1234567890123456789"
},
"creator": {
"type": "string",
"description": "创建人",
"example": "admin"
},
"updater": {
"type": "string",
"description": "更新人",
"example": "admin"
}
},
"required": ["userID", "roleID"]
}
]
}

View File

@@ -0,0 +1,19 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "PageDomain",
"description": "分页数据实体类",
"type": "object",
"properties": {
"pageParam": {
"$ref": "PageParam.json",
"description": "分页参数"
},
"dataList": {
"type": "array",
"description": "数据列表",
"items": {},
"example": []
}
},
"required": ["pageParam", "dataList"]
}

View File

@@ -0,0 +1,36 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "PageParam",
"description": "分页参数",
"type": "object",
"properties": {
"pageNumber": {
"type": "integer",
"description": "当前页码",
"minimum": 1,
"default": 1,
"example": 1
},
"pageSize": {
"type": "integer",
"description": "每页显示数量",
"minimum": 1,
"maximum": 1000,
"default": 10,
"example": 10
},
"totalPages": {
"type": "integer",
"description": "总页数",
"minimum": 0,
"example": 5
},
"totalElements": {
"type": "integer",
"description": "总记录数",
"minimum": 0,
"example": 50
}
},
"required": ["pageNumber", "pageSize", "totalPages", "totalElements"]
}

View File

@@ -0,0 +1,99 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "ResultDomain",
"description": "统一返回结果实体类",
"type": "object",
"properties": {
"code": {
"type": "integer",
"description": "状态码",
"example": 200
},
"message": {
"type": "string",
"description": "返回消息",
"example": "操作成功"
},
"success": {
"type": "boolean",
"description": "操作是否成功",
"example": true
},
"login": {
"type": "boolean",
"description": "是否登录",
"example": true
},
"auth": {
"type": "boolean",
"description": "是否有权限",
"example": true
},
"data": {
"description": "返回数据",
"example": null
},
"dataList": {
"type": "array",
"description": "返回数据列表",
"items": {},
"example": []
},
"pageParam": {
"$ref": "#/definitions/PageParam",
"description": "分页参数"
},
"pageDomain": {
"$ref": "#/definitions/PageDomain",
"description": "分页信息"
}
},
"required": ["code", "message", "success", "login", "auth"],
"definitions": {
"PageParam": {
"type": "object",
"properties": {
"pageNumber": {
"type": "integer",
"description": "当前页码",
"minimum": 1,
"example": 1
},
"pageSize": {
"type": "integer",
"description": "每页显示数量",
"minimum": 1,
"example": 10
},
"totalPages": {
"type": "integer",
"description": "总页数",
"minimum": 0,
"example": 5
},
"totalElements": {
"type": "integer",
"description": "总记录数",
"minimum": 0,
"example": 50
}
},
"required": ["pageNumber", "pageSize", "totalPages", "totalElements"]
},
"PageDomain": {
"type": "object",
"properties": {
"pageParam": {
"$ref": "#/definitions/PageParam",
"description": "分页参数"
},
"dataList": {
"type": "array",
"description": "数据列表",
"items": {}
}
},
"required": ["pageParam", "dataList"]
}
}
}

View File

@@ -1,12 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
通用Log4j2配置模板
使用说明:
1. 复制此文件到各模块的 src/main/resources/ 目录下,重命名为 log4j2-spring.xml
2. 修改 FILE_NAME 属性为对应的模块名称
3. 在 application.yml 中添加:
logging:
config: classpath:log4j2-spring.xml
校园新闻管理系统 - 统一日志配置模板
-->
<configuration status="WARN" monitorInterval="30">
<!--日志级别以及优先级排序: OFF > FATAL > ERROR > WARN > INFO > DEBUG > TRACE > ALL -->
@@ -18,29 +12,32 @@
<property name="LOG_PATTERN" value="%date{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n" />
<!-- 定义日志存储的路径 -->
<property name="FILE_PATH" value="./logs" />
<!-- 修改为对应的模块名称auth/system/admin/news -->
<!-- 模块日志文件名 -->
<property name="FILE_NAME" value="school-news-MODULE_NAME" />
<!-- 设置系统属性 -->
<property name="file.encoding" value="UTF-8" />
<property name="console.encoding" value="UTF-8" />
</Properties>
<appenders>
<console name="Console" target="SYSTEM_OUT">
<!--输出日志的格式-->
<PatternLayout pattern="${LOG_PATTERN}"/>
<!--控制台输出level及其以上级别的信息onMatch其他的直接拒绝onMismatch-->
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
<PatternLayout pattern="${LOG_PATTERN}" charset="UTF-8"/>
<!--控制台输出debug及以上级别的信息-->
<ThresholdFilter level="debug" onMatch="ACCEPT" onMismatch="DENY"/>
</console>
<!--文件会打印出所有信息这个log每次运行程序会自动清空由append属性决定适合临时测试用-->
<File name="Filelog" fileName="${FILE_PATH}/${FILE_NAME}-test.log" append="false">
<PatternLayout pattern="${LOG_PATTERN}"/>
<PatternLayout pattern="${LOG_PATTERN}" charset="UTF-8"/>
</File>
<!-- 这个会打印出所有的info及以下级别的信息每次大小超过size则这size大小的日志会自动存入按年份-月份建立的文件夹下面并进行压缩,作为存档-->
<RollingFile name="RollingFileInfo" fileName="${FILE_PATH}/${FILE_NAME}-info.log" filePattern="${FILE_PATH}/${FILE_NAME}-INFO-%d{yyyy-MM-dd}_%i.log.gz">
<!--控制台只输出level及以上级别的信息onMatch其他的直接拒绝onMismatch-->
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
<PatternLayout pattern="${LOG_PATTERN}"/>
<PatternLayout pattern="${LOG_PATTERN}" charset="UTF-8"/>
<Policies>
<!--interval属性用来指定多久滚动一次默认是1 hour-->
<TimeBasedTriggeringPolicy interval="1"/>
@@ -54,7 +51,7 @@
<RollingFile name="RollingFileWarn" fileName="${FILE_PATH}/${FILE_NAME}-warn.log" filePattern="${FILE_PATH}/${FILE_NAME}-WARN-%d{yyyy-MM-dd}_%i.log.gz">
<!--控制台只输出level及以上级别的信息onMatch其他的直接拒绝onMismatch-->
<ThresholdFilter level="warn" onMatch="ACCEPT" onMismatch="DENY"/>
<PatternLayout pattern="${LOG_PATTERN}"/>
<PatternLayout pattern="${LOG_PATTERN}" charset="UTF-8"/>
<Policies>
<!--interval属性用来指定多久滚动一次默认是1 hour-->
<TimeBasedTriggeringPolicy interval="1"/>
@@ -68,7 +65,7 @@
<RollingFile name="RollingFileError" fileName="${FILE_PATH}/${FILE_NAME}-error.log" filePattern="${FILE_PATH}/${FILE_NAME}-ERROR-%d{yyyy-MM-dd}_%i.log.gz">
<!--控制台只输出level及以上级别的信息onMatch其他的直接拒绝onMismatch-->
<ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/>
<PatternLayout pattern="${LOG_PATTERN}"/>
<PatternLayout pattern="${LOG_PATTERN}" charset="UTF-8"/>
<Policies>
<!--interval属性用来指定多久滚动一次默认是1 hour-->
<TimeBasedTriggeringPolicy interval="1"/>
@@ -94,8 +91,35 @@
<AppenderRef ref="Console"/>
</Logger>
<!-- 项目包日志配置 -->
<Logger name="org.xyzh" level="debug" additivity="false">
<!-- 项目包日志配置 - Auth模块 -->
<Logger name="org.xyzh.auth" level="debug" additivity="false">
<AppenderRef ref="Console"/>
<AppenderRef ref="Filelog"/>
<AppenderRef ref="RollingFileInfo"/>
<AppenderRef ref="RollingFileWarn"/>
<AppenderRef ref="RollingFileError"/>
</Logger>
<!-- 项目包日志配置 - System模块 -->
<Logger name="org.xyzh.system" level="debug" additivity="false">
<AppenderRef ref="Console"/>
<AppenderRef ref="Filelog"/>
<AppenderRef ref="RollingFileInfo"/>
<AppenderRef ref="RollingFileWarn"/>
<AppenderRef ref="RollingFileError"/>
</Logger>
<!-- 项目包日志配置 - News模块 -->
<Logger name="org.xyzh.news" level="debug" additivity="false">
<AppenderRef ref="Console"/>
<AppenderRef ref="Filelog"/>
<AppenderRef ref="RollingFileInfo"/>
<AppenderRef ref="RollingFileWarn"/>
<AppenderRef ref="RollingFileError"/>
</Logger>
<!-- 项目包日志配置 - Common模块 -->
<Logger name="org.xyzh.common" level="debug" additivity="false">
<AppenderRef ref="Console"/>
<AppenderRef ref="Filelog"/>
<AppenderRef ref="RollingFileInfo"/>