├── .gitattributes ├── .gitignore ├── .mvn └── wrapper │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── README.md ├── mvnw ├── mvnw.cmd ├── my.log ├── pom.xml └── src ├── main ├── java │ └── cn │ │ └── wmyskxz │ │ └── blog │ │ ├── BlogApplication.java │ │ ├── Swagger2.java │ │ ├── config │ │ └── MyWebMvcConfigurerAdapter.java │ │ ├── controller │ │ ├── BackController.java │ │ ├── BaseController.java │ │ ├── ForeController.java │ │ └── SysController.java │ │ ├── dao │ │ ├── ArticleCategoryMapper.java │ │ ├── ArticleCommentMapper.java │ │ ├── ArticleContentMapper.java │ │ ├── ArticleInfoMapper.java │ │ ├── ArticlePictureMapper.java │ │ ├── CategoryInfoMapper.java │ │ ├── CommentMapper.java │ │ ├── SysLogMapper.java │ │ └── SysViewMapper.java │ │ ├── dto │ │ ├── ArticleCategoryDto.java │ │ ├── ArticleCommentDto.java │ │ ├── ArticleDto.java │ │ └── ArticleWithPictureDto.java │ │ ├── entity │ │ ├── ArticleCategory.java │ │ ├── ArticleCategoryExample.java │ │ ├── ArticleComment.java │ │ ├── ArticleCommentExample.java │ │ ├── ArticleContent.java │ │ ├── ArticleContentExample.java │ │ ├── ArticleInfo.java │ │ ├── ArticleInfoExample.java │ │ ├── ArticlePicture.java │ │ ├── ArticlePictureExample.java │ │ ├── CategoryInfo.java │ │ ├── CategoryInfoExample.java │ │ ├── Comment.java │ │ ├── CommentExample.java │ │ ├── SysLog.java │ │ ├── SysLogExample.java │ │ ├── SysView.java │ │ ├── SysViewExample.java │ │ └── User.java │ │ ├── filter │ │ └── SimpleCORSFilter.java │ │ ├── generator │ │ └── MybatisGenerator.java │ │ ├── interceptor │ │ ├── BackInterceptor.java │ │ └── ForeInterceptor.java │ │ ├── service │ │ ├── ArticleService.java │ │ ├── CategoryService.java │ │ ├── CommentService.java │ │ ├── SysService.java │ │ └── impl │ │ │ ├── ArticleServiceImpl.java │ │ │ ├── CategoryServiceImpl.java │ │ │ ├── CommentServiceImpl.java │ │ │ └── SysServiceImpl.java │ │ └── util │ │ ├── BrowserUtil.java │ │ ├── Markdown2HtmlUtil.java │ │ └── OverIsMergeablePlugin.java └── resources │ ├── application.properties │ ├── banner.txt │ ├── generatorConfig.xml │ ├── logback-spring.xml │ ├── mapper │ ├── ArticleCategoryMapper.xml │ ├── ArticleCommentMapper.xml │ ├── ArticleContentMapper.xml │ ├── ArticleInfoMapper.xml │ ├── ArticlePictureMapper.xml │ ├── CategoryInfoMapper.xml │ ├── CommentMapper.xml │ ├── SysLogMapper.xml │ └── SysViewMapper.xml │ └── static │ ├── about.html │ ├── admin │ ├── article.html │ ├── assets │ │ ├── css │ │ │ ├── bootstrap.css │ │ │ ├── custom-styles.css │ │ │ └── font-awesome.css │ │ ├── font-awesome │ │ │ └── fonts │ │ │ │ ├── fontawesome-webfontba72.eot │ │ │ │ ├── fontawesome-webfontba72.svg │ │ │ │ ├── fontawesome-webfontba72.ttf │ │ │ │ ├── fontawesome-webfontba72.woff │ │ │ │ └── fontawesome-webfontd41d.eot │ │ ├── fonts │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ ├── glyphicons-halflings-regular.svg │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ └── glyphicons-halflings-regulard41d.eot │ │ └── js │ │ │ ├── bootstrap.min.js │ │ │ ├── custom-scripts.js │ │ │ ├── custom.js │ │ │ ├── dataTables │ │ │ ├── dataTables.bootstrap.css │ │ │ ├── dataTables.bootstrap.js │ │ │ └── jquery.dataTables.js │ │ │ ├── jquery-1.10.2.js │ │ │ ├── jquery.metisMenu.js │ │ │ ├── jquery.min.js │ │ │ ├── morris │ │ │ ├── morris-0.4.3.min.css │ │ │ ├── morris.js │ │ │ └── raphael-2.1.0.min.js │ │ │ └── pages │ │ │ ├── article.js │ │ │ ├── category.js │ │ │ ├── commont.js │ │ │ └── index.js │ ├── category.html │ ├── comment.html │ └── index.html │ ├── article.html │ ├── blog.html │ ├── css │ ├── about.css │ ├── article.css │ ├── blog.css │ ├── bootstrap │ │ ├── 3.3.6 │ │ │ ├── bootstrap-theme.css │ │ │ ├── bootstrap-theme.css.map │ │ │ ├── bootstrap-theme.min.css │ │ │ ├── bootstrap-theme.min.css.map │ │ │ ├── bootstrap.css │ │ │ ├── bootstrap.css.map │ │ │ ├── bootstrap.min.css │ │ │ └── bootstrap.min.css.map │ │ └── fonts │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ ├── glyphicons-halflings-regular.svg │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ └── glyphicons-halflings-regular.woff2 │ ├── darkula.css │ ├── index.css │ ├── lrtk.css │ └── prism │ │ └── prism.css │ ├── error.html │ ├── error │ └── 404.html │ ├── fonts │ └── fontawesome-webfont.woff │ ├── img │ ├── about │ │ └── titu.jpg │ ├── blog-logo.png │ ├── head.jpg │ ├── jianshu-icon.png │ ├── login │ │ ├── owl-login-arm.png │ │ ├── owl-login-arm@2x.png │ │ ├── owl-login.png │ │ ├── owl-login@2x.png │ │ ├── ph-owl-arm.png │ │ ├── ph-owl-arm@2x.png │ │ ├── ph-owl-arml.png │ │ ├── ph-owl-arml@2x.png │ │ ├── signup-arm.png │ │ └── signup-arm@2x.png │ ├── wechat-icon.png │ └── zhihu-icon.png │ ├── index.html │ ├── js │ ├── about.js │ ├── article.js │ ├── blog.js │ ├── bootstrap │ │ └── 3.3.6 │ │ │ ├── bootstrap.js │ │ │ ├── bootstrap.min.js │ │ │ └── npm.js │ ├── footer.js │ ├── getUrlParam.js │ ├── header.js │ ├── index.js │ ├── jquery │ │ └── 2.0.0 │ │ │ └── jquery.min.js │ └── prism │ │ └── prism.js │ ├── resume.html │ └── zwerowewvnzwoenwvw │ └── login.html └── test └── java └── cn └── wmyskxz └── blog ├── BlogApplicationTests.java └── Tester.java /.gitattributes: -------------------------------------------------------------------------------- 1 | *.css linguist-language=java -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | 4 | ### STS ### 5 | .apt_generated 6 | .classpath 7 | .factorypath 8 | .project 9 | .settings 10 | .springBeans 11 | .sts4-cache 12 | 13 | ### IntelliJ IDEA ### 14 | .idea 15 | *.iws 16 | *.iml 17 | *.ipr 18 | 19 | ### NetBeans ### 20 | /nbproject/private/ 21 | /build/ 22 | /nbbuild/ 23 | /dist/ 24 | /nbdist/ 25 | /.nb-gradle/ -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wmyskxz/MyBlog/810f0049b4f1fcce836cd38b10eb6378675fe277/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## MyBlog v0.1 2 | 使用技术栈如下: 3 | - 前端:HTML/CSS/Bootstrap/JavaScript/Prism.js(代码高亮插件)/font-awesome(Bootstrap字体) 4 | - 后台:Spring/SpringBoot/MyBatis/Druid/Swagger2(RESful API文档开发)/flexmark(md2html) 5 | 6 | 开发流程: 7 | - [1.SpringBoot技术栈搭建个人博客【项目准备】](https://www.jianshu.com/p/0293368fe750) 8 | - [2.SpringBoot技术栈搭建个人博客【后台开发】](https://www.jianshu.com/p/91c6c9fc67c4) 9 | - [3.SpringBoot技术栈搭建个人博客【前台开发/项目总结】](https://www.jianshu.com/p/c66541e59249) 10 | 11 | 前端原型参考:[戳这里](https://www.zcool.com.cn/work/ZMjgzMjE1ODA=.html) 12 | 13 | ![](https://upload-images.jianshu.io/upload_images/7896890-8f7f25a8328d2372.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1000/format/webp) 14 | -------------------------------------------------------------------------------- /mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM http://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven2 Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' 39 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 40 | 41 | @REM set %HOME% to equivalent of $HOME 42 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 43 | 44 | @REM Execute a user defined script before this one 45 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 46 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 47 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 48 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 49 | :skipRcPre 50 | 51 | @setlocal 52 | 53 | set ERROR_CODE=0 54 | 55 | @REM To isolate internal variables from possible post scripts, we use another setlocal 56 | @setlocal 57 | 58 | @REM ==== START VALIDATION ==== 59 | if not "%JAVA_HOME%" == "" goto OkJHome 60 | 61 | echo. 62 | echo Error: JAVA_HOME not found in your environment. >&2 63 | echo Please set the JAVA_HOME variable in your environment to match the >&2 64 | echo location of your Java installation. >&2 65 | echo. 66 | goto error 67 | 68 | :OkJHome 69 | if exist "%JAVA_HOME%\bin\java.exe" goto init 70 | 71 | echo. 72 | echo Error: JAVA_HOME is set to an invalid directory. >&2 73 | echo JAVA_HOME = "%JAVA_HOME%" >&2 74 | echo Please set the JAVA_HOME variable in your environment to match the >&2 75 | echo location of your Java installation. >&2 76 | echo. 77 | goto error 78 | 79 | @REM ==== END VALIDATION ==== 80 | 81 | :init 82 | 83 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 84 | @REM Fallback to current working directory if not found. 85 | 86 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 87 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 88 | 89 | set EXEC_DIR=%CD% 90 | set WDIR=%EXEC_DIR% 91 | :findBaseDir 92 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 93 | cd .. 94 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 95 | set WDIR=%CD% 96 | goto findBaseDir 97 | 98 | :baseDirFound 99 | set MAVEN_PROJECTBASEDIR=%WDIR% 100 | cd "%EXEC_DIR%" 101 | goto endDetectBaseDir 102 | 103 | :baseDirNotFound 104 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 105 | cd "%EXEC_DIR%" 106 | 107 | :endDetectBaseDir 108 | 109 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 110 | 111 | @setlocal EnableExtensions EnableDelayedExpansion 112 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 113 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 114 | 115 | :endReadAdditionalConfig 116 | 117 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 118 | 119 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 120 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 121 | 122 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 123 | if ERRORLEVEL 1 goto error 124 | goto end 125 | 126 | :error 127 | set ERROR_CODE=1 128 | 129 | :end 130 | @endlocal & set ERROR_CODE=%ERROR_CODE% 131 | 132 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 133 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 134 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 135 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 136 | :skipRcPost 137 | 138 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 139 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 140 | 141 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 142 | 143 | exit /B %ERROR_CODE% 144 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | cn.wmyskxz 7 | blog 8 | 0.0.1-SNAPSHOT 9 | jar 10 | 11 | blog 12 | Demo project for Spring Boot 13 | 14 | 15 | org.springframework.boot 16 | spring-boot-starter-parent 17 | 2.0.2.RELEASE 18 | 19 | 20 | 21 | 22 | UTF-8 23 | UTF-8 24 | 1.8 25 | 26 | 27 | 28 | 29 | 30 | 31 | com.alibaba 32 | fastjson 33 | 1.2.47 34 | 35 | 36 | 37 | org.springframework.boot 38 | spring-boot-starter-web 39 | 40 | 41 | 42 | 43 | org.mybatis.spring.boot 44 | mybatis-spring-boot-starter 45 | 1.3.2 46 | 47 | 48 | 49 | org.mybatis.generator 50 | mybatis-generator-core 51 | 1.3.6 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | org.springframework.boot 79 | spring-boot-starter-test 80 | test 81 | 82 | 83 | 84 | 85 | mysql 86 | mysql-connector-java 87 | runtime 88 | 89 | 90 | 91 | 92 | org.springframework.boot 93 | spring-boot-devtools 94 | true 95 | 96 | 97 | 98 | 99 | com.alibaba 100 | druid-spring-boot-starter 101 | 1.1.10 102 | 103 | 104 | 105 | 106 | io.springfox 107 | springfox-swagger2 108 | 2.2.2 109 | 110 | 111 | io.springfox 112 | springfox-swagger-ui 113 | 2.2.2 114 | 115 | 116 | 117 | 118 | com.vladsch.flexmark 119 | flexmark 120 | 0.26.4 121 | 122 | 123 | com.vladsch.flexmark 124 | flexmark-util 125 | 0.26.4 126 | 127 | 128 | 129 | com.vladsch.flexmark 130 | flexmark-ext-tables 131 | 0.26.4 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | org.springframework.boot 142 | spring-boot-maven-plugin 143 | 144 | 145 | 146 | 147 | 148 | -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/BlogApplication.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.context.annotation.ComponentScan; 7 | import org.springframework.transaction.annotation.EnableTransactionManagement; 8 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; 9 | 10 | 11 | @SpringBootApplication 12 | @EnableTransactionManagement // 启注解事务管理,等同于xml配置方式的 13 | @MapperScan("cn.wmyskxz.blog.dao") 14 | public class BlogApplication extends WebMvcConfigurerAdapter { 15 | 16 | public static void main(String[] args) { 17 | SpringApplication.run(BlogApplication.class, args); 18 | } 19 | 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/Swagger2.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import springfox.documentation.builders.ApiInfoBuilder; 6 | import springfox.documentation.builders.PathSelectors; 7 | import springfox.documentation.builders.RequestHandlerSelectors; 8 | import springfox.documentation.service.ApiInfo; 9 | import springfox.documentation.spi.DocumentationType; 10 | import springfox.documentation.spring.web.plugins.Docket; 11 | import springfox.documentation.swagger2.annotations.EnableSwagger2; 12 | 13 | /** 14 | * Swagger2 配置类 15 | * 16 | * @author:wmyskxz 17 | * @create:2018-06-14-上午 10:40 18 | */ 19 | @Configuration 20 | @EnableSwagger2 21 | public class Swagger2 { 22 | 23 | @Bean 24 | public Docket createRestApi() { 25 | return new Docket(DocumentationType.SWAGGER_2) 26 | .apiInfo(apiInfo()) 27 | .select() 28 | .apis(RequestHandlerSelectors.basePackage("cn.wmyskxz.blog")) 29 | .paths(PathSelectors.any()) 30 | .build(); 31 | } 32 | 33 | private ApiInfo apiInfo() { 34 | return new ApiInfoBuilder() 35 | .title("Wmyskxz个人博客RESTful APIs") 36 | .description("原文地址链接:http://blog.didispace.com/springbootswagger2/") 37 | .termsOfServiceUrl("http://blog.didispace.com/") 38 | .contact("@我没有三颗心脏") 39 | .version("1.0") 40 | .build(); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/config/MyWebMvcConfigurerAdapter.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.config; 2 | 3 | import cn.wmyskxz.blog.controller.ForeController; 4 | import cn.wmyskxz.blog.interceptor.BackInterceptor; 5 | import cn.wmyskxz.blog.interceptor.ForeInterceptor; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.http.converter.HttpMessageConverter; 9 | import org.springframework.http.converter.StringHttpMessageConverter; 10 | import org.springframework.web.servlet.HandlerInterceptor; 11 | import org.springframework.web.servlet.config.annotation.*; 12 | 13 | import java.nio.charset.Charset; 14 | import java.util.List; 15 | 16 | /** 17 | * 说明:更改编码为UTF-8 18 | * 19 | * @author:wmyskxz 20 | * @create:2018-06-19-上午 10:49 21 | */ 22 | @Configuration 23 | public class MyWebMvcConfigurerAdapter extends WebMvcConfigurerAdapter { 24 | @Bean 25 | public HttpMessageConverter responseBodyConverter() { 26 | StringHttpMessageConverter converter = new StringHttpMessageConverter(Charset.forName("UTF-8")); 27 | return converter; 28 | } 29 | 30 | @Bean 31 | public HandlerInterceptor getForeInterceptor() { 32 | return new ForeInterceptor(); 33 | } 34 | 35 | @Bean 36 | public HandlerInterceptor getBackInterceptor() { 37 | return new BackInterceptor(); 38 | } 39 | 40 | @Override 41 | public void configureMessageConverters(List> converters) { 42 | super.configureMessageConverters(converters); 43 | converters.add(responseBodyConverter()); 44 | } 45 | 46 | @Override 47 | public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { 48 | configurer.favorPathExtension(false); 49 | } 50 | 51 | /** 52 | * 以前要访问一个页面需要先创建个Controller控制类,在写方法跳转到页面 53 | * 在这里配置后就不需要那么麻烦了,直接访问http://10.2.3.235:80/toLogin就跳转到login.html页面了 54 | * 55 | * @param registry 56 | */ 57 | @Override 58 | public void addViewControllers(ViewControllerRegistry registry) { 59 | registry.addViewController("/toLogin").setViewName("zwerowewvnzwoenwvw/login.html"); 60 | super.addViewControllers(registry); 61 | } 62 | 63 | /** 64 | * 拦截器 65 | * 66 | * @param registry 67 | */ 68 | @Override 69 | public void addInterceptors(InterceptorRegistry registry) { 70 | // addPathPatterns 用于添加拦截规则 71 | // excludePathPatterns 用户排除拦截 72 | registry.addInterceptor(getBackInterceptor()).addPathPatterns("/admin/**").excludePathPatterns("/toLogin", "/admin/login"); 73 | registry.addInterceptor(getForeInterceptor()).addPathPatterns("/**").excludePathPatterns("/toLogin", "/admin/**", "/js/**", "/css/**", "/img/**"); 74 | super.addInterceptors(registry); 75 | } 76 | 77 | } 78 | 79 | -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/controller/BaseController.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.controller; 2 | 3 | import cn.wmyskxz.blog.service.ArticleService; 4 | import cn.wmyskxz.blog.service.CategoryService; 5 | import cn.wmyskxz.blog.service.CommentService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | 8 | /** 9 | * 基础控制器,包含了Controller层中共有的一些Service 10 | * 11 | * @author:wmyskxz 12 | * @create:2018-06-19-上午 11:25 13 | */ 14 | public class BaseController { 15 | 16 | @Autowired 17 | ArticleService articleService; 18 | @Autowired 19 | CommentService commentService; 20 | @Autowired 21 | CategoryService categoryService; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/controller/ForeController.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.controller; 2 | 3 | import cn.wmyskxz.blog.dto.ArticleCommentDto; 4 | import cn.wmyskxz.blog.dto.ArticleDto; 5 | import cn.wmyskxz.blog.dto.ArticleWithPictureDto; 6 | import cn.wmyskxz.blog.entity.*; 7 | import cn.wmyskxz.blog.util.Markdown2HtmlUtil; 8 | import io.swagger.annotations.ApiImplicitParam; 9 | import io.swagger.annotations.ApiImplicitParams; 10 | import io.swagger.annotations.ApiOperation; 11 | import org.springframework.web.bind.annotation.*; 12 | 13 | import javax.servlet.http.HttpServletRequest; 14 | import java.util.List; 15 | 16 | /** 17 | * 前台控制器 18 | * 19 | * @author:wmyskxz 20 | * @create:2018-06-16-下午 15:35 21 | */ 22 | @RestController 23 | @RequestMapping("/api") 24 | public class ForeController extends BaseController { 25 | 26 | /** 27 | * 获取所有文章列表 28 | * 29 | * @return 30 | */ 31 | @ApiOperation("获取所有文章") 32 | @GetMapping("article/list") 33 | public List listAllArticleInfo() { 34 | return articleService.listAll(); 35 | } 36 | 37 | /** 38 | * 获取某一个分类下的所有文章 39 | * 40 | * @param id 41 | * @return 42 | */ 43 | @ApiOperation("获取某一个分类下的所有文章") 44 | @ApiImplicitParam(name = "id", value = "分类ID", required = true, dataType = "Long") 45 | @GetMapping("article/list/sort/{id}") 46 | public List listArticleInfo(@PathVariable Long id) { 47 | return articleService.listByCategoryId(id); 48 | } 49 | 50 | /** 51 | * 获取最新的文章 52 | * 53 | * @return 54 | */ 55 | @ApiOperation("获取最新的几篇文章") 56 | @GetMapping("article/list/lastest") 57 | public List listLastestArticle() { 58 | return articleService.listLastest(); 59 | } 60 | 61 | /** 62 | * 通过文章的ID获取对应的文章信息 63 | * 64 | * @param id 65 | * @return 自己封装好的文章信息类 66 | */ 67 | @ApiOperation("通过文章ID获取文章信息") 68 | @GetMapping("article/{id}") 69 | public ArticleDto getArticleById(@PathVariable Long id) { 70 | ArticleDto articleDto = articleService.getOneById(id); 71 | articleDto.setContent(Markdown2HtmlUtil.markdown2html(articleDto.getContent())); 72 | return articleDto; 73 | } 74 | 75 | // /** 76 | // * 通过文章id获取一篇文章 77 | // * 说明:ArticleInfo中封装了picture/content/category信息 78 | // * 79 | // * @param id 80 | // * @return 81 | // */ 82 | // @ApiOperation("通过文章id获取文章内容") 83 | // @ApiImplicitParam(name = "id", value = "文章ID", required = true, dataType = "Long") 84 | // @GetMapping("article/{id}") 85 | // public ArticleInfo getArticleContent(@PathVariable Long id) { 86 | // return articleService.getOneById(id); 87 | // } 88 | 89 | // /** 90 | // * 通过文章ID获取它对应的题图信息 91 | // * 92 | // * @param id 93 | // * @return 94 | // */ 95 | // @ApiOperation("获取文章题图信息") 96 | // @ApiImplicitParam(name = "id", value = "文章ID", required = true, dataType = "Long") 97 | // @GetMapping("article/picture/{id}") 98 | // public ArticlePicture getArticlePicture(@PathVariable Long id) { 99 | // return null; 100 | // } 101 | 102 | /** 103 | * 获取所有分类信息 104 | * 105 | * @return 106 | */ 107 | @ApiOperation("获取所有分类信息") 108 | @GetMapping("category/list") 109 | public List listAllCategoryInfo() { 110 | return categoryService.listAllCategory(); 111 | } 112 | 113 | /** 114 | * 获取所有的留言信息 115 | * 116 | * @return 117 | */ 118 | @ApiOperation("获取所有的留言信息") 119 | @GetMapping("comment/list") 120 | public List listAllComment() { 121 | return commentService.listAllComment(); 122 | } 123 | 124 | /** 125 | * 通过文章ID获取某一篇文章的评论信息 126 | * 127 | * @param id 128 | * @return 129 | */ 130 | @ApiOperation("获取某一篇文章的评论信息") 131 | @ApiImplicitParam(name = "id", value = "文章ID", required = true, dataType = "Long") 132 | @GetMapping("comment/article/{id}") 133 | public List listMessageByArticleId(@PathVariable Long id) { 134 | return commentService.listAllArticleCommentById(id); 135 | } 136 | 137 | /** 138 | * 给某一篇文章增加一条评论信息 139 | * 140 | * @return 141 | */ 142 | @ApiOperation("给文章中增加一条评论信息") 143 | @ApiImplicitParams({ 144 | @ApiImplicitParam(name = "id", value = "文章ID", required = true, dataType = "Long"), 145 | @ApiImplicitParam(name = "content", value = "评论信息", required = true, dataType = "String"), 146 | @ApiImplicitParam(name = "email", value = "Email地址,用于回复", required = false, dataType = "String"), 147 | @ApiImplicitParam(name = "name", value = "用户自定义的名称", required = true, dataType = "String") 148 | }) 149 | @PostMapping("comment/article/{id}") 150 | public String addArticleComment(@PathVariable Long id, @RequestBody ArticleCommentDto articleCommentDto, HttpServletRequest request) { 151 | 152 | String ip = request.getRemoteAddr(); 153 | articleCommentDto.setIp(ip); 154 | articleCommentDto.setArticleId(id); 155 | commentService.addArticleComment(articleCommentDto); 156 | 157 | return null; 158 | } 159 | 160 | /** 161 | * 增加一条留言 162 | * 163 | * @return 164 | */ 165 | @ApiOperation("增加一条留言") 166 | @ApiImplicitParams({ 167 | @ApiImplicitParam(name = "content", value = "评论信息", required = true, dataType = "String"), 168 | @ApiImplicitParam(name = "email", value = "Email地址,用于回复", required = false, dataType = "String"), 169 | @ApiImplicitParam(name = "name", value = "用户自定义的名称", required = true, dataType = "String") 170 | }) 171 | @PostMapping("comment") 172 | public String addMessage(@RequestBody Comment comment, HttpServletRequest request) { 173 | 174 | String ip = request.getRemoteAddr(); 175 | comment.setIp(ip); 176 | commentService.addComment(comment); 177 | 178 | return null; 179 | } 180 | } 181 | -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/controller/SysController.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.controller; 2 | 3 | import cn.wmyskxz.blog.entity.SysLog; 4 | import cn.wmyskxz.blog.entity.SysView; 5 | import cn.wmyskxz.blog.service.SysService; 6 | import io.swagger.annotations.ApiOperation; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.web.bind.annotation.GetMapping; 9 | import org.springframework.web.bind.annotation.PathVariable; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.RestController; 12 | 13 | import java.util.List; 14 | 15 | /** 16 | * 系统Controller 17 | * 18 | * @author:wmyskxz 19 | * @create:2018-06-21-上午 10:23 20 | */ 21 | @RestController 22 | @RequestMapping("/admin") 23 | public class SysController { 24 | 25 | 26 | @Autowired 27 | SysService sysService; 28 | 29 | /** 30 | * 返回所有的系统日志记录信息 31 | * 32 | * @return 33 | */ 34 | @ApiOperation("返回所有的SysLog信息") 35 | @GetMapping("/sys/log") 36 | public List listAllLog() { 37 | return sysService.listAllLog(); 38 | } 39 | 40 | /** 41 | * 返回所有的系统浏览记录信息 42 | * 43 | * @return 44 | */ 45 | @ApiOperation("返回所有的SysView信息") 46 | @GetMapping("/sys/view") 47 | public List listAllView() { 48 | return sysService.listAllView(); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/dao/ArticleCategoryMapper.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.dao; 2 | 3 | import cn.wmyskxz.blog.entity.ArticleCategory; 4 | import cn.wmyskxz.blog.entity.ArticleCategoryExample; 5 | 6 | import java.util.List; 7 | 8 | public interface ArticleCategoryMapper { 9 | int deleteByPrimaryKey(Long id); 10 | 11 | int insert(ArticleCategory record); 12 | 13 | int insertSelective(ArticleCategory record); 14 | 15 | List selectByExample(ArticleCategoryExample example); 16 | 17 | ArticleCategory selectByPrimaryKey(Long id); 18 | 19 | int updateByPrimaryKeySelective(ArticleCategory record); 20 | 21 | int updateByPrimaryKey(ArticleCategory record); 22 | } -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/dao/ArticleCommentMapper.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.dao; 2 | 3 | import cn.wmyskxz.blog.entity.ArticleComment; 4 | import cn.wmyskxz.blog.entity.ArticleCommentExample; 5 | 6 | import java.util.List; 7 | 8 | public interface ArticleCommentMapper { 9 | int deleteByPrimaryKey(Long id); 10 | 11 | int insert(ArticleComment record); 12 | 13 | int insertSelective(ArticleComment record); 14 | 15 | List selectByExample(ArticleCommentExample example); 16 | 17 | ArticleComment selectByPrimaryKey(Long id); 18 | 19 | int updateByPrimaryKeySelective(ArticleComment record); 20 | 21 | int updateByPrimaryKey(ArticleComment record); 22 | } -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/dao/ArticleContentMapper.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.dao; 2 | 3 | import cn.wmyskxz.blog.entity.ArticleContent; 4 | import cn.wmyskxz.blog.entity.ArticleContentExample; 5 | 6 | import java.util.List; 7 | 8 | public interface ArticleContentMapper { 9 | int deleteByPrimaryKey(Long id); 10 | 11 | int insert(ArticleContent record); 12 | 13 | int insertSelective(ArticleContent record); 14 | 15 | List selectByExample(ArticleContentExample example); 16 | 17 | ArticleContent selectByPrimaryKey(Long id); 18 | 19 | int updateByPrimaryKeySelective(ArticleContent record); 20 | 21 | int updateByPrimaryKey(ArticleContent record); 22 | } -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/dao/ArticleInfoMapper.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.dao; 2 | 3 | import cn.wmyskxz.blog.entity.ArticleInfo; 4 | import cn.wmyskxz.blog.entity.ArticleInfoExample; 5 | 6 | import java.util.List; 7 | 8 | public interface ArticleInfoMapper { 9 | int deleteByPrimaryKey(Long id); 10 | 11 | int insert(ArticleInfo record); 12 | 13 | int insertSelective(ArticleInfo record); 14 | 15 | List selectByExample(ArticleInfoExample example); 16 | 17 | ArticleInfo selectByPrimaryKey(Long id); 18 | 19 | int updateByPrimaryKeySelective(ArticleInfo record); 20 | 21 | int updateByPrimaryKey(ArticleInfo record); 22 | } -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/dao/ArticlePictureMapper.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.dao; 2 | 3 | import cn.wmyskxz.blog.entity.ArticlePicture; 4 | import cn.wmyskxz.blog.entity.ArticlePictureExample; 5 | 6 | import java.util.List; 7 | 8 | public interface ArticlePictureMapper { 9 | int deleteByPrimaryKey(Long id); 10 | 11 | int insert(ArticlePicture record); 12 | 13 | int insertSelective(ArticlePicture record); 14 | 15 | List selectByExample(ArticlePictureExample example); 16 | 17 | ArticlePicture selectByPrimaryKey(Long id); 18 | 19 | int updateByPrimaryKeySelective(ArticlePicture record); 20 | 21 | int updateByPrimaryKey(ArticlePicture record); 22 | } -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/dao/CategoryInfoMapper.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.dao; 2 | 3 | import cn.wmyskxz.blog.entity.CategoryInfo; 4 | import cn.wmyskxz.blog.entity.CategoryInfoExample; 5 | 6 | import java.util.List; 7 | 8 | public interface CategoryInfoMapper { 9 | int deleteByPrimaryKey(Long id); 10 | 11 | int insert(CategoryInfo record); 12 | 13 | int insertSelective(CategoryInfo record); 14 | 15 | List selectByExample(CategoryInfoExample example); 16 | 17 | CategoryInfo selectByPrimaryKey(Long id); 18 | 19 | int updateByPrimaryKeySelective(CategoryInfo record); 20 | 21 | int updateByPrimaryKey(CategoryInfo record); 22 | } -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/dao/CommentMapper.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.dao; 2 | 3 | import cn.wmyskxz.blog.entity.Comment; 4 | import cn.wmyskxz.blog.entity.CommentExample; 5 | 6 | import java.util.List; 7 | 8 | public interface CommentMapper { 9 | int deleteByPrimaryKey(Long id); 10 | 11 | int insert(Comment record); 12 | 13 | int insertSelective(Comment record); 14 | 15 | List selectByExample(CommentExample example); 16 | 17 | Comment selectByPrimaryKey(Long id); 18 | 19 | int updateByPrimaryKeySelective(Comment record); 20 | 21 | int updateByPrimaryKey(Comment record); 22 | } -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/dao/SysLogMapper.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.dao; 2 | 3 | import cn.wmyskxz.blog.entity.SysLog; 4 | import cn.wmyskxz.blog.entity.SysLogExample; 5 | 6 | import java.util.List; 7 | 8 | public interface SysLogMapper { 9 | int deleteByPrimaryKey(Long id); 10 | 11 | int insert(SysLog record); 12 | 13 | int insertSelective(SysLog record); 14 | 15 | List selectByExample(SysLogExample example); 16 | 17 | SysLog selectByPrimaryKey(Long id); 18 | 19 | int updateByPrimaryKeySelective(SysLog record); 20 | 21 | int updateByPrimaryKey(SysLog record); 22 | } -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/dao/SysViewMapper.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.dao; 2 | 3 | import cn.wmyskxz.blog.entity.SysView; 4 | import cn.wmyskxz.blog.entity.SysViewExample; 5 | 6 | import java.util.List; 7 | 8 | public interface SysViewMapper { 9 | int deleteByPrimaryKey(Long id); 10 | 11 | int insert(SysView record); 12 | 13 | int insertSelective(SysView record); 14 | 15 | List selectByExample(SysViewExample example); 16 | 17 | SysView selectByPrimaryKey(Long id); 18 | 19 | int updateByPrimaryKeySelective(SysView record); 20 | 21 | int updateByPrimaryKey(SysView record); 22 | } -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/dto/ArticleCategoryDto.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.dto; 2 | 3 | /** 4 | * 文章分类传输对象 5 | * 说明:关联了tbl_article_category和tbl_category_info两张表的数据 6 | * 7 | * @author:wmyskxz 8 | * @create:2018-06-20-上午 8:45 9 | */ 10 | public class ArticleCategoryDto { 11 | 12 | // tbl_article_category表基础字段 13 | private Long id; // tbl_article_category表主键 14 | private Long categoryId; // 分类信息ID 15 | private Long articleId; // 文章ID 16 | 17 | // tbl_category_info表基础字段 18 | private String name; // 分类信息显示名称 19 | private Byte number; // 该分类下对应的文章数量 20 | 21 | public Long getId() { 22 | return id; 23 | } 24 | 25 | public void setId(Long id) { 26 | this.id = id; 27 | } 28 | 29 | public Long getCategoryId() { 30 | return categoryId; 31 | } 32 | 33 | public void setCategoryId(Long categoryId) { 34 | this.categoryId = categoryId; 35 | } 36 | 37 | public Long getArticleId() { 38 | return articleId; 39 | } 40 | 41 | public void setArticleId(Long articleId) { 42 | this.articleId = articleId; 43 | } 44 | 45 | public String getName() { 46 | return name; 47 | } 48 | 49 | public void setName(String name) { 50 | this.name = name; 51 | } 52 | 53 | public Byte getNumber() { 54 | return number; 55 | } 56 | 57 | public void setNumber(Byte number) { 58 | this.number = number; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/dto/ArticleCommentDto.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | 5 | import java.util.Date; 6 | 7 | /** 8 | * 文章评论信息 9 | * 说明:关联了tbl_comment和tbl_article_comment两张表的信息 10 | * 11 | * @author:wmyskxz 12 | * @create:2018-06-19-下午 14:09 13 | */ 14 | public class ArticleCommentDto { 15 | // tbl_comment基础字段 16 | private Long id; // 评论id 17 | private String content; // 评论内容 18 | private String name; // 用户自定义的显示名称 19 | private String email; 20 | private String ip; 21 | private Date createBy; // 创建时间 22 | 23 | // tbl_article_comment基础字段 24 | private Long articleCommentId; // tbl_article_comment主键 25 | private Long articleId; // 文章ID 26 | 27 | public Long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(Long id) { 32 | this.id = id; 33 | } 34 | 35 | public String getContent() { 36 | return content; 37 | } 38 | 39 | public void setContent(String content) { 40 | this.content = content; 41 | } 42 | 43 | public String getName() { 44 | return name; 45 | } 46 | 47 | public void setName(String name) { 48 | this.name = name; 49 | } 50 | 51 | public String getEmail() { 52 | return email; 53 | } 54 | 55 | public void setEmail(String email) { 56 | this.email = email; 57 | } 58 | 59 | public String getIp() { 60 | return ip; 61 | } 62 | 63 | public void setIp(String ip) { 64 | this.ip = ip; 65 | } 66 | 67 | public Long getArticleCommentId() { 68 | return articleCommentId; 69 | } 70 | 71 | public void setArticleCommentId(Long articleCommentId) { 72 | this.articleCommentId = articleCommentId; 73 | } 74 | 75 | public Long getArticleId() { 76 | return articleId; 77 | } 78 | 79 | public void setArticleId(Long articleId) { 80 | this.articleId = articleId; 81 | } 82 | 83 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 84 | public Date getCreateBy() { 85 | return createBy; 86 | } 87 | 88 | public void setCreateBy(Date createBy) { 89 | this.createBy = createBy; 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/dto/ArticleDto.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | 5 | import java.util.Date; 6 | 7 | /** 8 | * 文章信息类 9 | * 说明:关联了tbl_article_info/tbl_article_content/tbl_article_category/tbl_category_info/ 10 | * tbl_article_picture五张表的基础字段 11 | * 12 | * @author:wmyskxz 13 | * @create:2018-06-19-下午 14:13 14 | */ 15 | public class ArticleDto { 16 | 17 | // tbl_article_info基础字段 18 | private Long id; // 主键 19 | private String title; // 文章标题 20 | private String summary; // 文章简介 21 | private Boolean isTop; // 文章是否置顶 22 | private Integer traffic; // 文章浏览量 23 | private Date createBy; // 文章创建时间 24 | 25 | // tbl_article_content基础字段 26 | private Long articleContentId; // ArticleContent表主键 27 | private String content; // 文章内容 28 | 29 | // tbl_category_info基础字段 30 | private Long categoryId; // 分类ID 31 | private String categoryName; // 分类名称 32 | private Byte categoryNumber; // 分类对应的数量 33 | 34 | // tbl_article_category基础字段 35 | private Long articleCategoryId; // ArticleCategory表主键 36 | 37 | // tbl_article_picture基础字段 38 | private Long articlePictureId; // ArticlePicture表主键 39 | private String pictureUrl; // 文章题图url 40 | 41 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 42 | public Date getCreateBy() { 43 | return createBy; 44 | } 45 | 46 | public void setCreateBy(Date createBy) { 47 | this.createBy = createBy; 48 | } 49 | 50 | public Long getId() { 51 | return id; 52 | } 53 | 54 | public void setId(Long id) { 55 | this.id = id; 56 | } 57 | 58 | public String getTitle() { 59 | return title; 60 | } 61 | 62 | public void setTitle(String title) { 63 | this.title = title; 64 | } 65 | 66 | public String getSummary() { 67 | return summary; 68 | } 69 | 70 | public void setSummary(String summary) { 71 | this.summary = summary; 72 | } 73 | 74 | public Boolean getTop() { 75 | return isTop; 76 | } 77 | 78 | public void setTop(Boolean top) { 79 | isTop = top; 80 | } 81 | 82 | public Integer getTraffic() { 83 | return traffic; 84 | } 85 | 86 | public void setTraffic(Integer traffic) { 87 | this.traffic = traffic; 88 | } 89 | 90 | public Long getArticleContentId() { 91 | return articleContentId; 92 | } 93 | 94 | public void setArticleContentId(Long articleContentId) { 95 | this.articleContentId = articleContentId; 96 | } 97 | 98 | public String getContent() { 99 | return content; 100 | } 101 | 102 | public void setContent(String content) { 103 | this.content = content; 104 | } 105 | 106 | public Long getCategoryId() { 107 | return categoryId; 108 | } 109 | 110 | public void setCategoryId(Long categoryId) { 111 | this.categoryId = categoryId; 112 | } 113 | 114 | public String getCategoryName() { 115 | return categoryName; 116 | } 117 | 118 | public void setCategoryName(String categoryName) { 119 | this.categoryName = categoryName; 120 | } 121 | 122 | public Byte getCategoryNumber() { 123 | return categoryNumber; 124 | } 125 | 126 | public void setCategoryNumber(Byte categoryNumber) { 127 | this.categoryNumber = categoryNumber; 128 | } 129 | 130 | public Long getArticlePictureId() { 131 | return articlePictureId; 132 | } 133 | 134 | public void setArticlePictureId(Long articlePictureId) { 135 | this.articlePictureId = articlePictureId; 136 | } 137 | 138 | public String getPictureUrl() { 139 | return pictureUrl; 140 | } 141 | 142 | public void setPictureUrl(String pictureUrl) { 143 | this.pictureUrl = pictureUrl; 144 | } 145 | 146 | public Long getArticleCategoryId() { 147 | return articleCategoryId; 148 | } 149 | 150 | public void setArticleCategoryId(Long articleCategoryId) { 151 | this.articleCategoryId = articleCategoryId; 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/dto/ArticleWithPictureDto.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.dto; 2 | 3 | /** 4 | * 带题图信息的文章基础信息分装类 5 | * 6 | * @author:wmyskxz 7 | * @create:2018-06-19-下午 14:53 8 | */ 9 | public class ArticleWithPictureDto { 10 | // tbl_article_info基础字段 11 | private Long id; // ArticleInfo表主键 12 | private String title; // 文章标题 13 | private String summary; // 文章简介 14 | private Boolean isTop; // 文章是否置顶 15 | private Integer traffic; // 文章阅读量 16 | 17 | // tbl_article_picture基础字段 18 | private Long articlePictureId; // ArticlePicture主键 19 | private String pictureUrl; // 文章题图URL 20 | 21 | public Long getId() { 22 | return id; 23 | } 24 | 25 | public void setId(Long id) { 26 | this.id = id; 27 | } 28 | 29 | public String getTitle() { 30 | return title; 31 | } 32 | 33 | public void setTitle(String title) { 34 | this.title = title; 35 | } 36 | 37 | public String getSummary() { 38 | return summary; 39 | } 40 | 41 | public void setSummary(String summary) { 42 | this.summary = summary; 43 | } 44 | 45 | public Boolean getTop() { 46 | return isTop; 47 | } 48 | 49 | public void setTop(Boolean top) { 50 | isTop = top; 51 | } 52 | 53 | public Integer getTraffic() { 54 | return traffic; 55 | } 56 | 57 | public void setTraffic(Integer traffic) { 58 | this.traffic = traffic; 59 | } 60 | 61 | public Long getArticlePictureId() { 62 | return articlePictureId; 63 | } 64 | 65 | public void setArticlePictureId(Long articlePictureId) { 66 | this.articlePictureId = articlePictureId; 67 | } 68 | 69 | public String getPictureUrl() { 70 | return pictureUrl; 71 | } 72 | 73 | public void setPictureUrl(String pictureUrl) { 74 | this.pictureUrl = pictureUrl; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/entity/ArticleCategory.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | 5 | import java.util.Date; 6 | 7 | public class ArticleCategory { 8 | private Long id; 9 | 10 | private Long categoryId; 11 | 12 | private Long articleId; 13 | 14 | private Date createBy; 15 | 16 | private Date modifiedBy; 17 | 18 | public Long getId() { 19 | return id; 20 | } 21 | 22 | public void setId(Long id) { 23 | this.id = id; 24 | } 25 | 26 | public Long getCategoryId() { 27 | return categoryId; 28 | } 29 | 30 | public void setCategoryId(Long categoryId) { 31 | this.categoryId = categoryId; 32 | } 33 | 34 | public Long getArticleId() { 35 | return articleId; 36 | } 37 | 38 | public void setArticleId(Long articleId) { 39 | this.articleId = articleId; 40 | } 41 | 42 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 43 | public Date getCreateBy() { 44 | return createBy; 45 | } 46 | 47 | public void setCreateBy(Date createBy) { 48 | this.createBy = createBy; 49 | } 50 | 51 | public Date getModifiedBy() { 52 | return modifiedBy; 53 | } 54 | 55 | public void setModifiedBy(Date modifiedBy) { 56 | this.modifiedBy = modifiedBy; 57 | } 58 | } -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/entity/ArticleComment.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | 5 | import java.util.Date; 6 | 7 | public class ArticleComment { 8 | private Long id; 9 | 10 | private Long articleId; 11 | 12 | private Long commentId; 13 | 14 | private Date createBy; 15 | 16 | private Boolean isEffective; 17 | 18 | public Long getId() { 19 | return id; 20 | } 21 | 22 | public void setId(Long id) { 23 | this.id = id; 24 | } 25 | 26 | public Long getArticleId() { 27 | return articleId; 28 | } 29 | 30 | public void setArticleId(Long articleId) { 31 | this.articleId = articleId; 32 | } 33 | 34 | public Long getCommentId() { 35 | return commentId; 36 | } 37 | 38 | public void setCommentId(Long commentId) { 39 | this.commentId = commentId; 40 | } 41 | 42 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 43 | public Date getCreateBy() { 44 | return createBy; 45 | } 46 | 47 | public void setCreateBy(Date createBy) { 48 | this.createBy = createBy; 49 | } 50 | 51 | public Boolean getIsEffective() { 52 | return isEffective; 53 | } 54 | 55 | public void setIsEffective(Boolean isEffective) { 56 | this.isEffective = isEffective; 57 | } 58 | } -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/entity/ArticleContent.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | 5 | import java.util.Date; 6 | 7 | public class ArticleContent { 8 | private Long id; 9 | 10 | private String content; 11 | 12 | private Long articleId; 13 | 14 | private Date createBy; 15 | 16 | private Date modifieldBy; 17 | 18 | public Long getId() { 19 | return id; 20 | } 21 | 22 | public void setId(Long id) { 23 | this.id = id; 24 | } 25 | 26 | public String getContent() { 27 | return content; 28 | } 29 | 30 | public void setContent(String content) { 31 | this.content = content == null ? null : content.trim(); 32 | } 33 | 34 | public Long getArticleId() { 35 | return articleId; 36 | } 37 | 38 | public void setArticleId(Long articleId) { 39 | this.articleId = articleId; 40 | } 41 | 42 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 43 | public Date getCreateBy() { 44 | return createBy; 45 | } 46 | 47 | public void setCreateBy(Date createBy) { 48 | this.createBy = createBy; 49 | } 50 | 51 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 52 | public Date getModifieldBy() { 53 | return modifieldBy; 54 | } 55 | 56 | public void setModifieldBy(Date modifieldBy) { 57 | this.modifieldBy = modifieldBy; 58 | } 59 | } -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/entity/ArticleInfo.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | 5 | import java.util.Date; 6 | 7 | public class ArticleInfo { 8 | private Long id; 9 | 10 | private String title; 11 | 12 | private String summary; 13 | 14 | private Boolean isTop; 15 | 16 | private Integer traffic; 17 | 18 | private Date createBy; 19 | 20 | private Date modifiedBy; 21 | 22 | public Long getId() { 23 | return id; 24 | } 25 | 26 | public void setId(Long id) { 27 | this.id = id; 28 | } 29 | 30 | public String getTitle() { 31 | return title; 32 | } 33 | 34 | public void setTitle(String title) { 35 | this.title = title == null ? null : title.trim(); 36 | } 37 | 38 | public String getSummary() { 39 | return summary; 40 | } 41 | 42 | public void setSummary(String summary) { 43 | this.summary = summary == null ? null : summary.trim(); 44 | } 45 | 46 | public Boolean getIsTop() { 47 | return isTop; 48 | } 49 | 50 | public void setIsTop(Boolean isTop) { 51 | this.isTop = isTop; 52 | } 53 | 54 | public Integer getTraffic() { 55 | return traffic; 56 | } 57 | 58 | public void setTraffic(Integer traffic) { 59 | this.traffic = traffic; 60 | } 61 | 62 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 63 | public Date getCreateBy() { 64 | return createBy; 65 | } 66 | 67 | public void setCreateBy(Date createBy) { 68 | this.createBy = createBy; 69 | } 70 | 71 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 72 | public Date getModifiedBy() { 73 | return modifiedBy; 74 | } 75 | 76 | public void setModifiedBy(Date modifiedBy) { 77 | this.modifiedBy = modifiedBy; 78 | } 79 | } -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/entity/ArticlePicture.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | 5 | import java.util.Date; 6 | 7 | public class ArticlePicture { 8 | private Long id; 9 | 10 | private Long articleId; 11 | 12 | private String pictureUrl; 13 | 14 | private Date createBy; 15 | 16 | private Date modifiedBy; 17 | 18 | public Long getId() { 19 | return id; 20 | } 21 | 22 | public void setId(Long id) { 23 | this.id = id; 24 | } 25 | 26 | public Long getArticleId() { 27 | return articleId; 28 | } 29 | 30 | public void setArticleId(Long articleId) { 31 | this.articleId = articleId; 32 | } 33 | 34 | public String getPictureUrl() { 35 | return pictureUrl; 36 | } 37 | 38 | public void setPictureUrl(String pictureUrl) { 39 | this.pictureUrl = pictureUrl == null ? null : pictureUrl.trim(); 40 | } 41 | 42 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 43 | public Date getCreateBy() { 44 | return createBy; 45 | } 46 | 47 | public void setCreateBy(Date createBy) { 48 | this.createBy = createBy; 49 | } 50 | 51 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 52 | public Date getModifiedBy() { 53 | return modifiedBy; 54 | } 55 | 56 | public void setModifiedBy(Date modifiedBy) { 57 | this.modifiedBy = modifiedBy; 58 | } 59 | } -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/entity/CategoryInfo.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | 5 | import java.util.Date; 6 | 7 | public class CategoryInfo { 8 | private Long id; 9 | 10 | private String name; 11 | 12 | private Byte number; 13 | 14 | private Date createBy; 15 | 16 | private Date modifiedBy; 17 | 18 | public Long getId() { 19 | return id; 20 | } 21 | 22 | public void setId(Long id) { 23 | this.id = id; 24 | } 25 | 26 | public String getName() { 27 | return name; 28 | } 29 | 30 | public void setName(String name) { 31 | this.name = name == null ? null : name.trim(); 32 | } 33 | 34 | public Byte getNumber() { 35 | return number; 36 | } 37 | 38 | public void setNumber(Byte number) { 39 | this.number = number; 40 | } 41 | 42 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 43 | public Date getCreateBy() { 44 | return createBy; 45 | } 46 | 47 | public void setCreateBy(Date createBy) { 48 | this.createBy = createBy; 49 | } 50 | 51 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 52 | public Date getModifiedBy() { 53 | return modifiedBy; 54 | } 55 | 56 | public void setModifiedBy(Date modifiedBy) { 57 | this.modifiedBy = modifiedBy; 58 | } 59 | } -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/entity/Comment.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | 5 | import java.util.Date; 6 | 7 | public class Comment { 8 | private Long id; 9 | 10 | private String content; 11 | 12 | private Date createBy; 13 | 14 | private String email; 15 | 16 | private String name; 17 | 18 | private String ip; 19 | 20 | private Boolean isEffective; 21 | 22 | public Long getId() { 23 | return id; 24 | } 25 | 26 | public void setId(Long id) { 27 | this.id = id; 28 | } 29 | 30 | public String getContent() { 31 | return content; 32 | } 33 | 34 | public void setContent(String content) { 35 | this.content = content == null ? null : content.trim(); 36 | } 37 | 38 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 39 | public Date getCreateBy() { 40 | return createBy; 41 | } 42 | 43 | public void setCreateBy(Date createBy) { 44 | this.createBy = createBy; 45 | } 46 | 47 | public String getEmail() { 48 | return email; 49 | } 50 | 51 | public void setEmail(String email) { 52 | this.email = email == null ? null : email.trim(); 53 | } 54 | 55 | public String getName() { 56 | return name; 57 | } 58 | 59 | public void setName(String name) { 60 | this.name = name == null ? null : name.trim(); 61 | } 62 | 63 | public String getIp() { 64 | return ip; 65 | } 66 | 67 | public void setIp(String ip) { 68 | this.ip = ip == null ? null : ip.trim(); 69 | } 70 | 71 | public Boolean getIsEffective() { 72 | return isEffective; 73 | } 74 | 75 | public void setIsEffective(Boolean isEffective) { 76 | this.isEffective = isEffective; 77 | } 78 | } -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/entity/SysLog.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | 5 | import java.util.Date; 6 | 7 | public class SysLog { 8 | private Long id; 9 | 10 | private String ip; 11 | 12 | private Date createBy; 13 | 14 | private String remark; 15 | 16 | private String operateUrl; 17 | 18 | private String operateBy; 19 | 20 | public Long getId() { 21 | return id; 22 | } 23 | 24 | public void setId(Long id) { 25 | this.id = id; 26 | } 27 | 28 | public String getIp() { 29 | return ip; 30 | } 31 | 32 | public void setIp(String ip) { 33 | this.ip = ip == null ? null : ip.trim(); 34 | } 35 | 36 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 37 | public Date getCreateBy() { 38 | return createBy; 39 | } 40 | 41 | public void setCreateBy(Date createBy) { 42 | this.createBy = createBy; 43 | } 44 | 45 | public String getRemark() { 46 | return remark; 47 | } 48 | 49 | public void setRemark(String remark) { 50 | this.remark = remark == null ? null : remark.trim(); 51 | } 52 | 53 | public String getOperateUrl() { 54 | return operateUrl; 55 | } 56 | 57 | public void setOperateUrl(String operateUrl) { 58 | this.operateUrl = operateUrl == null ? null : operateUrl.trim(); 59 | } 60 | 61 | public String getOperateBy() { 62 | return operateBy; 63 | } 64 | 65 | public void setOperateBy(String operateBy) { 66 | this.operateBy = operateBy == null ? null : operateBy.trim(); 67 | } 68 | } -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/entity/SysView.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | 5 | import java.util.Date; 6 | 7 | public class SysView { 8 | private Long id; 9 | 10 | private String ip; 11 | 12 | private Date createBy; 13 | 14 | public Long getId() { 15 | return id; 16 | } 17 | 18 | public void setId(Long id) { 19 | this.id = id; 20 | } 21 | 22 | public String getIp() { 23 | return ip; 24 | } 25 | 26 | public void setIp(String ip) { 27 | this.ip = ip == null ? null : ip.trim(); 28 | } 29 | 30 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 31 | public Date getCreateBy() { 32 | return createBy; 33 | } 34 | 35 | public void setCreateBy(Date createBy) { 36 | this.createBy = createBy; 37 | } 38 | } -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/entity/User.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.entity; 2 | 3 | /** 4 | * 用户类 5 | * 6 | * @author:wmyskxz 7 | * @create:2018-06-20-下午 19:03 8 | */ 9 | public class User { 10 | private String username; 11 | private String password; 12 | 13 | public String getUsername() { 14 | return username; 15 | } 16 | 17 | public void setUsername(String username) { 18 | this.username = username; 19 | } 20 | 21 | public String getPassword() { 22 | return password; 23 | } 24 | 25 | public void setPassword(String password) { 26 | this.password = password; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/filter/SimpleCORSFilter.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.filter; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | import javax.servlet.*; 6 | import javax.servlet.http.HttpServletRequest; 7 | import javax.servlet.http.HttpServletResponse; 8 | import java.io.IOException; 9 | 10 | /** 11 | * 实现跨域 12 | * 13 | * @author:wmyskxz 14 | * @create:2018-06-21-下午 22:48 15 | */ 16 | @Component 17 | public class SimpleCORSFilter implements Filter { 18 | 19 | @Override 20 | public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { 21 | HttpServletRequest request = (HttpServletRequest) req; 22 | HttpServletResponse response = (HttpServletResponse) res; 23 | response.setHeader("Access-Control-Allow-Origin", request.getHeader("Origin")); 24 | response.setHeader("Access-Control-Allow-Credentials", "true"); 25 | response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS ,PUT, DELETE"); 26 | response.setHeader("Access-Control-Max-Age", "3600"); 27 | response.setHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Connection, User-Agent, Cookie"); 28 | chain.doFilter(req, res); 29 | } 30 | 31 | @Override 32 | public void init(FilterConfig filterConfig) { 33 | } 34 | 35 | @Override 36 | public void destroy() { 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/generator/MybatisGenerator.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.generator; 2 | 3 | import org.mybatis.generator.api.MyBatisGenerator; 4 | import org.mybatis.generator.config.Configuration; 5 | import org.mybatis.generator.config.xml.ConfigurationParser; 6 | import org.mybatis.generator.exception.XMLParserException; 7 | import org.mybatis.generator.internal.DefaultShellCallback; 8 | 9 | import java.io.IOException; 10 | import java.io.InputStream; 11 | import java.sql.SQLException; 12 | import java.text.ParseException; 13 | import java.text.SimpleDateFormat; 14 | import java.util.ArrayList; 15 | import java.util.Date; 16 | import java.util.List; 17 | 18 | /** 19 | * MyBatis逆向工程生成类 20 | * 21 | * @author:wmyskxz 22 | * @create:2018-06-14-上午 10:10 23 | */ 24 | public class MybatisGenerator { 25 | 26 | public static void main(String[] args) throws Exception { 27 | String today = "2018-6-19"; 28 | 29 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 30 | Date now = sdf.parse(today); 31 | Date d = new Date(); 32 | 33 | if (d.getTime() > now.getTime() + 1000 * 60 * 60 * 24) { 34 | System.err.println("——————未成成功运行——————"); 35 | System.err.println("——————未成成功运行——————"); 36 | System.err.println("本程序具有破坏作用,应该只运行一次,如果必须要再运行,需要修改today变量为今天,如:" + sdf.format(new Date())); 37 | return; 38 | } 39 | 40 | if (false) 41 | return; 42 | List warnings = new ArrayList(); 43 | boolean overwrite = true; 44 | InputStream is = MybatisGenerator.class.getClassLoader().getResource("generatorConfig.xml").openStream(); 45 | ConfigurationParser cp = new ConfigurationParser(warnings); 46 | Configuration config = cp.parseConfiguration(is); 47 | is.close(); 48 | DefaultShellCallback callback = new DefaultShellCallback(overwrite); 49 | MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings); 50 | myBatisGenerator.generate(null); 51 | 52 | System.out.println("生成代码成功,只能执行一次,以后执行会覆盖掉mapper,pojo,xml 等文件上做的修改"); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/interceptor/BackInterceptor.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.interceptor; 2 | 3 | import cn.wmyskxz.blog.entity.User; 4 | import org.springframework.util.StringUtils; 5 | import org.springframework.web.servlet.HandlerInterceptor; 6 | import org.springframework.web.servlet.ModelAndView; 7 | 8 | import javax.servlet.http.HttpServletRequest; 9 | import javax.servlet.http.HttpServletResponse; 10 | 11 | /** 12 | * 后台拦截器 13 | * 说明:对/admin开头的地址进行拦截,必须经过验证之后才能够访问 14 | * 15 | * @author:wmyskxz 16 | * @create:2018-06-20-下午 18:47 17 | */ 18 | public class BackInterceptor implements HandlerInterceptor { 19 | 20 | private static String username = "wmyskxz"; 21 | private static String password = "123456"; 22 | 23 | @Override 24 | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { 25 | boolean flag = true; 26 | // System.out.println("进入成功!"); 27 | User user = (User) request.getSession().getAttribute("user"); 28 | if (null == user) { 29 | // 如果用户为空则跳转到error页面 30 | // 2018年6月29日20:23:05:修改sendRedirect方法为getRequestDispatcher, 31 | // 目的是保证地址栏不改变(与前台错误页面响应一致),这样用户就不知道后台页面的地址 32 | request.getRequestDispatcher(request.getContextPath() + "/error.html").forward(request, response); 33 | // response.sendRedirect(request.getContextPath() + "/error.html"); 34 | flag = false; 35 | } else { 36 | // 对用户账号进行验证,是否正确 37 | if (user.getUsername().equals(username) && user.getPassword().equals(password)) { 38 | // System.out.println("访问后台API"); 39 | flag = true; 40 | } else { 41 | flag = false; 42 | } 43 | } 44 | return flag; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/interceptor/ForeInterceptor.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.interceptor; 2 | 3 | import cn.wmyskxz.blog.entity.SysLog; 4 | import cn.wmyskxz.blog.entity.SysView; 5 | import cn.wmyskxz.blog.service.SysService; 6 | import cn.wmyskxz.blog.util.BrowserUtil; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.util.StringUtils; 9 | import org.springframework.web.method.HandlerMethod; 10 | import org.springframework.web.servlet.HandlerInterceptor; 11 | import org.springframework.web.servlet.ModelAndView; 12 | 13 | import javax.servlet.http.HttpServletRequest; 14 | import javax.servlet.http.HttpServletResponse; 15 | import java.lang.reflect.Method; 16 | import java.util.StringTokenizer; 17 | 18 | /** 19 | * 前台拦截器 20 | * 说明:用于对访问数量进行统计 21 | * 22 | * @author:wmyskxz 23 | * @create:2018-06-20-下午 20:12 24 | */ 25 | public class ForeInterceptor implements HandlerInterceptor { 26 | 27 | @Autowired 28 | SysService sysService; 29 | 30 | private SysLog sysLog = new SysLog(); 31 | private SysView sysView = new SysView(); 32 | 33 | @Override 34 | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { 35 | 36 | // 访问者的IP 37 | String ip = request.getRemoteAddr(); 38 | // 访问地址 39 | String url = request.getRequestURL().toString(); 40 | //得到用户的浏览器名 41 | String userbrowser = BrowserUtil.getOsAndBrowserInfo(request); 42 | 43 | // 给SysLog增加字段 44 | sysLog.setIp(StringUtils.isEmpty(ip) ? "0.0.0.0" : ip); 45 | sysLog.setOperateBy(StringUtils.isEmpty(userbrowser) ? "获取浏览器名失败" : userbrowser); 46 | sysLog.setOperateUrl(StringUtils.isEmpty(url) ? "获取URL失败" : url); 47 | 48 | // 增加访问量 49 | sysView.setIp(StringUtils.isEmpty(ip) ? "0.0.0.0" : ip); 50 | sysService.addView(sysView); 51 | 52 | return true; 53 | } 54 | 55 | @Override 56 | public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { 57 | 58 | if (handler instanceof HandlerMethod) { 59 | HandlerMethod handlerMethod = (HandlerMethod) handler; 60 | Method method = handlerMethod.getMethod(); 61 | // 保存日志信息 62 | sysLog.setRemark(method.getName()); 63 | sysService.addLog(sysLog); 64 | 65 | } else { 66 | String uri = request.getRequestURI(); 67 | sysLog.setRemark(uri); 68 | sysService.addLog(sysLog); 69 | } 70 | 71 | // HandlerMethod handlerMethod = (HandlerMethod) handler; 72 | // Method method = handlerMethod.getMethod(); 73 | 74 | // 保存日志信息 75 | // sysLog.setRemark(method.getName()); 76 | // sysService.addLog(sysLog); 77 | } 78 | 79 | @Override 80 | public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { 81 | 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/service/ArticleService.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.service; 2 | 3 | import cn.wmyskxz.blog.dto.ArticleDto; 4 | import cn.wmyskxz.blog.dto.ArticleWithPictureDto; 5 | import cn.wmyskxz.blog.entity.ArticlePicture; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * 文章Service 11 | * 说明:ArticleInfo里面封装了picture/content/category等信息 12 | */ 13 | public interface ArticleService { 14 | 15 | void addArticle(ArticleDto articleDto); 16 | 17 | void deleteArticleById(Long id); 18 | 19 | void updateArticle(ArticleDto articleDto); 20 | 21 | void updateArticleCategory(Long articleId, Long categoryId); 22 | 23 | ArticleDto getOneById(Long id); 24 | 25 | ArticlePicture getPictureByArticleId(Long id); 26 | 27 | List listAll(); 28 | 29 | List listByCategoryId(Long id); 30 | 31 | List listLastest(); 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/service/CategoryService.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.service; 2 | 3 | import cn.wmyskxz.blog.dto.ArticleCategoryDto; 4 | import cn.wmyskxz.blog.entity.ArticleCategory; 5 | import cn.wmyskxz.blog.entity.CategoryInfo; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * 分类Service 11 | */ 12 | public interface CategoryService { 13 | void addCategory(CategoryInfo categoryInfo); 14 | 15 | void deleteCategoryById(Long id); 16 | 17 | void updateCategory(CategoryInfo categoryInfo); 18 | 19 | void updateArticleCategory(ArticleCategory articleCategory); 20 | 21 | CategoryInfo getOneById(Long id); 22 | 23 | List listAllCategory(); 24 | 25 | ArticleCategoryDto getCategoryByArticleId(Long id); 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/service/CommentService.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.service; 2 | 3 | import cn.wmyskxz.blog.dto.ArticleCategoryDto; 4 | import cn.wmyskxz.blog.dto.ArticleCommentDto; 5 | import cn.wmyskxz.blog.entity.ArticleComment; 6 | import cn.wmyskxz.blog.entity.Comment; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * 留言的Service 12 | */ 13 | public interface CommentService { 14 | void addComment(Comment comment); 15 | 16 | void addArticleComment(ArticleCommentDto articleCommentDto); 17 | 18 | void deleteCommentById(Long id); 19 | 20 | void deleteArticleCommentById(Long id); 21 | 22 | List listAllComment(); 23 | 24 | List listAllArticleCommentById(Long id); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/service/SysService.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.service; 2 | 3 | import cn.wmyskxz.blog.entity.SysLog; 4 | import cn.wmyskxz.blog.entity.SysView; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * 日志/访问统计等系统相关Service 10 | */ 11 | public interface SysService { 12 | void addLog(SysLog sysLog); 13 | 14 | void addView(SysView sysView); 15 | 16 | int getLogCount(); 17 | 18 | int getViewCount(); 19 | 20 | List listAllLog(); 21 | 22 | List listAllView(); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/service/impl/CategoryServiceImpl.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.service.impl; 2 | 3 | import cn.wmyskxz.blog.dao.ArticleCategoryMapper; 4 | import cn.wmyskxz.blog.dao.CategoryInfoMapper; 5 | import cn.wmyskxz.blog.dto.ArticleCategoryDto; 6 | import cn.wmyskxz.blog.entity.ArticleCategory; 7 | import cn.wmyskxz.blog.entity.ArticleCategoryExample; 8 | import cn.wmyskxz.blog.entity.CategoryInfo; 9 | import cn.wmyskxz.blog.entity.CategoryInfoExample; 10 | import cn.wmyskxz.blog.service.CategoryService; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.stereotype.Service; 13 | 14 | import java.util.List; 15 | 16 | /** 17 | * 分类Service实现类 18 | * 19 | * @author:wmyskxz 20 | * @create:2018-06-19-上午 8:46 21 | */ 22 | @Service 23 | public class CategoryServiceImpl implements CategoryService { 24 | 25 | @Autowired 26 | CategoryInfoMapper categoryInfoMapper; 27 | @Autowired 28 | ArticleCategoryMapper articleCategoryMapper; 29 | 30 | /** 31 | * 增加一条分类数据 32 | * 33 | * @param categoryInfo 34 | */ 35 | @Override 36 | public void addCategory(CategoryInfo categoryInfo) { 37 | categoryInfoMapper.insertSelective(categoryInfo); 38 | } 39 | 40 | /** 41 | * 通过分类id删除分类信息,要对应删除两个表的内容 42 | * 43 | * @param id 分类ID 44 | */ 45 | @Override 46 | public void deleteCategoryById(Long id) { 47 | // 先删除ArticleCategory表中的相关内容 48 | ArticleCategoryExample example = new ArticleCategoryExample(); 49 | example.or().andCategoryIdEqualTo(id); 50 | List categories = articleCategoryMapper.selectByExample(example); 51 | for (ArticleCategory articleCategory : categories) { 52 | articleCategoryMapper.deleteByPrimaryKey(articleCategory.getId()); 53 | } 54 | // 再删除CategoryInfo表中的内容 55 | categoryInfoMapper.deleteByPrimaryKey(id); 56 | } 57 | 58 | 59 | /** 60 | * 更改文章对应的分类 61 | * 62 | * @param articleCategory 63 | */ 64 | @Override 65 | public void updateArticleCategory(ArticleCategory articleCategory) { 66 | articleCategoryMapper.updateByPrimaryKeySelective(articleCategory); 67 | } 68 | 69 | /** 70 | * 更新分类信息 71 | * 72 | * @param categoryInfo 73 | */ 74 | @Override 75 | public void updateCategory(CategoryInfo categoryInfo) { 76 | categoryInfoMapper.updateByPrimaryKeySelective(categoryInfo); 77 | } 78 | 79 | /** 80 | * 获取一条分类信息数据 81 | * 82 | * @param id 83 | * @return 84 | */ 85 | @Override 86 | public CategoryInfo getOneById(Long id) { 87 | CategoryInfoExample example = new CategoryInfoExample(); 88 | example.or().andIdEqualTo(id); 89 | List categoryInfos = categoryInfoMapper.selectByExample(example); 90 | return categoryInfos.get(0); 91 | } 92 | 93 | /** 94 | * 列举返回所有的分类信息 95 | * 96 | * @return 97 | */ 98 | @Override 99 | public List listAllCategory() { 100 | // 无条件查询即返回所有 101 | CategoryInfoExample example = new CategoryInfoExample(); 102 | return categoryInfoMapper.selectByExample(example); 103 | } 104 | 105 | /** 106 | * 通过文章ID获取某一篇文章对应的分类 107 | * 108 | * @param id 文章ID 109 | * @return 110 | */ 111 | @Override 112 | public ArticleCategoryDto getCategoryByArticleId(Long id) { 113 | ArticleCategoryDto articleCategoryDto = new ArticleCategoryDto(); 114 | // 填充tbl_article_category中的基础数据 115 | ArticleCategoryExample example = new ArticleCategoryExample(); 116 | example.or().andArticleIdEqualTo(id); 117 | List articleCategories = articleCategoryMapper.selectByExample(example); 118 | ArticleCategory articleCategory = articleCategories.get(0); 119 | articleCategoryDto.setArticleId(articleCategory.getArticleId()); 120 | articleCategoryDto.setId(articleCategory.getId()); 121 | articleCategoryDto.setCategoryId(articleCategory.getCategoryId()); 122 | // 填充对应的分类信息 123 | CategoryInfo categoryInfo = getOneById(articleCategory.getCategoryId()); 124 | articleCategoryDto.setName(categoryInfo.getName()); 125 | articleCategoryDto.setNumber(categoryInfo.getNumber()); 126 | return articleCategoryDto; 127 | } 128 | 129 | // /** 130 | // * 往ArticleCategory中填充对应的CategoryInfo信息 131 | // * 说明:articleCategory中必能获取到对应的分类ID,这是在删除和增加时限制的 132 | // * 133 | // * @param articleCategory 134 | // */ 135 | // private void fill(ArticleCategory articleCategory) { 136 | // Long categoryId = articleCategory.getCategoryId(); 137 | // articleCategory.setCategoryInfo(getOneById(categoryId)); 138 | // } 139 | 140 | } 141 | -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/service/impl/CommentServiceImpl.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.service.impl; 2 | 3 | import cn.wmyskxz.blog.dao.ArticleCommentMapper; 4 | import cn.wmyskxz.blog.dao.CommentMapper; 5 | import cn.wmyskxz.blog.dto.ArticleCommentDto; 6 | import cn.wmyskxz.blog.entity.ArticleComment; 7 | import cn.wmyskxz.blog.entity.ArticleCommentExample; 8 | import cn.wmyskxz.blog.entity.Comment; 9 | import cn.wmyskxz.blog.entity.CommentExample; 10 | import cn.wmyskxz.blog.service.CommentService; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.stereotype.Service; 13 | 14 | import java.util.ArrayList; 15 | import java.util.List; 16 | 17 | /** 18 | * 留言/评论Service实现类 19 | * 20 | * @author:wmyskxz 21 | * @create:2018-06-17-上午 10:54 22 | */ 23 | @Service 24 | public class CommentServiceImpl implements CommentService { 25 | 26 | @Autowired 27 | CommentMapper commentMapper; 28 | @Autowired 29 | ArticleCommentMapper articleCommentMapper; 30 | 31 | /** 32 | * 增加一条留言信息 33 | * 34 | * @param comment 35 | */ 36 | @Override 37 | public void addComment(Comment comment) { 38 | commentMapper.insertSelective(comment); 39 | } 40 | 41 | /** 42 | * 增加一条文章评论信息 43 | * 说明:ArticleCommentDto中封装了tbl_comment和tbl_article_comment中的基础数据 44 | * 45 | * @param articleCommentDto 46 | */ 47 | @Override 48 | public void addArticleComment(ArticleCommentDto articleCommentDto) { 49 | // 先增加Comment留言数据 50 | Comment comment = new Comment(); 51 | comment.setIp(articleCommentDto.getIp()); 52 | comment.setName(articleCommentDto.getName()); 53 | comment.setEmail(articleCommentDto.getEmail()); 54 | comment.setContent(articleCommentDto.getContent()); 55 | addComment(comment); 56 | // 再更新tbl_article_comment作关联 57 | CommentExample example = new CommentExample(); 58 | example.setOrderByClause("id desc"); 59 | Long lastestCommentId = commentMapper.selectByExample(example).get(0).getId(); 60 | ArticleComment articleComment = new ArticleComment(); 61 | articleComment.setCommentId(lastestCommentId); 62 | articleComment.setArticleId(articleCommentDto.getArticleId()); 63 | articleCommentMapper.insertSelective(articleComment); 64 | } 65 | 66 | /** 67 | * 通过留言ID删除一条数据 68 | * 说明:并不是直接删除数据库中的数据而是直接将isEffective字段置为false 69 | * 70 | * @param id 71 | */ 72 | @Override 73 | public void deleteCommentById(Long id) { 74 | Comment comment = commentMapper.selectByPrimaryKey(id); 75 | comment.setIsEffective(false); 76 | commentMapper.updateByPrimaryKeySelective(comment); 77 | } 78 | 79 | /** 80 | * 删除文章评论信息 81 | * 说明:说明:并不是直接删除数据库中的数据而是直接将isEffective字段置为false 82 | * 注意:这里需要设置两个表的字段 83 | * 84 | * @param id tbl_article_comment表主键 85 | */ 86 | @Override 87 | public void deleteArticleCommentById(Long id) { 88 | // 设置ArticleComment表中的字段为false 89 | ArticleComment articleComment = articleCommentMapper.selectByPrimaryKey(id); 90 | articleComment.setIsEffective(false); 91 | articleCommentMapper.updateByPrimaryKeySelective(articleComment); 92 | // 删除Comment表中对应的数据 93 | deleteCommentById(articleComment.getCommentId()); 94 | } 95 | 96 | /** 97 | * 列举返回所有的留言信息 98 | * 99 | * @return 100 | */ 101 | @Override 102 | public List listAllComment() { 103 | // 无条件查询即返回所有 104 | CommentExample example = new CommentExample(); 105 | return commentMapper.selectByExample(example); 106 | } 107 | 108 | /** 109 | * 获取对应文章下的所有评论信息 110 | * 说明:需要返回一个自己封装好的用来与前端交互的ArticleCommentDto集合 111 | * 112 | * @param id 文章ID 113 | * @return 114 | */ 115 | @Override 116 | public List listAllArticleCommentById(Long id) { 117 | List comments = new ArrayList<>(); 118 | ArticleCommentExample example = new ArticleCommentExample(); 119 | example.or().andArticleIdEqualTo(id); 120 | List articleComments = articleCommentMapper.selectByExample(example); 121 | // 填充对应的评论信息 122 | for (ArticleComment articleComment : articleComments) { 123 | if (true == articleComment.getIsEffective()) { 124 | ArticleCommentDto articleCommentDto = new ArticleCommentDto(); 125 | articleCommentDto.setArticleCommentId(articleComment.getId()); 126 | articleCommentDto.setArticleId(articleComment.getArticleId()); 127 | articleCommentDto.setCreateBy(articleComment.getCreateBy()); 128 | // 查询对应的评论信息 129 | Comment comment = commentMapper.selectByPrimaryKey(articleComment.getCommentId()); 130 | articleCommentDto.setId(comment.getId()); 131 | articleCommentDto.setContent(comment.getContent()); 132 | articleCommentDto.setEmail(comment.getEmail()); 133 | articleCommentDto.setIp(comment.getIp()); 134 | articleCommentDto.setName(comment.getName()); 135 | comments.add(articleCommentDto); 136 | } 137 | } 138 | return comments; 139 | } 140 | 141 | } 142 | -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/service/impl/SysServiceImpl.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.service.impl; 2 | 3 | import cn.wmyskxz.blog.dao.SysLogMapper; 4 | import cn.wmyskxz.blog.dao.SysViewMapper; 5 | import cn.wmyskxz.blog.entity.SysLog; 6 | import cn.wmyskxz.blog.entity.SysLogExample; 7 | import cn.wmyskxz.blog.entity.SysView; 8 | import cn.wmyskxz.blog.entity.SysViewExample; 9 | import cn.wmyskxz.blog.service.SysService; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.stereotype.Component; 12 | import org.springframework.stereotype.Service; 13 | 14 | import javax.annotation.PostConstruct; 15 | import java.util.List; 16 | 17 | /** 18 | * SysService实现类 19 | * 20 | * @author:wmyskxz 21 | * @create:2018-06-20-下午 20:17 22 | */ 23 | @Component 24 | public class SysServiceImpl implements SysService { 25 | 26 | @Autowired 27 | SysLogMapper sysLogMapper; 28 | @Autowired 29 | SysViewMapper sysViewMapper; 30 | 31 | // private static SysServiceImpl sysService; 32 | // 33 | // @PostConstruct 34 | // public void init() { 35 | // sysService = this; 36 | // sysService.sysLogMapper = this.sysLogMapper; 37 | // sysService.sysViewMapper = this.sysViewMapper; 38 | // } 39 | 40 | 41 | /** 42 | * 增加一条日志信息 43 | * 44 | * @param sysLog 45 | */ 46 | @Override 47 | public void addLog(SysLog sysLog) { 48 | sysLogMapper.insertSelective(sysLog); 49 | } 50 | 51 | /** 52 | * 增加一条访问量 53 | * 54 | * @param sysView 55 | */ 56 | @Override 57 | public void addView(SysView sysView) { 58 | sysViewMapper.insertSelective(sysView); 59 | } 60 | 61 | /** 62 | * 获取日志的总数量 63 | * 64 | * @return 日志的总数量 65 | */ 66 | @Override 67 | public int getLogCount() { 68 | SysLogExample example = new SysLogExample(); 69 | return sysLogMapper.selectByExample(example).size(); 70 | } 71 | 72 | /** 73 | * 返回当前网站的访问量 74 | * 75 | * @return 76 | */ 77 | @Override 78 | public int getViewCount() { 79 | SysViewExample example = new SysViewExample(); 80 | return sysViewMapper.selectByExample(example).size(); 81 | } 82 | 83 | /** 84 | * 返回所有的日志信息 85 | * 86 | * @return 87 | */ 88 | @Override 89 | public List listAllLog() { 90 | SysLogExample example = new SysLogExample(); 91 | return sysLogMapper.selectByExample(example); 92 | } 93 | 94 | /** 95 | * 返回所有的访问信息 96 | * 97 | * @return 98 | */ 99 | @Override 100 | public List listAllView() { 101 | SysViewExample example = new SysViewExample(); 102 | return sysViewMapper.selectByExample(example); 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/util/BrowserUtil.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.util; 2 | 3 | import javax.servlet.http.HttpServletRequest; 4 | 5 | /** 6 | * 用于从Request请求中获取到客户端的获取操作系统,浏览器及浏览器版本信息 7 | * 8 | * @author:wmyskxz 9 | * @create:2018-06-21-上午 8:40 10 | */ 11 | public class BrowserUtil { 12 | /** 13 | * 获取操作系统,浏览器及浏览器版本信息 14 | * 15 | * @param request 16 | * @return 17 | */ 18 | public static String getOsAndBrowserInfo(HttpServletRequest request) { 19 | String browserDetails = request.getHeader("User-Agent"); 20 | String userAgent = browserDetails; 21 | String user = userAgent.toLowerCase(); 22 | 23 | String os = ""; 24 | String browser = ""; 25 | 26 | //=================OS Info======================= 27 | if (userAgent.toLowerCase().indexOf("windows") >= 0) { 28 | os = "Windows"; 29 | } else if (userAgent.toLowerCase().indexOf("mac") >= 0) { 30 | os = "Mac"; 31 | } else if (userAgent.toLowerCase().indexOf("x11") >= 0) { 32 | os = "Unix"; 33 | } else if (userAgent.toLowerCase().indexOf("android") >= 0) { 34 | os = "Android"; 35 | } else if (userAgent.toLowerCase().indexOf("iphone") >= 0) { 36 | os = "IPhone"; 37 | } else { 38 | os = "UnKnown, More-Info: " + userAgent; 39 | } 40 | //===============Browser=========================== 41 | if (user.contains("edge")) { 42 | browser = (userAgent.substring(userAgent.indexOf("Edge")).split(" ")[0]).replace("/", "-"); 43 | } else if (user.contains("msie")) { 44 | String substring = userAgent.substring(userAgent.indexOf("MSIE")).split(";")[0]; 45 | browser = substring.split(" ")[0].replace("MSIE", "IE") + "-" + substring.split(" ")[1]; 46 | } else if (user.contains("safari") && user.contains("version")) { 47 | browser = (userAgent.substring(userAgent.indexOf("Safari")).split(" ")[0]).split("/")[0] 48 | + "-" + (userAgent.substring(userAgent.indexOf("Version")).split(" ")[0]).split("/")[1]; 49 | } else if (user.contains("opr") || user.contains("opera")) { 50 | if (user.contains("opera")) { 51 | browser = (userAgent.substring(userAgent.indexOf("Opera")).split(" ")[0]).split("/")[0] 52 | + "-" + (userAgent.substring(userAgent.indexOf("Version")).split(" ")[0]).split("/")[1]; 53 | } else if (user.contains("opr")) { 54 | browser = ((userAgent.substring(userAgent.indexOf("OPR")).split(" ")[0]).replace("/", "-")) 55 | .replace("OPR", "Opera"); 56 | } 57 | 58 | } else if (user.contains("chrome")) { 59 | browser = (userAgent.substring(userAgent.indexOf("Chrome")).split(" ")[0]).replace("/", "-"); 60 | } else if ((user.indexOf("mozilla/7.0") > -1) || (user.indexOf("netscape6") != -1) || 61 | (user.indexOf("mozilla/4.7") != -1) || (user.indexOf("mozilla/4.78") != -1) || 62 | (user.indexOf("mozilla/4.08") != -1) || (user.indexOf("mozilla/3") != -1)) { 63 | browser = "Netscape-?"; 64 | 65 | } else if (user.contains("firefox")) { 66 | browser = (userAgent.substring(userAgent.indexOf("Firefox")).split(" ")[0]).replace("/", "-"); 67 | } else if (user.contains("rv")) { 68 | String IEVersion = (userAgent.substring(userAgent.indexOf("rv")).split(" ")[0]).replace("rv:", "-"); 69 | browser = "IE" + IEVersion.substring(0, IEVersion.length() - 1); 70 | } else { 71 | browser = "UnKnown, More-Info: " + userAgent; 72 | } 73 | 74 | return os + "-" + browser; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/util/Markdown2HtmlUtil.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.util; 2 | 3 | import com.vladsch.flexmark.Extension; 4 | import com.vladsch.flexmark.ast.Node; 5 | import com.vladsch.flexmark.ext.tables.TablesExtension; 6 | import com.vladsch.flexmark.html.HtmlRenderer; 7 | import com.vladsch.flexmark.parser.Parser; 8 | import com.vladsch.flexmark.parser.ParserEmulationProfile; 9 | import com.vladsch.flexmark.util.options.MutableDataSet; 10 | 11 | import java.util.Arrays; 12 | 13 | /** 14 | * Markdown转Html工具类 15 | * 16 | * @author:wmyskxz 17 | * @create:2018-06-21-上午 10:09 18 | */ 19 | public class Markdown2HtmlUtil { 20 | /** 21 | * 将markdown源码转换成html返回 22 | * 23 | * @param markdown md源码 24 | * @return html代码 25 | */ 26 | public static String markdown2html(String markdown) { 27 | MutableDataSet options = new MutableDataSet(); 28 | options.setFrom(ParserEmulationProfile.MARKDOWN); 29 | options.set(Parser.EXTENSIONS, Arrays.asList(new Extension[]{TablesExtension.create()})); 30 | Parser parser = Parser.builder(options).build(); 31 | HtmlRenderer renderer = HtmlRenderer.builder(options).build(); 32 | 33 | Node document = parser.parse(markdown); 34 | return renderer.render(document); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/cn/wmyskxz/blog/util/OverIsMergeablePlugin.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog.util; 2 | 3 | import org.mybatis.generator.api.GeneratedXmlFile; 4 | import org.mybatis.generator.api.IntrospectedTable; 5 | import org.mybatis.generator.api.PluginAdapter; 6 | 7 | import java.lang.reflect.Field; 8 | import java.util.List; 9 | 10 | /** 11 | * 避免MyBatiis重复生成的工具 12 | * 13 | * @author:wmyskxz 14 | * @create:2018-06-14-上午 9:50 15 | */ 16 | public class OverIsMergeablePlugin extends PluginAdapter { 17 | @Override 18 | public boolean validate(List warnings) { 19 | return true; 20 | } 21 | 22 | @Override 23 | public boolean sqlMapGenerated(GeneratedXmlFile sqlMap, IntrospectedTable introspectedTable) { 24 | try { 25 | Field field = sqlMap.getClass().getDeclaredField("isMergeable"); 26 | field.setAccessible(true); 27 | field.setBoolean(sqlMap, false); 28 | } catch (Exception e) { 29 | e.printStackTrace(); 30 | } 31 | return true; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | ## Tomcat配置 2 | server.port=80 3 | ## 数据库连接配置 4 | spring.datasource.type=com.alibaba.druid.pool.DruidDataSource 5 | spring.datasource.driver-class-name=com.mysql.jdbc.Driver 6 | spring.datasource.url=jdbc:mysql://127.0.0.1:3306/blog?characterEncoding=UTF-8 7 | spring.datasource.username=root 8 | spring.datasource.password=123456 9 | # 初始化大小,最小,最大配置 10 | spring.datasource.druid.initial-size=5 11 | spring.datasource.druid.min-idle=5 12 | spring.datasource.druid.max-active=20 13 | # 配置获取连接等待超时的时间 14 | spring.datasource.druid.max-wait=60000 15 | # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 16 | spring.datasource.druid.time-between-eviction-runs-millis=60000 17 | # 配置一个连接在池中最小生存的时间,单位是毫秒 18 | spring.datasource.druid.min-evictable-idle-time-millis=300000 19 | spring.datasource.druid.validation-query=SELECT 1 FROM DUAL 20 | spring.datasource.druid.test-while-idle=true 21 | spring.datasource.druid.test-on-borrow=false 22 | spring.datasource.druid.test-on-return=false 23 | # 打开PSCache,并且指定每个连接上PSCache的大小 24 | spring.datasource.druid.pool-prepared-statements=true 25 | spring.datasource.druid.max-pool-prepared-statement-per-connection-size=20 26 | # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙 27 | spring.datasource.druid.filters=stat,wall 28 | # 通过connectProperties属性来打开mergeSql功能;慢SQL记录 29 | spring.datasource.druid.connect-properties.=druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 30 | spring.datasource.druid.valid-connection-checker-class-name=com.alibaba.druid.pool.vendor.MSSQLValidConnectionChecker 31 | ## 默认编码配置 32 | spring.http.encoding.charset=UTF-8 33 | spring.http.encoding.force=true 34 | spring.http.encoding.enabled=true 35 | server.tomcat.uri-encoding=UTF-8 36 | ## MyBatis相关配置 37 | mybatis.type-aliases-package=cn.wmyskxz.blog.entity 38 | mybatis.mapper-locations=classpath:mapper/*.xml 39 | -------------------------------------------------------------------------------- /src/main/resources/banner.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | __ __ __ 4 | /\ \ __/\ \ /\ \ 5 | \ \ \/\ \ \ \ ___ ___ __ __ ____\ \ \/'\ __ _ ____ 6 | \ \ \ \ \ \ \ /' __` __`\ /\ \/\ \ /',__\\ \ , < /\ \/'\/\_ ,`\ 7 | \ \ \_/ \_\ \/\ \/\ \/\ \\ \ \_\ \ /\__, `\\ \ \\`\ \/> \\/___/ \/_/\/_/\//\/_/ \/____/ 10 | /\___/ 11 | \/__/ 12 | 13 | -------------------------------------------------------------------------------- /src/main/resources/logback-spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | logback 4 | 5 | 6 | 7 | 8 | 11 | 12 | %d{HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{36} - %msg%n 13 | 14 | 15 | 16 | 17 | 18 | 19 | ${log.path}/logback.%d{yyyy-MM-dd}.log 20 | 21 | 22 | %d{HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{36} - %msg%n 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/main/resources/mapper/ArticleCategoryMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | and ${criterion.condition} 20 | 21 | 22 | and ${criterion.condition} #{criterion.value} 23 | 24 | 25 | and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} 26 | 27 | 28 | and ${criterion.condition} 29 | 30 | #{listItem} 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | id, category_id, article_id, create_by, modified_by 42 | 43 | 58 | 64 | 65 | delete from tbl_article_category 66 | where id = #{id,jdbcType=BIGINT} 67 | 68 | 69 | insert into tbl_article_category (category_id, article_id, create_by, 70 | modified_by) 71 | values (#{categoryId,jdbcType=BIGINT}, #{articleId,jdbcType=BIGINT}, #{createBy,jdbcType=TIMESTAMP}, 72 | #{modifiedBy,jdbcType=TIMESTAMP}) 73 | 74 | 75 | insert into tbl_article_category 76 | 77 | 78 | category_id, 79 | 80 | 81 | article_id, 82 | 83 | 84 | create_by, 85 | 86 | 87 | modified_by, 88 | 89 | 90 | 91 | 92 | #{categoryId,jdbcType=BIGINT}, 93 | 94 | 95 | #{articleId,jdbcType=BIGINT}, 96 | 97 | 98 | #{createBy,jdbcType=TIMESTAMP}, 99 | 100 | 101 | #{modifiedBy,jdbcType=TIMESTAMP}, 102 | 103 | 104 | 105 | 106 | update tbl_article_category 107 | 108 | 109 | category_id = #{categoryId,jdbcType=BIGINT}, 110 | 111 | 112 | article_id = #{articleId,jdbcType=BIGINT}, 113 | 114 | 115 | create_by = #{createBy,jdbcType=TIMESTAMP}, 116 | 117 | 118 | modified_by = #{modifiedBy,jdbcType=TIMESTAMP}, 119 | 120 | 121 | where id = #{id,jdbcType=BIGINT} 122 | 123 | 124 | update tbl_article_category 125 | set category_id = #{categoryId,jdbcType=BIGINT}, 126 | article_id = #{articleId,jdbcType=BIGINT}, 127 | create_by = #{createBy,jdbcType=TIMESTAMP}, 128 | modified_by = #{modifiedBy,jdbcType=TIMESTAMP} 129 | where id = #{id,jdbcType=BIGINT} 130 | 131 | -------------------------------------------------------------------------------- /src/main/resources/mapper/ArticleCommentMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | and ${criterion.condition} 20 | 21 | 22 | and ${criterion.condition} #{criterion.value} 23 | 24 | 25 | and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} 26 | 27 | 28 | and ${criterion.condition} 29 | 30 | #{listItem} 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | id, article_id, comment_id, create_by, is_effective 42 | 43 | 58 | 64 | 65 | delete from tbl_article_comment 66 | where id = #{id,jdbcType=BIGINT} 67 | 68 | 69 | insert into tbl_article_comment (article_id, comment_id, create_by, 70 | is_effective) 71 | values (#{articleId,jdbcType=BIGINT}, #{commentId,jdbcType=BIGINT}, #{createBy,jdbcType=TIMESTAMP}, 72 | #{isEffective,jdbcType=BIT}) 73 | 74 | 75 | insert into tbl_article_comment 76 | 77 | 78 | article_id, 79 | 80 | 81 | comment_id, 82 | 83 | 84 | create_by, 85 | 86 | 87 | is_effective, 88 | 89 | 90 | 91 | 92 | #{articleId,jdbcType=BIGINT}, 93 | 94 | 95 | #{commentId,jdbcType=BIGINT}, 96 | 97 | 98 | #{createBy,jdbcType=TIMESTAMP}, 99 | 100 | 101 | #{isEffective,jdbcType=BIT}, 102 | 103 | 104 | 105 | 106 | update tbl_article_comment 107 | 108 | 109 | article_id = #{articleId,jdbcType=BIGINT}, 110 | 111 | 112 | comment_id = #{commentId,jdbcType=BIGINT}, 113 | 114 | 115 | create_by = #{createBy,jdbcType=TIMESTAMP}, 116 | 117 | 118 | is_effective = #{isEffective,jdbcType=BIT}, 119 | 120 | 121 | where id = #{id,jdbcType=BIGINT} 122 | 123 | 124 | update tbl_article_comment 125 | set article_id = #{articleId,jdbcType=BIGINT}, 126 | comment_id = #{commentId,jdbcType=BIGINT}, 127 | create_by = #{createBy,jdbcType=TIMESTAMP}, 128 | is_effective = #{isEffective,jdbcType=BIT} 129 | where id = #{id,jdbcType=BIGINT} 130 | 131 | -------------------------------------------------------------------------------- /src/main/resources/mapper/ArticleContentMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | and ${criterion.condition} 20 | 21 | 22 | and ${criterion.condition} #{criterion.value} 23 | 24 | 25 | and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} 26 | 27 | 28 | and ${criterion.condition} 29 | 30 | #{listItem} 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | id, content, article_id, create_by, modifield_by 42 | 43 | 58 | 64 | 65 | delete from tbl_article_content 66 | where id = #{id,jdbcType=BIGINT} 67 | 68 | 69 | insert into tbl_article_content (content, article_id, create_by, 70 | modifield_by) 71 | values (#{content,jdbcType=VARCHAR}, #{articleId,jdbcType=BIGINT}, #{createBy,jdbcType=TIMESTAMP}, 72 | #{modifieldBy,jdbcType=TIMESTAMP}) 73 | 74 | 75 | insert into tbl_article_content 76 | 77 | 78 | content, 79 | 80 | 81 | article_id, 82 | 83 | 84 | create_by, 85 | 86 | 87 | modifield_by, 88 | 89 | 90 | 91 | 92 | #{content,jdbcType=VARCHAR}, 93 | 94 | 95 | #{articleId,jdbcType=BIGINT}, 96 | 97 | 98 | #{createBy,jdbcType=TIMESTAMP}, 99 | 100 | 101 | #{modifieldBy,jdbcType=TIMESTAMP}, 102 | 103 | 104 | 105 | 106 | update tbl_article_content 107 | 108 | 109 | content = #{content,jdbcType=VARCHAR}, 110 | 111 | 112 | article_id = #{articleId,jdbcType=BIGINT}, 113 | 114 | 115 | create_by = #{createBy,jdbcType=TIMESTAMP}, 116 | 117 | 118 | modifield_by = #{modifieldBy,jdbcType=TIMESTAMP}, 119 | 120 | 121 | where id = #{id,jdbcType=BIGINT} 122 | 123 | 124 | update tbl_article_content 125 | set content = #{content,jdbcType=VARCHAR}, 126 | article_id = #{articleId,jdbcType=BIGINT}, 127 | create_by = #{createBy,jdbcType=TIMESTAMP}, 128 | modifield_by = #{modifieldBy,jdbcType=TIMESTAMP} 129 | where id = #{id,jdbcType=BIGINT} 130 | 131 | -------------------------------------------------------------------------------- /src/main/resources/mapper/ArticlePictureMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | and ${criterion.condition} 20 | 21 | 22 | and ${criterion.condition} #{criterion.value} 23 | 24 | 25 | and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} 26 | 27 | 28 | and ${criterion.condition} 29 | 30 | #{listItem} 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | id, article_id, picture_url, create_by, modified_by 42 | 43 | 58 | 64 | 65 | delete from tbl_article_picture 66 | where id = #{id,jdbcType=BIGINT} 67 | 68 | 69 | insert into tbl_article_picture (article_id, picture_url, create_by, 70 | modified_by) 71 | values (#{articleId,jdbcType=BIGINT}, #{pictureUrl,jdbcType=VARCHAR}, #{createBy,jdbcType=TIMESTAMP}, 72 | #{modifiedBy,jdbcType=TIMESTAMP}) 73 | 74 | 75 | insert into tbl_article_picture 76 | 77 | 78 | article_id, 79 | 80 | 81 | picture_url, 82 | 83 | 84 | create_by, 85 | 86 | 87 | modified_by, 88 | 89 | 90 | 91 | 92 | #{articleId,jdbcType=BIGINT}, 93 | 94 | 95 | #{pictureUrl,jdbcType=VARCHAR}, 96 | 97 | 98 | #{createBy,jdbcType=TIMESTAMP}, 99 | 100 | 101 | #{modifiedBy,jdbcType=TIMESTAMP}, 102 | 103 | 104 | 105 | 106 | update tbl_article_picture 107 | 108 | 109 | article_id = #{articleId,jdbcType=BIGINT}, 110 | 111 | 112 | picture_url = #{pictureUrl,jdbcType=VARCHAR}, 113 | 114 | 115 | create_by = #{createBy,jdbcType=TIMESTAMP}, 116 | 117 | 118 | modified_by = #{modifiedBy,jdbcType=TIMESTAMP}, 119 | 120 | 121 | where id = #{id,jdbcType=BIGINT} 122 | 123 | 124 | update tbl_article_picture 125 | set article_id = #{articleId,jdbcType=BIGINT}, 126 | picture_url = #{pictureUrl,jdbcType=VARCHAR}, 127 | create_by = #{createBy,jdbcType=TIMESTAMP}, 128 | modified_by = #{modifiedBy,jdbcType=TIMESTAMP} 129 | where id = #{id,jdbcType=BIGINT} 130 | 131 | -------------------------------------------------------------------------------- /src/main/resources/mapper/CategoryInfoMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | and ${criterion.condition} 20 | 21 | 22 | and ${criterion.condition} #{criterion.value} 23 | 24 | 25 | and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} 26 | 27 | 28 | and ${criterion.condition} 29 | 30 | #{listItem} 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | id, name, number, create_by, modified_by 42 | 43 | 58 | 64 | 65 | delete from tbl_category_info 66 | where id = #{id,jdbcType=BIGINT} 67 | 68 | 69 | insert into tbl_category_info (name, number, create_by, 70 | modified_by) 71 | values (#{name,jdbcType=VARCHAR}, #{number,jdbcType=TINYINT}, #{createBy,jdbcType=TIMESTAMP}, 72 | #{modifiedBy,jdbcType=TIMESTAMP}) 73 | 74 | 75 | insert into tbl_category_info 76 | 77 | 78 | name, 79 | 80 | 81 | number, 82 | 83 | 84 | create_by, 85 | 86 | 87 | modified_by, 88 | 89 | 90 | 91 | 92 | #{name,jdbcType=VARCHAR}, 93 | 94 | 95 | #{number,jdbcType=TINYINT}, 96 | 97 | 98 | #{createBy,jdbcType=TIMESTAMP}, 99 | 100 | 101 | #{modifiedBy,jdbcType=TIMESTAMP}, 102 | 103 | 104 | 105 | 106 | update tbl_category_info 107 | 108 | 109 | name = #{name,jdbcType=VARCHAR}, 110 | 111 | 112 | number = #{number,jdbcType=TINYINT}, 113 | 114 | 115 | create_by = #{createBy,jdbcType=TIMESTAMP}, 116 | 117 | 118 | modified_by = #{modifiedBy,jdbcType=TIMESTAMP}, 119 | 120 | 121 | where id = #{id,jdbcType=BIGINT} 122 | 123 | 124 | update tbl_category_info 125 | set name = #{name,jdbcType=VARCHAR}, 126 | number = #{number,jdbcType=TINYINT}, 127 | create_by = #{createBy,jdbcType=TIMESTAMP}, 128 | modified_by = #{modifiedBy,jdbcType=TIMESTAMP} 129 | where id = #{id,jdbcType=BIGINT} 130 | 131 | -------------------------------------------------------------------------------- /src/main/resources/mapper/SysLogMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | and ${criterion.condition} 21 | 22 | 23 | and ${criterion.condition} #{criterion.value} 24 | 25 | 26 | and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} 27 | 28 | 29 | and ${criterion.condition} 30 | 31 | #{listItem} 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | id, ip, create_by, remark, operate_url, operate_by 43 | 44 | 59 | 65 | 66 | delete from sys_log 67 | where id = #{id,jdbcType=BIGINT} 68 | 69 | 70 | insert into sys_log (ip, create_by, remark, 71 | operate_url, operate_by) 72 | values (#{ip,jdbcType=VARCHAR}, #{createBy,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR}, 73 | #{operateUrl,jdbcType=VARCHAR}, #{operateBy,jdbcType=VARCHAR}) 74 | 75 | 76 | insert into sys_log 77 | 78 | 79 | ip, 80 | 81 | 82 | create_by, 83 | 84 | 85 | remark, 86 | 87 | 88 | operate_url, 89 | 90 | 91 | operate_by, 92 | 93 | 94 | 95 | 96 | #{ip,jdbcType=VARCHAR}, 97 | 98 | 99 | #{createBy,jdbcType=TIMESTAMP}, 100 | 101 | 102 | #{remark,jdbcType=VARCHAR}, 103 | 104 | 105 | #{operateUrl,jdbcType=VARCHAR}, 106 | 107 | 108 | #{operateBy,jdbcType=VARCHAR}, 109 | 110 | 111 | 112 | 113 | update sys_log 114 | 115 | 116 | ip = #{ip,jdbcType=VARCHAR}, 117 | 118 | 119 | create_by = #{createBy,jdbcType=TIMESTAMP}, 120 | 121 | 122 | remark = #{remark,jdbcType=VARCHAR}, 123 | 124 | 125 | operate_url = #{operateUrl,jdbcType=VARCHAR}, 126 | 127 | 128 | operate_by = #{operateBy,jdbcType=VARCHAR}, 129 | 130 | 131 | where id = #{id,jdbcType=BIGINT} 132 | 133 | 134 | update sys_log 135 | set ip = #{ip,jdbcType=VARCHAR}, 136 | create_by = #{createBy,jdbcType=TIMESTAMP}, 137 | remark = #{remark,jdbcType=VARCHAR}, 138 | operate_url = #{operateUrl,jdbcType=VARCHAR}, 139 | operate_by = #{operateBy,jdbcType=VARCHAR} 140 | where id = #{id,jdbcType=BIGINT} 141 | 142 | -------------------------------------------------------------------------------- /src/main/resources/mapper/SysViewMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | and ${criterion.condition} 18 | 19 | 20 | and ${criterion.condition} #{criterion.value} 21 | 22 | 23 | and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} 24 | 25 | 26 | and ${criterion.condition} 27 | 28 | #{listItem} 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | id, ip, create_by 40 | 41 | 56 | 62 | 63 | delete from sys_view 64 | where id = #{id,jdbcType=BIGINT} 65 | 66 | 67 | insert into sys_view (ip, create_by) 68 | values (#{ip,jdbcType=VARCHAR}, #{createBy,jdbcType=TIMESTAMP}) 69 | 70 | 71 | insert into sys_view 72 | 73 | 74 | ip, 75 | 76 | 77 | create_by, 78 | 79 | 80 | 81 | 82 | #{ip,jdbcType=VARCHAR}, 83 | 84 | 85 | #{createBy,jdbcType=TIMESTAMP}, 86 | 87 | 88 | 89 | 90 | update sys_view 91 | 92 | 93 | ip = #{ip,jdbcType=VARCHAR}, 94 | 95 | 96 | create_by = #{createBy,jdbcType=TIMESTAMP}, 97 | 98 | 99 | where id = #{id,jdbcType=BIGINT} 100 | 101 | 102 | update sys_view 103 | set ip = #{ip,jdbcType=VARCHAR}, 104 | create_by = #{createBy,jdbcType=TIMESTAMP} 105 | where id = #{id,jdbcType=BIGINT} 106 | 107 | -------------------------------------------------------------------------------- /src/main/resources/static/about.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | wmyskxz个人博客 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 |
27 |
28 | 29 |

我没有三颗心脏

30 |

wmyskxz

31 |

AB型摩羯it男爱文艺爱音乐

32 |
33 |
34 |

博客搭建流程:

35 |
36 | 39 |
40 | 项目准备包括需求分析、数据库设计、原型设计、项目搭建、RESTful APIs设计 41 |
42 |
43 |
44 | 47 |
48 | 按照设计的RESTful APIs进行后台开发,并实现日志记录/统计/权限等功能 49 |
50 |
51 |
52 | 55 |
56 | 前后端结合以及项目总结 57 |
58 |
59 |
60 |
61 | 62 | 63 | 64 |
65 | 66 |
67 |
68 |
69 | 70 | 71 | 72 |
73 |
74 |
75 | 新增留言 76 |
77 |
78 | 79 | 80 | 81 | 82 | 83 |
84 |
85 | 86 |
87 |
88 | 89 |
90 | 91 |
92 | 93 | 94 | 95 | 119 | 120 | 121 | 144 | 145 |
146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | -------------------------------------------------------------------------------- /src/main/resources/static/admin/assets/font-awesome/fonts/fontawesome-webfontba72.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wmyskxz/MyBlog/810f0049b4f1fcce836cd38b10eb6378675fe277/src/main/resources/static/admin/assets/font-awesome/fonts/fontawesome-webfontba72.eot -------------------------------------------------------------------------------- /src/main/resources/static/admin/assets/font-awesome/fonts/fontawesome-webfontba72.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wmyskxz/MyBlog/810f0049b4f1fcce836cd38b10eb6378675fe277/src/main/resources/static/admin/assets/font-awesome/fonts/fontawesome-webfontba72.ttf -------------------------------------------------------------------------------- /src/main/resources/static/admin/assets/font-awesome/fonts/fontawesome-webfontba72.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wmyskxz/MyBlog/810f0049b4f1fcce836cd38b10eb6378675fe277/src/main/resources/static/admin/assets/font-awesome/fonts/fontawesome-webfontba72.woff -------------------------------------------------------------------------------- /src/main/resources/static/admin/assets/font-awesome/fonts/fontawesome-webfontd41d.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wmyskxz/MyBlog/810f0049b4f1fcce836cd38b10eb6378675fe277/src/main/resources/static/admin/assets/font-awesome/fonts/fontawesome-webfontd41d.eot -------------------------------------------------------------------------------- /src/main/resources/static/admin/assets/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wmyskxz/MyBlog/810f0049b4f1fcce836cd38b10eb6378675fe277/src/main/resources/static/admin/assets/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /src/main/resources/static/admin/assets/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wmyskxz/MyBlog/810f0049b4f1fcce836cd38b10eb6378675fe277/src/main/resources/static/admin/assets/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /src/main/resources/static/admin/assets/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wmyskxz/MyBlog/810f0049b4f1fcce836cd38b10eb6378675fe277/src/main/resources/static/admin/assets/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /src/main/resources/static/admin/assets/fonts/glyphicons-halflings-regulard41d.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wmyskxz/MyBlog/810f0049b4f1fcce836cd38b10eb6378675fe277/src/main/resources/static/admin/assets/fonts/glyphicons-halflings-regulard41d.eot -------------------------------------------------------------------------------- /src/main/resources/static/admin/assets/js/dataTables/dataTables.bootstrap.css: -------------------------------------------------------------------------------- 1 | div.dataTables_length label { 2 | float: left; 3 | text-align: left; 4 | font-weight: normal; 5 | } 6 | 7 | div.dataTables_length select { 8 | width: 75px; 9 | } 10 | 11 | div.dataTables_filter label { 12 | float: right; 13 | font-weight: normal; 14 | } 15 | 16 | div.dataTables_filter input { 17 | width: 16em; 18 | } 19 | 20 | div.dataTables_info { 21 | padding-top: 8px; 22 | } 23 | 24 | div.dataTables_paginate { 25 | float: right; 26 | margin: 0; 27 | } 28 | 29 | div.dataTables_paginate ul.pagination { 30 | margin: 2px 0; 31 | white-space: nowrap; 32 | } 33 | 34 | table.dataTable, 35 | table.dataTable td, 36 | table.dataTable th { 37 | -webkit-box-sizing: content-box; 38 | -moz-box-sizing: content-box; 39 | box-sizing: content-box; 40 | } 41 | 42 | table.dataTable { 43 | clear: both; 44 | margin-top: 6px !important; 45 | margin-bottom: 6px !important; 46 | max-width: none !important; 47 | } 48 | 49 | table.dataTable thead .sorting, 50 | table.dataTable thead .sorting_asc, 51 | table.dataTable thead .sorting_desc, 52 | table.dataTable thead .sorting_asc_disabled, 53 | table.dataTable thead .sorting_desc_disabled { 54 | cursor: pointer; 55 | } 56 | 57 | table.dataTable thead .sorting { 58 | background: url('../images/sort_both.png') no-repeat center right; 59 | } 60 | 61 | table.dataTable thead .sorting_asc { 62 | background: url('../images/sort_asc.png') no-repeat center right; 63 | } 64 | 65 | table.dataTable thead .sorting_desc { 66 | background: url('../images/sort_desc.png') no-repeat center right; 67 | } 68 | 69 | table.dataTable thead .sorting_asc_disabled { 70 | background: url('../images/sort_asc_disabled.png') no-repeat center right; 71 | } 72 | 73 | table.dataTable thead .sorting_desc_disabled { 74 | background: url('../images/sort_desc_disabled.png') no-repeat center right; 75 | } 76 | 77 | table.dataTable th:active { 78 | outline: none; 79 | } 80 | 81 | /* Scrolling */ 82 | 83 | div.dataTables_scrollHead table { 84 | margin-bottom: 0 !important; 85 | border-bottom-left-radius: 0; 86 | border-bottom-right-radius: 0; 87 | } 88 | 89 | div.dataTables_scrollHead table thead tr:last-child th:first-child, 90 | div.dataTables_scrollHead table thead tr:last-child td:first-child { 91 | border-bottom-left-radius: 0 !important; 92 | border-bottom-right-radius: 0 !important; 93 | } 94 | 95 | div.dataTables_scrollBody table { 96 | margin-top: 0 !important; 97 | margin-bottom: 0 !important; 98 | border-top: none; 99 | } 100 | 101 | div.dataTables_scrollBody tbody tr:first-child th, 102 | div.dataTables_scrollBody tbody tr:first-child td { 103 | border-top: none; 104 | } 105 | 106 | div.dataTables_scrollFoot table { 107 | margin-top: 0 !important; 108 | border-top: none; 109 | } 110 | 111 | /* 112 | * TableTools styles 113 | */ 114 | 115 | .table tbody tr.active td, 116 | .table tbody tr.active th { 117 | color: white; 118 | background-color: #08C; 119 | } 120 | 121 | .table tbody tr.active:hover td, 122 | .table tbody tr.active:hover th { 123 | background-color: #0075b0 !important; 124 | } 125 | 126 | .table tbody tr.active a { 127 | color: white; 128 | } 129 | 130 | .table-striped tbody tr.active:nth-child(odd) td, 131 | .table-striped tbody tr.active:nth-child(odd) th { 132 | background-color: #017ebc; 133 | } 134 | 135 | table.DTTT_selectable tbody tr { 136 | cursor: pointer; 137 | } 138 | 139 | div.DTTT .btn { 140 | font-size: 12px; 141 | color: #333 !important; 142 | } 143 | 144 | div.DTTT .btn:hover { 145 | text-decoration: none !important; 146 | } 147 | 148 | ul.DTTT_dropdown.dropdown-menu { 149 | z-index: 2003; 150 | } 151 | 152 | ul.DTTT_dropdown.dropdown-menu a { 153 | color: #333 !important; /* needed only when demo_page.css is included */ 154 | } 155 | 156 | ul.DTTT_dropdown.dropdown-menu li { 157 | position: relative; 158 | } 159 | 160 | ul.DTTT_dropdown.dropdown-menu li:hover a { 161 | color: white !important; 162 | background-color: #0088cc; 163 | } 164 | 165 | div.DTTT_collection_background { 166 | z-index: 2002; 167 | } 168 | 169 | /* TableTools information display */ 170 | 171 | div.DTTT_print_info.modal { 172 | height: 150px; 173 | margin-top: -75px; 174 | text-align: center; 175 | } 176 | 177 | div.DTTT_print_info h6 { 178 | margin: 1em; 179 | font-size: 28px; 180 | font-weight: normal; 181 | line-height: 28px; 182 | } 183 | 184 | div.DTTT_print_info p { 185 | font-size: 14px; 186 | line-height: 20px; 187 | } 188 | 189 | /* 190 | * FixedColumns styles 191 | */ 192 | 193 | div.DTFC_LeftHeadWrapper table, 194 | div.DTFC_LeftFootWrapper table, 195 | div.DTFC_RightHeadWrapper table, 196 | div.DTFC_RightFootWrapper table, 197 | table.DTFC_Cloned tr.even { 198 | background-color: white; 199 | } 200 | 201 | div.DTFC_RightHeadWrapper table, 202 | div.DTFC_LeftHeadWrapper table { 203 | margin-bottom: 0 !important; 204 | border-top-right-radius: 0 !important; 205 | border-bottom-left-radius: 0 !important; 206 | border-bottom-right-radius: 0 !important; 207 | } 208 | 209 | div.DTFC_RightHeadWrapper table thead tr:last-child th:first-child, 210 | div.DTFC_RightHeadWrapper table thead tr:last-child td:first-child, 211 | div.DTFC_LeftHeadWrapper table thead tr:last-child th:first-child, 212 | div.DTFC_LeftHeadWrapper table thead tr:last-child td:first-child { 213 | border-bottom-left-radius: 0 !important; 214 | border-bottom-right-radius: 0 !important; 215 | } 216 | 217 | div.DTFC_RightBodyWrapper table, 218 | div.DTFC_LeftBodyWrapper table { 219 | margin-bottom: 0 !important; 220 | border-top: none; 221 | } 222 | 223 | div.DTFC_RightBodyWrapper tbody tr:first-child th, 224 | div.DTFC_RightBodyWrapper tbody tr:first-child td, 225 | div.DTFC_LeftBodyWrapper tbody tr:first-child th, 226 | div.DTFC_LeftBodyWrapper tbody tr:first-child td { 227 | border-top: none; 228 | } 229 | 230 | div.DTFC_RightFootWrapper table, 231 | div.DTFC_LeftFootWrapper table { 232 | border-top: none; 233 | } -------------------------------------------------------------------------------- /src/main/resources/static/admin/assets/js/jquery.metisMenu.js: -------------------------------------------------------------------------------- 1 | ;(function ($, window, document, undefined) { 2 | 3 | var pluginName = "metisMenu", 4 | defaults = { 5 | toggle: true 6 | }; 7 | 8 | function Plugin(element, options) { 9 | this.element = element; 10 | this.settings = $.extend({}, defaults, options); 11 | this._defaults = defaults; 12 | this._name = pluginName; 13 | this.init(); 14 | } 15 | 16 | Plugin.prototype = { 17 | init: function () { 18 | 19 | var $this = $(this.element), 20 | $toggle = this.settings.toggle; 21 | 22 | $this.find('li.active').has('ul').children('ul').addClass('collapse in'); 23 | $this.find('li').not('.active').has('ul').children('ul').addClass('collapse'); 24 | 25 | $this.find('li').has('ul').children('a').on('click', function (e) { 26 | e.preventDefault(); 27 | 28 | $(this).parent('li').toggleClass('active').children('ul').collapse('toggle'); 29 | 30 | if ($toggle) { 31 | $(this).parent('li').siblings().removeClass('active').children('ul.in').collapse('hide'); 32 | } 33 | }); 34 | } 35 | }; 36 | 37 | $.fn[ pluginName ] = function (options) { 38 | return this.each(function () { 39 | if (!$.data(this, "plugin_" + pluginName)) { 40 | $.data(this, "plugin_" + pluginName, new Plugin(this, options)); 41 | } 42 | }); 43 | }; 44 | 45 | })(jQuery, window, document); 46 | -------------------------------------------------------------------------------- /src/main/resources/static/admin/assets/js/morris/morris-0.4.3.min.css: -------------------------------------------------------------------------------- 1 | .morris-hover{position:absolute;z-index:1000;}.morris-hover.morris-default-style{border-radius:10px;padding:6px;color:#666;background:rgba(255, 255, 255, 0.8);border:solid 2px rgba(230, 230, 230, 0.8);font-family:sans-serif;font-size:12px;text-align:center;}.morris-hover.morris-default-style .morris-hover-row-label{font-weight:bold;margin:0.25em 0;} 2 | .morris-hover.morris-default-style .morris-hover-point{white-space:nowrap;margin:0.1em 0;} -------------------------------------------------------------------------------- /src/main/resources/static/admin/assets/js/pages/category.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function() { 2 | // 填充浏览统计数据 3 | $.ajax({ 4 | url: "http://10.2.3.235:80/api/category/list", 5 | type: "GET", 6 | dataType: "json", 7 | success: function(json) { 8 | $.each(json, function(i, item) { 9 | $('#tbody-categoris').append( 10 | '' + +item.id + 11 | '' + item.name + 12 | '' + item.number + 13 | '' + item.createBy + 14 | '' + item.modifiedBy + 15 | ''); 16 | $('#select-category').append( 17 | '' 18 | ); 19 | }); 20 | $('#dataTables-categoris').dataTable(); 21 | } 22 | }); 23 | }); 24 | 25 | // 删除按钮点击事件 26 | function deleteCategory(id) { 27 | $('#confirmBtn').attr("categoryId", id); 28 | $('#myModal').modal(); 29 | }; 30 | 31 | // 确认删除按钮点击事件 32 | $('#confirmBtn').click(function() { 33 | var id = $(this).attr("categoryId"); 34 | $.ajax({ 35 | type: "DELETE", 36 | url: "http://10.2.3.235:80/admin/category/" + id, 37 | success: function() { 38 | // 刷新页面 39 | location.reload(); 40 | } 41 | }); 42 | }); 43 | 44 | // 增加分类按钮点击事件 45 | $('#addCategoryBtn').click(function() { 46 | var categoryName = $('#addName').val(); 47 | var json = { 48 | name: categoryName 49 | }; 50 | $.ajax({ 51 | type: "POST", 52 | dataType: "json", 53 | contentType: "application/json;charset=utf-8", 54 | url: "http://10.2.3.235:80/admin/category", 55 | data: JSON.stringify(json), 56 | success: function() { 57 | // 刷新页面 58 | location.reload(); 59 | }, 60 | error: function() { 61 | location.reload(); 62 | } 63 | }); 64 | }); 65 | 66 | // 更新分类点击事件 67 | $('#updateCategoryBtn').click(function() { 68 | var categoryId = $('#select-category option:selected').attr("categoryId"); 69 | var categoryName = $('#updateName').val(); 70 | var categoryJson = { 71 | id: categoryId, 72 | name: categoryName 73 | }; 74 | $.ajax({ 75 | type: "PUT", 76 | url: "http://10.2.3.235:80/admin/category/" + categoryId, 77 | data: JSON.stringify(categoryJson), 78 | dataType: "json", 79 | contentType: "application/json;charset=utf-8", 80 | success: function() { 81 | // 刷新页面 82 | location.reload(); 83 | }, 84 | error: function() { 85 | $('#updateName').val(""); 86 | location.reload(); 87 | } 88 | }) 89 | }) -------------------------------------------------------------------------------- /src/main/resources/static/admin/assets/js/pages/commont.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function() { 2 | // 填充文章列表数据 3 | $.ajax({ 4 | type: "get", 5 | url: "http://10.2.3.235:80/api/article/list", 6 | dataType: "json", 7 | contentType: "application/json;charset=utf-8", 8 | success: function(json) { 9 | $.each(json, function(i, item) { 10 | if(i == 0) { 11 | // 默认填充第一篇文章的评论信息 12 | addCommentList(item.id) 13 | } 14 | $('#articleList').append(''); 15 | }); 16 | // alert(firstArticleId); 17 | } 18 | }); 19 | }); 20 | 21 | // 根据ID填充评论列表的信息 22 | function addCommentList(id) { 23 | $.ajax({ 24 | type: "get", 25 | url: "http://10.2.3.235:80/api/comment/article/" + id, 26 | dataType: "json", 27 | contentType: "application/json;charset=utf-8", 28 | success: function(json) { 29 | // 先要清空原来的数据 30 | $('#tbody-comments').html(""); 31 | $.each(json, function(i, item) { 32 | $('#tbody-comments').append( 33 | '' + +item.id + 34 | '' + item.content + 35 | '' + item.name + 36 | '' + item.email + 37 | '' + item.ip + 38 | '' + item.createBy + 39 | ''); 40 | }); 41 | $('#dataTables-comments').dataTable(); 42 | } 43 | }); 44 | } 45 | 46 | // 监听文章Select改变,改变注入相应的评论 47 | document.getElementById("articleList").onchange = function() { 48 | var articleId = $('#articleList option:selected').attr("articleId"); 49 | // alert(categoryId); 50 | addCommentList(articleId); 51 | }; 52 | 53 | // 删除按钮点击事件 54 | function deleteArticleComment(id) { 55 | $('#confirmBtn').attr("articleCommentId", id); 56 | $('#myModal').modal(); 57 | }; 58 | 59 | // 确认删除按钮点击事件 60 | $('#confirmBtn').click(function() { 61 | var id = $(this).attr("articleCommentId"); 62 | // alert(id); 63 | $.ajax({ 64 | type: "DELETE", 65 | url: "http://10.2.3.235:80/admin/comment/article/" + id, 66 | success: function() { 67 | // 刷新页面 68 | location.reload(); 69 | }, 70 | error: function() { 71 | location.reload(); 72 | } 73 | }); 74 | }); -------------------------------------------------------------------------------- /src/main/resources/static/admin/assets/js/pages/index.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function () { 2 | 3 | // 填充浏览统计数据 4 | $.ajax({ 5 | url: "http://10.2.3.235:80/admin/sys/view", 6 | type: "GET", 7 | dataType: "json", 8 | success: function (json) { 9 | $('#count-visits').append(json.length) 10 | 11 | $.each(json, function (i, item) { 12 | $('#tbody-visits').append( 13 | '' + item.id + 14 | '' + item.ip + 15 | '' + item.createBy + ''); 16 | }); 17 | $('#dataTables-visits').dataTable(); 18 | } 19 | }); 20 | 21 | // 填充日志统计数据 22 | $.ajax({ 23 | url: "http://10.2.3.235:80/admin/sys/log", 24 | type: "GET", 25 | dataType: "json", 26 | success: function (json) { 27 | $('#count-logs').append(json.length) 28 | $.each(json, function (i, item) { 29 | $('#tbody-logs').append( 30 | '' + item.id + 31 | '' + item.ip + 32 | '' + item.createBy + 33 | '' + item.remark + 34 | '' + item.operateUrl + 35 | '' + item.operateBy + ''); 36 | }); 37 | $('#dataTables-logs').dataTable(); 38 | } 39 | }); 40 | 41 | // 填充评论统计数据 42 | $.ajax({ 43 | url: "http://10.2.3.235:80/api/comment/list", 44 | type: "GET", 45 | dataType: "json", 46 | success: function (json) { 47 | $('#count-comments').append(json.length) 48 | $.each(json, function (i, item) { 49 | $('#tbody-comments').append( 50 | '' + item.id + 51 | '' + item.content + 52 | '' + item.createBy + 53 | '' + item.name + 54 | '' + item.ip + 55 | '' + item.isEffective + 56 | ''); 57 | 58 | }); 59 | $('#dataTables-comments').dataTable(); 60 | } 61 | }); 62 | 63 | }); 64 | 65 | // 删除评论 66 | function deleteComment(id) { 67 | $('#confirmBtn').attr("commentId", id); 68 | $('#myModal').modal(); 69 | }; 70 | 71 | // 确认删除留言点击事件 72 | $('#confirmBtn').click(function () { 73 | var id = $(this).attr("commentId"); 74 | $.ajax({ 75 | type: "DELETE", 76 | url: "http://10.2.3.235:80/admin/comment/" + id, 77 | success: function () { 78 | // 刷新页面 79 | location.reload(); 80 | } 81 | }); 82 | }); -------------------------------------------------------------------------------- /src/main/resources/static/article.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | wmyskxz个人博客 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 |
25 | 26 |
27 | 28 | 29 |
30 |

这里是文章的标题

31 |
32 | 33 |
34 |
时间:这里是文章创建时间
35 |
36 | 37 |
38 | 39 |
40 | 41 |
42 | 43 |
44 | 45 | 46 |
47 | 48 |
49 |
50 |
51 | 52 | 53 |
54 |
55 |
56 | 新增评论 57 |
58 |
59 | 60 | 61 | 62 | 63 | 64 |
65 |
66 | 67 |
68 | 69 |
70 |
71 | 72 |
73 | 74 | 75 | 76 | 77 | 101 | 102 | 103 | 104 | 127 | 128 | 129 |
130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | -------------------------------------------------------------------------------- /src/main/resources/static/blog.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | wmyskxz个人博客 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 |
25 |
26 | 全部 27 | 32 |
33 | 34 |
35 | 46 |
47 |
48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /src/main/resources/static/css/about.css: -------------------------------------------------------------------------------- 1 | #titu { 2 | width: 100%; 3 | } 4 | 5 | #content { 6 | width: 60%; 7 | margin: 0 auto 5px auto; 8 | } 9 | 10 | /*.comment { 11 | margin-top: 60px; 12 | }*/ 13 | 14 | .commentList { 15 | border-top: 2px rgb(231, 231, 231) solid; 16 | /*padding-top: 10px;*/ 17 | /*margin-top: 60px;*/ 18 | margin-bottom: 20px; 19 | } 20 | 21 | .commentName { 22 | padding-top: 10px; 23 | } 24 | 25 | .commentTime { 26 | padding-top: 10px; 27 | float: right; 28 | } 29 | 30 | .commentContent { 31 | margin-top: 5px; 32 | } 33 | 34 | .comment { 35 | padding-bottom: 5px; 36 | border-bottom: 2px rgb(231, 231, 231) dashed; 37 | } 38 | 39 | /* 关于信息 */ 40 | 41 | .aboutInfo { 42 | margin-top: 30px; 43 | height: 400px; 44 | width: auto; 45 | margin-bottom: 60px; 46 | } 47 | 48 | .aboutInfo .leftInfo { 49 | float: left; 50 | width: 30%; 51 | } 52 | 53 | .aboutInfo .leftInfo img { 54 | width: 100%; 55 | border-radius: 6px !important; 56 | } 57 | 58 | .aboutInfo .leftInfo h2 { 59 | font-weight: bold; 60 | } 61 | 62 | .aboutInfo .leftInfo h4 { 63 | color: #666; 64 | } 65 | 66 | .aboutInfo .rightInfo { 67 | float: right; 68 | width: 70%; 69 | } 70 | 71 | .aboutArticle { 72 | border: 1px #D1D5DA solid; 73 | margin: 8px 0px 8px 20px; 74 | padding: 15px; 75 | } 76 | 77 | .rightInfo .title { 78 | font-size: 20px; 79 | color: #0366d6; 80 | margin-bottom: 5px; 81 | } 82 | 83 | .rightInfo h2 { 84 | top: 0; 85 | margin-left: 20px; 86 | } -------------------------------------------------------------------------------- /src/main/resources/static/css/article.css: -------------------------------------------------------------------------------- 1 | p { 2 | font-size: 15px; 3 | line-height: 28px; 4 | color: #595959; 5 | font-family: 微软雅黑 6 | } 7 | 8 | strong, 9 | b { 10 | color: #BF360C; 11 | } 12 | 13 | em, 14 | i { 15 | color: #009688; 16 | } 17 | 18 | big { 19 | font-size: 22px; 20 | color: #009688; 21 | font-weight: bold; 22 | vertical-align: middle; 23 | border-bottom: 1px solid #eee; 24 | } 25 | 26 | small { 27 | font-size: 12px; 28 | line-height: 22px; 29 | } 30 | 31 | hr { 32 | border-bottom: 0.05em dotted #eee; 33 | margin: 10px auto; 34 | } 35 | 36 | p { 37 | margin: 15px 5px !important; 38 | } 39 | 40 | table, 41 | pre, 42 | dl, 43 | blockquote, 44 | q, 45 | ul, 46 | ol { 47 | margin: 10px 5px; 48 | } 49 | 50 | ul, 51 | ol { 52 | padding-left: 10px; 53 | } 54 | 55 | li { 56 | margin: 5px; 57 | } 58 | 59 | lip { 60 | margin: 5px 0 !important; 61 | } 62 | 63 | ulul, 64 | ulol, 65 | olul, 66 | olol { 67 | margin: 0; 68 | padding-left: 10px; 69 | } 70 | 71 | olol, 72 | ulol { 73 | list-style-type: lower-roman; 74 | } 75 | 76 | ululol, 77 | ulolol, 78 | olulol, 79 | ololol { 80 | list-style-type: lower-alpha; 81 | } 82 | 83 | dl { 84 | padding: 0; 85 | } 86 | 87 | dldt { 88 | font-size: 1em; 89 | font-weight: bold; 90 | font-style: italic; 91 | } 92 | 93 | dldd { 94 | margin: 0 0 10px; 95 | padding: 0 10px; 96 | } 97 | 98 | blockquote, 99 | q { 100 | border-left: 3px solid #009688; 101 | padding: 0 10px; 102 | color: #777; 103 | quotes: none; 104 | } 105 | 106 | blockquote::before, 107 | blockquote::after, 108 | q::before, 109 | q::after { 110 | content: none; 111 | } 112 | 113 | h1, 114 | h2, 115 | h3, 116 | h4, 117 | h5, 118 | h6 { 119 | margin: 20px 0 10px !important; 120 | padding: 0 !important; 121 | font-weight: bold !important; 122 | color: #009688 !important; 123 | } 124 | 125 | h1 { 126 | font-size: 26px; 127 | } 128 | 129 | h2 { 130 | font-size: 24px; 131 | } 132 | 133 | h3 { 134 | font-size: 20px; 135 | } 136 | 137 | h4 { 138 | font-size: 18px; 139 | } 140 | 141 | h5 { 142 | font-size: 16px; 143 | } 144 | 145 | h6 { 146 | font-size: 16px; 147 | color: #777; 148 | } 149 | 150 | table { 151 | padding: 0; 152 | border-collapse: collapse; 153 | border-spacing: 0; 154 | font-size: 1em; 155 | font: inherit; 156 | border: 0; 157 | } 158 | 159 | tbody { 160 | margin: 0; 161 | padding: 0; 162 | border: 0; 163 | } 164 | 165 | tabletr { 166 | border: 0; 167 | border-top: 1px solid #CCC; 168 | background-color: white; 169 | margin: 0; 170 | padding: 0; 171 | } 172 | 173 | tabletr:nth-child(2n) { 174 | background-color: #F8F8F8; 175 | } 176 | 177 | tabletrth, 178 | tabletrtd { 179 | font-size: 16px; 180 | border: 1px solid #CCC; 181 | margin: 0; 182 | padding: 5px 10px; 183 | } 184 | 185 | tabletrth { 186 | font-weight: bold; 187 | background-color: #F0F0F0; 188 | } 189 | 190 | img { 191 | display: block; 192 | text-align: center; 193 | margin: 0 auto; 194 | max-width: 100%; 195 | } 196 | 197 | /*——————————————分割线——————————————*/ 198 | 199 | #content { 200 | width: 60%; 201 | margin: 60px auto; 202 | } 203 | 204 | #articleTitle { 205 | padding-top: 20px; 206 | color: #000000 !important; 207 | } 208 | 209 | #articleCreateBy { 210 | color: #000000 !important; 211 | } 212 | 213 | .articlePicture { 214 | height: 400px; 215 | width: 100%; 216 | overflow: hidden; 217 | } 218 | 219 | .articlePicture img { 220 | height: 400px; 221 | width: 100%; 222 | object-fit: cover; 223 | } 224 | 225 | #articleContent { 226 | margin-top: 40px; 227 | } 228 | 229 | #backBtn { 230 | height: 30px; 231 | position: absolute; 232 | right: 20%; 233 | } 234 | 235 | #backBtn:hover { 236 | cursor: pointer !important; 237 | color: cornflowerblue; 238 | } 239 | 240 | .commentList { 241 | border-top: 2px rgb(231, 231, 231) solid; 242 | /*padding-top: 10px;*/ 243 | /*margin-top: 60px;*/ 244 | margin-bottom: 20px; 245 | } 246 | 247 | .commentName { 248 | padding-top: 10px; 249 | } 250 | 251 | .commentTime { 252 | padding-top: 10px; 253 | float: right; 254 | } 255 | 256 | .commentContent { 257 | margin-top: 5px; 258 | } 259 | 260 | .comments { 261 | padding-bottom: 5px; 262 | border-bottom: 2px rgb(231, 231, 231) dashed; 263 | } -------------------------------------------------------------------------------- /src/main/resources/static/css/blog.css: -------------------------------------------------------------------------------- 1 | #content { 2 | margin-top: 60px; 3 | min-height: 640px; 4 | } 5 | 6 | #category { 7 | width: 25%; 8 | float: left; 9 | text-align: right; 10 | font-size: 16px; 11 | } 12 | 13 | #category a { 14 | display: block; 15 | color: #000000; 16 | padding-bottom: 15px; 17 | } 18 | 19 | #category a:hover { 20 | font-size: 18px; 21 | font-weight: bold; 22 | text-decoration: none; 23 | } 24 | 25 | #articleInfos { 26 | width: 60%; 27 | padding-left: 140px; 28 | overflow: hidden; 29 | display: block; 30 | } 31 | 32 | .articleInfo { 33 | width: 180px; 34 | float: left; 35 | margin: 0px 30px 30px 30px; 36 | /*padding: 3px;*/ 37 | } 38 | 39 | .articleInfo:hover { 40 | cursor: pointer; 41 | /*padding: 0px;*/ 42 | /*border: 3px #000000 solid;*/ 43 | } 44 | 45 | .articleInfo img { 46 | object-fit: cover; 47 | height: 180px; 48 | width: 180px; 49 | } 50 | 51 | .articleTitle{ 52 | width: 180px; 53 | } -------------------------------------------------------------------------------- /src/main/resources/static/css/bootstrap/3.3.6/bootstrap-theme.min.css.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["less/theme.less","less/mixins/vendor-prefixes.less","less/mixins/gradients.less","less/mixins/reset-filter.less"],"names":[],"mappings":";;;;AAmBA,YAAA,aAAA,UAAA,aAAA,aAAA,aAME,YAAA,EAAA,KAAA,EAAA,eC2CA,mBAAA,MAAA,EAAA,IAAA,EAAA,sBAAA,EAAA,IAAA,IAAA,iBACQ,WAAA,MAAA,EAAA,IAAA,EAAA,sBAAA,EAAA,IAAA,IAAA,iBDvCR,mBAAA,mBAAA,oBAAA,oBAAA,iBAAA,iBAAA,oBAAA,oBAAA,oBAAA,oBAAA,oBAAA,oBCsCA,mBAAA,MAAA,EAAA,IAAA,IAAA,iBACQ,WAAA,MAAA,EAAA,IAAA,IAAA,iBDlCR,qBAAA,sBAAA,sBAAA,uBAAA,mBAAA,oBAAA,sBAAA,uBAAA,sBAAA,uBAAA,sBAAA,uBAAA,+BAAA,gCAAA,6BAAA,gCAAA,gCAAA,gCCiCA,mBAAA,KACQ,WAAA,KDlDV,mBAAA,oBAAA,iBAAA,oBAAA,oBAAA,oBAuBI,YAAA,KAyCF,YAAA,YAEE,iBAAA,KAKJ,aErEI,YAAA,EAAA,IAAA,EAAA,KACA,iBAAA,iDACA,iBAAA,4CAAA,iBAAA,qEAEA,iBAAA,+CCnBF,OAAA,+GH4CA,OAAA,0DACA,kBAAA,SAuC2C,aAAA,QAA2B,aAAA,KArCtE,mBAAA,mBAEE,iBAAA,QACA,oBAAA,EAAA,MAGF,oBAAA,oBAEE,iBAAA,QACA,aAAA,QAMA,sBAAA,6BAAA,4BAAA,6BAAA,4BAAA,4BAAA,uBAAA,8BAAA,6BAAA,8BAAA,6BAAA,6BAAA,gCAAA,uCAAA,sCAAA,uCAAA,sCAAA,sCAME,iBAAA,QACA,iBAAA,KAgBN,aEtEI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDAEA,OAAA,+GCnBF,OAAA,0DH4CA,kBAAA,SACA,aAAA,QAEA,mBAAA,mBAEE,iBAAA,QACA,oBAAA,EAAA,MAGF,oBAAA,oBAEE,iBAAA,QACA,aAAA,QAMA,sBAAA,6BAAA,4BAAA,6BAAA,4BAAA,4BAAA,uBAAA,8BAAA,6BAAA,8BAAA,6BAAA,6BAAA,gCAAA,uCAAA,sCAAA,uCAAA,sCAAA,sCAME,iBAAA,QACA,iBAAA,KAiBN,aEvEI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDAEA,OAAA,+GCnBF,OAAA,0DH4CA,kBAAA,SACA,aAAA,QAEA,mBAAA,mBAEE,iBAAA,QACA,oBAAA,EAAA,MAGF,oBAAA,oBAEE,iBAAA,QACA,aAAA,QAMA,sBAAA,6BAAA,4BAAA,6BAAA,4BAAA,4BAAA,uBAAA,8BAAA,6BAAA,8BAAA,6BAAA,6BAAA,gCAAA,uCAAA,sCAAA,uCAAA,sCAAA,sCAME,iBAAA,QACA,iBAAA,KAkBN,UExEI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDAEA,OAAA,+GCnBF,OAAA,0DH4CA,kBAAA,SACA,aAAA,QAEA,gBAAA,gBAEE,iBAAA,QACA,oBAAA,EAAA,MAGF,iBAAA,iBAEE,iBAAA,QACA,aAAA,QAMA,mBAAA,0BAAA,yBAAA,0BAAA,yBAAA,yBAAA,oBAAA,2BAAA,0BAAA,2BAAA,0BAAA,0BAAA,6BAAA,oCAAA,mCAAA,oCAAA,mCAAA,mCAME,iBAAA,QACA,iBAAA,KAmBN,aEzEI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDAEA,OAAA,+GCnBF,OAAA,0DH4CA,kBAAA,SACA,aAAA,QAEA,mBAAA,mBAEE,iBAAA,QACA,oBAAA,EAAA,MAGF,oBAAA,oBAEE,iBAAA,QACA,aAAA,QAMA,sBAAA,6BAAA,4BAAA,6BAAA,4BAAA,4BAAA,uBAAA,8BAAA,6BAAA,8BAAA,6BAAA,6BAAA,gCAAA,uCAAA,sCAAA,uCAAA,sCAAA,sCAME,iBAAA,QACA,iBAAA,KAoBN,YE1EI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDAEA,OAAA,+GCnBF,OAAA,0DH4CA,kBAAA,SACA,aAAA,QAEA,kBAAA,kBAEE,iBAAA,QACA,oBAAA,EAAA,MAGF,mBAAA,mBAEE,iBAAA,QACA,aAAA,QAMA,qBAAA,4BAAA,2BAAA,4BAAA,2BAAA,2BAAA,sBAAA,6BAAA,4BAAA,6BAAA,4BAAA,4BAAA,+BAAA,sCAAA,qCAAA,sCAAA,qCAAA,qCAME,iBAAA,QACA,iBAAA,KA2BN,eAAA,WClCE,mBAAA,EAAA,IAAA,IAAA,iBACQ,WAAA,EAAA,IAAA,IAAA,iBD2CV,0BAAA,0BE3FI,iBAAA,QACA,iBAAA,oDACA,iBAAA,+CAAA,iBAAA,wEACA,iBAAA,kDACA,OAAA,+GF0FF,kBAAA,SAEF,yBAAA,+BAAA,+BEhGI,iBAAA,QACA,iBAAA,oDACA,iBAAA,+CAAA,iBAAA,wEACA,iBAAA,kDACA,OAAA,+GFgGF,kBAAA,SASF,gBE7GI,iBAAA,iDACA,iBAAA,4CACA,iBAAA,qEAAA,iBAAA,+CACA,OAAA,+GACA,OAAA,0DCnBF,kBAAA,SH+HA,cAAA,ICjEA,mBAAA,MAAA,EAAA,IAAA,EAAA,sBAAA,EAAA,IAAA,IAAA,iBACQ,WAAA,MAAA,EAAA,IAAA,EAAA,sBAAA,EAAA,IAAA,IAAA,iBD6DV,sCAAA,oCE7GI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SD2CF,mBAAA,MAAA,EAAA,IAAA,IAAA,iBACQ,WAAA,MAAA,EAAA,IAAA,IAAA,iBD0EV,cAAA,iBAEE,YAAA,EAAA,IAAA,EAAA,sBAIF,gBEhII,iBAAA,iDACA,iBAAA,4CACA,iBAAA,qEAAA,iBAAA,+CACA,OAAA,+GACA,OAAA,0DCnBF,kBAAA,SHkJA,cAAA,IAHF,sCAAA,oCEhII,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SD2CF,mBAAA,MAAA,EAAA,IAAA,IAAA,gBACQ,WAAA,MAAA,EAAA,IAAA,IAAA,gBDgFV,8BAAA,iCAYI,YAAA,EAAA,KAAA,EAAA,gBAKJ,qBAAA,kBAAA,mBAGE,cAAA,EAqBF,yBAfI,mDAAA,yDAAA,yDAGE,MAAA,KE7JF,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,UFqKJ,OACE,YAAA,EAAA,IAAA,EAAA,qBC3HA,mBAAA,MAAA,EAAA,IAAA,EAAA,sBAAA,EAAA,IAAA,IAAA,gBACQ,WAAA,MAAA,EAAA,IAAA,EAAA,sBAAA,EAAA,IAAA,IAAA,gBDsIV,eEtLI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SF8KF,aAAA,QAKF,YEvLI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SF8KF,aAAA,QAMF,eExLI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SF8KF,aAAA,QAOF,cEzLI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SF8KF,aAAA,QAeF,UEjMI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SFuMJ,cE3MI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SFwMJ,sBE5MI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SFyMJ,mBE7MI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SF0MJ,sBE9MI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SF2MJ,qBE/MI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SF+MJ,sBElLI,iBAAA,yKACA,iBAAA,oKACA,iBAAA,iKFyLJ,YACE,cAAA,IC9KA,mBAAA,EAAA,IAAA,IAAA,iBACQ,WAAA,EAAA,IAAA,IAAA,iBDgLV,wBAAA,8BAAA,8BAGE,YAAA,EAAA,KAAA,EAAA,QEnOE,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SFiOF,aAAA,QALF,+BAAA,qCAAA,qCAQI,YAAA,KAUJ,OCnME,mBAAA,EAAA,IAAA,IAAA,gBACQ,WAAA,EAAA,IAAA,IAAA,gBD4MV,8BE5PI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SFyPJ,8BE7PI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SF0PJ,8BE9PI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SF2PJ,2BE/PI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SF4PJ,8BEhQI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SF6PJ,6BEjQI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SFoQJ,MExQI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SFsQF,aAAA,QC3NA,mBAAA,MAAA,EAAA,IAAA,IAAA,gBAAA,EAAA,IAAA,EAAA,qBACQ,WAAA,MAAA,EAAA,IAAA,IAAA,gBAAA,EAAA,IAAA,EAAA"} -------------------------------------------------------------------------------- /src/main/resources/static/css/bootstrap/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wmyskxz/MyBlog/810f0049b4f1fcce836cd38b10eb6378675fe277/src/main/resources/static/css/bootstrap/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /src/main/resources/static/css/bootstrap/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wmyskxz/MyBlog/810f0049b4f1fcce836cd38b10eb6378675fe277/src/main/resources/static/css/bootstrap/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /src/main/resources/static/css/bootstrap/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wmyskxz/MyBlog/810f0049b4f1fcce836cd38b10eb6378675fe277/src/main/resources/static/css/bootstrap/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /src/main/resources/static/css/bootstrap/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wmyskxz/MyBlog/810f0049b4f1fcce836cd38b10eb6378675fe277/src/main/resources/static/css/bootstrap/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /src/main/resources/static/css/darkula.css: -------------------------------------------------------------------------------- 1 | /* 2 | Deprecated due to a typo in the name and left here for compatibility purpose only. 3 | Please use darcula.css instead. 4 | */ 5 | 6 | @import url('darcula.css'); 7 | -------------------------------------------------------------------------------- /src/main/resources/static/css/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: "微软雅黑"; 3 | font-size: 16px; 4 | } 5 | 6 | #content { 7 | max-height: 640px; 8 | /*width: 100%;*/ 9 | background-size: cover; 10 | } 11 | 12 | #articlePicture img { 13 | height: 640px; 14 | object-fit: cover; 15 | width: 100%; 16 | } 17 | 18 | .smallArticlePictures { 19 | right: 6%; 20 | top: 620px; 21 | position: absolute; 22 | width: 600px; 23 | height: 110px; 24 | } 25 | 26 | .smallPictures { 27 | float: left; 28 | margin-right: 10px; 29 | width: 110px; 30 | height: 110px; 31 | overflow: hidden; 32 | /*background-size: cover; 33 | background-repeat: no-repeat; 34 | background-position: 50% 50%;*/ 35 | } 36 | 37 | .smallPictures img { 38 | object-fit: cover; 39 | width: 110px; 40 | height: 110px; 41 | } 42 | 43 | .smallPictures:hover { 44 | border: 3px #FFFFFF solid; 45 | } 46 | 47 | #footer { 48 | height: 70px; 49 | } 50 | 51 | #articleInfo { 52 | position: absolute; 53 | width: 50%; 54 | left: 16%; 55 | top: 400px; 56 | color: #000000; 57 | } 58 | 59 | #showArticle { 60 | width: 100px; 61 | background: transparent; 62 | border-radius: 0px; 63 | border: 1px #000000 solid; 64 | } 65 | 66 | #showArticle:hover { 67 | color: white; 68 | } 69 | 70 | .icon { 71 | height: 36px; 72 | margin: 20px 5px 0px 0px; 73 | } 74 | 75 | #info { 76 | margin: 5px 0px 20px 20px; 77 | color: rgb(198, 198, 198); 78 | font-size: 12px; 79 | } -------------------------------------------------------------------------------- /src/main/resources/static/css/prism/prism.css: -------------------------------------------------------------------------------- 1 | /* PrismJS 1.15.0 2 | https://prismjs.com/download.html#themes=prism-tomorrow&languages=markup+css+clike+javascript */ 3 | /** 4 | * prism.js tomorrow night eighties for JavaScript, CoffeeScript, CSS and HTML 5 | * Based on https://github.com/chriskempson/tomorrow-theme 6 | * @author Rose Pritchard 7 | */ 8 | 9 | code[class*="language-"], 10 | pre[class*="language-"] { 11 | color: #ccc; 12 | background: none; 13 | font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; 14 | text-align: left; 15 | white-space: pre; 16 | word-spacing: normal; 17 | word-break: normal; 18 | word-wrap: normal; 19 | line-height: 1.5; 20 | 21 | -moz-tab-size: 4; 22 | -o-tab-size: 4; 23 | tab-size: 4; 24 | 25 | -webkit-hyphens: none; 26 | -moz-hyphens: none; 27 | -ms-hyphens: none; 28 | hyphens: none; 29 | 30 | } 31 | 32 | /* Code blocks */ 33 | pre[class*="language-"] { 34 | padding: 1em; 35 | margin: .5em 0; 36 | overflow: auto; 37 | } 38 | 39 | :not(pre) > code[class*="language-"], 40 | pre[class*="language-"] { 41 | background: #2d2d2d; 42 | } 43 | 44 | /* Inline code */ 45 | :not(pre) > code[class*="language-"] { 46 | padding: .1em; 47 | border-radius: .3em; 48 | white-space: normal; 49 | } 50 | 51 | .token.comment, 52 | .token.block-comment, 53 | .token.prolog, 54 | .token.doctype, 55 | .token.cdata { 56 | color: #999; 57 | } 58 | 59 | .token.punctuation { 60 | color: #ccc; 61 | } 62 | 63 | .token.tag, 64 | .token.attr-name, 65 | .token.namespace, 66 | .token.deleted { 67 | color: #e2777a; 68 | } 69 | 70 | .token.function-name { 71 | color: #6196cc; 72 | } 73 | 74 | .token.boolean, 75 | .token.number, 76 | .token.function { 77 | color: #f08d49; 78 | } 79 | 80 | .token.property, 81 | .token.class-name, 82 | .token.constant, 83 | .token.symbol { 84 | color: #f8c555; 85 | } 86 | 87 | .token.selector, 88 | .token.important, 89 | .token.atrule, 90 | .token.keyword, 91 | .token.builtin { 92 | color: #cc99cd; 93 | } 94 | 95 | .token.string, 96 | .token.char, 97 | .token.attr-value, 98 | .token.regex, 99 | .token.variable { 100 | color: #7ec699; 101 | } 102 | 103 | .token.operator, 104 | .token.entity, 105 | .token.url { 106 | color: #67cdcc; 107 | } 108 | 109 | .token.important, 110 | .token.bold { 111 | font-weight: bold; 112 | } 113 | .token.italic { 114 | font-style: italic; 115 | } 116 | 117 | .token.entity { 118 | cursor: help; 119 | } 120 | 121 | .token.inserted { 122 | color: green; 123 | } 124 | 125 | -------------------------------------------------------------------------------- /src/main/resources/static/error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 错误页面 7 | 8 | 98 | 99 | 100 | 101 |

102 | 106 |
107 | 108 |
109 |
    110 |
  • 不要返回吗 ?
  • 111 |
  • 确定不要返回吗 ?
  • 112 |
  • 真的真的确定不要返回吗 ?
  • 113 |
  • 好吧.还是随便你要不要真的确定返回吧 ! ~
  • 114 |
115 |
116 |
117 | 118 | 119 | -------------------------------------------------------------------------------- /src/main/resources/static/error/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 错误页面 7 | 8 | 98 | 99 | 100 | 101 |

102 | 106 |
107 | 108 |
109 |
    110 |
  • 不要返回吗 ?
  • 111 |
  • 确定不要返回吗 ?
  • 112 |
  • 真的真的确定不要返回吗 ?
  • 113 |
  • 好吧.还是随便你要不要真的确定返回吧 ! ~
  • 114 |
115 |
116 |
117 | 118 | 119 | -------------------------------------------------------------------------------- /src/main/resources/static/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wmyskxz/MyBlog/810f0049b4f1fcce836cd38b10eb6378675fe277/src/main/resources/static/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /src/main/resources/static/img/about/titu.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wmyskxz/MyBlog/810f0049b4f1fcce836cd38b10eb6378675fe277/src/main/resources/static/img/about/titu.jpg -------------------------------------------------------------------------------- /src/main/resources/static/img/blog-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wmyskxz/MyBlog/810f0049b4f1fcce836cd38b10eb6378675fe277/src/main/resources/static/img/blog-logo.png -------------------------------------------------------------------------------- /src/main/resources/static/img/head.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wmyskxz/MyBlog/810f0049b4f1fcce836cd38b10eb6378675fe277/src/main/resources/static/img/head.jpg -------------------------------------------------------------------------------- /src/main/resources/static/img/jianshu-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wmyskxz/MyBlog/810f0049b4f1fcce836cd38b10eb6378675fe277/src/main/resources/static/img/jianshu-icon.png -------------------------------------------------------------------------------- /src/main/resources/static/img/login/owl-login-arm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wmyskxz/MyBlog/810f0049b4f1fcce836cd38b10eb6378675fe277/src/main/resources/static/img/login/owl-login-arm.png -------------------------------------------------------------------------------- /src/main/resources/static/img/login/owl-login-arm@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wmyskxz/MyBlog/810f0049b4f1fcce836cd38b10eb6378675fe277/src/main/resources/static/img/login/owl-login-arm@2x.png -------------------------------------------------------------------------------- /src/main/resources/static/img/login/owl-login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wmyskxz/MyBlog/810f0049b4f1fcce836cd38b10eb6378675fe277/src/main/resources/static/img/login/owl-login.png -------------------------------------------------------------------------------- /src/main/resources/static/img/login/owl-login@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wmyskxz/MyBlog/810f0049b4f1fcce836cd38b10eb6378675fe277/src/main/resources/static/img/login/owl-login@2x.png -------------------------------------------------------------------------------- /src/main/resources/static/img/login/ph-owl-arm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wmyskxz/MyBlog/810f0049b4f1fcce836cd38b10eb6378675fe277/src/main/resources/static/img/login/ph-owl-arm.png -------------------------------------------------------------------------------- /src/main/resources/static/img/login/ph-owl-arm@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wmyskxz/MyBlog/810f0049b4f1fcce836cd38b10eb6378675fe277/src/main/resources/static/img/login/ph-owl-arm@2x.png -------------------------------------------------------------------------------- /src/main/resources/static/img/login/ph-owl-arml.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wmyskxz/MyBlog/810f0049b4f1fcce836cd38b10eb6378675fe277/src/main/resources/static/img/login/ph-owl-arml.png -------------------------------------------------------------------------------- /src/main/resources/static/img/login/ph-owl-arml@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wmyskxz/MyBlog/810f0049b4f1fcce836cd38b10eb6378675fe277/src/main/resources/static/img/login/ph-owl-arml@2x.png -------------------------------------------------------------------------------- /src/main/resources/static/img/login/signup-arm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wmyskxz/MyBlog/810f0049b4f1fcce836cd38b10eb6378675fe277/src/main/resources/static/img/login/signup-arm.png -------------------------------------------------------------------------------- /src/main/resources/static/img/login/signup-arm@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wmyskxz/MyBlog/810f0049b4f1fcce836cd38b10eb6378675fe277/src/main/resources/static/img/login/signup-arm@2x.png -------------------------------------------------------------------------------- /src/main/resources/static/img/wechat-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wmyskxz/MyBlog/810f0049b4f1fcce836cd38b10eb6378675fe277/src/main/resources/static/img/wechat-icon.png -------------------------------------------------------------------------------- /src/main/resources/static/img/zhihu-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wmyskxz/MyBlog/810f0049b4f1fcce836cd38b10eb6378675fe277/src/main/resources/static/img/zhihu-icon.png -------------------------------------------------------------------------------- /src/main/resources/static/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | wmyskxz个人博客 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 |
25 | 26 |
27 | 28 | 29 |
30 | 31 |
32 |

标题

33 |
34 | 35 | 36 |
37 |

简介特别多特别多特别多特别多特别多特别多特别多特别多特别多特别多特别多特别多特别多特别多特别多特别多

38 |
39 | 40 | 41 | 42 |
43 | 44 | 45 |
46 |
47 | 48 |
49 |
50 | 51 |
52 |
53 | 54 |
55 |
56 | 57 |
58 |
59 | 60 |
61 |
62 | 63 |
64 | 65 | 66 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /src/main/resources/static/js/about.js: -------------------------------------------------------------------------------- 1 | window.onload = function () { 2 | // 获取留言信息 3 | $.ajax({ 4 | url: "http://10.2.3.235:80/api/comment/list", 5 | type: "GET", 6 | dataType: "json", 7 | success: function (json) { 8 | $.each(json, function (i, item) { 9 | $('#commentList').append( 10 | '
' + 11 | '
' + 12 | '' + item.content + '' + 13 | '
' 14 | ); 15 | }); 16 | } 17 | }) 18 | }; 19 | 20 | // 增加留言 21 | $('#addComment').click(function () { 22 | var name = $('#commentName').val(); 23 | var email = $('#commentEmail').val(); 24 | var content = $('#commentContent').val(); 25 | 26 | // 判断是否为空 27 | if ("" == name || "" == content) { 28 | $('#modal').modal(); 29 | return; 30 | return; 31 | } 32 | 33 | // 不为空才能增加 34 | var comment = { 35 | name: name, 36 | email: email, 37 | content: content 38 | } 39 | // 提交AJAX请求 40 | $.ajax({ 41 | url: "http://10.2.3.235:80/api/comment/", 42 | type: "POST", 43 | dataType: "json", 44 | contentType: "application/json;charset=utf-8", 45 | data: JSON.stringify(comment), 46 | success: function () { 47 | // 显示成功提示信息 48 | $('#addModal').modal(); 49 | }, 50 | error: function () { 51 | // 显示成功提示信息 52 | $('#addModal').modal(); 53 | } 54 | }) 55 | }); 56 | 57 | // 模态框确认按钮点击事件 58 | $('#addConfirmBtn').click(function () { 59 | // 刷新页面 60 | location.reload(); 61 | }); -------------------------------------------------------------------------------- /src/main/resources/static/js/article.js: -------------------------------------------------------------------------------- 1 | window.onload = function () { 2 | var articleId = getQueryVariable("articleId"); 3 | 4 | // 添加文章信息 5 | $.ajax({ 6 | type: "get", 7 | url: "http://10.2.3.235:80/api/article/" + articleId, 8 | dataType: "json", 9 | success: function (json) { 10 | // 解析json对象,并向页面添加数据 11 | 12 | $("#articleTitle").html(json.title); 13 | $("#articleCreateBy").html(json.createBy); 14 | $("#articleContent").html(json.content); 15 | Prism.highlightAll(); 16 | $("#articlePicture").attr("src", json.pictureUrl); 17 | } 18 | }); 19 | 20 | // 添加文章评论信息 21 | $.ajax({ 22 | type: "get", 23 | url: "http://10.2.3.235:80/api/comment/article/" + articleId, 24 | dataType: "json", 25 | success: function (json) { 26 | // 解析json对象,并向页面添加数据 27 | $.each(json, function (i, item) { 28 | $('#commentList').append( 29 | '
' + 30 | '
' + 31 | '' + item.content + '' + 32 | '
' 33 | ); 34 | }); 35 | } 36 | }) 37 | 38 | } 39 | 40 | // 获取网页中的参数 41 | function getQueryVariable(variable) { 42 | var query = window.location.search.substring(1); 43 | var vars = query.split("&"); 44 | for (var i = 0; i < vars.length; i++) { 45 | var pair = vars[i].split("="); 46 | if (pair[0] == variable) { 47 | return pair[1]; 48 | } 49 | } 50 | return (false); 51 | } 52 | 53 | // 增加评论 54 | $('#addComment').click(function () { 55 | var articleId = getQueryVariable("articleId"); 56 | var name = $('#commentName').val(); 57 | var email = $('#commentEmail').val(); 58 | var content = $('#commentContent').val(); 59 | 60 | // 判断是否为空 61 | if ("" == name || "" == content) { 62 | $('#modal').modal(); 63 | return; 64 | return; 65 | } 66 | 67 | // 不为空才能增加 68 | var comment = { 69 | name: name, 70 | email: email, 71 | content: content 72 | } 73 | // 提交AJAX请求 74 | $.ajax({ 75 | url: "http://10.2.3.235:80/api/comment/article/" + articleId, 76 | type: "POST", 77 | dataType: "json", 78 | contentType: "application/json;charset=utf-8", 79 | data: JSON.stringify(comment), 80 | success: function () { 81 | // 显示成功提示信息 82 | $('#addModal').modal(); 83 | }, 84 | error: function () { 85 | $('#addModal').modal(); 86 | } 87 | }) 88 | }); 89 | 90 | // 模态框确认按钮点击事件 91 | $('#addConfirmBtn').click(function () { 92 | // 刷新页面 93 | location.reload(); 94 | }); -------------------------------------------------------------------------------- /src/main/resources/static/js/blog.js: -------------------------------------------------------------------------------- 1 | // 页面初始化:填充数据 2 | window.onload = function () { 3 | $.ajax({ 4 | url: "http://10.2.3.235:80/api/category/list/", 5 | type: "GET", 6 | dataType: "json", 7 | success: function (json) { 8 | 9 | // 先填充分类信息 10 | $.each(json, function (i, item) { 11 | // 填充分类信息 12 | var categoryInfo = document.querySelector("#categoryInfo"); 13 | categoryInfo.content.querySelector("a").innerHTML = item.name + "(" + item.number + ")"; 14 | categoryInfo.content.querySelector("a").href = "?categoryId=" + item.id; 15 | document.getElementById("category").appendChild(categoryInfo.content.cloneNode(true)); 16 | }); 17 | 18 | // 判断当前分类情况 19 | var categoryId = getQueryVariable("categoryId"); 20 | // alert(categoryId); 21 | if (categoryId == false) { 22 | 23 | // 如果没有指定分类则获取全部文章 24 | showAllArticleInfo(); 25 | } else { 26 | // 有指定分类则显示指定分类下的文章 27 | showArticleByCategoryId(categoryId); 28 | } 29 | 30 | } 31 | }); 32 | }; 33 | 34 | // 获取网页中的参数 35 | function getQueryVariable(variable) { 36 | var query = window.location.search.substring(1); 37 | var vars = query.split("&"); 38 | for (var i = 0; i < vars.length; i++) { 39 | var pair = vars[i].split("="); 40 | if (pair[0] == variable) { 41 | return pair[1]; 42 | } 43 | } 44 | return (false); 45 | } 46 | 47 | // 显示全部文章信息 48 | function showAllArticleInfo() { 49 | 50 | $.ajax({ 51 | type: "get", 52 | url: "http://10.2.3.235:80/api/article/list", 53 | dataType: "json", 54 | success: function (json) { 55 | $.each(json, function (i, item) { 56 | // 填充文章信息 57 | var articleInfo = document.querySelector("#articleInfo"); 58 | articleInfo.content.querySelector("img").src = item.pictureUrl; 59 | if (item.top == true) { 60 | articleInfo.content.querySelector("h5").innerHTML = "[置顶]" + item.title; 61 | // articleInfo.content.querySelector("h5").style.fontWeight = "bold"; 62 | } else { 63 | articleInfo.content.querySelector("h5").innerHTML = item.title; 64 | } 65 | articleInfo.content.querySelector("h6").innerHTML = item.id; 66 | document.getElementById("articleInfos").appendChild(articleInfo.content.cloneNode(true)); 67 | 68 | }); 69 | } 70 | }); 71 | } 72 | 73 | // 显示指定分类下的文章列表 74 | function showArticleByCategoryId(id) { 75 | $.ajax({ 76 | type: "get", 77 | url: "http://10.2.3.235:80/api/article/list/sort/" + id, 78 | dataType: "json", 79 | success: function (json) { 80 | $.each(json, function (i, item) { 81 | // 填充文章信息 82 | var articleInfo = document.querySelector("#articleInfo"); 83 | articleInfo.content.querySelector("img").src = item.pictureUrl; 84 | if (item.top == true) { 85 | articleInfo.content.querySelector("h5").innerHTML = "[置顶]" + item.title; 86 | // articleInfo.content.querySelector("h5").style.fontWeight = "bold"; 87 | } else { 88 | articleInfo.content.querySelector("h5").innerHTML = item.title; 89 | } 90 | articleInfo.content.querySelector("h6").innerHTML = item.id; 91 | document.getElementById("articleInfos").appendChild(articleInfo.content.cloneNode(true)); 92 | }); 93 | } 94 | }); 95 | } 96 | 97 | // 跳转到指定文章 98 | function showArticle(_this) { 99 | var articleId = $(_this).children("h6").text(); 100 | var url = "article.html?articleId=" + articleId; 101 | window.location.href = url; 102 | } -------------------------------------------------------------------------------- /src/main/resources/static/js/bootstrap/3.3.6/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /src/main/resources/static/js/footer.js: -------------------------------------------------------------------------------- 1 | document.writeln(""); 2 | document.writeln(""); 3 | document.writeln(""); 4 | document.writeln(" "); 5 | document.writeln(" "); 6 | document.writeln(" Bootstrap 实例 - 默认的导航栏"); 7 | document.writeln(" "); 8 | document.writeln(" "); 9 | document.writeln(" "); 10 | document.writeln(""); 11 | document.writeln(" "); 50 | document.writeln(" "); 51 | document.writeln(""); 52 | document.writeln(" "); 53 | document.writeln("
"); 54 | document.writeln(" "); 70 | document.writeln(" "); 71 | document.writeln(""); 72 | document.writeln(""); -------------------------------------------------------------------------------- /src/main/resources/static/js/getUrlParam.js: -------------------------------------------------------------------------------- 1 | // 获取网页参数中的参数,来自:http://www.runoob.com/w3cnote/js-get-url-param.html 2 | function getQueryVariable(variable) 3 | { 4 | var query = window.location.search.substring(1); 5 | var vars = query.split("&"); 6 | for (var i=0;i"); 2 | document.writeln(""); 3 | document.writeln(""); 4 | document.writeln(" "); 5 | document.writeln(" "); 6 | document.writeln(" Bootstrap 实例 - 默认的导航栏"); 7 | document.writeln(" "); 8 | document.writeln(" "); 9 | document.writeln(" "); 10 | document.writeln(""); 11 | document.writeln(" "); 43 | document.writeln(" "); 44 | document.writeln(""); 45 | document.writeln(" "); 46 | document.writeln(" "); 54 | document.writeln(" "); 55 | document.writeln(" "); 98 | document.writeln(""); 99 | document.writeln(""); -------------------------------------------------------------------------------- /src/main/resources/static/js/index.js: -------------------------------------------------------------------------------- 1 | // 页面初始化:填充数据 2 | window.onload = function() { 3 | $.ajax({ 4 | url: "http://10.2.3.235:80/api/article/list/lastest", 5 | type: "GET", 6 | dataType: "json", 7 | success: function(json) { 8 | $.each(json, function(i, item) { 9 | // 设置右下角题图的内容 10 | $(".smallPictures img[location=" + i + "]").attr("src", item.pictureUrl); 11 | $(".smallPictures img[location=" + i + "]").attr("pictureUrl", item.pictureUrl); 12 | $(".smallPictures img[location=" + i + "]").attr("articleId", item.id); 13 | $(".smallPictures img[location=" + i + "]").attr("title", item.title); 14 | $(".smallPictures img[location=" + i + "]").attr("summary", item.summary); 15 | 16 | // 默认显示第一篇文章的信息 17 | if(i == "0") { 18 | $("#articleTitle").html(item.title); 19 | $("#articleSummary").html(item.summary); 20 | $("#articlePicture img").attr("src", item.pictureUrl); 21 | $("#showArticle").attr("articleId", item.id); 22 | } 23 | }); 24 | } 25 | }); 26 | }; 27 | 28 | // 按钮点击进行文章详情页 29 | $("#showArticle").click(function() { 30 | var articleId = $(this).attr("articleId"); 31 | var url = "article.html?articleId=" + articleId; 32 | window.location.href = url; 33 | }); 34 | 35 | // 测试使用的函数 36 | // $("#showArticle").click(function() { 37 | // $.ajax({ 38 | // url: "http://10.2.3.235:80/api/article/1", 39 | // type: "GET", 40 | // dataType: "json", 41 | // success: function(json) { 42 | // $("#articleTitle").html(json.title); 43 | // $("#articleSummary").html(json.summary); 44 | // } 45 | // }) 46 | // }); 47 | 48 | // 缩略图鼠标进入事件:更换大图和按钮的articleId 49 | $(".smallPictures img").mouseenter(function() { 50 | var pictureUrl = $(this).attr("pictureUrl"); 51 | var articleId = $(this).attr("articleId") 52 | var title = $(this).attr("title"); 53 | var summary = $(this).attr("summary"); 54 | $("#articlePicture img").attr("src", pictureUrl); 55 | $("#showArticle").attr("articleId", articleId); 56 | $("#articleTitle").html(title); 57 | $("#articleSummary").html(summary); 58 | }); 59 | 60 | // function checkPicurl(url) { 61 | // var img = new Image(); 62 | // img.src = url; 63 | // img.onerror = function() { 64 | // alert(name + " 图片加载失败,请检查url是否正确"); 65 | // return false; 66 | // }; 67 | // 68 | // if(img.complete) { 69 | // console.log(img.width + " " + img.height); 70 | // } else { 71 | // img.onload = function() { 72 | // console.log(img.width + " " + img.height); 73 | // img.onload = null; 74 | // //避免重复加载 75 | // } 76 | // } 77 | // } -------------------------------------------------------------------------------- /src/main/resources/static/resume.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | wmyskxz个人博客 7 | 8 | 9 | 10 | 11 | 12 | 13 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 |

简历页内容待完善

28 |
29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/main/resources/static/zwerowewvnzwoenwvw/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 登录页面 6 | 7 | 8 | 9 |
10 |
11 | 45 |
46 | 47 | 58 |
59 | 60 | 61 | -------------------------------------------------------------------------------- /src/test/java/cn/wmyskxz/blog/BlogApplicationTests.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog; 2 | 3 | import cn.wmyskxz.blog.controller.ForeController; 4 | import cn.wmyskxz.blog.entity.Comment; 5 | import com.fasterxml.jackson.databind.ObjectMapper; 6 | import javafx.application.Application; 7 | import org.junit.Before; 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.boot.test.context.SpringBootTest; 12 | import org.springframework.http.MediaType; 13 | import org.springframework.test.context.junit4.SpringRunner; 14 | import org.springframework.test.web.servlet.MockMvc; 15 | import org.springframework.test.web.servlet.MvcResult; 16 | import org.springframework.test.web.servlet.RequestBuilder; 17 | import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; 18 | import org.springframework.test.web.servlet.setup.MockMvcBuilders; 19 | import springfox.documentation.spring.web.json.Json; 20 | 21 | @RunWith(SpringRunner.class) 22 | @SpringBootTest 23 | public class BlogApplicationTests { 24 | 25 | 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/test/java/cn/wmyskxz/blog/Tester.java: -------------------------------------------------------------------------------- 1 | package cn.wmyskxz.blog; 2 | 3 | import com.vladsch.flexmark.Extension; 4 | import com.vladsch.flexmark.ast.Node; 5 | import com.vladsch.flexmark.ext.tables.TablesExtension; 6 | import com.vladsch.flexmark.html.HtmlRenderer; 7 | import com.vladsch.flexmark.parser.Parser; 8 | import com.vladsch.flexmark.parser.ParserEmulationProfile; 9 | import com.vladsch.flexmark.util.options.MutableDataSet; 10 | import org.junit.Test; 11 | 12 | import java.util.Arrays; 13 | import java.util.LinkedList; 14 | import java.util.List; 15 | 16 | /** 17 | * 测试类 18 | * 19 | * @author:wmyskxz 20 | * @create:2018-06-21-上午 9:53 21 | */ 22 | public class Tester { 23 | 24 | @Test 25 | public void test1(){ 26 | LinkedList list = new LinkedList<>(); 27 | list.add("加入第一个元素"); 28 | list.add("加入第二个元素"); 29 | list.addFirst("加入第三个元素"); 30 | list.add("加入第四个元素"); 31 | list.addLast("加入第五个元素"); 32 | 33 | System.out.println(list); 34 | } 35 | 36 | @Test 37 | public void test() { 38 | 39 | String content = "Markdown cells support standard Markdown syntax as well as GitHub Flavored Markdown (GFM). Open the preview to see these rendered.\n" + 40 | "\n" + 41 | "### Basics\n" + 42 | "\n" + 43 | "# H1\n" + 44 | "## H2\n" + 45 | "### H3\n" + 46 | "#### H4\n" + 47 | "##### H5\n" + 48 | "###### H6\n" + 49 | "\n" + 50 | "---\n" + 51 | "\n" + 52 | "*italic*, **bold**, ~~Scratch this.~~\n" + 53 | "\n" + 54 | "`inline code`\n" + 55 | "\n" + 56 | "### Lists\n" + 57 | "\n" + 58 | "1. First ordered list item\n" + 59 | "2. Another item\n" + 60 | " * Unordered sub-list. \n" + 61 | "1. Actual numbers don't matter, just that it's a number\n" + 62 | " 1. Ordered sub-list\n" + 63 | "4. And another item.\n" + 64 | "\n" + 65 | "### Quote\n" + 66 | "\n" + 67 | "> Peace cannot be kept by force; it can only be achieved by understanding.\n" + 68 | "\n" + 69 | "### Links\n" + 70 | "\n" + 71 | "[I'm an inline-style link](https://www.google.com)\n" + 72 | "http://example.com\n" + 73 | "\n" + 74 | "You can also create a link to another note: (Note menu -> Copy Note Link -> Paste)\n" + 75 | "[01 - Getting Started](quiver-note-url/D2A1CC36-CC97-4701-A895-EFC98EF47026)\n" + 76 | "\n" + 77 | "### Tables\n" + 78 | "\n" + 79 | "| Tables | Are | Cool |\n" + 80 | "| ------------- |:-------------:| -----:|\n" + 81 | "| col 3 is | right-aligned | $1600 |\n" + 82 | "| col 2 is | centered | $12 |\n" + 83 | "| zebra stripes | are neat | $1 |\n" + 84 | "\n" + 85 | "### GFM Task Lists\n" + 86 | "\n" + 87 | "- [ ] a task list item\n" + 88 | "- [ ] list syntax required\n" + 89 | "- [ ] normal **formatting**, @mentions, #1234 refs\n" + 90 | "- [ ] incomplete\n" + 91 | "- [x] completed\n" + 92 | "\n" + 93 | "### Inline LaTeX\n" + 94 | "\n" + 95 | "You can use inline LaTeX inside Markdown cells as well, for example, $x^2$."; 96 | MutableDataSet options = new MutableDataSet(); 97 | options.setFrom(ParserEmulationProfile.MARKDOWN); 98 | options.set(Parser.EXTENSIONS, Arrays.asList(new Extension[]{TablesExtension.create()})); 99 | Parser parser = Parser.builder(options).build(); 100 | HtmlRenderer renderer = HtmlRenderer.builder(options).build(); 101 | 102 | Node document = parser.parse(content); 103 | String html = renderer.render(document); 104 | 105 | System.out.println(html); 106 | } 107 | } 108 | --------------------------------------------------------------------------------