Skip to content

Just add a few code comments , beautify the code style and update the README.md file #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
02e2e85
:art: style : add the code comment
GoogTech Aug 13, 2019
a973c4e
:art: style(mapper) : add the code comment
GoogTech Aug 14, 2019
b75a8c0
:art: style(beans) : add the code comment
GoogTech Aug 14, 2019
9b4fb4b
:art: style(service) : add the code comment
GoogTech Aug 14, 2019
078ca44
:art: style(pom.xml) : add the code comment
GoogTech Aug 14, 2019
9fe9fa8
:lipstick: style : update the favicon.ico
GoogTech Aug 14, 2019
bc46df6
:memo: docs : update the README.md
GoogTech Aug 15, 2019
2ebc414
:art: style(consts) : add the code comment
GoogTech Aug 15, 2019
e99add4
Merge branch 'master' of https://github.com/YUbuntu0109/springboot-shiro
GoogTech Aug 15, 2019
786de38
:art: style(entity) : add the code comment
GoogTech Aug 15, 2019
94fe664
:art: style(enums) : add the code comment
GoogTech Aug 15, 2019
5ccb2c5
:art: style(vo) : add the code comment
GoogTech Aug 15, 2019
a3c925a
:art: style(util) : add the code comment
GoogTech Aug 15, 2019
10c8255
:art: style(property) : add the code comment
GoogTech Aug 15, 2019
a3a2997
:art: style(config) : add the code comment
GoogTech Aug 15, 2019
a912273
:art: style(controller) : add the code comment
GoogTech Aug 15, 2019
a08d4a4
:art: style(core-framework-holder) : add the code comment
GoogTech Aug 16, 2019
cd5b99b
:art: style(core-plugin) : add the code comment
GoogTech Aug 16, 2019
a303ea7
:art: style(core-framework-object) : add the code comment
GoogTech Aug 16, 2019
2941dcc
:lipstick: style : update the user portrait
GoogTech Aug 16, 2019
1eaa619
:lipstick: style(index.ftl) : update the timeline
GoogTech Aug 16, 2019
0873475
:wrench: style(application.yml) : update the code comment
GoogTech Aug 17, 2019
9c648fd
:art: style(core-service) : add the code comment
GoogTech Aug 17, 2019
0fc999a
:camera_flash: update the project screenshot
GoogTech Oct 11, 2019
c67f3b1
:camera_flash: add a new project screenshot
GoogTech Oct 11, 2019
67713b0
:memo: docs : update the README.md
GoogTech Oct 11, 2019
affffcf
:lipstick: perf(zhyd.core.css) : beautify the navigation title style
GoogTech Oct 12, 2019
bf64a41
:memo: docs : update the README.md
GoogTech Oct 25, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
355 changes: 298 additions & 57 deletions README.md

Large diffs are not rendered by default.

Binary file added docs/img/admin-resource.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/img/admin-resource.png
Binary file not shown.
Binary file added docs/img/admin-role.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/img/admin-role.png
Binary file not shown.
Binary file added docs/img/admin-user.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/img/admin-user.png
Binary file not shown.
Binary file added docs/img/db-datasource.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/db-login.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/index.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/img/index.png
Binary file not shown.
Binary file added docs/img/login.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/role-role[admin].PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/root-resource.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/img/root-resource.png
Binary file not shown.
Binary file added docs/img/root-role-[root].PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/root-role.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/img/root-role.png
Binary file not shown.
Binary file removed docs/img/root-role[admin].png
Binary file not shown.
Binary file removed docs/img/root-role[root].png
Binary file not shown.
Binary file added docs/img/root-user.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/img/root-user.png
Binary file not shown.
Binary file added docs/img/root-user[role].PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/img/root-user[role].png
Binary file not shown.
11 changes: 9 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,22 @@
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<!-- 核心业务类模块:提供基本的数据操作、工具处理等 -->
<module>shiro-core</module>
<!-- 后台管理模块 -->
<module>shiro-admin</module>
</modules>

<name>shiro</name>
<description>Demo project for Spring Boot</description>
<description>A simpele authority management system</description>
<url>https://github.com/YUbuntu0109/springboot-shiro</url>

<!-- lookup parent from repository -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
<relativePath/>
</parent>

<properties>
Expand All @@ -38,11 +42,13 @@
</properties>

<dependencies>
<!-- Lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<!-- Test -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
Expand All @@ -55,4 +61,5 @@
<scope>test</scope>
</dependency>
</dependencies>

</project>
63 changes: 31 additions & 32 deletions shiro-admin/pom.xml
Original file line number Diff line number Diff line change
@@ -1,41 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<artifactId>shiro-admin</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<artifactId>shiro-admin</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>shiro-admin</name>
<description>Demo project for Spring Boot</description>
<name>shiro-admin</name>
<description>后台管理模块</description>

<parent>
<groupId>com.zyd.shiro</groupId>
<artifactId>shiro</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<parent>
<groupId>com.zyd.shiro</groupId>
<artifactId>shiro</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>

<dependencies>
<dependency>
<groupId>com.zyd.shiro</groupId>
<artifactId>shiro-core</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.zyd.shiro.ShiroAdminApplication</mainClass>
<layout>JAR</layout>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.zyd.shiro</groupId>
<artifactId>shiro-core</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.zyd.shiro.ShiroAdminApplication</mainClass>
<layout>JAR</layout>
</configuration>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,12 @@
import java.util.Map;

/**
* 重写BasicErrorController,主要负责系统的异常页面的处理以及错误信息的显示
* <p/>
* 此处指需要记录
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @date 2018/4/16 16:26
* <p/>
* 要注意,这个类里面的代码一定不能有异常或者潜在异常发生,否则可能会让程序陷入死循环。
* <p/>
* @since 1.0
* @project: springboot-shiro
* @description: 重写BasicErrorController, 主要负责系统的异常页面的处理以及错误信息的显示
* 注意: 这个类里面的代码一定不能有异常或者潜在异常发生,否则可能会让程序陷入死循环
* @date: 2019-08-15 7:42 PM
* @version: 1.0
* @website: https://yubuntu0109.github.io/
*/
@Slf4j
@Controller
Expand All @@ -64,16 +58,25 @@ public class ErrorPagesController implements ErrorController {
private ServerProperties serverProperties;

/**
* 初始化ExceptionController
*
* @param errorAttributes
* @description: 初始化ExceptionController
* @param: errorAttributes
* @date: 2019-08-15 8:10 PM
* @return:
*/
@Autowired
public ErrorPagesController(ErrorAttributes errorAttributes) {
Assert.notNull(errorAttributes, "ErrorAttributes must not be null");
this.errorAttributes = errorAttributes;
}

/**
* @description: 404:指网页或文件未找到错误
* @param: request
* @param: response
* @param: webRequest
* @date: 2019-08-15 8:10 PM
* @return: org.springframework.web.servlet.ModelAndView
*/
@RequestMapping("/404")
public ModelAndView errorHtml404(HttpServletRequest request, HttpServletResponse response, WebRequest webRequest) {
response.setStatus(HttpStatus.NOT_FOUND.value());
Expand All @@ -82,31 +85,63 @@ public ModelAndView errorHtml404(HttpServletRequest request, HttpServletResponse
return new ModelAndView("error/404", model);
}

/**
* @description: 403:资源不可用错误
* @param: request
* @param: response
* @param: webRequest
* @date: 2019-08-15 8:11 PM
* @return: org.springframework.web.servlet.ModelAndView
*/
@RequestMapping("/403")
public ModelAndView errorHtml403(HttpServletRequest request, HttpServletResponse response, WebRequest webRequest) {
response.setStatus(HttpStatus.FORBIDDEN.value());
// 404拦截规则如果是静态文件发生的404则不记录到DB
// 404拦截规则,如果是静态文件发生的404则不记录到DB
Map<String, Object> model = getErrorAttributes(webRequest, isIncludeStackTrace(request, MediaType.TEXT_HTML));
if (!String.valueOf(model.get("path")).contains(".")) {
model.put("status", HttpStatus.FORBIDDEN.value());
}
return new ModelAndView("error/403", model);
}

/**
* @description: 400:访问的页面域名不存在或者请求错误
* @param: request
* @param: response
* @param: webRequest
* @date: 2019-08-15 8:11 PM
* @return: org.springframework.web.servlet.ModelAndView
*/
@RequestMapping("/400")
public ModelAndView errorHtml400(HttpServletRequest request, HttpServletResponse response, WebRequest webRequest) {
response.setStatus(HttpStatus.BAD_REQUEST.value());
Map<String, Object> model = getErrorAttributes(webRequest, isIncludeStackTrace(request, MediaType.TEXT_HTML));
return new ModelAndView("error/400", model);
}

/**
* @description: 401:未经授权错误
* @param: request
* @param: response
* @param: webRequest
* @date: 2019-08-15 8:12 PM
* @return: org.springframework.web.servlet.ModelAndView
*/
@RequestMapping("/401")
public ModelAndView errorHtml401(HttpServletRequest request, HttpServletResponse response, WebRequest webRequest) {
response.setStatus(HttpStatus.UNAUTHORIZED.value());
Map<String, Object> model = getErrorAttributes(webRequest, isIncludeStackTrace(request, MediaType.TEXT_HTML));
return new ModelAndView("error/401", model);
}

/**
* @description: 500:服务器端发生异常
* @param: request
* @param: response
* @param: webRequest
* @date: 2019-08-15 8:12 PM
* @return: org.springframework.web.servlet.ModelAndView
*/
@RequestMapping("/500")
public ModelAndView errorHtml500(HttpServletRequest request, HttpServletResponse response, WebRequest webRequest) {
response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
Expand All @@ -121,8 +156,7 @@ public ModelAndView errorHtml500(HttpServletRequest request, HttpServletResponse
* @param produces the media type produced (or {@code MediaType.ALL})
* @return if the stacktrace attribute should be included
*/
protected boolean isIncludeStackTrace(HttpServletRequest request,
MediaType produces) {
protected boolean isIncludeStackTrace(HttpServletRequest request, MediaType produces) {
ErrorProperties.IncludeStacktrace include = this.serverProperties.getError().getIncludeStacktrace();
if (include == ErrorProperties.IncludeStacktrace.ALWAYS) {
return true;
Expand All @@ -132,33 +166,32 @@ protected boolean isIncludeStackTrace(HttpServletRequest request,


/**
* 获取错误的信息
*
* @param webRequest
* @param includeStackTrace
* @return
* @description: 获取错误信息
* @param: webRequest
* @param: includeStackTrace
* @date: 2019-08-15 8:13 PM
* @return: java.util.Map<java.lang.String, java.lang.Object>
*/
private Map<String, Object> getErrorAttributes(WebRequest webRequest,
boolean includeStackTrace) {
private Map<String, Object> getErrorAttributes(WebRequest webRequest, boolean includeStackTrace) {
return this.errorAttributes.getErrorAttributes(webRequest, includeStackTrace);
}

/**
* 是否包含trace
*
* @param request
* @return
* @description: 判断是否包含trace
* @param: request
* @date: 2019-08-15 8:13 PM
* @return: boolean
*/
private boolean getTraceParameter(HttpServletRequest request) {
String parameter = request.getParameter("trace");
return parameter != null && !"false".equalsIgnoreCase(parameter);
}

/**
* 获取错误编码
*
* @param request
* @return
* @description: (never used)获取错误编码
* @param: request
* @date: 2019-08-15 8:14 PM
* @return: org.springframework.http.HttpStatus
*/
private HttpStatus getStatus(HttpServletRequest request) {
Integer statusCode = (Integer) request
Expand All @@ -175,9 +208,10 @@ private HttpStatus getStatus(HttpServletRequest request) {
}

/**
* 实现错误路径,暂时无用
*
* @return
* @description: 实现错误路径, 暂时无用
* @param:
* @date: 2019-08-15 8:14 PM
* @return: java.lang.String
*/
@Override
public String getErrorPath() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,11 @@
import java.lang.reflect.UndeclaredThrowableException;

/**
* 统一异常处理类<br>
* 捕获程序所有异常,针对不同异常,采取不同的处理方式
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @date 2018/4/24 14:37
* @since 1.0
* @project: springboot-shiro
* @description: 统一异常处理类:捕获程序所有异常,针对不同异常,采取不同的处理方式
* @date: 2019-08-15 7:38 PM
* @version: 1.0
* @website: https://yubuntu0109.github.io/
*/
@Slf4j
@ControllerAdvice
Expand All @@ -59,7 +56,7 @@ public ResponseVO handle(Throwable e) {
log.error(responseStatus.getMessage());
return ResultUtil.error(responseStatus.getCode(), responseStatus.getMessage());
}
e.printStackTrace(); // 打印异常栈
e.printStackTrace(); //打印异常栈
return ResultUtil.error(CommonConst.DEFAULT_ERROR_CODE, ResponseStatus.ERROR.getMessage());
}

Expand Down
Loading