swagger文档优化,数据库文档优化
This commit is contained in:
@@ -1,58 +1,66 @@
|
||||
package com.zyplayer.doc.manage.web.manage;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.security.web.WebAttributes;
|
||||
import org.springframework.security.web.savedrequest.HttpSessionRequestCache;
|
||||
import org.springframework.security.web.savedrequest.RequestCache;
|
||||
import org.springframework.security.web.savedrequest.SavedRequest;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||
|
||||
@RestController
|
||||
public class LoginController {
|
||||
private RequestCache requestCache = new HttpSessionRequestCache();
|
||||
|
||||
@GetMapping(value = "/login")
|
||||
public ModelAndView loginPage(HttpServletRequest request) {
|
||||
return new ModelAndView("/statics/manage/login.html");
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果是访问受限页面后,跳转到登录页的,则在targetUrl保存之前受限页面的路径,供页面调用
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/login/success")
|
||||
public DocResponseJson<String> loginSuccess(HttpServletRequest request, HttpServletResponse response) {
|
||||
SavedRequest savedRequest = requestCache.getRequest(request, response);
|
||||
String targetUrl = null;
|
||||
if (savedRequest != null) {
|
||||
targetUrl = savedRequest.getRedirectUrl();
|
||||
}
|
||||
if (StringUtils.isBlank(targetUrl)) {
|
||||
targetUrl = "/";
|
||||
}
|
||||
return DocResponseJson.ok(targetUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取异常信息返回给页面
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/login/failure")
|
||||
public DocResponseJson<String> loginFailure(HttpServletRequest request, HttpServletResponse response) {
|
||||
AuthenticationException ae = (AuthenticationException) request.getSession().getAttribute(WebAttributes.AUTHENTICATION_EXCEPTION);
|
||||
return DocResponseJson.warn(ae.getMessage());
|
||||
}
|
||||
package com.zyplayer.doc.manage.web.manage;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.security.web.WebAttributes;
|
||||
import org.springframework.security.web.savedrequest.HttpSessionRequestCache;
|
||||
import org.springframework.security.web.savedrequest.RequestCache;
|
||||
import org.springframework.security.web.savedrequest.SavedRequest;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||
|
||||
@RestController
|
||||
public class LoginController {
|
||||
private RequestCache requestCache = new HttpSessionRequestCache();
|
||||
|
||||
@GetMapping(value = "/login")
|
||||
public ModelAndView loginPage(HttpServletRequest request) {
|
||||
return new ModelAndView("/statics/manage/login.html");
|
||||
}
|
||||
|
||||
// @PostMapping(value = "/logout")
|
||||
// public DocResponseJson<Object> logout(HttpServletRequest request) {
|
||||
//
|
||||
// return DocResponseJson.ok();
|
||||
// }
|
||||
|
||||
/**
|
||||
* 如果是访问受限页面后,跳转到登录页的,则在targetUrl保存之前受限页面的路径,供页面调用
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/login/success")
|
||||
public DocResponseJson<String> loginSuccess(HttpServletRequest request, HttpServletResponse response) {
|
||||
SavedRequest savedRequest = requestCache.getRequest(request, response);
|
||||
String targetUrl = null;
|
||||
if (savedRequest != null) {
|
||||
targetUrl = savedRequest.getRedirectUrl();
|
||||
}
|
||||
if (StringUtils.isBlank(targetUrl)) {
|
||||
targetUrl = "/";
|
||||
}
|
||||
return DocResponseJson.ok(targetUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取异常信息返回给页面
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/login/failure")
|
||||
public DocResponseJson<String> loginFailure(HttpServletRequest request, HttpServletResponse response) {
|
||||
AuthenticationException ae = (AuthenticationException) request.getSession().getAttribute(WebAttributes.AUTHENTICATION_EXCEPTION);
|
||||
return DocResponseJson.warn(ae.getMessage());
|
||||
}
|
||||
}
|
||||
@@ -27,24 +27,24 @@ server:
|
||||
|
||||
zyplayer:
|
||||
doc:
|
||||
# zyplayer-doc-manage管理端的数据库配置
|
||||
# zyplayer_doc_manage管理端的数据库配置
|
||||
manage:
|
||||
datasource:
|
||||
driverClassName: com.mysql.jdbc.Driver
|
||||
url: jdbc:mysql://127.0.0.1:3306/zyplayer-doc-manage?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&useSSL=false
|
||||
url: jdbc:mysql://127.0.0.1:3306/zyplayer_doc_manage?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&useSSL=false
|
||||
username: root
|
||||
password: root
|
||||
# 数据库文档相关
|
||||
# 打开/zyplayer-doc-manage/doc-db.html即可看到这里配置的数据库的文档
|
||||
# 打开/zyplayer_doc_manage/doc-db.html即可看到这里配置的数据库的文档
|
||||
db:
|
||||
dbConfigList:
|
||||
- driverClassName: com.mysql.jdbc.Driver
|
||||
url: jdbc:mysql://127.0.0.1:3306/zyplayer-doc-manage?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&useSSL=false
|
||||
url: jdbc:mysql://127.0.0.1:3306/zyplayer_doc_manage?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&useSSL=false
|
||||
username: root
|
||||
password: root
|
||||
# 多个数据源直接这样累加
|
||||
# - driverClassName: com.mysql.jdbc.Driver
|
||||
# url: jdbc:mysql://127.0.0.1:3306/zyplayer-doc-manage?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&useSSL=false
|
||||
# url: jdbc:mysql://127.0.0.1:3306/zyplayer_doc_manage?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&useSSL=false
|
||||
# username: root
|
||||
# password: root
|
||||
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
Source Server Type : MySQL
|
||||
Source Server Version : 80012
|
||||
Source Host : localhost:3306
|
||||
Source Schema : zyplayer-doc-manage
|
||||
Source Schema : zyplayer_doc_manage
|
||||
|
||||
Target Server Type : MySQL
|
||||
Target Server Version : 80012
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 15/12/2018 22:34:43
|
||||
Date: 22/12/2018 22:58:00
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
@@ -25,11 +25,11 @@ CREATE TABLE `auth_info` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键自增ID',
|
||||
`auth_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '权限名',
|
||||
`auth_desc` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '权限说明',
|
||||
`can_edit` tinyint(4) NULL DEFAULT NULL COMMENT '是否可编辑 0=否 1=是',
|
||||
`can_edit` tinyint(4) NULL DEFAULT 1 COMMENT '是否可编辑 0=否 1=是',
|
||||
`create_uid` bigint(20) NULL DEFAULT NULL COMMENT '创建人用户ID',
|
||||
`creation_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '权限信息表' ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of auth_info
|
||||
@@ -53,19 +53,11 @@ CREATE TABLE `user_auth` (
|
||||
`creation_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
|
||||
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 28 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户权限表' ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of user_auth
|
||||
-- ----------------------------
|
||||
INSERT INTO `user_auth` VALUES (1, 1, 1, 1, 1, 1, '2018-12-01 11:41:13', '2018-12-15 22:19:59');
|
||||
INSERT INTO `user_auth` VALUES (2, 1, 2, 1, 1, 1, '2018-12-15 19:51:13', '2018-12-15 22:19:59');
|
||||
INSERT INTO `user_auth` VALUES (3, 1, 3, 1, 1, 1, '2018-12-15 19:51:28', '2018-12-15 22:19:59');
|
||||
INSERT INTO `user_auth` VALUES (4, 1, 4, 1, 1, 1, '2018-12-15 19:51:40', '2018-12-15 22:19:59');
|
||||
INSERT INTO `user_auth` VALUES (5, 1, 1, 1, NULL, 0, '2018-12-15 22:19:59', NULL);
|
||||
INSERT INTO `user_auth` VALUES (6, 1, 2, 1, NULL, 0, '2018-12-15 22:19:59', NULL);
|
||||
INSERT INTO `user_auth` VALUES (7, 1, 3, 1, NULL, 0, '2018-12-15 22:19:59', NULL);
|
||||
INSERT INTO `user_auth` VALUES (8, 1, 4, 1, NULL, 0, '2018-12-15 22:19:59', NULL);
|
||||
INSERT INTO `user_auth` VALUES (9, 2, 1, 1, NULL, 0, '2018-12-15 22:19:59', NULL);
|
||||
INSERT INTO `user_auth` VALUES (10, 2, 2, 1, NULL, 0, '2018-12-15 22:19:59', NULL);
|
||||
INSERT INTO `user_auth` VALUES (11, 2, 3, 1, NULL, 0, '2018-12-15 22:19:59', NULL);
|
||||
@@ -74,6 +66,10 @@ INSERT INTO `user_auth` VALUES (13, 3, 1, 1, NULL, 0, '2018-12-15 22:19:59', NUL
|
||||
INSERT INTO `user_auth` VALUES (14, 3, 2, 1, NULL, 0, '2018-12-15 22:19:59', NULL);
|
||||
INSERT INTO `user_auth` VALUES (15, 3, 3, 1, NULL, 0, '2018-12-15 22:19:59', NULL);
|
||||
INSERT INTO `user_auth` VALUES (16, 3, 4, 1, NULL, 0, '2018-12-15 22:19:59', NULL);
|
||||
INSERT INTO `user_auth` VALUES (24, 1, 1, 1, NULL, 0, '2018-12-16 21:41:01', NULL);
|
||||
INSERT INTO `user_auth` VALUES (25, 1, 2, 1, NULL, 0, '2018-12-16 21:41:01', NULL);
|
||||
INSERT INTO `user_auth` VALUES (26, 1, 3, 1, NULL, 0, '2018-12-16 21:41:01', NULL);
|
||||
INSERT INTO `user_auth` VALUES (27, 1, 4, 1, NULL, 0, '2018-12-16 21:41:01', NULL);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for user_info
|
||||
@@ -92,7 +88,7 @@ CREATE TABLE `user_info` (
|
||||
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE INDEX `idx_userNo`(`user_no`) USING BTREE COMMENT '登录用户名'
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户信息表' ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of user_info
|
||||
@@ -106,17 +102,16 @@ INSERT INTO `user_info` VALUES (3, '2', NULL, '11', '11', NULL, 0, '2018-12-15 2
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `zyplayer_storage`;
|
||||
CREATE TABLE `zyplayer_storage` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`doc_key` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`doc_value` varchar(2048) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`creation_time` datetime(0) NULL DEFAULT NULL,
|
||||
`update_time` datetime(0) NULL DEFAULT NULL,
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键自增ID',
|
||||
`doc_key` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '参数名字',
|
||||
`doc_value` varchar(2048) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '参数值',
|
||||
`creation_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
|
||||
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE INDEX `key`(`doc_key`) USING BTREE COMMENT 'key唯一索引'
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 20 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 27 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '存储网页上相关的数据' ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of zyplayer_storage
|
||||
-- ----------------------------
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
@@ -47,6 +47,13 @@
|
||||
<li><a target="_blank" href="../../swagger-ui.html"><i class="icon-window"></i> springfox-swagger-ui</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#"><i class="icon icon-window-alt"></i> 信息管理</a>
|
||||
<ul>
|
||||
<li><a href="#" class="page-nav" data-id="operation-log" data-href="./user/operation-log.html" data-icon="icon-check-board" data-reload="1"><i class="icon-check-board"></i> 操作日志</a></li>
|
||||
<li><a href="#" class="user-signout"><i class="icon-signout"></i> 退出登录</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -115,6 +122,14 @@
|
||||
$("#showLeftContent").hide();
|
||||
changeContentWidth(360);
|
||||
});
|
||||
/**
|
||||
* 退出登录
|
||||
*/
|
||||
$(".user-signout").click(function () {
|
||||
post(ctx + "logout", {}, function () {}, function () {}, function () {
|
||||
location.reload();
|
||||
});
|
||||
});
|
||||
/**
|
||||
* 页面导航切换
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<!doctype html>
|
||||
<html xmlns:v-on="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>操作日志</title>
|
||||
<link rel="stylesheet" type="text/css" href="../../lib/zui/css/zui.min.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app">
|
||||
操作日志,暂未开发
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<script src="../../lib/jquery/jquery-3.1.0.min.js"></script>
|
||||
<script src="../../lib/zui/js/zui.min.js"></script>
|
||||
<script src="../../lib/vue/vue.js"></script>
|
||||
<script src="../../lib/mg/js/common.js"></script>
|
||||
<script src="../../lib/mg/js/toast.js"></script>
|
||||
|
||||
<script>
|
||||
var app = new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
},
|
||||
mounted: function(){
|
||||
},
|
||||
methods: {
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
body{padding: 10px;}
|
||||
</style>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user