diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 index 12586691..ebaf883b --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,35 @@ - -.DS_Store +!.mvn/wrapper/maven-wrapper.jar + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr +*.log +*.gz + +### NetBeans ### +nbproject/private/ +build/ +nbbuild/ +dist/ +nbdist/ +.nb-gradle/ + + +.DS_Store + +target/ +.mvn/ +mvnw.cmd +mvnw +sens-log/ +/templates \ No newline at end of file diff --git a/ForestBlog/pom.xml b/ForestBlog/pom.xml index 3a5b2e21..aa830ec6 100755 --- a/ForestBlog/pom.xml +++ b/ForestBlog/pom.xml @@ -1,250 +1,268 @@ - 4.0.0 - com.liuyanzhao - ForestBlog - war - 1.0-SNAPSHOT - ForestBlog Maven Webapp - http://maven.apache.org - - - - - junit - junit - 3.8.1 - test - - - - - javax.servlet - javax.servlet-api - 3.1.0 - provided - - - - - javax.servlet.jsp - javax.servlet.jsp-api - 2.3.1 - - - - javax.servlet - jstl - 1.1.2 - - - taglibs - standard - 1.1.2 - - - - org.springframework - spring-core - 4.2.0.RELEASE - - - org.springframework - spring-beans - 4.2.0.RELEASE - - - org.springframework - spring-context - 4.2.0.RELEASE - - - org.springframework - spring-context-support - 4.2.0.RELEASE - - - org.springframework - spring-web - 4.2.0.RELEASE - - - - org.springframework - spring-test - 4.2.0.RELEASE - - - - org.springframework - spring-webmvc - 4.2.0.RELEASE - - - - - org.springframework - spring-tx - 4.2.0.RELEASE - - - - org.springframework - spring-jdbc - 4.2.0.RELEASE - - - - org.springframework - spring-aop - 4.2.0.RELEASE - - - org.springframework - spring-aspects - 4.2.0.RELEASE - - - - org.mybatis - mybatis - 3.4.0 - - - org.mybatis - mybatis-spring - 1.3.0 - - - - mysql - mysql-connector-java - 5.1.30 - - - - com.alibaba - druid - 1.0.16 - - - - log4j - log4j - 1.2.17 - - - org.slf4j - slf4j-api - 1.7.21 - - - - commons-logging - commons-logging - 1.2 - - - - junit - junit - 4.12 - test - - - - - commons-fileupload - commons-fileupload - 1.2.2 - - - commons-io - commons-io - 2.4 - - - org.junit.jupiter - junit-jupiter-api - RELEASE - - - - - com.fasterxml.jackson.core - jackson-databind - 2.5.0 - - - com.fasterxml.jackson.core - jackson-core - 2.5.0 - - - com.fasterxml.jackson.core - jackson-annotations - 2.5.0 - - - - org.json - json - 20170516 - - - - - com.googlecode.rapid-framework - rapid-core - 4.0.5 - - - - - 1.8 - 1.8 - UTF-8 - - - - - - ForestBlog - - - src/main/java - - **/*.properties - **/*.xml - - true - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy-dependencies - prepare-package - - copy-dependencies - - - ${project.build.directory}/myTESTapplication/WEB-INF/lib - false - false - true - - - - - - - + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + 4.0.0 + com.liuyanzhao + ForestBlog + war + 1.0.0-SNAPSHOT + ForestBlog Maven Webapp + http://maven.apache.org + + + + 1.8 + 1.8 + UTF-8 + 4.3.19.RELEASE + 2.10.1 + + + + + + + org.projectlombok + lombok + 1.16.22 + + + + + javax.servlet + javax.servlet-api + 3.1.0 + provided + + + + + javax.servlet.jsp + javax.servlet.jsp-api + 2.3.1 + + + + javax.servlet + jstl + 1.1.2 + + + taglibs + standard + 1.1.2 + + + + org.springframework + spring-core + ${spring.version} + + + org.springframework + spring-beans + ${spring.version} + + + org.springframework + spring-context + ${spring.version} + + + org.springframework + spring-context-support + ${spring.version} + + + org.springframework + spring-web + ${spring.version} + + + + org.springframework + spring-test + ${spring.version} + + + + org.springframework + spring-webmvc + ${spring.version} + + + + + org.springframework + spring-tx + ${spring.version} + + + + org.springframework + spring-jdbc + ${spring.version} + + + + org.springframework + spring-aop + ${spring.version} + + + org.springframework + spring-aspects + ${spring.version} + + + + org.mybatis + mybatis + 3.4.0 + + + org.mybatis + mybatis-spring + 1.3.0 + + + + mysql + mysql-connector-java + 8.0.11 + + + + com.alibaba + druid + 1.0.16 + + + + ch.qos.logback + logback-classic + 1.1.2 + + + ch.qos.logback + logback-core + 1.1.2 + + + org.logback-extensions + logback-ext-spring + 0.1.1 + + + + + junit + junit + 4.12 + test + + + + + commons-fileupload + commons-fileupload + 1.3.3 + + + commons-io + commons-io + 2.4 + + + + + com.fasterxml.jackson.core + jackson-databind + 2.5.0 + + + com.fasterxml.jackson.core + jackson-core + 2.5.0 + + + com.fasterxml.jackson.core + jackson-annotations + 2.5.0 + + + + org.json + json + 20170516 + + + com.googlecode.rapid-framework + rapid-core + 4.0.5 + + + + com.google.guava + guava + 26.0-jre + + + + com.github.pagehelper + pagehelper + 4.2.1 + + + com.alibaba + fastjson + 1.2.72 + + + + + cn.hutool + hutool-all + 4.1.13 + + + + com.fasterxml.jackson.core + jackson-databind + ${jackson-databind-version} + + + com.fasterxml.jackson.core + jackson-core + ${jackson-databind-version} + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson-databind-version} + + + + + + + + + src/main/java + + **/*.xml + + true + + + + src/main/resources + + **/* + + true + + + diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/Interceptor/AdminResourceInterceptor.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/Interceptor/AdminResourceInterceptor.java deleted file mode 100755 index ef9a0088..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/Interceptor/AdminResourceInterceptor.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.liuyanzhao.blog.Interceptor; - -import com.liuyanzhao.blog.entity.User; -import com.liuyanzhao.blog.service.*; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.ui.ModelMap; -import org.springframework.web.context.request.WebRequest; -import org.springframework.web.context.request.WebRequestInterceptor; - -import javax.servlet.http.HttpSession; - -public class AdminResourceInterceptor implements WebRequestInterceptor { - - @Autowired - private HttpSession httpSession; - - @Autowired - private UserService userService; - /** - * 在请求处理之前执行,该方法主要是用于准备资源数据的,然后可以把它们当做请求属性放到WebRequest中 - */ - @Override - public void preHandle(WebRequest request) throws Exception { - User user = (User) httpSession.getAttribute("user"); - User user2 = userService.getUserById(user.getUserId()); - request.setAttribute("loginUser",user2,WebRequest.SCOPE_SESSION); - } - /** - * 该方法将在Controller执行之后,返回视图之前执行,ModelMap表示请求Controller处理之后返回的Model对象,所以可以在 - * 这个方法中修改ModelMap的属性,从而达到改变返回的模型的效果。 - */ - @Override - public void postHandle(WebRequest request, ModelMap map) throws Exception { - //System.out.println("postHandle......."); - } - - /** - * 该方法将在整个请求完成之后,也就是说在视图渲染之后进行调用,主要用于进行一些资源的释放 - */ - @Override - public void afterCompletion(WebRequest request, Exception exception) - throws Exception { - //System.out.println("afterCompletion"); - } -} - diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/Interceptor/HomeResourceInterceptor.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/Interceptor/HomeResourceInterceptor.java deleted file mode 100755 index 44f18d1e..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/Interceptor/HomeResourceInterceptor.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.liuyanzhao.blog.Interceptor; -import com.liuyanzhao.blog.entity.Options; -import com.liuyanzhao.blog.entity.custom.*; -import com.liuyanzhao.blog.service.*; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.ui.ModelMap; -import org.springframework.web.context.request.WebRequest; -import org.springframework.web.context.request.WebRequestInterceptor; - -import java.util.ArrayList; -import java.util.List; - -public class HomeResourceInterceptor implements WebRequestInterceptor { - @Autowired - private ArticleService articleService; - - @Autowired - private CategoryService categoryService; - - @Autowired - private TagService tagService; - - @Autowired - private LinkService linkService; - - @Autowired - private OptionsService optionsService; - - @Autowired - private MenuService menuService; - - @Autowired - private CommentService commentService; - /** - * 在请求处理之前执行,该方法主要是用于准备资源数据的,然后可以把它们当做请求属性放到WebRequest中 - */ - @Override - public void preHandle(WebRequest request) throws Exception { - System.out.println("HomeResourceInterceptor...preHandle......"); - //导航主要菜单显示 - //分类目录显示 - List categoryList = categoryService.listCategory(1); - request.setAttribute("categoryList",categoryList,WebRequest.SCOPE_REQUEST); - //菜单显示 - List menuCustomList = menuService.listMenu(1); - request.setAttribute("menuCustomList",menuCustomList,WebRequest.SCOPE_REQUEST); - - //侧边栏显示 - //标签列表显示 - List tagList = tagService.listTag(1); - request.setAttribute("tagList",tagList,WebRequest.SCOPE_REQUEST); - //获得随机文章 - List randomArticleList = articleService.listRandomArticle(1,8); - request.setAttribute("randomArticleList",randomArticleList,WebRequest.SCOPE_REQUEST); - //获得热评文章 - List mostCommentArticleList = articleService.listArticleByCommentCount(1,8); - request.setAttribute("mostCommentArticleList",mostCommentArticleList,WebRequest.SCOPE_REQUEST); - //最新评论 - List recentCommentList = commentService.listRecentComment(10); - request.setAttribute("recentCommentList",recentCommentList,WebRequest.SCOPE_REQUEST); - - //获得网站概况 - List siteBasicStatistics = new ArrayList(); - siteBasicStatistics.add(articleService.countArticle(1)+""); - siteBasicStatistics.add(articleService.countArticleComment(1)+""); - siteBasicStatistics.add(categoryService.countCategory(1)+""); - siteBasicStatistics.add(tagService.countTag(1)+""); - siteBasicStatistics.add(linkService.countLink(1)+""); - siteBasicStatistics.add(articleService.countArticleView(1)+""); - request.setAttribute("siteBasicStatistics",siteBasicStatistics,WebRequest.SCOPE_REQUEST); - //最后更新的文章 - ArticleCustom lastUpdateArticle = articleService.getLastUpdateArticle(); - request.setAttribute("lastUpdateArticle",lastUpdateArticle,WebRequest.SCOPE_REQUEST); - - //页脚显示 - //博客基本信息显示(Options) - Options options = optionsService.getOptions(); - request.setAttribute("options", options,WebRequest.SCOPE_REQUEST); - - } - /** - * 该方法将在Controller执行之后,返回视图之前执行,ModelMap表示请求Controller处理之后返回的Model对象,所以可以在 - * 这个方法中修改ModelMap的属性,从而达到改变返回的模型的效果。 - */ - @Override - public void postHandle(WebRequest request, ModelMap map) throws Exception { - //System.out.println("postHandle......."); - } - - /** - * 该方法将在整个请求完成之后,也就是说在视图渲染之后进行调用,主要用于进行一些资源的释放 - */ - @Override - public void afterCompletion(WebRequest request, Exception exception) - throws Exception { - //System.out.println("afterCompletion"); - } -} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Admin/AdminController.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Admin/AdminController.java deleted file mode 100755 index 5fd104de..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Admin/AdminController.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.liuyanzhao.blog.controller.Admin; - -import com.liuyanzhao.blog.entity.User; -import com.liuyanzhao.blog.entity.custom.*; -import com.liuyanzhao.blog.service.ArticleService; -import com.liuyanzhao.blog.service.CommentService; -import com.liuyanzhao.blog.service.LinkService; -import com.liuyanzhao.blog.service.UserService; -import org.json.JSONObject; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.servlet.ModelAndView; - -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static com.liuyanzhao.blog.util.Functions.getIpAddr; - -@Controller -public class AdminController { - @Autowired - private UserService userService; - - @Autowired - private ArticleService articleService; - - @Autowired - private CommentService commentService; - - @Autowired - private LinkService linkService; - - @ModelAttribute - public void init(Model model) throws Exception { - - } - - //后台首页 - @RequestMapping("/admin") - public ModelAndView index() throws Exception { - ModelAndView modelAndView = new ModelAndView(); - //文章列表 - List articleCustomList = articleService.listArticle(null); - modelAndView.addObject("articleCustomList",articleCustomList); - //评论列表 - List commentListVoList = commentService.listCommentVo(null); - modelAndView.addObject("commentListVoList",commentListVoList); - //评论数 - Integer allCommentCount = commentService.countComment(null); - Integer approvedCommentCount = commentService.countComment(1); - Integer hiddenCommentCount = commentService.countComment(0); - modelAndView.addObject("allCommentCount",allCommentCount); - modelAndView.addObject("approvedCommentCount",approvedCommentCount); - modelAndView.addObject("hiddenCommentCount",hiddenCommentCount); - - modelAndView.setViewName("/Admin/index"); - return modelAndView; - } - - //登录页面显示 - @RequestMapping("/login") - public ModelAndView loginView() { - ModelAndView modelAndView = new ModelAndView(); - modelAndView.setViewName("/Admin/login"); - return modelAndView; - } - - //登录验证 - @RequestMapping(value = "/loginVerify",method = RequestMethod.POST) - @ResponseBody - public String loginVerify(HttpServletRequest request, HttpServletResponse response) throws Exception { - Map map = new HashMap(); - - String username = request.getParameter("username"); - String password = request.getParameter("password"); - String rememberme = request.getParameter("rememberme"); - User user = userService.getUserByNameOrEmail(username); - if(user==null) { - map.put("code",0); - map.put("msg","用户名无效!"); - } else if(!user.getUserPass().equals(password)) { - map.put("code",0); - map.put("msg","密码错误!"); - } else { - //登录成功 - map.put("code",1); - map.put("msg",""); - //添加session - request.getSession().setAttribute("user", user); - //添加cookie - if(rememberme!=null) { - //创建两个Cookie对象 - Cookie nameCookie = new Cookie("username", username); - //设置Cookie的有效期为3天 - nameCookie.setMaxAge(60 * 60 * 24 * 3); - Cookie pwdCookie = new Cookie("password", password); - pwdCookie.setMaxAge(60 * 60 * 24 * 3); - response.addCookie(nameCookie); - response.addCookie(pwdCookie); - } - user.setUserLastLoginTime(new Date()); - user.setUserLastLoginIp(getIpAddr(request)); - userService.updateUser(user); - - } - String result = new JSONObject(map).toString(); - return result; - } - - //退出登录 - @RequestMapping(value = "/admin/logout") - public String logout(HttpSession session) throws Exception { - session.removeAttribute("user"); - session.invalidate(); - return "redirect:/login"; - } - - -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Admin/BackArticleController.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Admin/BackArticleController.java deleted file mode 100755 index 697bd648..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Admin/BackArticleController.java +++ /dev/null @@ -1,205 +0,0 @@ -package com.liuyanzhao.blog.controller.Admin; - -import com.liuyanzhao.blog.entity.Article; -import com.liuyanzhao.blog.entity.custom.*; -import com.liuyanzhao.blog.service.ArticleService; -import com.liuyanzhao.blog.service.CategoryService; -import com.liuyanzhao.blog.service.TagService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.servlet.ModelAndView; - -import javax.servlet.http.HttpServletRequest; -import java.util.Date; -import java.util.List; - - -@Controller -@RequestMapping("/admin/article") -public class BackArticleController { - @Autowired - private ArticleService articleService; - - - @Autowired - private TagService tagService; - - @Autowired - private CategoryService categoryService; - - //后台文章列表显示 - @RequestMapping(value = "") - public ModelAndView index() throws Exception { - ModelAndView modelAndView = new ModelAndView(); - - //分页显示已发布文章 - Integer pageSize = 20; - List publishedArticleListVoList = articleService.listArticleByPage(1,null,pageSize); - modelAndView.addObject("publishedArticleListVoList",publishedArticleListVoList); - - //不分页显示 草稿文章 - List draftArticleList = articleService.listArticle(0); - modelAndView.addObject("draftArticleList",draftArticleList); - modelAndView.setViewName("Admin/Article/index"); - return modelAndView; - } - - //文章分页显示 - @RequestMapping("/p/{pageNow}") - public @ResponseBody ModelAndView ArticleListByPageView(@PathVariable("pageNow") Integer pageNow) throws Exception{ - ModelAndView modelAndView = new ModelAndView(); - //分页显示已发布文章 - Integer pageSize = 20; - List publishedArticleListVoList = articleService.listArticleByPage(1,pageNow,pageSize); - modelAndView.addObject("publishedArticleListVoList",publishedArticleListVoList); - - //不分页显示 草稿文章 - List draftArticleList = articleService.listArticle(0); - modelAndView.addObject("draftArticleList",draftArticleList); - modelAndView.setViewName("Admin/Article/index"); - return modelAndView; - } - - //后台添加文章页面显示 - @RequestMapping(value = "/insert") - public ModelAndView insertArticleView() throws Exception { - ModelAndView modelAndView = new ModelAndView(); - - List categoryCustomList = categoryService.listCategory(1); - List tagCustomList = tagService.listTag(1); - - modelAndView.addObject("categoryCustomList",categoryCustomList); - modelAndView.addObject("tagCustomList",tagCustomList); - - modelAndView.setViewName("Admin/Article/insert"); - return modelAndView; - } - - //后台添加文章提交操作 - @RequestMapping(value = "/insertSubmit",method = RequestMethod.POST) - public String insertArticleSubmit(Article article) throws Exception { - - article.setArticlePostTime(new Date()); - article.setArticleUpdateTime(new Date()); - article.setArticleIsComment(1); - article.setArticleViewCount(0); - article.setArticleLikeCount(0); - article.setArticleCommentCount(0); - article.setArticleStatus(1); - article.setArticleOrder(1); - - articleService.insertArticle(article); - - return "redirect:/admin/article"; - } - - //后台添加文章提交操作 - @RequestMapping(value = "/insertDraftSubmit",method = RequestMethod.POST) - public String insertArticleDraftSubmit(Article article) throws Exception { - - article.setArticlePostTime(new Date()); - article.setArticleUpdateTime(new Date()); - article.setArticleIsComment(1); - article.setArticleViewCount(0); - article.setArticleLikeCount(0); - article.setArticleCommentCount(0); - article.setArticleStatus(0); - article.setArticleOrder(1); - - articleService.insertArticle(article); - - return "redirect:/admin/article"; - } - - - //搜索实现 - @RequestMapping("/search") - @ResponseBody - public ModelAndView SearchPageView(HttpServletRequest request,Model model) throws Exception { - ModelAndView modelAndView = new ModelAndView(); - //设置每页显示的数量 - int pageSize = 20; - String query = request.getParameter("query"); - List articleSearchVoList = articleService.listSearchResultByPage(1,request,model,null,pageSize,query); - modelAndView.addObject("articleSearchVoList", articleSearchVoList); - modelAndView.setViewName("Admin/Article/search"); - return modelAndView; - } - - //搜索分页实现 - @RequestMapping("/p/{pageNow}/search") - @ResponseBody - public ModelAndView SearchPageByPageView(HttpServletRequest request, Model model,@PathVariable("pageNow") Integer pageNow) throws Exception { - ModelAndView modelAndView = new ModelAndView(); - //设置每页显示的数量 - int pageSize = 20; - String query = request.getParameter("query"); - List articleSearchVoList = articleService.listSearchResultByPage(1,request,model,pageNow,pageSize,query); - modelAndView.addObject("articleSearchVoList", articleSearchVoList); - modelAndView.setViewName("/Admin/Article/search"); - return modelAndView; - } - - - - //删除文章 - @RequestMapping(value = "/delete/{id}") - public void deleteArticle(@PathVariable("id") Integer id) throws Exception { - //调用service批量删除 - articleService.deleteArticle(id); - } - - //批量删除文章 - @RequestMapping(value = "/deleteBatch") - public void deleteArticles(HttpServletRequest request) throws Exception { - String str = request.getParameter("ids"); - String[] arr = str.split(","); - Integer[] ids = new Integer[arr.length]; - for(int i=0;i categoryCustomList = categoryService.listCategory(1); - modelAndView.addObject("categoryCustomList",categoryCustomList); - - List tagCustomList = tagService.listTag(1); - modelAndView.addObject("tagCustomList",tagCustomList); - - - modelAndView.setViewName("Admin/Article/edit"); - return modelAndView; - } - - - //编辑文章提交 - @RequestMapping(value = "/editSubmit",method = RequestMethod.POST) - public String editArticleSubmit(ArticleCustom articleCustom) throws Exception { - Integer id = articleCustom.getArticleId(); - articleCustom.setArticleUpdateTime(new Date()); - articleService.updateArticle(id,articleCustom); - return "redirect:/admin/article"; - } - - - -} - - - diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Admin/BackCommentController.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Admin/BackCommentController.java deleted file mode 100755 index 519c1dcf..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Admin/BackCommentController.java +++ /dev/null @@ -1,204 +0,0 @@ -package com.liuyanzhao.blog.controller.Admin; - - -import com.liuyanzhao.blog.entity.Article; -import com.liuyanzhao.blog.entity.Comment; -import com.liuyanzhao.blog.entity.custom.CommentCustom; -import com.liuyanzhao.blog.entity.custom.CommentListVo; -import com.liuyanzhao.blog.service.ArticleService; -import com.liuyanzhao.blog.service.CommentService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.servlet.ModelAndView; - -import javax.servlet.http.HttpServletRequest; -import java.util.Date; -import java.util.List; - - -@Controller -@RequestMapping("/admin/comment") -public class BackCommentController { - - @Autowired - private CommentService commentService; - - @Autowired - private ArticleService articleService; - - //后台评论列表显示 - @RequestMapping(value = "") - public ModelAndView commentListView() throws Exception { - ModelAndView modelandview = new ModelAndView(); - //正常评论显示 - Integer pageSize = 20; - List commentListVoList = commentService.listCommentByPage(null,null,pageSize); - modelandview.addObject("commentListVoList", commentListVoList); - - //待审核评论不分页显示 - List hiddenCommentListVoList = commentService.listCommentVo(0); - modelandview.addObject("hiddenCommentListVoList", hiddenCommentListVoList); - - modelandview.setViewName("Admin/Comment/index"); - return modelandview; - - } - - //后台评论分页显示 - @RequestMapping("p/{pageNow}") - //适合RESTful - public @ResponseBody - ModelAndView commentListByPageView(@PathVariable("pageNow") Integer pageNow) throws Exception{ - ModelAndView modelandview = new ModelAndView(); - //全部评论分页显示 - Integer pageSize = 20; - List commentListVoList = commentService.listCommentByPage(null,pageNow,pageSize); - modelandview.addObject("commentListVoList", commentListVoList); - - //待审核评论不分页显示 - List hiddenCommentListVoList = commentService.listCommentVo(0); - modelandview.addObject("hiddenCommentListVoList", hiddenCommentListVoList); - - modelandview.setViewName("Admin/Comment/index"); - return modelandview; - - } - - //添加评论 - @RequestMapping(value = "/insert",method = {RequestMethod.POST}) - @ResponseBody - public void insertComment(HttpServletRequest request,Comment comment) throws Exception { - //添加评论 - comment.setCommentCreateTime(new Date()); - commentService.insertComment(request,comment); - //更新文章的评论数 - Article article = articleService.getArticleById(null,comment.getCommentArticleId()); - articleService.updateCommentCount(article.getArticleId()); - } - - //删除评论 - @RequestMapping(value = "/delete/{id}") - public void deleteComment(@PathVariable("id") Integer id) throws Exception { - Comment comment = commentService.getCommentById(id); - //删除评论 - commentService.deleteComment(id); - //删除其子评论 - List childCommentList = commentService.listChildComment(id); - for(int i=0;i childCommentList = commentService.listChildComment(id); - for(int i=0;i childCommentList = commentService.listChildComment(id); - for(int i=0;i childCommentList = commentService.listChildComment(id); - for(int i=0;i childCommentList = commentService.listChildComment(id); - for(int i=0;i menuCustomList = menuService.listMenu(null); - modelandview.addObject("menuCustomList",menuCustomList); - modelandview.setViewName("Admin/Menu/index"); - return modelandview; - } - - //添加菜单内容提交 - @RequestMapping(value = "/insertSubmit",method = RequestMethod.POST) - public String insertMenuSubmit(Menu menu) throws Exception { - menu.setMenuStatus(1); - menu.setMenuOrder(1); - menuService.insertMenu(menu); - return "redirect:/admin/menu"; - } - - //删除菜单内容 - @RequestMapping(value = "/delete/{id}") - public String deleteMenu(@PathVariable("id") Integer id) throws Exception { - - menuService.deleteMenu(id); - return "redirect:/admin/menu"; - } - - //编辑菜单内容显示 - @RequestMapping(value = "/edit/{id}") - public ModelAndView editMenuView(@PathVariable("id") Integer id) throws Exception { - ModelAndView modelAndView = new ModelAndView(); - - MenuCustom menuCustom = menuService.getMenuById(id); - modelAndView.addObject("menuCustom",menuCustom); - - List menuCustomList = menuService.listMenu(null); - modelAndView.addObject("menuCustomList",menuCustomList); - - modelAndView.setViewName("Admin/Menu/edit"); - return modelAndView; - } - - - //编辑菜单内容提交 - @RequestMapping(value = "/editSubmit",method = RequestMethod.POST) - public String editMenuSubmit(Menu menu) throws Exception { - menuService.updateMenu(menu); - return "redirect:/admin/menu"; - } - - //显示菜单内容 - @RequestMapping(value = "/show/{id}",method = RequestMethod.POST) - public void showMenu(@PathVariable("id") Integer id) throws Exception { - Menu menu = new Menu(); - menu.setMenuId(id); - menu.setMenuStatus(1); - menuService.updateMenu(menu); - } - - //隐藏菜单内容 - @RequestMapping(value = "/hide/{id}",method = RequestMethod.POST) - public void hideMenu(@PathVariable("id") Integer id) throws Exception { - Menu menu = new Menu(); - menu.setMenuId(id); - menu.setMenuStatus(0); - menuService.updateMenu(menu); - } - -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Admin/BackNoticeController.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Admin/BackNoticeController.java deleted file mode 100755 index 377cf729..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Admin/BackNoticeController.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.liuyanzhao.blog.controller.Admin; - - -import com.liuyanzhao.blog.entity.Notice; -import com.liuyanzhao.blog.entity.custom.NoticeCustom; -import com.liuyanzhao.blog.service.NoticeService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.servlet.ModelAndView; - -import java.util.Date; -import java.util.List; - - -@Controller -@RequestMapping("/admin/notice") -public class BackNoticeController { - - @Autowired - private NoticeService noticeService; - - //后台公告列表显示 - @RequestMapping(value = "") - public ModelAndView index() throws Exception { - ModelAndView modelandview = new ModelAndView(); - - List noticeCustomList = noticeService.listNotice(null); - modelandview.addObject("noticeCustomList",noticeCustomList); - - modelandview.setViewName("Admin/Notice/index"); - return modelandview; - - } - - //添加公告显示 - @RequestMapping(value = "/insert") - public ModelAndView insertNoticeView() throws Exception { - ModelAndView modelAndView = new ModelAndView(); - modelAndView.setViewName("Admin/Notice/insert"); - return modelAndView; - } - - //添加公告提交 - @RequestMapping(value = "/insertSubmit",method = RequestMethod.POST) - public String insertNoticeSubmit(Notice notice) throws Exception { - notice.setNoticeCreateTime(new Date()); - notice.setNoticeUpdateTime(new Date()); - notice.setNoticeStatus(1); - notice.setNoticeOrder(1); - noticeService.insertNotice(notice); - return "redirect:/admin/notice"; - } - - //删除公告 - @RequestMapping(value = "/delete/{id}") - public String deleteNotice(@PathVariable("id") Integer id) throws Exception { - noticeService.deleteNotice(id); - - return "redirect:/admin/notice"; - } - - //编辑公告页面显示 - @RequestMapping(value = "/edit/{id}") - public ModelAndView editNoticeView(@PathVariable("id") Integer id) throws Exception { - ModelAndView modelAndView = new ModelAndView(); - - NoticeCustom noticeCustom = noticeService.getNoticeById(id); - modelAndView.addObject("noticeCustom",noticeCustom); - - modelAndView.setViewName("Admin/Notice/edit"); - return modelAndView; - } - - - //编辑公告提交 - @RequestMapping(value = "/editSubmit",method = RequestMethod.POST) - public String editNoticeSubmit(Notice notice) throws Exception { - notice.setNoticeUpdateTime(new Date()); - noticeService.updateNotice(notice); - return "redirect:/admin/notice"; - } - - - -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Common/UploadFileController.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Common/UploadFileController.java deleted file mode 100755 index 30a98796..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Common/UploadFileController.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.liuyanzhao.blog.controller.Common; - -import com.liuyanzhao.blog.entity.custom.ResultVO; -import com.liuyanzhao.blog.entity.custom.UploadFileVO; -import org.apache.ibatis.annotations.Param; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; - -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.multipart.MultipartFile; - - -import java.io.File; -import java.io.IOException; -import java.util.Calendar; - -@Controller -public class UploadFileController { - //上传文件 - //上传文件 - @RequestMapping(value = "/uploadFile",method = RequestMethod.POST) - @ResponseBody - public ResultVO uploadFile(@Param("file")MultipartFile file) throws IOException { - - //本地使用,上传位置 - //String rootPath ="/Users/liuyanzhao/Documents/uploads/"; - String rootPath ="/www/uploads/"; - - //文件的完整名称,如spring.jpeg - String filename = file.getOriginalFilename(); - //文件名,如spring - String name = filename.substring(0,filename.indexOf(".")); - //文件后缀,如.jpeg - String suffix = filename.substring(filename.lastIndexOf(".")); - - //创建年月文件夹 - Calendar date = Calendar.getInstance(); - File dateDirs = new File(date.get(Calendar.YEAR) - + File.separator + (date.get(Calendar.MONTH)+1)); - - //目标文件 - File descFile = new File(rootPath+File.separator+dateDirs+File.separator+filename); - int i = 1; - //若文件存在重命名 - String newFilename = filename; - while(descFile.exists()) { - newFilename = name+"("+i+")"+suffix; - String parentPath = descFile.getParent(); - descFile = new File(parentPath+File.separator+newFilename); - i++; - } - //判断目标文件所在的目录是否存在 - if(!descFile.getParentFile().exists()) { - //如果目标文件所在的目录不存在,则创建父目录 - descFile.getParentFile().mkdirs(); - } - - //将内存中的数据写入磁盘 - file.transferTo(descFile); - //完整的url - String fileUrl = "/uploads/"+dateDirs+ "/"+newFilename; - - ResultVO resultVO = new ResultVO(); - resultVO.setCode(0); - resultVO.setMsg("成功"); - - UploadFileVO uploadFileVO = new UploadFileVO(); - uploadFileVO.setTitle(filename); - uploadFileVO.setSrc(fileUrl); - resultVO.setData(uploadFileVO); - return resultVO; - } -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Home/ArticleController.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Home/ArticleController.java deleted file mode 100755 index 851a311a..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Home/ArticleController.java +++ /dev/null @@ -1,145 +0,0 @@ -package com.liuyanzhao.blog.controller.Home; - - -import com.liuyanzhao.blog.entity.custom.*; -import com.liuyanzhao.blog.service.ArticleService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.*; - -import org.springframework.web.servlet.ModelAndView; - -import javax.servlet.http.HttpServletRequest; - -import java.util.List; - -/** - * 文章的controller - * Created by 言曌 on 2017/8/24. - */ -@Controller -public class ArticleController { - - @Autowired - private ArticleService articleService; - - @ModelAttribute - public void init(Model model) throws Exception { - - } - - //文章详情页显示 - @RequestMapping(value = "/article/{articleId}") - @ResponseBody //适合RESTful - public ModelAndView ArticleDetailView(@PathVariable("articleId") Integer articleId) throws Exception{ - ModelAndView modelAndView = new ModelAndView(); - - //文章信息,分类,标签,作者,评论 - ArticleDetailVo articleDetailVo = articleService.getArticleDetailById(articleId); - if(articleDetailVo!=null) { - - modelAndView.addObject("articleDetailVo", articleDetailVo); - //相关文章 - Integer parentCategoryId = articleService.getArticleById(1, articleId).getArticleParentCategoryId(); - Integer childCategoryId = articleService.getArticleById(1, articleId).getArticleChildCategoryId(); - List similarArticleList = articleService.listArticleWithSameCategory(1, parentCategoryId, childCategoryId, 5); - modelAndView.addObject("similarArticleList", similarArticleList); - - //猜你喜欢 - List mostViewArticleList = articleService.listArticleByViewCount(1, 5); - modelAndView.addObject("mostViewArticleList", mostViewArticleList); - //获取下一篇文章 - ArticleCustom afterArticle = articleService.getAfterArticle(1, articleId); - modelAndView.addObject("afterArticle", afterArticle); - //获取上一篇文章 - ArticleCustom preArticle = articleService.getPreArticle(1, articleId); - modelAndView.addObject("preArticle", preArticle); - modelAndView.setViewName("Home/Page/articleDetail"); - } else { - modelAndView.setViewName("Home/Error/404"); - } - return modelAndView;//不会被解析为跳转路径,而是直接写入HTTP response body中 - - } - - //文章点赞数增加 - @RequestMapping(value = "/article/addLike/{id}",method = {RequestMethod.POST}) - @ResponseBody - public Integer increaseLikeCount(@PathVariable("id") Integer id) - throws Exception { - ArticleCustom articleCustom = articleService.getArticleById(1,id); - int articleCount = articleCustom.getArticleLikeCount(); - articleCustom.setArticleLikeCount(articleCount + 1); - articleService.updateArticle(id, articleCustom); - return articleCount+1; - } - - //文章访问量数增加 - @RequestMapping(value = "/article/addView/{id}",method = {RequestMethod.POST}) - @ResponseBody - public Integer increaseViewCount(@PathVariable("id") Integer id) - throws Exception { - ArticleCustom articleCustom = articleService.getArticleById(1,id); - int articleCount = articleCustom.getArticleViewCount(); - articleCustom.setArticleViewCount(articleCount + 1); - articleService.updateArticle(id, articleCustom); - return articleCount+1; - } - - - - - //文章信息修改提交 - @RequestMapping(value = "/editArticleSubmit",method = RequestMethod.POST) - public String editArticleSubmit(Integer id , - ArticleCustom articleCustom - ) throws Exception { - - - articleService.updateArticle(id,articleCustom); - - return "redirect:articleList.action"; - } - - //文章搜索实现 - @RequestMapping("/search") - @ResponseBody - public ModelAndView SearchPageView(HttpServletRequest request,Model model) throws Exception { - ModelAndView modelAndView = new ModelAndView(); - //设置每页显示的数量 - int pageSize = 10; - String query = request.getParameter("query"); - List articleSearchVoList = articleService.listSearchResultByPage(1,request,model,null,pageSize,query); - if(articleSearchVoList!=null) { - modelAndView.addObject("articleSearchVoList", articleSearchVoList); - } else { - modelAndView.addObject("articleSearchVoList", null); - } - modelAndView.setViewName("Home/Page/search"); - return modelAndView; - } - - //文章搜索分页实现 - @RequestMapping("/p/{pageNow}/search") - @ResponseBody - public ModelAndView SearchPageByPageView(HttpServletRequest request, Model model,@PathVariable("pageNow") Integer pageNow) throws Exception { - ModelAndView modelAndView = new ModelAndView(); - //设置每页显示的数量 - int pageSize = 10; - String query = request.getParameter("query"); - List articleSearchVoList = articleService.listSearchResultByPage(1,request,model,pageNow,pageSize,query); - modelAndView.addObject("articleSearchVoList", articleSearchVoList); - modelAndView.setViewName("Home/Page/search"); - return modelAndView; - } - - - - - - - - - -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Home/BaseController.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Home/BaseController.java deleted file mode 100755 index 281635ae..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Home/BaseController.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.liuyanzhao.blog.controller.Home; - -public class BaseController { - -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Home/CategoryController.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Home/CategoryController.java deleted file mode 100755 index 306b0c81..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Home/CategoryController.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.liuyanzhao.blog.controller.Home; - - -import com.liuyanzhao.blog.entity.custom.*; -import com.liuyanzhao.blog.service.*; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.servlet.ModelAndView; - -import java.util.List; - - -/** - * 文章分类目录的controller - * Created by 言曌 on 2017/8/24. - */ -@Controller -public class CategoryController { - - @Autowired - private CategoryService categoryService; - - @ModelAttribute - public void init(Model model) throws Exception { - - - } - - //根据分类查询文章 - @RequestMapping("/category/{cateId}") - @ResponseBody - public ModelAndView ArticleListByCategoryView(@PathVariable("cateId") Integer cateId) throws Exception { - ModelAndView modelAndView = new ModelAndView(); - //设置每页显示条数 - int pageSize = 10; - List articleListVoList = categoryService.listArticleWithCategoryByPage(1,null,pageSize,cateId); - - //如果articleListVoList=null表示该分类不存在,如果=0表示该分类暂时没有文章 - modelAndView.addObject("articleListVoList",articleListVoList); - - //该分类信息 - CategoryCustom categoryCustom = categoryService.getCategoryById(1,cateId); - modelAndView.addObject("categoryCustom",categoryCustom); - - modelAndView.setViewName("Home/Page/articleListByCategory"); - return modelAndView; - } - - //根据分类查询文章分页 - @RequestMapping("/category/{cateId}/p/{pageNow}") - @ResponseBody - public ModelAndView ArticleListByCategoryAndPageView(@PathVariable("pageNow") Integer pageNow,@PathVariable("cateId") Integer cateId) throws Exception { - ModelAndView modelAndView = new ModelAndView(); - //设置每页显示条数 - int pageSize = 10; - List articleListVoList = categoryService.listArticleWithCategoryByPage(1,pageNow,pageSize,cateId); - modelAndView.addObject("articleListVoList",articleListVoList); - modelAndView.setViewName("Home/Page/articleListByCategory"); - - //该分类信息 - CategoryCustom categoryCustom = categoryService.getCategoryById(1,cateId); - modelAndView.addObject("categoryCustom",categoryCustom); - return modelAndView; - } - -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Home/CommentController.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Home/CommentController.java deleted file mode 100755 index 2ca2cdca..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Home/CommentController.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.liuyanzhao.blog.controller.Home; - -import com.liuyanzhao.blog.entity.Article; -import com.liuyanzhao.blog.entity.Comment; -import com.liuyanzhao.blog.entity.custom.CommentCustom; -import com.liuyanzhao.blog.service.ArticleService; -import com.liuyanzhao.blog.service.CommentService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.servlet.ModelAndView; - -import javax.servlet.http.HttpServletRequest; -import java.util.Date; - -/** - * Created by 言曌 on 2017/9/10. - */ - -@Controller -public class CommentController { - @Autowired - private CommentService commentService; - - @Autowired - private ArticleService articleService; - - //添加评论 - @RequestMapping(value = "/comment/insert",method = {RequestMethod.POST}) - @ResponseBody - public void insertComment(HttpServletRequest request,Comment comment) throws Exception { - //添加评论 - comment.setCommentCreateTime(new Date()); - commentService.insertComment(request,comment); - //更新文章的评论数 - Article article = articleService.getArticleById(null,comment.getCommentArticleId()); - articleService.updateCommentCount(article.getArticleId()); - } - - -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Home/IndexController.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Home/IndexController.java deleted file mode 100755 index 7b260c8b..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Home/IndexController.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.liuyanzhao.blog.controller.Home; - -import com.liuyanzhao.blog.entity.custom.*; -import com.liuyanzhao.blog.service.*; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.servlet.ModelAndView; - -import java.util.List; - -/** - * 用户的controller - * Created by 言曌 on 2017/8/24. - */ -@Controller -public class IndexController { - - @Autowired - private ArticleService articleService; - - @Autowired - private LinkService linkService; - - @Autowired - private NoticeService noticeService; - - @ModelAttribute - public void init(Model model) throws Exception { - //友情链接 - List linkCustomList = linkService.listLink(1); - model.addAttribute("linkCustomList",linkCustomList); - - //公告 - List noticeCustomList = noticeService.listNotice(1); - model.addAttribute("noticeCustomList",noticeCustomList); - } - - //首页显示 - @RequestMapping("/") - public ModelAndView IndexView() throws Exception { - ModelAndView modelAndView = new ModelAndView(); - //文章列表 - int pageSize = 10; - List articleListVoList = articleService.listArticleByPage(1,null,pageSize); - modelAndView.addObject("articleListVoList",articleListVoList); - - modelAndView.setViewName("/Home/index"); - return modelAndView; - } - - //文章分页显示 - @RequestMapping("p/{pageNow}") - //适合RESTful - public @ResponseBody ModelAndView ArticleListByPageView(@PathVariable("pageNow") Integer pageNow) throws Exception{ - ModelAndView modelAndView = new ModelAndView(); - //设置每页显示的数量 - int pageSize = 10; - List articleListVoList = articleService.listArticleByPage(1,pageNow,pageSize); - modelAndView.addObject("articleListVoList",articleListVoList); - modelAndView.setViewName("Home/index"); - return modelAndView;//不会被解析为跳转路径,而是直接写入HTTP response body中 - } - -} - - - - diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Home/LinkController.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Home/LinkController.java deleted file mode 100755 index d44329dd..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Home/LinkController.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.liuyanzhao.blog.controller.Home; - -import com.liuyanzhao.blog.entity.Link; -import com.liuyanzhao.blog.service.LinkService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.servlet.ModelAndView; -import java.util.Date; - -/** - * Created by 言曌 on 2017/9/5. - */ -@Controller -public class LinkController { - @Autowired - private LinkService linkService; - - @RequestMapping("/applyLink") - public ModelAndView applyLinkView() throws Exception { - ModelAndView modelAndView = new ModelAndView(); - modelAndView.setViewName("Home/Page/applyLink"); - return modelAndView; - } - - - @RequestMapping(value = "/applyLinkSubmit",method = {RequestMethod.POST}) - @ResponseBody - public void applyLinkSubmit(Link link) throws Exception { - link.setLinkStatus(0); - link.setLinkCreateTime(new Date()); - link.setLinkUpdateTime(new Date()); - linkService.insertLink(link); - } -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Home/NoticeController.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Home/NoticeController.java deleted file mode 100755 index 8d477fdf..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Home/NoticeController.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.liuyanzhao.blog.controller.Home; - -import com.liuyanzhao.blog.entity.custom.NoticeCustom; -import com.liuyanzhao.blog.service.NoticeService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.servlet.ModelAndView; - -@Controller -public class NoticeController { - @Autowired - private NoticeService noticeService; - - //公告详情页显示 - @RequestMapping(value = "/notice/{noticeId}") - @ResponseBody //适合RESTful - public ModelAndView NoticeDetailView(@PathVariable("noticeId") Integer noticeId) throws Exception{ - ModelAndView modelAndView = new ModelAndView(); - //公告内容和信息显示 - NoticeCustom noticeCustom = noticeService.getNoticeById(noticeId); - modelAndView.addObject("noticeCustom",noticeCustom); - - modelAndView.setViewName("Home/Page/noticeDetail"); - return modelAndView;//不会被解析为跳转路径,而是直接写入HTTP response body中 - } -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Home/PageController.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Home/PageController.java deleted file mode 100755 index 2c3596d1..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Home/PageController.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.liuyanzhao.blog.controller.Home; - -import com.liuyanzhao.blog.entity.custom.*; -import com.liuyanzhao.blog.service.*; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.servlet.ModelAndView; - -import java.util.List; - -/** - * Created by 言曌 on 2017/9/7. - */ -@Controller -public class PageController { - @Autowired - private PageService pageService; - - @Autowired - private ArticleService articleService; - - @Autowired - private CategoryService categoryService; - - - @Autowired - private TagService tagService; - - - @ModelAttribute - public void init(Model model) throws Exception { - - } - - //页面显示 - @RequestMapping(value = "/{key}") - public ModelAndView ArticleDetailView(@PathVariable("key") String key) throws Exception{ - ModelAndView modelAndView = new ModelAndView(); - PageCustom pageCustom = pageService.getPageByKey(1,key); - if(pageCustom!=null) { - modelAndView.addObject("pageCustom",pageCustom); - modelAndView.setViewName("Home/Page/page"); - } else { - modelAndView.setViewName("Home/Error/404"); - } - return modelAndView; - - } - - - //文章归档页面显示 - @RequestMapping(value = "/articleFile") - public ModelAndView articleFile() throws Exception { - ModelAndView modelAndView = new ModelAndView(); - modelAndView.setViewName("Home/Page/articleFile"); - List articleList = articleService.listArticle(1); - modelAndView.addObject("articleList",articleList); - return modelAndView; - } - - //站点地图显示 - @RequestMapping(value = "/map") - public ModelAndView siteMap() throws Exception { - ModelAndView modelAndView = new ModelAndView(); - modelAndView.setViewName("Home/Page/siteMap"); - //文章显示 - List articleList = articleService.listArticle(1); - modelAndView.addObject("articleList",articleList); - //分类显示 - List categoryCustomList = categoryService.listCategory(1); - modelAndView.addObject("categoryCustomList",categoryCustomList); - //标签显示 - List tagCustomList = tagService.listTag(1); - modelAndView.addObject("tagCustomList",tagCustomList); - - return modelAndView; - } - - //留言板 - @RequestMapping(value = "/message") - public ModelAndView message() throws Exception { - ModelAndView modelAndView = new ModelAndView(); - modelAndView.setViewName("Home/Page/message"); - return modelAndView; - } -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Home/TagController.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Home/TagController.java deleted file mode 100755 index cfcccdfc..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Home/TagController.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.liuyanzhao.blog.controller.Home; - -import com.liuyanzhao.blog.entity.custom.*; -import com.liuyanzhao.blog.service.*; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.servlet.ModelAndView; - -import java.util.List; - -/** - * Created by 言曌 on 2017/9/2. - */ -@Controller -public class TagController { - - @Autowired - private TagService tagService; - - @ModelAttribute - public void init(Model model) throws Exception { - - } - - //根据标签查询文章 - @RequestMapping("tag/{tagId}") - @ResponseBody - public ModelAndView ArticleListByTagView(@PathVariable("tagId") Integer tagId) throws Exception { - ModelAndView modelAndView = new ModelAndView(); - //设置每页显示条数、 - int pageSize = 10; - List articleListVoList = tagService.getArticleListByPage(1,null,pageSize,tagId); - - modelAndView.addObject("articleListVoList",articleListVoList); - - //标签信息 - TagCustom tagCustom = tagService.getTagById(tagId); - modelAndView.addObject("tagCustom",tagCustom); - - modelAndView.setViewName("Home/Page/articleListByTag"); - return modelAndView; - } - - //根据标签查询文章分页 - @RequestMapping("tag/{tagId}/p/{pageNow}") - @ResponseBody - public ModelAndView ArticleListByTagAndPageView(@PathVariable("pageNow") Integer pageNow,@PathVariable("tagId") Integer tagId) throws Exception { - ModelAndView modelAndView = new ModelAndView(); - - //设置每页显示条数 - int pageSize = 10; - List articleListVoList = tagService.getArticleListByPage(1,pageNow,pageSize,tagId); - modelAndView.addObject("articleListVoList",articleListVoList); - modelAndView.setViewName("Home/Page/articleListByTag"); - //标签信息 - TagCustom tagCustom = tagService.getTagById(tagId); - modelAndView.addObject("tagCustom",tagCustom); - - return modelAndView; - } -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Home/UserController.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Home/UserController.java deleted file mode 100755 index e4332a6d..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Home/UserController.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.liuyanzhao.blog.controller.Home; - -import com.liuyanzhao.blog.service.UserService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; - -import javax.servlet.http.HttpServletRequest; - - -import com.liuyanzhao.blog.util.Functions; -/** - * 用户的controller - * Created by 言曌 on 2017/8/24. - */ -@Controller -public class UserController { - - @Autowired - private HttpServletRequest request; - - @Autowired - private UserService userService; - - @Autowired - private Functions functions; - - - - - - - - -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/Article.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/Article.java deleted file mode 100644 index 8079cc4a..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/Article.java +++ /dev/null @@ -1,155 +0,0 @@ -package com.liuyanzhao.blog.entity; - -import java.util.Date; - -public class Article { - private Integer articleId; - - private Integer articleUserId; - - private String articleTitle; - - private Integer articleParentCategoryId; - - private Integer articleChildCategoryId; - - private String articleTagIds; - - private Integer articleViewCount; - - private Integer articleCommentCount; - - private Integer articleLikeCount; - - private Date articlePostTime; - - private Date articleUpdateTime; - - private Integer articleIsComment; - - private Integer articleStatus; - - private Integer articleOrder; - - private String articleContent; - - public Integer getArticleId() { - return articleId; - } - - public void setArticleId(Integer articleId) { - this.articleId = articleId; - } - - public Integer getArticleUserId() { - return articleUserId; - } - - public void setArticleUserId(Integer articleUserId) { - this.articleUserId = articleUserId; - } - - public String getArticleTitle() { - return articleTitle; - } - - public void setArticleTitle(String articleTitle) { - this.articleTitle = articleTitle == null ? null : articleTitle.trim(); - } - - public Integer getArticleParentCategoryId() { - return articleParentCategoryId; - } - - public void setArticleParentCategoryId(Integer articleParentCategoryId) { - this.articleParentCategoryId = articleParentCategoryId; - } - - public Integer getArticleChildCategoryId() { - return articleChildCategoryId; - } - - public void setArticleChildCategoryId(Integer articleChildCategoryId) { - this.articleChildCategoryId = articleChildCategoryId; - } - - public String getArticleTagIds() { - return articleTagIds; - } - - public void setArticleTagIds(String articleTagIds) { - this.articleTagIds = articleTagIds == null ? null : articleTagIds.trim(); - } - - public Integer getArticleViewCount() { - return articleViewCount; - } - - public void setArticleViewCount(Integer articleViewCount) { - this.articleViewCount = articleViewCount; - } - - public Integer getArticleCommentCount() { - return articleCommentCount; - } - - public void setArticleCommentCount(Integer articleCommentCount) { - this.articleCommentCount = articleCommentCount; - } - - public Integer getArticleLikeCount() { - return articleLikeCount; - } - - public void setArticleLikeCount(Integer articleLikeCount) { - this.articleLikeCount = articleLikeCount; - } - - public Date getArticlePostTime() { - return articlePostTime; - } - - public void setArticlePostTime(Date articlePostTime) { - this.articlePostTime = articlePostTime; - } - - public Date getArticleUpdateTime() { - return articleUpdateTime; - } - - public void setArticleUpdateTime(Date articleUpdateTime) { - this.articleUpdateTime = articleUpdateTime; - } - - public Integer getArticleIsComment() { - return articleIsComment; - } - - public void setArticleIsComment(Integer articleIsComment) { - this.articleIsComment = articleIsComment; - } - - public Integer getArticleStatus() { - return articleStatus; - } - - public void setArticleStatus(Integer articleStatus) { - this.articleStatus = articleStatus; - } - - public Integer getArticleOrder() { - return articleOrder; - } - - public void setArticleOrder(Integer articleOrder) { - this.articleOrder = articleOrder; - } - - public String getArticleContent() { - return articleContent; - } - - public void setArticleContent(String articleContent) { - this.articleContent = articleContent == null ? null : articleContent.trim(); - } -} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/Category.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/Category.java deleted file mode 100755 index 295ca259..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/Category.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.liuyanzhao.blog.entity; - -public class Category { - private Integer categoryId; - - private Integer categoryPid; - - private String categoryName; - - private String categoryDescription; - - private Integer categoryOrder; - - private String categoryIcon; - - private Integer categoryStatus; - - public Integer getCategoryId() { - return categoryId; - } - - public void setCategoryId(Integer categoryId) { - this.categoryId = categoryId; - } - - public Integer getCategoryPid() { - return categoryPid; - } - - public void setCategoryPid(Integer categoryPid) { - this.categoryPid = categoryPid; - } - - public String getCategoryName() { - return categoryName; - } - - public void setCategoryName(String categoryName) { - this.categoryName = categoryName == null ? null : categoryName.trim(); - } - - public String getCategoryDescription() { - return categoryDescription; - } - - public void setCategoryDescription(String categoryDescription) { - this.categoryDescription = categoryDescription == null ? null : categoryDescription.trim(); - } - - public Integer getCategoryOrder() { - return categoryOrder; - } - - public void setCategoryOrder(Integer categoryOrder) { - this.categoryOrder = categoryOrder; - } - - public String getCategoryIcon() { - return categoryIcon; - } - - public void setCategoryIcon(String categoryIcon) { - this.categoryIcon = categoryIcon == null ? null : categoryIcon.trim(); - } - - public Integer getCategoryStatus() { - return categoryStatus; - } - - public void setCategoryStatus(Integer categoryStatus) { - this.categoryStatus = categoryStatus; - } -} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/Comment.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/Comment.java deleted file mode 100755 index 5a332206..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/Comment.java +++ /dev/null @@ -1,135 +0,0 @@ -package com.liuyanzhao.blog.entity; - -import java.util.Date; - -public class Comment { - private Integer commentId; - - private Integer commentPid; - - private String commentPname; - - private Integer commentArticleId; - - private String commentAuthorName; - - private String commentAuthorEmail; - - private String commentAuthorUrl; - - private String commentContent; - - private String commentAgent; - - private String commentIp; - - private Date commentCreateTime; - - private Integer commentRole; - - private Integer commentStatus; - - public Integer getCommentId() { - return commentId; - } - - public void setCommentId(Integer commentId) { - this.commentId = commentId; - } - - public Integer getCommentPid() { - return commentPid; - } - - public void setCommentPid(Integer commentPid) { - this.commentPid = commentPid; - } - - public String getCommentPname() { - return commentPname; - } - - public void setCommentPname(String commentPname) { - this.commentPname = commentPname == null ? null : commentPname.trim(); - } - - public Integer getCommentArticleId() { - return commentArticleId; - } - - public void setCommentArticleId(Integer commentArticleId) { - this.commentArticleId = commentArticleId; - } - - public String getCommentAuthorName() { - return commentAuthorName; - } - - public void setCommentAuthorName(String commentAuthorName) { - this.commentAuthorName = commentAuthorName == null ? null : commentAuthorName.trim(); - } - - public String getCommentAuthorEmail() { - return commentAuthorEmail; - } - - public void setCommentAuthorEmail(String commentAuthorEmail) { - this.commentAuthorEmail = commentAuthorEmail == null ? null : commentAuthorEmail.trim(); - } - - public String getCommentAuthorUrl() { - return commentAuthorUrl; - } - - public void setCommentAuthorUrl(String commentAuthorUrl) { - this.commentAuthorUrl = commentAuthorUrl == null ? null : commentAuthorUrl.trim(); - } - - public String getCommentContent() { - return commentContent; - } - - public void setCommentContent(String commentContent) { - this.commentContent = commentContent == null ? null : commentContent.trim(); - } - - public String getCommentAgent() { - return commentAgent; - } - - public void setCommentAgent(String commentAgent) { - this.commentAgent = commentAgent == null ? null : commentAgent.trim(); - } - - public String getCommentIp() { - return commentIp; - } - - public void setCommentIp(String commentIp) { - this.commentIp = commentIp == null ? null : commentIp.trim(); - } - - public Date getCommentCreateTime() { - return commentCreateTime; - } - - public void setCommentCreateTime(Date commentCreateTime) { - this.commentCreateTime = commentCreateTime; - } - - public Integer getCommentRole() { - return commentRole; - } - - public void setCommentRole(Integer commentRole) { - this.commentRole = commentRole; - } - - public Integer getCommentStatus() { - return commentStatus; - } - - public void setCommentStatus(Integer commentStatus) { - this.commentStatus = commentStatus; - } -} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/Link.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/Link.java deleted file mode 100755 index 629dbae5..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/Link.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.liuyanzhao.blog.entity; - -import java.util.Date; - -public class Link { - private Integer linkId; - - private String linkUrl; - - private String linkName; - - private String linkImage; - - private String linkDescription; - - private String linkOwnerNickname; - - private String linkOwnerContact; - - private Date linkUpdateTime; - - private Date linkCreateTime; - - private Integer linkOrder; - - private Integer linkStatus; - - public Integer getLinkId() { - return linkId; - } - - public void setLinkId(Integer linkId) { - this.linkId = linkId; - } - - public String getLinkUrl() { - return linkUrl; - } - - public void setLinkUrl(String linkUrl) { - this.linkUrl = linkUrl == null ? null : linkUrl.trim(); - } - - public String getLinkName() { - return linkName; - } - - public void setLinkName(String linkName) { - this.linkName = linkName == null ? null : linkName.trim(); - } - - public String getLinkImage() { - return linkImage; - } - - public void setLinkImage(String linkImage) { - this.linkImage = linkImage == null ? null : linkImage.trim(); - } - - public String getLinkDescription() { - return linkDescription; - } - - public void setLinkDescription(String linkDescription) { - this.linkDescription = linkDescription == null ? null : linkDescription.trim(); - } - - public String getLinkOwnerNickname() { - return linkOwnerNickname; - } - - public void setLinkOwnerNickname(String linkOwnerNickname) { - this.linkOwnerNickname = linkOwnerNickname == null ? null : linkOwnerNickname.trim(); - } - - public String getLinkOwnerContact() { - return linkOwnerContact; - } - - public void setLinkOwnerContact(String linkOwnerContact) { - this.linkOwnerContact = linkOwnerContact == null ? null : linkOwnerContact.trim(); - } - - public Date getLinkUpdateTime() { - return linkUpdateTime; - } - - public void setLinkUpdateTime(Date linkUpdateTime) { - this.linkUpdateTime = linkUpdateTime; - } - - public Date getLinkCreateTime() { - return linkCreateTime; - } - - public void setLinkCreateTime(Date linkCreateTime) { - this.linkCreateTime = linkCreateTime; - } - - public Integer getLinkOrder() { - return linkOrder; - } - - public void setLinkOrder(Integer linkOrder) { - this.linkOrder = linkOrder; - } - - public Integer getLinkStatus() { - return linkStatus; - } - - public void setLinkStatus(Integer linkStatus) { - this.linkStatus = linkStatus; - } -} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/Menu.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/Menu.java deleted file mode 100755 index 0e0a8091..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/Menu.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.liuyanzhao.blog.entity; - -public class Menu { - private Integer menuId; - - private String menuName; - - private String menuUrl; - - private Integer menuLevel; - - private String menuIcon; - - private Integer menuOrder; - - private Integer menuStatus; - - public Integer getMenuId() { - return menuId; - } - - public void setMenuId(Integer menuId) { - this.menuId = menuId; - } - - public String getMenuName() { - return menuName; - } - - public void setMenuName(String menuName) { - this.menuName = menuName == null ? null : menuName.trim(); - } - - public String getMenuUrl() { - return menuUrl; - } - - public void setMenuUrl(String menuUrl) { - this.menuUrl = menuUrl == null ? null : menuUrl.trim(); - } - - public Integer getMenuLevel() { - return menuLevel; - } - - public void setMenuLevel(Integer menuLevel) { - this.menuLevel = menuLevel; - } - - public String getMenuIcon() { - return menuIcon; - } - - public void setMenuIcon(String menuIcon) { - this.menuIcon = menuIcon == null ? null : menuIcon.trim(); - } - - public Integer getMenuOrder() { - return menuOrder; - } - - public void setMenuOrder(Integer menuOrder) { - this.menuOrder = menuOrder; - } - - public Integer getMenuStatus() { - return menuStatus; - } - - public void setMenuStatus(Integer menuStatus) { - this.menuStatus = menuStatus; - } -} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/Notice.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/Notice.java deleted file mode 100755 index 38353f5c..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/Notice.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.liuyanzhao.blog.entity; - -import java.util.Date; - -public class Notice { - private Integer noticeId; - - private String noticeTitle; - - private String noticeContent; - - private Date noticeCreateTime; - - private Date noticeUpdateTime; - - private Integer noticeStatus; - - private Integer noticeOrder; - - public Integer getNoticeId() { - return noticeId; - } - - public void setNoticeId(Integer noticeId) { - this.noticeId = noticeId; - } - - public String getNoticeTitle() { - return noticeTitle; - } - - public void setNoticeTitle(String noticeTitle) { - this.noticeTitle = noticeTitle == null ? null : noticeTitle.trim(); - } - - public String getNoticeContent() { - return noticeContent; - } - - public void setNoticeContent(String noticeContent) { - this.noticeContent = noticeContent == null ? null : noticeContent.trim(); - } - - public Date getNoticeCreateTime() { - return noticeCreateTime; - } - - public void setNoticeCreateTime(Date noticeCreateTime) { - this.noticeCreateTime = noticeCreateTime; - } - - public Date getNoticeUpdateTime() { - return noticeUpdateTime; - } - - public void setNoticeUpdateTime(Date noticeUpdateTime) { - this.noticeUpdateTime = noticeUpdateTime; - } - - public Integer getNoticeStatus() { - return noticeStatus; - } - - public void setNoticeStatus(Integer noticeStatus) { - this.noticeStatus = noticeStatus; - } - - public Integer getNoticeOrder() { - return noticeOrder; - } - - public void setNoticeOrder(Integer noticeOrder) { - this.noticeOrder = noticeOrder; - } -} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/Options.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/Options.java deleted file mode 100755 index 0f65bf86..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/Options.java +++ /dev/null @@ -1,143 +0,0 @@ -package com.liuyanzhao.blog.entity; - -public class Options { - private Integer optionId; - - private String optionSiteTitle; - - private String optionSiteDescrption; - - private String optionMetaDescrption; - - private String optionMetaKeyword; - - private String optionAboutsiteAvatar; - - private String optionAboutsiteTitle; - - private String optionAboutsiteContent; - - private String optionAboutsiteWechat; - - private String optionAboutsiteQq; - - private String optionAboutsiteGithub; - - private String optionAboutsiteWeibo; - - private String optionTongji; - - private Integer optionStatus; - - public Integer getOptionId() { - return optionId; - } - - public void setOptionId(Integer optionId) { - this.optionId = optionId; - } - - public String getOptionSiteTitle() { - return optionSiteTitle; - } - - public void setOptionSiteTitle(String optionSiteTitle) { - this.optionSiteTitle = optionSiteTitle == null ? null : optionSiteTitle.trim(); - } - - public String getOptionSiteDescrption() { - return optionSiteDescrption; - } - - public void setOptionSiteDescrption(String optionSiteDescrption) { - this.optionSiteDescrption = optionSiteDescrption == null ? null : optionSiteDescrption.trim(); - } - - public String getOptionMetaDescrption() { - return optionMetaDescrption; - } - - public void setOptionMetaDescrption(String optionMetaDescrption) { - this.optionMetaDescrption = optionMetaDescrption == null ? null : optionMetaDescrption.trim(); - } - - public String getOptionMetaKeyword() { - return optionMetaKeyword; - } - - public void setOptionMetaKeyword(String optionMetaKeyword) { - this.optionMetaKeyword = optionMetaKeyword == null ? null : optionMetaKeyword.trim(); - } - - public String getOptionAboutsiteAvatar() { - return optionAboutsiteAvatar; - } - - public void setOptionAboutsiteAvatar(String optionAboutsiteAvatar) { - this.optionAboutsiteAvatar = optionAboutsiteAvatar == null ? null : optionAboutsiteAvatar.trim(); - } - - public String getOptionAboutsiteTitle() { - return optionAboutsiteTitle; - } - - public void setOptionAboutsiteTitle(String optionAboutsiteTitle) { - this.optionAboutsiteTitle = optionAboutsiteTitle == null ? null : optionAboutsiteTitle.trim(); - } - - public String getOptionAboutsiteContent() { - return optionAboutsiteContent; - } - - public void setOptionAboutsiteContent(String optionAboutsiteContent) { - this.optionAboutsiteContent = optionAboutsiteContent == null ? null : optionAboutsiteContent.trim(); - } - - public String getOptionAboutsiteWechat() { - return optionAboutsiteWechat; - } - - public void setOptionAboutsiteWechat(String optionAboutsiteWechat) { - this.optionAboutsiteWechat = optionAboutsiteWechat == null ? null : optionAboutsiteWechat.trim(); - } - - public String getOptionAboutsiteQq() { - return optionAboutsiteQq; - } - - public void setOptionAboutsiteQq(String optionAboutsiteQq) { - this.optionAboutsiteQq = optionAboutsiteQq == null ? null : optionAboutsiteQq.trim(); - } - - public String getOptionAboutsiteGithub() { - return optionAboutsiteGithub; - } - - public void setOptionAboutsiteGithub(String optionAboutsiteGithub) { - this.optionAboutsiteGithub = optionAboutsiteGithub == null ? null : optionAboutsiteGithub.trim(); - } - - public String getOptionAboutsiteWeibo() { - return optionAboutsiteWeibo; - } - - public void setOptionAboutsiteWeibo(String optionAboutsiteWeibo) { - this.optionAboutsiteWeibo = optionAboutsiteWeibo == null ? null : optionAboutsiteWeibo.trim(); - } - - public String getOptionTongji() { - return optionTongji; - } - - public void setOptionTongji(String optionTongji) { - this.optionTongji = optionTongji == null ? null : optionTongji.trim(); - } - - public Integer getOptionStatus() { - return optionStatus; - } - - public void setOptionStatus(Integer optionStatus) { - this.optionStatus = optionStatus; - } -} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/Page.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/Page.java deleted file mode 100755 index 8dc901c4..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/Page.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.liuyanzhao.blog.entity; - -import java.util.Date; - -public class Page { - private Integer pageId; - - private String pageKey; - - private String pageTitle; - - private String pageContent; - - private Date pageCreateTime; - - private Date pageUpdateTime; - - private Integer pageViewCount; - - private Integer pageCommentCount; - - private Integer pageStatus; - - public Integer getPageId() { - return pageId; - } - - public void setPageId(Integer pageId) { - this.pageId = pageId; - } - - public String getPageKey() { - return pageKey; - } - - public void setPageKey(String pageKey) { - this.pageKey = pageKey == null ? null : pageKey.trim(); - } - - public String getPageTitle() { - return pageTitle; - } - - public void setPageTitle(String pageTitle) { - this.pageTitle = pageTitle == null ? null : pageTitle.trim(); - } - - public String getPageContent() { - return pageContent; - } - - public void setPageContent(String pageContent) { - this.pageContent = pageContent == null ? null : pageContent.trim(); - } - - public Date getPageCreateTime() { - return pageCreateTime; - } - - public void setPageCreateTime(Date pageCreateTime) { - this.pageCreateTime = pageCreateTime; - } - - public Date getPageUpdateTime() { - return pageUpdateTime; - } - - public void setPageUpdateTime(Date pageUpdateTime) { - this.pageUpdateTime = pageUpdateTime; - } - - public Integer getPageViewCount() { - return pageViewCount; - } - - public void setPageViewCount(Integer pageViewCount) { - this.pageViewCount = pageViewCount; - } - - public Integer getPageCommentCount() { - return pageCommentCount; - } - - public void setPageCommentCount(Integer pageCommentCount) { - this.pageCommentCount = pageCommentCount; - } - - public Integer getPageStatus() { - return pageStatus; - } - - public void setPageStatus(Integer pageStatus) { - this.pageStatus = pageStatus; - } -} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/Tag.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/Tag.java deleted file mode 100755 index 338c5eaf..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/Tag.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.liuyanzhao.blog.entity; - -public class Tag { - private Integer tagId; - - private String tagName; - - private String tagDescription; - - private Integer tagStatus; - - public Integer getTagId() { - return tagId; - } - - public void setTagId(Integer tagId) { - this.tagId = tagId; - } - - public String getTagName() { - return tagName; - } - - public void setTagName(String tagName) { - this.tagName = tagName == null ? null : tagName.trim(); - } - - public String getTagDescription() { - return tagDescription; - } - - public void setTagDescription(String tagDescription) { - this.tagDescription = tagDescription == null ? null : tagDescription.trim(); - } - - public Integer getTagStatus() { - return tagStatus; - } - - public void setTagStatus(Integer tagStatus) { - this.tagStatus = tagStatus; - } -} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/User.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/User.java deleted file mode 100755 index fd31ad08..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/User.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.liuyanzhao.blog.entity; - -import java.util.Date; - -public class User { - private Integer userId; - - private String userName; - - private String userPass; - - private String userNickname; - - private String userEmail; - - private String userUrl; - - private String userAvatar; - - private String userLastLoginIp; - - private Date userRegisterTime; - - private Date userLastLoginTime; - - private Integer userStatus; - - public Integer getUserId() { - return userId; - } - - public void setUserId(Integer userId) { - this.userId = userId; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName == null ? null : userName.trim(); - } - - public String getUserPass() { - return userPass; - } - - public void setUserPass(String userPass) { - this.userPass = userPass == null ? null : userPass.trim(); - } - - public String getUserNickname() { - return userNickname; - } - - public void setUserNickname(String userNickname) { - this.userNickname = userNickname == null ? null : userNickname.trim(); - } - - public String getUserEmail() { - return userEmail; - } - - public void setUserEmail(String userEmail) { - this.userEmail = userEmail == null ? null : userEmail.trim(); - } - - public String getUserUrl() { - return userUrl; - } - - public void setUserUrl(String userUrl) { - this.userUrl = userUrl == null ? null : userUrl.trim(); - } - - public String getUserAvatar() { - return userAvatar; - } - - public void setUserAvatar(String userAvatar) { - this.userAvatar = userAvatar == null ? null : userAvatar.trim(); - } - - public String getUserLastLoginIp() { - return userLastLoginIp; - } - - public void setUserLastLoginIp(String userLastLoginIp) { - this.userLastLoginIp = userLastLoginIp == null ? null : userLastLoginIp.trim(); - } - - public Date getUserRegisterTime() { - return userRegisterTime; - } - - public void setUserRegisterTime(Date userRegisterTime) { - this.userRegisterTime = userRegisterTime; - } - - public Date getUserLastLoginTime() { - return userLastLoginTime; - } - - public void setUserLastLoginTime(Date userLastLoginTime) { - this.userLastLoginTime = userLastLoginTime; - } - - public Integer getUserStatus() { - return userStatus; - } - - public void setUserStatus(Integer userStatus) { - this.userStatus = userStatus; - } -} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/ArticleCustom.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/ArticleCustom.java deleted file mode 100755 index 99f7e019..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/ArticleCustom.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.liuyanzhao.blog.entity.custom; - - -import com.liuyanzhao.blog.entity.Article; - - -/** - * 文章信息的扩展 - * Created by 言曌 on 2017/8/24. - */ -public class ArticleCustom extends Article { - - -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/ArticleDetailVo.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/ArticleDetailVo.java deleted file mode 100755 index 836557f5..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/ArticleDetailVo.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.liuyanzhao.blog.entity.custom; - -import java.util.List; - -/** - * 用于封装文章正文详细信息,包括文章内容信息,作者信息,分类和标签信息 - * Created by 言曌 on 2017/9/9. - */ -public class ArticleDetailVo { - //文章相关信息 - private ArticleCustom articleCustom; - - //文章的作者相关信息 - private UserCustom userCustom; - - //文章的分类相关信息 - private List categoryCustomList; - - //文章的标签相关信息 - private List tagCustomList; - - //评论信息 - private List commentCustomList; - - public ArticleCustom getArticleCustom() { - return articleCustom; - } - - public void setArticleCustom(ArticleCustom articleCustom) { - this.articleCustom = articleCustom; - } - - public UserCustom getUserCustom() { - return userCustom; - } - - public void setUserCustom(UserCustom userCustom) { - this.userCustom = userCustom; - } - - public List getCategoryCustomList() { - return categoryCustomList; - } - - public void setCategoryCustomList(List categoryCustomList) { - this.categoryCustomList = categoryCustomList; - } - - public List getTagCustomList() { - return tagCustomList; - } - - public void setTagCustomList(List tagCustomList) { - this.tagCustomList = tagCustomList; - } - - public List getCommentCustomList() { - return commentCustomList; - } - - public void setCommentCustomList(List commentCustomList) { - this.commentCustomList = commentCustomList; - } - -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/ArticleListVo.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/ArticleListVo.java deleted file mode 100755 index 8f96f306..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/ArticleListVo.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.liuyanzhao.blog.entity.custom; - - -import com.liuyanzhao.blog.util.others.Page; - -import java.util.List; - -/** - * 用于封装文章列表,包括文章信息,作者信息,分类信息,标签信息 - * Created by 言曌 on 2017/8/24. - */ -public class ArticleListVo { - //文章信息 - private ArticleCustom articleCustom; - - //文章对应的分类 - private List categoryCustomList; - - //文章对应的标签 - private List tagCustomList; - - //作者信息 - private UserCustom userCustom; - - public UserCustom getUserCustom() { - return userCustom; - } - - public void setUserCustom(UserCustom userCustom) { - this.userCustom = userCustom; - } - - //文章分页信息 - private Page page; - - public ArticleCustom getArticleCustom() { - return articleCustom; - } - - public void setArticleCustom(ArticleCustom articleCustom) { - this.articleCustom = articleCustom; - } - - public List getCategoryCustomList() { - return categoryCustomList; - } - - public void setCategoryCustomList(List categoryCustomList) { - this.categoryCustomList = categoryCustomList; - } - - public List getTagCustomList() { - return tagCustomList; - } - - public void setTagCustomList(List tagCustomList) { - this.tagCustomList = tagCustomList; - } - - public Page getPage() { - return page; - } - - public void setPage(Page page) { - this.page = page; - } -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/ArticleSearchVo.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/ArticleSearchVo.java deleted file mode 100755 index eda599ce..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/ArticleSearchVo.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.liuyanzhao.blog.entity.custom; - - -import com.liuyanzhao.blog.util.others.Page; - -import java.util.List; - -/** - * 用于封装搜索的文章列表,包括文章信息,作者信息,分类信息,标签信息,搜索信息 - * Created by 言曌 on 2017/8/24. - */ -public class ArticleSearchVo { - //文章信息 - private ArticleCustom articleCustom; - - //文章对应的分类 - private List categoryCustomList; - - //文章对应的标签 - private List tagCustomList; - - //作者信息 - private UserCustom userCustom; - - //文章分页信息 - private Page page; - - //搜索关键词 - private String query; - - public String getQuery() { - return query; - } - - public UserCustom getUserCustom() { - return userCustom; - } - - public void setUserCustom(UserCustom userCustom) { - this.userCustom = userCustom; - } - - public void setQuery(String query) { - this.query = query; - } - - - public ArticleCustom getArticleCustom() { - return articleCustom; - } - - public void setArticleCustom(ArticleCustom articleCustom) { - this.articleCustom = articleCustom; - } - - public List getCategoryCustomList() { - return categoryCustomList; - } - - public void setCategoryCustomList(List categoryCustomList) { - this.categoryCustomList = categoryCustomList; - } - - public List getTagCustomList() { - return tagCustomList; - } - - public void setTagCustomList(List tagCustomList) { - this.tagCustomList = tagCustomList; - } - - public Page getPage() { - return page; - } - - public void setPage(Page page) { - this.page = page; - } -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/CategoryCustom.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/CategoryCustom.java deleted file mode 100755 index 0254fb9e..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/CategoryCustom.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.liuyanzhao.blog.entity.custom; - -import com.liuyanzhao.blog.entity.Category; - - -/** - * 文章分类目录的信息的扩展 - * Created by 言曌 on 2017/8/24. - */ -public class CategoryCustom extends Category { - //分类对应的文章数 - private Integer articleCount; - - //分类的父分类名称 - private String categoryPname; - - public Integer getArticleCount() { - return articleCount; - } - - public void setArticleCount(Integer articleCount) { - this.articleCount = articleCount; - } - - public String getCategoryPname() { - return categoryPname; - } - - public void setCategoryPname(String categoryPname) { - this.categoryPname = categoryPname; - } -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/CommentCustom.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/CommentCustom.java deleted file mode 100755 index 169e13d5..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/CommentCustom.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.liuyanzhao.blog.entity.custom; - -import com.liuyanzhao.blog.entity.Comment; - -/** - * Created by 言曌 on 2017/9/10. - */ -public class CommentCustom extends Comment { - //评论者的头像 - private String commentAuthorAvatar; - - public String getCommentAuthorAvatar() { - return commentAuthorAvatar; - } - - public void setCommentAuthorAvatar(String commentAuthorAvatar) { - this.commentAuthorAvatar = commentAuthorAvatar; - } -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/CommentListVo.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/CommentListVo.java deleted file mode 100755 index 15aef03a..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/CommentListVo.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.liuyanzhao.blog.entity.custom; - - -import com.liuyanzhao.blog.util.others.Page; - -/** - * 用于封装评论信息,包括评论内容,作者信息,文章信息 - */ -public class CommentListVo { - //评论信息 - private CommentCustom commentCustom; - - //文章信息 - private ArticleCustom articleCustom; - - //分页信息 - private Page page; - - public CommentCustom getCommentCustom() { - return commentCustom; - } - - public void setCommentCustom(CommentCustom commentCustom) { - this.commentCustom = commentCustom; - } - - public ArticleCustom getArticleCustom() { - return articleCustom; - } - - public void setArticleCustom(ArticleCustom articleCustom) { - this.articleCustom = articleCustom; - } - - public Page getPage() { - return page; - } - - public void setPage(Page page) { - this.page = page; - } -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/LinkCustom.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/LinkCustom.java deleted file mode 100755 index e5630737..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/LinkCustom.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.liuyanzhao.blog.entity.custom; - -import com.liuyanzhao.blog.entity.Link; - -/** - * Created by 言曌 on 2017/9/5. - */ -public class LinkCustom extends Link { -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/MenuCustom.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/MenuCustom.java deleted file mode 100755 index ababcb68..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/MenuCustom.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.liuyanzhao.blog.entity.custom; - -import com.liuyanzhao.blog.entity.Menu; - -public class MenuCustom extends Menu { - -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/NoticeCustom.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/NoticeCustom.java deleted file mode 100755 index 494c60be..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/NoticeCustom.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.liuyanzhao.blog.entity.custom; - -import com.liuyanzhao.blog.entity.Notice; - -public class NoticeCustom extends Notice { - -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/OptionsCustom.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/OptionsCustom.java deleted file mode 100755 index 2fda206a..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/OptionsCustom.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.liuyanzhao.blog.entity.custom; - -import com.liuyanzhao.blog.entity.Options; - -/** - * Created by 言曌 on 2017/9/7. - */ -public class OptionsCustom extends Options { -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/PageCustom.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/PageCustom.java deleted file mode 100755 index 7edc47f5..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/PageCustom.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.liuyanzhao.blog.entity.custom; - -import com.liuyanzhao.blog.entity.Page; - -/** - * Created by 言曌 on 2017/9/7. - */ -public class PageCustom extends Page { - -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/ResultVO.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/ResultVO.java deleted file mode 100644 index 79d91212..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/ResultVO.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.liuyanzhao.blog.entity.custom; - -/** - * @author 言曌 - * @date 2017/11/30 下午7:04 - */ - -public class ResultVO { - - //错误码 - private Integer code; - - //提示信息 - private String msg; - - //返回的具体内容 - private T data; - - public Integer getCode() { - return code; - } - - public void setCode(Integer code) { - this.code = code; - } - - public String getMsg() { - return msg; - } - - public void setMsg(String msg) { - this.msg = msg; - } - - public T getData() { - return data; - } - - public void setData(T data) { - this.data = data; - } -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/TagCustom.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/TagCustom.java deleted file mode 100755 index 160a4def..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/TagCustom.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.liuyanzhao.blog.entity.custom; - -import com.liuyanzhao.blog.entity.Tag; - -/** - * 文章标签的信息的扩展 - * Created by 言曌 on 2017/9/1. - */ -public class TagCustom extends Tag { - //标签对应的文章数目 - private Integer articleCount; - - public Integer getArticleCount() { - return articleCount; - } - - public void setArticleCount(Integer articleCount) { - this.articleCount = articleCount; - } -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/UploadFileVO.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/UploadFileVO.java deleted file mode 100644 index b8f07db3..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/UploadFileVO.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.liuyanzhao.blog.entity.custom; - -/** - * @author 言曌 - * @date 2017/11/30 下午7:41 - */ - -public class UploadFileVO { - - private String src; - - private String title; - - public String getSrc() { - return src; - } - - public void setSrc(String src) { - this.src = src; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/UserCustom.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/UserCustom.java deleted file mode 100755 index 96a3aa58..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/entity/custom/UserCustom.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.liuyanzhao.blog.entity.custom; - -import com.liuyanzhao.blog.entity.User; - -/** - * 用户信息的扩展 - * Created by 言曌 on 2017/8/24. - */ -public class UserCustom extends User { - //用户的文章数 - private Integer articleCount; - - public Integer getArticleCount() { - return articleCount; - } - - public void setArticleCount(Integer articleCount) { - this.articleCount = articleCount; - } -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/ArticleMapper.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/ArticleMapper.java deleted file mode 100644 index 7b388764..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/ArticleMapper.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.liuyanzhao.blog.mapper; - -import com.liuyanzhao.blog.entity.Article; - -public interface ArticleMapper { - int deleteByPrimaryKey(Integer articleId); - - int insert(Article record); - - int insertSelective(Article record); - - Article selectByPrimaryKey(Integer articleId); - - int updateByPrimaryKeySelective(Article record); - - int updateByPrimaryKeyWithBLOBs(Article record); - - int updateByPrimaryKey(Article record); -} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/ArticleMapper.xml b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/ArticleMapper.xml deleted file mode 100644 index 8042ec36..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/ArticleMapper.xml +++ /dev/null @@ -1,237 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - article_id, article_user_id, article_title, article_parent_category_id, article_child_category_id, - article_tag_ids, article_view_count, article_comment_count, article_like_count, article_post_time, - article_update_time, article_is_comment, article_status, article_order - - - article_content - - - - delete from article - where article_id = #{articleId,jdbcType=INTEGER} - - - insert into article (article_id, article_user_id, article_title, - article_parent_category_id, article_child_category_id, - article_tag_ids, article_view_count, article_comment_count, - article_like_count, article_post_time, article_update_time, - article_is_comment, article_status, article_order, - article_content) - values (#{articleId,jdbcType=INTEGER}, #{articleUserId,jdbcType=INTEGER}, #{articleTitle,jdbcType=VARCHAR}, - #{articleParentCategoryId,jdbcType=INTEGER}, #{articleChildCategoryId,jdbcType=INTEGER}, - #{articleTagIds,jdbcType=VARCHAR}, #{articleViewCount,jdbcType=INTEGER}, #{articleCommentCount,jdbcType=INTEGER}, - #{articleLikeCount,jdbcType=INTEGER}, #{articlePostTime,jdbcType=TIMESTAMP}, #{articleUpdateTime,jdbcType=TIMESTAMP}, - #{articleIsComment,jdbcType=INTEGER}, #{articleStatus,jdbcType=INTEGER}, #{articleOrder,jdbcType=INTEGER}, - #{articleContent,jdbcType=LONGVARCHAR}) - - - insert into article - - - article_id, - - - article_user_id, - - - article_title, - - - article_parent_category_id, - - - article_child_category_id, - - - article_tag_ids, - - - article_view_count, - - - article_comment_count, - - - article_like_count, - - - article_post_time, - - - article_update_time, - - - article_is_comment, - - - article_status, - - - article_order, - - - article_content, - - - - - #{articleId,jdbcType=INTEGER}, - - - #{articleUserId,jdbcType=INTEGER}, - - - #{articleTitle,jdbcType=VARCHAR}, - - - #{articleParentCategoryId,jdbcType=INTEGER}, - - - #{articleChildCategoryId,jdbcType=INTEGER}, - - - #{articleTagIds,jdbcType=VARCHAR}, - - - #{articleViewCount,jdbcType=INTEGER}, - - - #{articleCommentCount,jdbcType=INTEGER}, - - - #{articleLikeCount,jdbcType=INTEGER}, - - - #{articlePostTime,jdbcType=TIMESTAMP}, - - - #{articleUpdateTime,jdbcType=TIMESTAMP}, - - - #{articleIsComment,jdbcType=INTEGER}, - - - #{articleStatus,jdbcType=INTEGER}, - - - #{articleOrder,jdbcType=INTEGER}, - - - #{articleContent,jdbcType=LONGVARCHAR}, - - - - - update article - - - article_user_id = #{articleUserId,jdbcType=INTEGER}, - - - article_title = #{articleTitle,jdbcType=VARCHAR}, - - - article_parent_category_id = #{articleParentCategoryId,jdbcType=INTEGER}, - - - article_child_category_id = #{articleChildCategoryId,jdbcType=INTEGER}, - - - article_tag_ids = #{articleTagIds,jdbcType=VARCHAR}, - - - article_view_count = #{articleViewCount,jdbcType=INTEGER}, - - - article_comment_count = #{articleCommentCount,jdbcType=INTEGER}, - - - article_like_count = #{articleLikeCount,jdbcType=INTEGER}, - - - article_post_time = #{articlePostTime,jdbcType=TIMESTAMP}, - - - article_update_time = #{articleUpdateTime,jdbcType=TIMESTAMP}, - - - article_is_comment = #{articleIsComment,jdbcType=INTEGER}, - - - article_status = #{articleStatus,jdbcType=INTEGER}, - - - article_order = #{articleOrder,jdbcType=INTEGER}, - - - article_content = #{articleContent,jdbcType=LONGVARCHAR}, - - - where article_id = #{articleId,jdbcType=INTEGER} - - - update article - set article_user_id = #{articleUserId,jdbcType=INTEGER}, - article_title = #{articleTitle,jdbcType=VARCHAR}, - article_parent_category_id = #{articleParentCategoryId,jdbcType=INTEGER}, - article_child_category_id = #{articleChildCategoryId,jdbcType=INTEGER}, - article_tag_ids = #{articleTagIds,jdbcType=VARCHAR}, - article_view_count = #{articleViewCount,jdbcType=INTEGER}, - article_comment_count = #{articleCommentCount,jdbcType=INTEGER}, - article_like_count = #{articleLikeCount,jdbcType=INTEGER}, - article_post_time = #{articlePostTime,jdbcType=TIMESTAMP}, - article_update_time = #{articleUpdateTime,jdbcType=TIMESTAMP}, - article_is_comment = #{articleIsComment,jdbcType=INTEGER}, - article_status = #{articleStatus,jdbcType=INTEGER}, - article_order = #{articleOrder,jdbcType=INTEGER}, - article_content = #{articleContent,jdbcType=LONGVARCHAR} - where article_id = #{articleId,jdbcType=INTEGER} - - - update article - set article_user_id = #{articleUserId,jdbcType=INTEGER}, - article_title = #{articleTitle,jdbcType=VARCHAR}, - article_parent_category_id = #{articleParentCategoryId,jdbcType=INTEGER}, - article_child_category_id = #{articleChildCategoryId,jdbcType=INTEGER}, - article_tag_ids = #{articleTagIds,jdbcType=VARCHAR}, - article_view_count = #{articleViewCount,jdbcType=INTEGER}, - article_comment_count = #{articleCommentCount,jdbcType=INTEGER}, - article_like_count = #{articleLikeCount,jdbcType=INTEGER}, - article_post_time = #{articlePostTime,jdbcType=TIMESTAMP}, - article_update_time = #{articleUpdateTime,jdbcType=TIMESTAMP}, - article_is_comment = #{articleIsComment,jdbcType=INTEGER}, - article_status = #{articleStatus,jdbcType=INTEGER}, - article_order = #{articleOrder,jdbcType=INTEGER} - where article_id = #{articleId,jdbcType=INTEGER} - - \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/CategoryMapper.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/CategoryMapper.java deleted file mode 100755 index 388d7753..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/CategoryMapper.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.liuyanzhao.blog.mapper; - -import com.liuyanzhao.blog.entity.Category; - -public interface CategoryMapper { - int deleteByPrimaryKey(Integer categoryId); - - int insert(Category record); - - int insertSelective(Category record); - - Category selectByPrimaryKey(Integer categoryId); - - int updateByPrimaryKeySelective(Category record); - - int updateByPrimaryKey(Category record); -} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/CategoryMapper.xml b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/CategoryMapper.xml deleted file mode 100755 index 8dcf9c8e..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/CategoryMapper.xml +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - - - - - - - - category_id, category_pid, category_name, category_description, category_order, category_icon, - category_status - - - - delete from category - where category_id = #{categoryId,jdbcType=INTEGER} - - - insert into category (category_id, category_pid, category_name, - category_description, category_order, category_icon, - category_status) - values (#{categoryId,jdbcType=INTEGER}, #{categoryPid,jdbcType=INTEGER}, #{categoryName,jdbcType=VARCHAR}, - #{categoryDescription,jdbcType=VARCHAR}, #{categoryOrder,jdbcType=INTEGER}, #{categoryIcon,jdbcType=VARCHAR}, - #{categoryStatus,jdbcType=INTEGER}) - - - insert into category - - - category_id, - - - category_pid, - - - category_name, - - - category_description, - - - category_order, - - - category_icon, - - - category_status, - - - - - #{categoryId,jdbcType=INTEGER}, - - - #{categoryPid,jdbcType=INTEGER}, - - - #{categoryName,jdbcType=VARCHAR}, - - - #{categoryDescription,jdbcType=VARCHAR}, - - - #{categoryOrder,jdbcType=INTEGER}, - - - #{categoryIcon,jdbcType=VARCHAR}, - - - #{categoryStatus,jdbcType=INTEGER}, - - - - - update category - - - category_pid = #{categoryPid,jdbcType=INTEGER}, - - - category_name = #{categoryName,jdbcType=VARCHAR}, - - - category_description = #{categoryDescription,jdbcType=VARCHAR}, - - - category_order = #{categoryOrder,jdbcType=INTEGER}, - - - category_icon = #{categoryIcon,jdbcType=VARCHAR}, - - - category_status = #{categoryStatus,jdbcType=INTEGER}, - - - where category_id = #{categoryId,jdbcType=INTEGER} - - - update category - set category_pid = #{categoryPid,jdbcType=INTEGER}, - category_name = #{categoryName,jdbcType=VARCHAR}, - category_description = #{categoryDescription,jdbcType=VARCHAR}, - category_order = #{categoryOrder,jdbcType=INTEGER}, - category_icon = #{categoryIcon,jdbcType=VARCHAR}, - category_status = #{categoryStatus,jdbcType=INTEGER} - where category_id = #{categoryId,jdbcType=INTEGER} - - \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/CommentMapper.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/CommentMapper.java deleted file mode 100755 index dda04820..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/CommentMapper.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.liuyanzhao.blog.mapper; - -import com.liuyanzhao.blog.entity.Comment; - -public interface CommentMapper { - int deleteByPrimaryKey(Integer commentId); - - int insert(Comment record); - - int insertSelective(Comment record); - - Comment selectByPrimaryKey(Integer commentId); - - int updateByPrimaryKeySelective(Comment record); - - int updateByPrimaryKey(Comment record); -} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/CommentMapper.xml b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/CommentMapper.xml deleted file mode 100755 index 1e5b0f25..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/CommentMapper.xml +++ /dev/null @@ -1,189 +0,0 @@ - - - - - - - - - - - - - - - - - - - - comment_id, comment_pid, comment_pname, comment_article_id, comment_author_name, - comment_author_email, comment_author_url, comment_content, comment_agent, comment_ip, - comment_create_time, comment_role, comment_status - - - - delete from comment - where comment_id = #{commentId,jdbcType=INTEGER} - - - insert into comment (comment_id, comment_pid, comment_pname, - comment_article_id, comment_author_name, comment_author_email, - comment_author_url, comment_content, comment_agent, - comment_ip, comment_create_time, comment_role, - comment_status) - values (#{commentId,jdbcType=INTEGER}, #{commentPid,jdbcType=INTEGER}, #{commentPname,jdbcType=VARCHAR}, - #{commentArticleId,jdbcType=INTEGER}, #{commentAuthorName,jdbcType=VARCHAR}, #{commentAuthorEmail,jdbcType=VARCHAR}, - #{commentAuthorUrl,jdbcType=VARCHAR}, #{commentContent,jdbcType=VARCHAR}, #{commentAgent,jdbcType=VARCHAR}, - #{commentIp,jdbcType=VARCHAR}, #{commentCreateTime,jdbcType=TIMESTAMP}, #{commentRole,jdbcType=INTEGER}, - #{commentStatus,jdbcType=INTEGER}) - - - insert into comment - - - comment_id, - - - comment_pid, - - - comment_pname, - - - comment_article_id, - - - comment_author_name, - - - comment_author_email, - - - comment_author_url, - - - comment_content, - - - comment_agent, - - - comment_ip, - - - comment_create_time, - - - comment_role, - - - comment_status, - - - - - #{commentId,jdbcType=INTEGER}, - - - #{commentPid,jdbcType=INTEGER}, - - - #{commentPname,jdbcType=VARCHAR}, - - - #{commentArticleId,jdbcType=INTEGER}, - - - #{commentAuthorName,jdbcType=VARCHAR}, - - - #{commentAuthorEmail,jdbcType=VARCHAR}, - - - #{commentAuthorUrl,jdbcType=VARCHAR}, - - - #{commentContent,jdbcType=VARCHAR}, - - - #{commentAgent,jdbcType=VARCHAR}, - - - #{commentIp,jdbcType=VARCHAR}, - - - #{commentCreateTime,jdbcType=TIMESTAMP}, - - - #{commentRole,jdbcType=INTEGER}, - - - #{commentStatus,jdbcType=INTEGER}, - - - - - update comment - - - comment_pid = #{commentPid,jdbcType=INTEGER}, - - - comment_pname = #{commentPname,jdbcType=VARCHAR}, - - - comment_article_id = #{commentArticleId,jdbcType=INTEGER}, - - - comment_author_name = #{commentAuthorName,jdbcType=VARCHAR}, - - - comment_author_email = #{commentAuthorEmail,jdbcType=VARCHAR}, - - - comment_author_url = #{commentAuthorUrl,jdbcType=VARCHAR}, - - - comment_content = #{commentContent,jdbcType=VARCHAR}, - - - comment_agent = #{commentAgent,jdbcType=VARCHAR}, - - - comment_ip = #{commentIp,jdbcType=VARCHAR}, - - - comment_create_time = #{commentCreateTime,jdbcType=TIMESTAMP}, - - - comment_role = #{commentRole,jdbcType=INTEGER}, - - - comment_status = #{commentStatus,jdbcType=INTEGER}, - - - where comment_id = #{commentId,jdbcType=INTEGER} - - - update comment - set comment_pid = #{commentPid,jdbcType=INTEGER}, - comment_pname = #{commentPname,jdbcType=VARCHAR}, - comment_article_id = #{commentArticleId,jdbcType=INTEGER}, - comment_author_name = #{commentAuthorName,jdbcType=VARCHAR}, - comment_author_email = #{commentAuthorEmail,jdbcType=VARCHAR}, - comment_author_url = #{commentAuthorUrl,jdbcType=VARCHAR}, - comment_content = #{commentContent,jdbcType=VARCHAR}, - comment_agent = #{commentAgent,jdbcType=VARCHAR}, - comment_ip = #{commentIp,jdbcType=VARCHAR}, - comment_create_time = #{commentCreateTime,jdbcType=TIMESTAMP}, - comment_role = #{commentRole,jdbcType=INTEGER}, - comment_status = #{commentStatus,jdbcType=INTEGER} - where comment_id = #{commentId,jdbcType=INTEGER} - - \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/LinkMapper.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/LinkMapper.java deleted file mode 100755 index 54f75016..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/LinkMapper.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.liuyanzhao.blog.mapper; - -import com.liuyanzhao.blog.entity.Link; - -public interface LinkMapper { - int deleteByPrimaryKey(Integer linkId); - - int insert(Link record); - - int insertSelective(Link record); - - Link selectByPrimaryKey(Integer linkId); - - int updateByPrimaryKeySelective(Link record); - - int updateByPrimaryKey(Link record); -} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/LinkMapper.xml b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/LinkMapper.xml deleted file mode 100755 index 34ba926c..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/LinkMapper.xml +++ /dev/null @@ -1,164 +0,0 @@ - - - - - - - - - - - - - - - - - - link_id, link_url, link_name, link_image, link_description, link_owner_nickname, - link_owner_contact, link_update_time, link_create_time, link_order, link_status - - - - delete from link - where link_id = #{linkId,jdbcType=INTEGER} - - - insert into link (link_id, link_url, link_name, - link_image, link_description, link_owner_nickname, - link_owner_contact, link_update_time, link_create_time, - link_order, link_status) - values (#{linkId,jdbcType=INTEGER}, #{linkUrl,jdbcType=VARCHAR}, #{linkName,jdbcType=VARCHAR}, - #{linkImage,jdbcType=VARCHAR}, #{linkDescription,jdbcType=VARCHAR}, #{linkOwnerNickname,jdbcType=VARCHAR}, - #{linkOwnerContact,jdbcType=VARCHAR}, #{linkUpdateTime,jdbcType=TIMESTAMP}, #{linkCreateTime,jdbcType=TIMESTAMP}, - #{linkOrder,jdbcType=INTEGER}, #{linkStatus,jdbcType=INTEGER}) - - - insert into link - - - link_id, - - - link_url, - - - link_name, - - - link_image, - - - link_description, - - - link_owner_nickname, - - - link_owner_contact, - - - link_update_time, - - - link_create_time, - - - link_order, - - - link_status, - - - - - #{linkId,jdbcType=INTEGER}, - - - #{linkUrl,jdbcType=VARCHAR}, - - - #{linkName,jdbcType=VARCHAR}, - - - #{linkImage,jdbcType=VARCHAR}, - - - #{linkDescription,jdbcType=VARCHAR}, - - - #{linkOwnerNickname,jdbcType=VARCHAR}, - - - #{linkOwnerContact,jdbcType=VARCHAR}, - - - #{linkUpdateTime,jdbcType=TIMESTAMP}, - - - #{linkCreateTime,jdbcType=TIMESTAMP}, - - - #{linkOrder,jdbcType=INTEGER}, - - - #{linkStatus,jdbcType=INTEGER}, - - - - - update link - - - link_url = #{linkUrl,jdbcType=VARCHAR}, - - - link_name = #{linkName,jdbcType=VARCHAR}, - - - link_image = #{linkImage,jdbcType=VARCHAR}, - - - link_description = #{linkDescription,jdbcType=VARCHAR}, - - - link_owner_nickname = #{linkOwnerNickname,jdbcType=VARCHAR}, - - - link_owner_contact = #{linkOwnerContact,jdbcType=VARCHAR}, - - - link_update_time = #{linkUpdateTime,jdbcType=TIMESTAMP}, - - - link_create_time = #{linkCreateTime,jdbcType=TIMESTAMP}, - - - link_order = #{linkOrder,jdbcType=INTEGER}, - - - link_status = #{linkStatus,jdbcType=INTEGER}, - - - where link_id = #{linkId,jdbcType=INTEGER} - - - update link - set link_url = #{linkUrl,jdbcType=VARCHAR}, - link_name = #{linkName,jdbcType=VARCHAR}, - link_image = #{linkImage,jdbcType=VARCHAR}, - link_description = #{linkDescription,jdbcType=VARCHAR}, - link_owner_nickname = #{linkOwnerNickname,jdbcType=VARCHAR}, - link_owner_contact = #{linkOwnerContact,jdbcType=VARCHAR}, - link_update_time = #{linkUpdateTime,jdbcType=TIMESTAMP}, - link_create_time = #{linkCreateTime,jdbcType=TIMESTAMP}, - link_order = #{linkOrder,jdbcType=INTEGER}, - link_status = #{linkStatus,jdbcType=INTEGER} - where link_id = #{linkId,jdbcType=INTEGER} - - \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/MenuMapper.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/MenuMapper.java deleted file mode 100755 index ef37ab6d..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/MenuMapper.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.liuyanzhao.blog.mapper; - -import com.liuyanzhao.blog.entity.Menu; - -public interface MenuMapper { - int deleteByPrimaryKey(Integer menuId); - - int insert(Menu record); - - int insertSelective(Menu record); - - Menu selectByPrimaryKey(Integer menuId); - - int updateByPrimaryKeySelective(Menu record); - - int updateByPrimaryKey(Menu record); -} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/MenuMapper.xml b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/MenuMapper.xml deleted file mode 100755 index 766aca4b..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/MenuMapper.xml +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - menu_id, menu_name, menu_url, menu_level, menu_icon, menu_order, menu_status - - - - delete from menu - where menu_id = #{menuId,jdbcType=INTEGER} - - - insert into menu (menu_id, menu_name, menu_url, - menu_level, menu_icon, menu_order, - menu_status) - values (#{menuId,jdbcType=INTEGER}, #{menuName,jdbcType=VARCHAR}, #{menuUrl,jdbcType=VARCHAR}, - #{menuLevel,jdbcType=INTEGER}, #{menuIcon,jdbcType=VARCHAR}, #{menuOrder,jdbcType=INTEGER}, - #{menuStatus,jdbcType=INTEGER}) - - - insert into menu - - - menu_id, - - - menu_name, - - - menu_url, - - - menu_level, - - - menu_icon, - - - menu_order, - - - menu_status, - - - - - #{menuId,jdbcType=INTEGER}, - - - #{menuName,jdbcType=VARCHAR}, - - - #{menuUrl,jdbcType=VARCHAR}, - - - #{menuLevel,jdbcType=INTEGER}, - - - #{menuIcon,jdbcType=VARCHAR}, - - - #{menuOrder,jdbcType=INTEGER}, - - - #{menuStatus,jdbcType=INTEGER}, - - - - - update menu - - - menu_name = #{menuName,jdbcType=VARCHAR}, - - - menu_url = #{menuUrl,jdbcType=VARCHAR}, - - - menu_level = #{menuLevel,jdbcType=INTEGER}, - - - menu_icon = #{menuIcon,jdbcType=VARCHAR}, - - - menu_order = #{menuOrder,jdbcType=INTEGER}, - - - menu_status = #{menuStatus,jdbcType=INTEGER}, - - - where menu_id = #{menuId,jdbcType=INTEGER} - - - update menu - set menu_name = #{menuName,jdbcType=VARCHAR}, - menu_url = #{menuUrl,jdbcType=VARCHAR}, - menu_level = #{menuLevel,jdbcType=INTEGER}, - menu_icon = #{menuIcon,jdbcType=VARCHAR}, - menu_order = #{menuOrder,jdbcType=INTEGER}, - menu_status = #{menuStatus,jdbcType=INTEGER} - where menu_id = #{menuId,jdbcType=INTEGER} - - \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/NoticeMapper.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/NoticeMapper.java deleted file mode 100755 index 2fa8bdd8..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/NoticeMapper.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.liuyanzhao.blog.mapper; - -import com.liuyanzhao.blog.entity.Notice; - -public interface NoticeMapper { - int deleteByPrimaryKey(Integer noticeId); - - int insert(Notice record); - - int insertSelective(Notice record); - - Notice selectByPrimaryKey(Integer noticeId); - - int updateByPrimaryKeySelective(Notice record); - - int updateByPrimaryKey(Notice record); -} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/NoticeMapper.xml b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/NoticeMapper.xml deleted file mode 100755 index 98a203bc..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/NoticeMapper.xml +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - - - - - - - - notice_id, notice_title, notice_content, notice_create_time, notice_update_time, - notice_status, notice_order - - - - delete from notice - where notice_id = #{noticeId,jdbcType=INTEGER} - - - insert into notice (notice_id, notice_title, notice_content, - notice_create_time, notice_update_time, - notice_status, notice_order) - values (#{noticeId,jdbcType=INTEGER}, #{noticeTitle,jdbcType=VARCHAR}, #{noticeContent,jdbcType=VARCHAR}, - #{noticeCreateTime,jdbcType=TIMESTAMP}, #{noticeUpdateTime,jdbcType=TIMESTAMP}, - #{noticeStatus,jdbcType=INTEGER}, #{noticeOrder,jdbcType=INTEGER}) - - - insert into notice - - - notice_id, - - - notice_title, - - - notice_update_time, - - - notice_status, - - - - - #{noticeId,jdbcType=INTEGER}, - - - #{noticeTitle,jdbcType=VARCHAR}, - - - #{noticeUpdateTime,jdbcType=TIMESTAMP}, - - - #{noticeStatus,jdbcType=INTEGER}, - - - - - update notice - - - notice_title = #{noticeTitle,jdbcType=VARCHAR}, - - - notice_content = #{noticeContent,jdbcType=VARCHAR}, - - - notice_create_time = #{noticeCreateTime,jdbcType=TIMESTAMP}, - - - notice_update_time = #{noticeUpdateTime,jdbcType=TIMESTAMP}, - - - notice_status = #{noticeStatus,jdbcType=INTEGER}, - - - notice_order = #{noticeOrder,jdbcType=INTEGER}, - - - where notice_id = #{noticeId,jdbcType=INTEGER} - - - update notice - set notice_title = #{noticeTitle,jdbcType=VARCHAR}, - notice_content = #{noticeContent,jdbcType=VARCHAR}, - notice_create_time = #{noticeCreateTime,jdbcType=TIMESTAMP}, - notice_update_time = #{noticeUpdateTime,jdbcType=TIMESTAMP}, - notice_status = #{noticeStatus,jdbcType=INTEGER}, - notice_order = #{noticeOrder,jdbcType=INTEGER} - where notice_id = #{noticeId,jdbcType=INTEGER} - - \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/OptionsMapper.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/OptionsMapper.java deleted file mode 100755 index 839f47ae..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/OptionsMapper.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.liuyanzhao.blog.mapper; - -import com.liuyanzhao.blog.entity.Options; - -public interface OptionsMapper { - int deleteByPrimaryKey(Integer optionId); - - int insert(Options record); - - int insertSelective(Options record); - - Options selectByPrimaryKey(Integer optionId); - - int updateByPrimaryKeySelective(Options record); - - int updateByPrimaryKey(Options record); -} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/OptionsMapper.xml b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/OptionsMapper.xml deleted file mode 100755 index f01e90de..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/OptionsMapper.xml +++ /dev/null @@ -1,205 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - option_id, option_site_title, option_site_descrption, option_meta_descrption, option_meta_keyword, - option_aboutsite_avatar, option_aboutsite_title, option_aboutsite_content, option_aboutsite_wechat, - option_aboutsite_qq, option_aboutsite_github, option_aboutsite_weibo, option_tongji, - option_status - - - - delete from options - where option_id = #{optionId,jdbcType=INTEGER} - - - insert into options (option_id, option_site_title, option_site_descrption, - option_meta_descrption, option_meta_keyword, - option_aboutsite_avatar, option_aboutsite_title, - option_aboutsite_content, option_aboutsite_wechat, - option_aboutsite_qq, option_aboutsite_github, - option_aboutsite_weibo, option_tongji, option_status - ) - values (#{optionId,jdbcType=INTEGER}, #{optionSiteTitle,jdbcType=VARCHAR}, #{optionSiteDescrption,jdbcType=VARCHAR}, - #{optionMetaDescrption,jdbcType=VARCHAR}, #{optionMetaKeyword,jdbcType=VARCHAR}, - #{optionAboutsiteAvatar,jdbcType=VARCHAR}, #{optionAboutsiteTitle,jdbcType=VARCHAR}, - #{optionAboutsiteContent,jdbcType=VARCHAR}, #{optionAboutsiteWechat,jdbcType=VARCHAR}, - #{optionAboutsiteQq,jdbcType=VARCHAR}, #{optionAboutsiteGithub,jdbcType=VARCHAR}, - #{optionAboutsiteWeibo,jdbcType=VARCHAR}, #{optionTongji,jdbcType=VARCHAR}, #{optionStatus,jdbcType=INTEGER} - ) - - - insert into options - - - option_id, - - - option_site_title, - - - option_site_descrption, - - - option_meta_descrption, - - - option_meta_keyword, - - - option_aboutsite_avatar, - - - option_aboutsite_title, - - - option_aboutsite_content, - - - option_aboutsite_wechat, - - - option_aboutsite_qq, - - - option_aboutsite_github, - - - option_aboutsite_weibo, - - - option_tongji, - - - option_status, - - - - - #{optionId,jdbcType=INTEGER}, - - - #{optionSiteTitle,jdbcType=VARCHAR}, - - - #{optionSiteDescrption,jdbcType=VARCHAR}, - - - #{optionMetaDescrption,jdbcType=VARCHAR}, - - - #{optionMetaKeyword,jdbcType=VARCHAR}, - - - #{optionAboutsiteAvatar,jdbcType=VARCHAR}, - - - #{optionAboutsiteTitle,jdbcType=VARCHAR}, - - - #{optionAboutsiteContent,jdbcType=VARCHAR}, - - - #{optionAboutsiteWechat,jdbcType=VARCHAR}, - - - #{optionAboutsiteQq,jdbcType=VARCHAR}, - - - #{optionAboutsiteGithub,jdbcType=VARCHAR}, - - - #{optionAboutsiteWeibo,jdbcType=VARCHAR}, - - - #{optionTongji,jdbcType=VARCHAR}, - - - #{optionStatus,jdbcType=INTEGER}, - - - - - update options - - - option_site_title = #{optionSiteTitle,jdbcType=VARCHAR}, - - - option_site_descrption = #{optionSiteDescrption,jdbcType=VARCHAR}, - - - option_meta_descrption = #{optionMetaDescrption,jdbcType=VARCHAR}, - - - option_meta_keyword = #{optionMetaKeyword,jdbcType=VARCHAR}, - - - option_aboutsite_avatar = #{optionAboutsiteAvatar,jdbcType=VARCHAR}, - - - option_aboutsite_title = #{optionAboutsiteTitle,jdbcType=VARCHAR}, - - - option_aboutsite_content = #{optionAboutsiteContent,jdbcType=VARCHAR}, - - - option_aboutsite_wechat = #{optionAboutsiteWechat,jdbcType=VARCHAR}, - - - option_aboutsite_qq = #{optionAboutsiteQq,jdbcType=VARCHAR}, - - - option_aboutsite_github = #{optionAboutsiteGithub,jdbcType=VARCHAR}, - - - option_aboutsite_weibo = #{optionAboutsiteWeibo,jdbcType=VARCHAR}, - - - option_tongji = #{optionTongji,jdbcType=VARCHAR}, - - - option_status = #{optionStatus,jdbcType=INTEGER}, - - - where option_id = #{optionId,jdbcType=INTEGER} - - - update options - set option_site_title = #{optionSiteTitle,jdbcType=VARCHAR}, - option_site_descrption = #{optionSiteDescrption,jdbcType=VARCHAR}, - option_meta_descrption = #{optionMetaDescrption,jdbcType=VARCHAR}, - option_meta_keyword = #{optionMetaKeyword,jdbcType=VARCHAR}, - option_aboutsite_avatar = #{optionAboutsiteAvatar,jdbcType=VARCHAR}, - option_aboutsite_title = #{optionAboutsiteTitle,jdbcType=VARCHAR}, - option_aboutsite_content = #{optionAboutsiteContent,jdbcType=VARCHAR}, - option_aboutsite_wechat = #{optionAboutsiteWechat,jdbcType=VARCHAR}, - option_aboutsite_qq = #{optionAboutsiteQq,jdbcType=VARCHAR}, - option_aboutsite_github = #{optionAboutsiteGithub,jdbcType=VARCHAR}, - option_aboutsite_weibo = #{optionAboutsiteWeibo,jdbcType=VARCHAR}, - option_tongji = #{optionTongji,jdbcType=VARCHAR}, - option_status = #{optionStatus,jdbcType=INTEGER} - where option_id = #{optionId,jdbcType=INTEGER} - - \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/PageMapper.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/PageMapper.java deleted file mode 100755 index 9b7dbb83..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/PageMapper.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.liuyanzhao.blog.mapper; - -import com.liuyanzhao.blog.entity.Page; - -public interface PageMapper { - int deleteByPrimaryKey(Integer pageId); - - int insert(Page record); - - int insertSelective(Page record); - - Page selectByPrimaryKey(Integer pageId); - - int updateByPrimaryKeySelective(Page record); - - int updateByPrimaryKey(Page record); -} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/PageMapper.xml b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/PageMapper.xml deleted file mode 100755 index 98bbcdbc..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/PageMapper.xml +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - - - - - - - - - - - page_id, page_key, page_title, page_content, page_create_time, page_update_time, - page_view_count, page_comment_count, page_status - - - - delete from page - where page_id = #{pageId,jdbcType=INTEGER} - - - insert into page (page_id, page_key, page_title, - page_content, page_create_time, page_update_time, - page_view_count, page_comment_count, page_status - ) - values (#{pageId,jdbcType=INTEGER}, #{pageKey,jdbcType=VARCHAR}, #{pageTitle,jdbcType=VARCHAR}, - #{pageContent,jdbcType=VARCHAR}, #{pageCreateTime,jdbcType=TIMESTAMP}, #{pageUpdateTime,jdbcType=TIMESTAMP}, - #{pageViewCount,jdbcType=INTEGER}, #{pageCommentCount,jdbcType=INTEGER}, #{pageStatus,jdbcType=INTEGER} - ) - - - insert into page - - - page_id, - - - page_key, - - - page_title, - - - page_content, - - - page_create_time, - - - page_update_time, - - - page_view_count, - - - page_comment_count, - - - page_status, - - - - - #{pageId,jdbcType=INTEGER}, - - - #{pageKey,jdbcType=VARCHAR}, - - - #{pageTitle,jdbcType=VARCHAR}, - - - #{pageContent,jdbcType=VARCHAR}, - - - #{pageCreateTime,jdbcType=TIMESTAMP}, - - - #{pageUpdateTime,jdbcType=TIMESTAMP}, - - - #{pageViewCount,jdbcType=INTEGER}, - - - #{pageCommentCount,jdbcType=INTEGER}, - - - #{pageStatus,jdbcType=INTEGER}, - - - - - update page - - - page_key = #{pageKey,jdbcType=VARCHAR}, - - - page_title = #{pageTitle,jdbcType=VARCHAR}, - - - page_content = #{pageContent,jdbcType=VARCHAR}, - - - page_create_time = #{pageCreateTime,jdbcType=TIMESTAMP}, - - - page_update_time = #{pageUpdateTime,jdbcType=TIMESTAMP}, - - - page_view_count = #{pageViewCount,jdbcType=INTEGER}, - - - page_comment_count = #{pageCommentCount,jdbcType=INTEGER}, - - - page_status = #{pageStatus,jdbcType=INTEGER}, - - - where page_id = #{pageId,jdbcType=INTEGER} - - - update page - set page_key = #{pageKey,jdbcType=VARCHAR}, - page_title = #{pageTitle,jdbcType=VARCHAR}, - page_content = #{pageContent,jdbcType=VARCHAR}, - page_create_time = #{pageCreateTime,jdbcType=TIMESTAMP}, - page_update_time = #{pageUpdateTime,jdbcType=TIMESTAMP}, - page_view_count = #{pageViewCount,jdbcType=INTEGER}, - page_comment_count = #{pageCommentCount,jdbcType=INTEGER}, - page_status = #{pageStatus,jdbcType=INTEGER} - where page_id = #{pageId,jdbcType=INTEGER} - - \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/TagMapper.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/TagMapper.java deleted file mode 100755 index 4fef7d5a..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/TagMapper.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.liuyanzhao.blog.mapper; - -import com.liuyanzhao.blog.entity.Tag; - -public interface TagMapper { - int deleteByPrimaryKey(Integer tagId); - - int insert(Tag record); - - int insertSelective(Tag record); - - Tag selectByPrimaryKey(Integer tagId); - - int updateByPrimaryKeySelective(Tag record); - - int updateByPrimaryKey(Tag record); -} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/TagMapper.xml b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/TagMapper.xml deleted file mode 100755 index 79f7b3c1..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/TagMapper.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - - tag_id, tag_name, tag_description, tag_status - - - - delete from tag - where tag_id = #{tagId,jdbcType=INTEGER} - - - insert into tag (tag_id, tag_name, tag_description, - tag_status) - values (#{tagId,jdbcType=INTEGER}, #{tagName,jdbcType=VARCHAR}, #{tagDescription,jdbcType=VARCHAR}, - #{tagStatus,jdbcType=INTEGER}) - - - insert into tag - - - tag_id, - - - tag_name, - - - tag_description, - - - tag_status, - - - - - #{tagId,jdbcType=INTEGER}, - - - #{tagName,jdbcType=VARCHAR}, - - - #{tagDescription,jdbcType=VARCHAR}, - - - #{tagStatus,jdbcType=INTEGER}, - - - - - update tag - - - tag_name = #{tagName,jdbcType=VARCHAR}, - - - tag_description = #{tagDescription,jdbcType=VARCHAR}, - - - tag_status = #{tagStatus,jdbcType=INTEGER}, - - - where tag_id = #{tagId,jdbcType=INTEGER} - - - update tag - set tag_name = #{tagName,jdbcType=VARCHAR}, - tag_description = #{tagDescription,jdbcType=VARCHAR}, - tag_status = #{tagStatus,jdbcType=INTEGER} - where tag_id = #{tagId,jdbcType=INTEGER} - - \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/UserMapper.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/UserMapper.java deleted file mode 100755 index 1be034b0..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/UserMapper.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.liuyanzhao.blog.mapper; - -import com.liuyanzhao.blog.entity.User; - -public interface UserMapper { - int deleteByPrimaryKey(Integer userId); - - int insert(User record); - - int insertSelective(User record); - - User selectByPrimaryKey(Integer userId); - - int updateByPrimaryKeySelective(User record); - - int updateByPrimaryKey(User record); -} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/UserMapper.xml b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/UserMapper.xml deleted file mode 100755 index e87c8558..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/UserMapper.xml +++ /dev/null @@ -1,164 +0,0 @@ - - - - - - - - - - - - - - - - - - user_id, user_name, user_pass, user_nickname, user_email, user_url, user_avatar, - user_last_login_ip, user_register_time, user_last_login_time, user_status - - - - delete from user - where user_id = #{userId,jdbcType=INTEGER} - - - insert into user (user_id, user_name, user_pass, - user_nickname, user_email, user_url, - user_avatar, user_last_login_ip, user_register_time, - user_last_login_time, user_status) - values (#{userId,jdbcType=INTEGER}, #{userName,jdbcType=VARCHAR}, #{userPass,jdbcType=VARCHAR}, - #{userNickname,jdbcType=VARCHAR}, #{userEmail,jdbcType=VARCHAR}, #{userUrl,jdbcType=VARCHAR}, - #{userAvatar,jdbcType=VARCHAR}, #{userLastLoginIp,jdbcType=VARCHAR}, #{userRegisterTime,jdbcType=TIMESTAMP}, - #{userLastLoginTime,jdbcType=TIMESTAMP}, #{userStatus,jdbcType=INTEGER}) - - - insert into user - - - user_id, - - - user_name, - - - user_pass, - - - user_nickname, - - - user_email, - - - user_url, - - - user_avatar, - - - user_last_login_ip, - - - user_register_time, - - - user_last_login_time, - - - user_status, - - - - - #{userId,jdbcType=INTEGER}, - - - #{userName,jdbcType=VARCHAR}, - - - #{userPass,jdbcType=VARCHAR}, - - - #{userNickname,jdbcType=VARCHAR}, - - - #{userEmail,jdbcType=VARCHAR}, - - - #{userUrl,jdbcType=VARCHAR}, - - - #{userAvatar,jdbcType=VARCHAR}, - - - #{userLastLoginIp,jdbcType=VARCHAR}, - - - #{userRegisterTime,jdbcType=TIMESTAMP}, - - - #{userLastLoginTime,jdbcType=TIMESTAMP}, - - - #{userStatus,jdbcType=INTEGER}, - - - - - update user - - - user_name = #{userName,jdbcType=VARCHAR}, - - - user_pass = #{userPass,jdbcType=VARCHAR}, - - - user_nickname = #{userNickname,jdbcType=VARCHAR}, - - - user_email = #{userEmail,jdbcType=VARCHAR}, - - - user_url = #{userUrl,jdbcType=VARCHAR}, - - - user_avatar = #{userAvatar,jdbcType=VARCHAR}, - - - user_last_login_ip = #{userLastLoginIp,jdbcType=VARCHAR}, - - - user_register_time = #{userRegisterTime,jdbcType=TIMESTAMP}, - - - user_last_login_time = #{userLastLoginTime,jdbcType=TIMESTAMP}, - - - user_status = #{userStatus,jdbcType=INTEGER}, - - - where user_id = #{userId,jdbcType=INTEGER} - - - update user - set user_name = #{userName,jdbcType=VARCHAR}, - user_pass = #{userPass,jdbcType=VARCHAR}, - user_nickname = #{userNickname,jdbcType=VARCHAR}, - user_email = #{userEmail,jdbcType=VARCHAR}, - user_url = #{userUrl,jdbcType=VARCHAR}, - user_avatar = #{userAvatar,jdbcType=VARCHAR}, - user_last_login_ip = #{userLastLoginIp,jdbcType=VARCHAR}, - user_register_time = #{userRegisterTime,jdbcType=TIMESTAMP}, - user_last_login_time = #{userLastLoginTime,jdbcType=TIMESTAMP}, - user_status = #{userStatus,jdbcType=INTEGER} - where user_id = #{userId,jdbcType=INTEGER} - - \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/ArticleMapperCustom.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/ArticleMapperCustom.java deleted file mode 100755 index 0df29a42..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/ArticleMapperCustom.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.liuyanzhao.blog.mapper.custom; - -import com.liuyanzhao.blog.entity.custom.ArticleCustom; -import org.apache.ibatis.annotations.Param; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** - * Created by 言曌 on 2017/8/24. - */ - -@Repository -public interface ArticleMapperCustom { - //获取文章总数 - public Integer countArticle(@Param(value="status") Integer status) throws Exception; - - //获得留言总数 - public Integer countArticleComment(@Param(value="status")Integer status) throws Exception; - - //获得浏览量总数 - public Integer countArticleView(@Param(value="status")Integer status) throws Exception; - - //获得所有文章(文章归档) - public List listArticle(@Param(value="status")Integer status) throws Exception; - - //根据id查询用户信息 - public ArticleCustom getArticleById(@Param(value="status")Integer status,@Param(value="id")Integer id) throws Exception; - - //分页操作 - public List listArticleByPage(@Param(value="status") Integer status,@Param(value="startPos") Integer startPos, @Param(value="pageSize") Integer pageSize) throws Exception; - - //文章结果查询结果的数量 - public Integer getSearchResultCount(@Param(value="status") Integer status,@Param(value="query")String query) throws Exception; - - //查询文章分页操作 - public List listSearchResultByPage(@Param(value="status") Integer status,@Param(value="query") String query,@Param(value="startPos") Integer startPos,@Param(value="pageSize") Integer pageSize) throws Exception; - - //获得同分类的文章(相关文章) - public List listArticleWithSameCategory( - @Param(value="status") Integer status, - @Param(value = "parentCategory") Integer parentCategory - ,@Param(value = "childCategory") Integer childCategory - ,@Param(value = "limit") Integer limit - ) throws Exception; - - //获得访问最多的文章(猜你喜欢) - public List listArticleByViewCount(@Param(value="status") Integer status,@Param(value = "limit") Integer limit) throws Exception; - - //获得上一篇文章 - public ArticleCustom getAfterArticle(@Param(value="status") Integer status,@Param(value="id") Integer id) throws Exception; - - //获得下一篇文章 - public ArticleCustom getPreArticle(@Param(value="status") Integer status,@Param(value="id") Integer id) throws Exception; - - //获得随机文章 - public List listRandomArticle(@Param(value="status") Integer status,@Param(value = "limit") Integer limit) throws Exception; - - //热评文章 - public List listArticleByCommentCount(@Param(value="status") Integer status,@Param(value = "limit") Integer limit) throws Exception; - - //获得该分类的文章数 - public Integer countArticleByCategory(@Param(value="status") Integer status,@Param(value = "id") Integer id) throws Exception; - - //获得该分类的文章数 - public Integer countArticleByTag(@Param(value="status") Integer status,@Param(value = "id") Integer id) throws Exception; - - //更新文章的评论数 - public void updateCommentCount(@Param(value = "articleId") Integer articleId) throws Exception; - - //获得最后更新的记录 - public ArticleCustom getLastUpdateArticle() throws Exception; -} - - - diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/ArticleMapperCustom.xml b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/ArticleMapperCustom.xml deleted file mode 100755 index a92ec254..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/ArticleMapperCustom.xml +++ /dev/null @@ -1,319 +0,0 @@ - - - - - - article_id, - article_user_id, - article_title, - article_content, - article_parent_category_id, - article_child_category_id, - article_tag_ids, - article_view_count, - article_comment_count, - article_like_count, - article_post_time, - article_update_time, - article_is_comment, - article_status, - article_order - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - UPDATE `article` - SET article_comment_count= - ( - SELECT count(*) FROM `comment` - WHERE article.article_id=comment.comment_article_id AND comment_status=1 - ) - WHERE article_id=#{articleId} - - - - - - \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/CategoryMapperCustom.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/CategoryMapperCustom.java deleted file mode 100755 index 1d189911..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/CategoryMapperCustom.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.liuyanzhao.blog.mapper.custom; - - - -import com.liuyanzhao.blog.entity.Category; -import com.liuyanzhao.blog.entity.custom.ArticleCustom; -import com.liuyanzhao.blog.entity.custom.CategoryCustom; -import org.apache.ibatis.annotations.Param; -import org.springframework.stereotype.Repository; - -import java.util.List; - - -/** - * Created by 言曌 on 2017/8/24. - */ - -@Repository -public interface CategoryMapperCustom { - //查询分类总数 - public Integer countCategory(@Param(value="status") Integer status) throws Exception; - - //获得分类列表 - public List listCategory(@Param(value="status") Integer status) throws Exception; - - //根据分类id获得分类信息 - public CategoryCustom getCategoryById(@Param(value="status") Integer status,@Param(value="id")Integer id) throws Exception; - - //获得含有该分类的文章列表 - public List listArticleWithCategoryByPage( - @Param(value="status") Integer status, - @Param(value = "cateId") Integer cateId - ,@Param(value="startPos") Integer startPos - ,@Param(value="pageSize") Integer pageSize - ) throws Exception; - - //删除分类 - public void deleteCategory(Integer id) throws Exception; - - //根据父分类找子分类 - public List findChildCategory(@Param(value="status") Integer status,@Param(value="id")Integer id) throws Exception; - - //根据标签名获取标签 - public Category getCategoryByName(String name) throws Exception; - -} - - - diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/CategoryMapperCustom.xml b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/CategoryMapperCustom.xml deleted file mode 100755 index 0396b066..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/CategoryMapperCustom.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - category_id,category_pid,category_name,category_description,category_order,category_icon,category_status - - - - - - - - - - - - - - - - - - DELETE FROM `category` WHERE category_id=#{value} - - - - - - - - - - \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/CommentMapperCustom.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/CommentMapperCustom.java deleted file mode 100755 index ebb897f1..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/CommentMapperCustom.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.liuyanzhao.blog.mapper.custom; - -import com.liuyanzhao.blog.entity.Comment; -import com.liuyanzhao.blog.entity.custom.CommentCustom; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * Created by 言曌 on 2017/9/10. - */ -public interface CommentMapperCustom { - - //根据文章id获取评论列表 - public List listCommentByArticleId(@Param(value="status") Integer status,@Param(value="id") Integer id); - - //获得评论列表分页 - public List listCommentByPage(@Param(value="status") Integer status,@Param(value="startPos") Integer startPos, @Param(value="pageSize") Integer pageSize) throws Exception; - - //获得评论列表 - public List listComment(@Param(value="status") Integer status) throws Exception; - - //统计评论数 - public Integer countComment(@Param(value="status") Integer status) throws Exception; - - //获得最近评论 - public List listRecentComment(@Param(value = "limit") Integer limit) throws Exception; - - //获得评论的子评论 - public List listChildComment(@Param(value = "id") Integer id) throws Exception; - -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/CommentMapperCustom.xml b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/CommentMapperCustom.xml deleted file mode 100755 index b0d39c37..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/CommentMapperCustom.xml +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - comment_id, - comment_pid, - comment_pname, - comment_article_id, - comment_author_name, - comment_author_email, - comment_author_url, - comment_content, - comment_agent, - comment_ip, - comment_create_time, - comment_role, - comment_status - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/LinkMapperCustom.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/LinkMapperCustom.java deleted file mode 100755 index 52cfb2f9..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/LinkMapperCustom.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.liuyanzhao.blog.mapper.custom; - -import com.liuyanzhao.blog.entity.custom.LinkCustom; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * Created by 言曌 on 2017/9/4. - */ -public interface LinkMapperCustom { - - //获得链接总数 - public Integer countLink(@Param(value = "status") Integer status) throws Exception; - - //获得链接列表 - public List listLink(@Param(value = "status") Integer status) throws Exception; - - -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/LinkMapperCustom.xml b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/LinkMapperCustom.xml deleted file mode 100755 index cda02d33..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/LinkMapperCustom.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - link_id, - link_url, - link_name, - link_image, - link_description, - link_owner_nickname, - link_owner_contact, - link_update_time, - link_create_time, - link_order, - link_status - - - - - - - - - - - - - diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/MenuMapperCustom.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/MenuMapperCustom.java deleted file mode 100755 index 1453c1b1..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/MenuMapperCustom.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.liuyanzhao.blog.mapper.custom; - -import com.liuyanzhao.blog.entity.custom.MenuCustom; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -public interface MenuMapperCustom { - //获得菜单列表 - public List listMenu(@Param(value = "status") Integer status) throws Exception; -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/MenuMapperCustom.xml b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/MenuMapperCustom.xml deleted file mode 100755 index 8c51b9be..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/MenuMapperCustom.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - menu_id, - menu_name, - menu_url, - menu_icon, - menu_level, - menu_order, - menu_status - - - - - - - - - diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/NoticeMapperCustom.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/NoticeMapperCustom.java deleted file mode 100755 index 5822d914..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/NoticeMapperCustom.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.liuyanzhao.blog.mapper.custom; - -import com.liuyanzhao.blog.entity.custom.NoticeCustom; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * Created by 言曌 on 2017/9/4. - */ -public interface NoticeMapperCustom { - - //获得公告总数 - public Integer countNotice(@Param(value = "status") Integer status) throws Exception; - - //获得公告列表 - public List listNotice(@Param(value = "status") Integer status) throws Exception; - - -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/NoticeMapperCustom.xml b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/NoticeMapperCustom.xml deleted file mode 100755 index 97188466..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/NoticeMapperCustom.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - notice_id, - notice_title, - notice_content, - notice_order, - notice_create_time, - notice_update_time, - notice_status - - - - - - - - - - - - - diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/OptionsMapperCustom.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/OptionsMapperCustom.java deleted file mode 100755 index eb545031..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/OptionsMapperCustom.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.liuyanzhao.blog.mapper.custom; - -import com.liuyanzhao.blog.entity.Options; - -/** - * Created by 言曌 on 2017/9/7. - */ -public interface OptionsMapperCustom { - public Options getOptions() throws Exception; -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/OptionsMapperCustom.xml b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/OptionsMapperCustom.xml deleted file mode 100755 index 7939387f..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/OptionsMapperCustom.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/PageMapperCustom.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/PageMapperCustom.java deleted file mode 100755 index 4e0a76d6..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/PageMapperCustom.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.liuyanzhao.blog.mapper.custom; - -import com.liuyanzhao.blog.entity.custom.PageCustom; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * Created by 言曌 on 2017/9/7. - */ -public interface PageMapperCustom { - //获得页面列表 - public List listPage(@Param(value="status") Integer status) throws Exception; - - //根据key获得页面 - public PageCustom getPageByKey(@Param(value="status") Integer status,@Param(value="key")String key) throws Exception; -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/PageMapperCustom.xml b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/PageMapperCustom.xml deleted file mode 100755 index 6775c351..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/PageMapperCustom.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - page_id, - page_key, - page_title, - page_content, - page_create_time, - page_update_time, - page_view_count, - page_comment_count, - page_status - - - - - - - - - - - - diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/TagMapperCustom.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/TagMapperCustom.java deleted file mode 100755 index e86465c6..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/TagMapperCustom.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.liuyanzhao.blog.mapper.custom; - - -import com.liuyanzhao.blog.entity.Tag; -import com.liuyanzhao.blog.entity.custom.ArticleCustom; -import com.liuyanzhao.blog.entity.custom.TagCustom; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * Created by 言曌 on 2017/9/2. - */ -public interface TagMapperCustom { - //获得标签总数 - public Integer countTag(@Param(value = "status") Integer status) throws Exception; - - //获得标签列表 - public List listTag(@Param(value = "status")Integer status) throws Exception; - - //获得带有该标签的文章列表 - public List listArticleWithTagByPage(@Param(value = "status") Integer status,@Param(value = "tagId") Integer tagId, @Param(value="startPos") Integer startPos, @Param(value="pageSize") Integer pageSize) throws Exception; - - //根据标签名获取标签 - public Tag getTagByName(String name) throws Exception; - -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/TagMapperCustom.xml b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/TagMapperCustom.xml deleted file mode 100755 index e50d7659..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/TagMapperCustom.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - tag_id, - tag_name, - tag_description, - tag_status - - - - - - - - - - - - - - - - diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/UserMapperCustom.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/UserMapperCustom.java deleted file mode 100755 index a2067522..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/UserMapperCustom.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.liuyanzhao.blog.mapper.custom; - -import com.liuyanzhao.blog.entity.User; -import com.liuyanzhao.blog.entity.custom.UserCustom; -import org.apache.ibatis.annotations.Param; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** - * Created by 言曌 on 2017/8/24. - */ - -@Repository -public interface UserMapperCustom { - - //获得用户列表 - public List listUser() throws Exception; - - - //根据用户名或Email获得用户 - public User getUserByNameOrEmail(String str) throws Exception; - - //根据用户名查用户 - public User getUserByName(String name) throws Exception; - - //根据Email查询用户 - public User getUserByEmail(String email) throws Exception; - - //用户的文章数 - public Integer countArticleByUser(@Param(value = "id") Integer id) throws Exception; -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/UserMapperCustom.xml b/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/UserMapperCustom.xml deleted file mode 100755 index 602a1710..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/mapper/custom/UserMapperCustom.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - user_id, - user_name, - user_pass, - user_nickname, - user_email, - user_url, - user_avatar, - user_last_login_ip, - user_register_time, - user_last_login_time, - user_status - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/ArticleService.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/service/ArticleService.java deleted file mode 100755 index b567b812..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/ArticleService.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.liuyanzhao.blog.service; - -import com.liuyanzhao.blog.entity.Article; -import com.liuyanzhao.blog.entity.custom.ArticleCustom; -import com.liuyanzhao.blog.entity.custom.ArticleDetailVo; -import com.liuyanzhao.blog.entity.custom.ArticleListVo; -import com.liuyanzhao.blog.entity.custom.ArticleSearchVo; -import org.springframework.ui.Model; - -import javax.servlet.http.HttpServletRequest; -import java.util.List; - -/** - * Created by 言曌 on 2017/8/24. - */ -public interface ArticleService { - //获取文章总数 - public Integer countArticle(Integer status) throws Exception; - - //获取评论总数 - public Integer countArticleComment(Integer status) throws Exception; - - //获得浏览量总数 - public Integer countArticleView(Integer status) throws Exception; - - //获得所有文章不分页 - public List listArticle(Integer status) throws Exception; - - //根据id获得文章 - public ArticleCustom getArticleById(Integer status,Integer id) throws Exception; - - //修改文章信息 - public void updateArticle(Integer id, Article article) throws Exception; - - //批量删除文章 - public void deleteArticleBatch(Integer[] ids) throws Exception; - - //删除文章 - public void deleteArticle(Integer id) throws Exception; - - //分页显示() - public List listArticleByPage(Integer status,Integer pageNow,Integer pageSize) throws Exception; - - //文章详情页面显示 - public ArticleDetailVo getArticleDetailById(Integer id) throws Exception; - - //文章查询分页显示 - public List listSearchResultByPage(Integer status,HttpServletRequest request, Model model, Integer pageNow, Integer pageSize, String s) throws Exception; - - //获得相关文章 - public List listArticleWithSameCategory(Integer status,Integer parentCategoryId,Integer childCategoryId, Integer limit) throws Exception; - - //获取访问量较多的文章 - public List listArticleByViewCount(Integer status,Integer limit) throws Exception; - - //获得上一篇文章 - public ArticleCustom getAfterArticle(Integer status,Integer id) throws Exception; - - //获得下一篇文章 - public ArticleCustom getPreArticle(Integer status,Integer id) throws Exception; - - //获得随机文章 - public List listRandomArticle(Integer status,Integer limit) throws Exception; - - //获得评论数较多的文章 - public List listArticleByCommentCount(Integer status,Integer limit) throws Exception; - - //添加文章 - public void insertArticle(Article article) throws Exception; - - //获得某个分类的文章数 - public Integer countArticleWithCategory(Integer status,Integer id) throws Exception; - - //获得某个标签的文章数 - public Integer countArticleWithTag(Integer status,Integer id) throws Exception; - - //更新文章的评论数 - public void updateCommentCount(Integer articleId) throws Exception; - - //获得最后更新记录 - public ArticleCustom getLastUpdateArticle() throws Exception; -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/CategoryService.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/service/CategoryService.java deleted file mode 100755 index 763db9dd..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/CategoryService.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.liuyanzhao.blog.service; - - -import com.liuyanzhao.blog.entity.Category; -import com.liuyanzhao.blog.entity.custom.ArticleListVo; -import com.liuyanzhao.blog.entity.custom.CategoryCustom; - - -import java.util.List; - -/** - * Created by 言曌 on 2017/8/24. - */ -public interface CategoryService { - //获得分类总数 - public Integer countCategory(Integer status) throws Exception; - - //获得分类列表 - public List listCategory(Integer status) throws Exception; - - //获得带有该分类的文章列表 - public List listArticleWithCategoryByPage(Integer status,Integer pageNow,Integer pageSize,Integer cateId) throws Exception; - - //获得某个分类信息 - public CategoryCustom getCategory(Integer status,Integer id) throws Exception; - - //删除分类 - public void deleteCategory(Integer id) throws Exception; - - //根据id查询分类信息 - public CategoryCustom getCategoryById(Integer status,Integer id) throws Exception; - - //添加分类 - public void insertCategory(Category category) throws Exception; - - //更新分类 - public void updateCategory(Category category) throws Exception; - - //根据分类名获取分类 - public Category getCategoryByName(String name) throws Exception; - - -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/CommentService.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/service/CommentService.java deleted file mode 100755 index 1c21dfb8..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/CommentService.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.liuyanzhao.blog.service; - -import com.liuyanzhao.blog.entity.Comment; -import com.liuyanzhao.blog.entity.custom.CommentCustom; -import com.liuyanzhao.blog.entity.custom.CommentListVo; -import org.springframework.stereotype.Service; - -import javax.servlet.http.HttpServletRequest; -import java.util.List; - -/** - * Created by 言曌 on 2017/9/10. - */ -@Service -public interface CommentService { - //添加评论 - public void insertComment(HttpServletRequest request, Comment comment) throws Exception; - - //根据文章id获取评论列表 - public List listCommentByArticleId(Integer status,Integer articleId); - - //根据id获取评论 - public CommentCustom getCommentById(Integer id) throws Exception; - - - //获取所有评论列表 - public List listCommentByPage(Integer status, Integer pageNow, Integer pageSize) throws Exception; - - //获得评论列表 - public List listCommentVo(Integer status) throws Exception; - - //获得评论列表 - public List listComment(Integer status) throws Exception; - - //删除评论 - public void deleteComment(Integer id) throws Exception; - - //修改评论 - public void updateComment(Comment comment) throws Exception; - - //统计评论数 - public Integer countComment(Integer status) throws Exception; - - //获得最近评论 - public List listRecentComment(Integer limit) throws Exception; - - //获得评论的子评论 - public List listChildComment(Integer id) throws Exception; - - -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/LinkService.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/service/LinkService.java deleted file mode 100755 index 6528dde4..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/LinkService.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.liuyanzhao.blog.service; - -import com.liuyanzhao.blog.entity.Link; -import com.liuyanzhao.blog.entity.custom.LinkCustom; -import org.apache.xpath.operations.Bool; - -import java.util.List; - -/** - * Created by 言曌 on 2017/9/4. - */ -public interface LinkService { - - //获得链接总数 - public Integer countLink(Integer status) throws Exception; - - //获得链接列表 - public List listLink(Integer status) throws Exception; - - //添加链接 - public void insertLink(Link link) throws Exception; - - //删除链接 - public void deleteLink(Integer id) throws Exception; - - //更新链接 - public void updateLink(Link link) throws Exception; - - //根据id查询链接 - public LinkCustom getLinkById(Integer id) throws Exception; - - -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/MenuService.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/service/MenuService.java deleted file mode 100755 index 220fcf92..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/MenuService.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.liuyanzhao.blog.service; - -import com.liuyanzhao.blog.entity.Menu; -import com.liuyanzhao.blog.entity.custom.MenuCustom; - -import java.util.List; - -public interface MenuService { - //获得菜单列表 - public List listMenu(Integer status) throws Exception; - - //添加菜单项目 - public void insertMenu(Menu menu) throws Exception; - - //删除菜单项目 - public void deleteMenu(Integer id) throws Exception; - - //更新菜单项目 - public void updateMenu(Menu menu) throws Exception; - - //根据id获得菜单项目信息 - public MenuCustom getMenuById(Integer id) throws Exception; -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/NoticeService.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/service/NoticeService.java deleted file mode 100755 index 6d1a28ae..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/NoticeService.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.liuyanzhao.blog.service; - -import com.liuyanzhao.blog.entity.Notice; -import com.liuyanzhao.blog.entity.custom.NoticeCustom; - -import java.util.List; - -public interface NoticeService { - - - //获得公告列表 - public List listNotice(Integer status) throws Exception; - - //添加公告 - public void insertNotice(Notice notice) throws Exception; - - //删除公告 - public void deleteNotice(Integer id) throws Exception; - - //更新公告 - public void updateNotice(Notice notice) throws Exception; - - //根据id查询公告 - public NoticeCustom getNoticeById(Integer id) throws Exception; - -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/OptionsService.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/service/OptionsService.java deleted file mode 100755 index 32117dce..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/OptionsService.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.liuyanzhao.blog.service; - -import com.liuyanzhao.blog.entity.Options; -import com.liuyanzhao.blog.entity.custom.OptionsCustom; - - -/** - * Created by 言曌 on 2017/9/7. - */ -public interface OptionsService { - //获得基本信息 - public OptionsCustom getOptions() throws Exception; - - //新建基本信息 - public void insertOptions(Options options) throws Exception; - - //更新基本信息 - public void updateOptions(Options options) throws Exception; -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/PageService.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/service/PageService.java deleted file mode 100755 index cb36bc89..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/PageService.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.liuyanzhao.blog.service; - -import com.liuyanzhao.blog.entity.Page; -import com.liuyanzhao.blog.entity.custom.PageCustom; - -import java.util.List; - -/** - * Created by 言曌 on 2017/9/7. - */ -public interface PageService { - //获得页面列表 - public List listPage(Integer status) throws Exception; - - //根据页面key获得页面 - public PageCustom getPageByKey(Integer status,String key) throws Exception; - - //根据id获取页面 - public PageCustom getPageById(Integer id) throws Exception; - - //添加页面 - public void insertPage(Page page) throws Exception; - - //删除页面 - public void deletePage(Integer id) throws Exception; - - //编辑页面 - public void updatePage(Page page) throws Exception; -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/TagService.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/service/TagService.java deleted file mode 100755 index 71d4a496..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/TagService.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.liuyanzhao.blog.service; - -import com.liuyanzhao.blog.entity.Tag; -import com.liuyanzhao.blog.entity.custom.ArticleListVo; -import com.liuyanzhao.blog.entity.custom.TagCustom; -import org.apache.xpath.operations.Bool; - -import java.util.List; - -/** - * Created by 言曌 on 2017/9/2. - */ -public interface TagService { - - //获得标签总数 - public Integer countTag(Integer status) throws Exception; - - //获得标签列表 - public List listTag(Integer status) throws Exception; - - //获得含有该标签的文章列表 - public List getArticleListByPage(Integer status,Integer pageNow, Integer pageSize,Integer tagId) throws Exception; - - //根据id获得标签信息 - public TagCustom getTagById(Integer id) throws Exception; - - //添加标签 - public void insertTag(Tag tag) throws Exception; - - //修改标签 - public void updateTag(Tag tag) throws Exception; - - //删除标签 - public void deleteTag(Integer id) throws Exception; - - //根据标签名获取标签 - public Tag getTagByName(String name) throws Exception; - -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/UserService.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/service/UserService.java deleted file mode 100755 index fd90111c..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/UserService.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.liuyanzhao.blog.service; - -import com.liuyanzhao.blog.entity.User; -import com.liuyanzhao.blog.entity.custom.UserCustom; - -import java.util.List; - -/** - * Created by 言曌 on 2017/8/24. - */ -public interface UserService { - public List listUser() throws Exception; - - //根据id查询用户信息 - public UserCustom getUserById(Integer id) throws Exception; - - //修改用户信息 - public void updateUser(User user) throws Exception; - - //删除用户 - public void deleteUser(Integer id) throws Exception; - - //添加用户 - public void insertUser(User user) throws Exception; - - //根据用户名和邮箱查询用户 - public User getUserByNameOrEmail(String str) throws Exception; - - //根据用户名查询用户 - public User getUserByName(String name) throws Exception; - - //根据邮箱查询用户 - public User getUserByEmail(String email) throws Exception; -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/impl/ArticleServiceImpl.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/service/impl/ArticleServiceImpl.java deleted file mode 100755 index 802e6839..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/impl/ArticleServiceImpl.java +++ /dev/null @@ -1,455 +0,0 @@ -package com.liuyanzhao.blog.service.impl; - -import com.liuyanzhao.blog.mapper.ArticleMapper; -import com.liuyanzhao.blog.mapper.CategoryMapper; -import com.liuyanzhao.blog.mapper.TagMapper; -import com.liuyanzhao.blog.mapper.UserMapper; -import com.liuyanzhao.blog.mapper.custom.*; -import com.liuyanzhao.blog.entity.Article; -import com.liuyanzhao.blog.entity.Tag; -import com.liuyanzhao.blog.entity.User; -import com.liuyanzhao.blog.entity.custom.*; -import com.liuyanzhao.blog.service.ArticleService; -import com.liuyanzhao.blog.util.Functions; -import com.liuyanzhao.blog.util.others.Page; -import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.ui.Model; - -import javax.servlet.http.HttpServletRequest; -import java.util.ArrayList; -import java.util.List; - -/** - * 用户管理 - * Created by 言曌 on 2017/8/24. - */ -@Service -public class ArticleServiceImpl implements ArticleService { - @Autowired - private ArticleMapperCustom articleMapperCustom; - - @Autowired - private ArticleMapper articleMapper; - - @Autowired - private CategoryMapperCustom categoryMapperCustom; - - @Autowired - private CategoryMapper categoryMapper; - - @Autowired - private TagMapper tagMapper; - - @Autowired - private UserMapper userMapper; - - @Autowired - private CommentMapperCustom commentMapperCustom; - - - @Override - public Integer countArticle(Integer status) throws Exception { - Integer articleCount = articleMapperCustom.countArticle(status); - return articleCount ; - } - - @Override - public Integer countArticleComment(Integer status) throws Exception { - Integer commentCount = articleMapperCustom.countArticleComment(status); - return commentCount; - } - - - @Override - public Integer countArticleView(Integer status) throws Exception { - Integer viewCount = articleMapperCustom.countArticleView(status); - return viewCount; - } - - @Override - public List listArticle(Integer status) throws Exception { - List articleListVoList = new ArrayList(); - - //获得文章列表信息和分页信息 - List articleCustomList = articleMapperCustom.listArticle(status); - - //获得分类信息 - for (int i = 0; i < articleCustomList.size(); i++) { - ArticleListVo articleListVo = new ArticleListVo(); - - //1、将文章信息装到 articleListVoList 中 - ArticleCustom articleCustom = articleCustomList.get(i); - articleListVo.setArticleCustom(articleCustom); - - //2、将分类信息装到 articleListVoList 中 - List categoryCustomList = new ArrayList(); - Integer parentCategoryId = articleCustomList.get(i).getArticleParentCategoryId(); - Integer childCategoryId = articleCustomList.get(i).getArticleChildCategoryId(); - CategoryCustom categoryCustom = categoryMapperCustom.getCategoryById(1,parentCategoryId); - CategoryCustom categoryCustom2 = categoryMapperCustom.getCategoryById(1,childCategoryId); - if (categoryCustom != null) { - categoryCustomList.add(categoryCustom); - } - if (categoryCustom2 != null) { - categoryCustomList.add(categoryCustom2); - } - articleListVo.setCategoryCustomList(categoryCustomList); - - //3、获得标签信息 - List tagCustomList = new ArrayList(); - String tagIds = articleCustomList.get(i).getArticleTagIds(); - //防止该文章没有分类,空指针 - if (tagIds != null && tagIds != "") { - String[] tagId = tagIds.split(","); - for (int j = 0; j < tagId.length; j++) { - Tag tag = tagMapper.selectByPrimaryKey(Integer.valueOf(tagId[j])); - //防止标签不存在,被删除 - if (tag != null) { - TagCustom tagCustom = new TagCustom(); - BeanUtils.copyProperties(tag, tagCustom); - tagCustomList.add(tagCustom); - } - } - } - articleListVo.setTagCustomList(tagCustomList); - - //4、获得作者信息 - User user = userMapper.selectByPrimaryKey(articleCustom.getArticleUserId()); - UserCustom userCustom = new UserCustom(); - BeanUtils.copyProperties(user, userCustom); - articleListVo.setUserCustom(userCustom); - - - articleListVoList.add(articleListVo); - - } - return articleListVoList; - } - - - @Override - public ArticleCustom getArticleById(Integer status,Integer id) throws Exception { - return articleMapperCustom.getArticleById(status,id); - } - - @Override - public void updateArticle(Integer id,Article article) throws Exception { - //添加业务校验,通常在service接口对关键 - article.setArticleId(id); - articleMapper.updateByPrimaryKeySelective(article); - } - - @Override - public void deleteArticleBatch(Integer[] ids) throws Exception { - for (int i=0;i listArticleByPage(Integer status,Integer pageNow,Integer pageSize) throws Exception { - List articleListVoList = new ArrayList(); - - //获得文章列表信息和分页信息 - List articleCustomList = new ArrayList(); - Page page = null; - int totalCount = articleMapperCustom.countArticle(status); - if (pageNow != null) { - page = new Page(totalCount, pageNow,pageSize); - articleCustomList = articleMapperCustom.listArticleByPage(status,page.getStartPos(),pageSize); - } else { - page = new Page(totalCount, 1,pageSize); - articleCustomList = articleMapperCustom.listArticleByPage(status,page.getStartPos(), pageSize); - } - - //获得分类信息 - for(int i=0;i categoryCustomList = new ArrayList(); - Integer parentCategoryId =articleCustomList.get(i).getArticleParentCategoryId(); - Integer childCategoryId =articleCustomList.get(i).getArticleChildCategoryId(); - CategoryCustom categoryCustom = categoryMapperCustom.getCategoryById(status,parentCategoryId); - CategoryCustom categoryCustom2 = categoryMapperCustom.getCategoryById(status,childCategoryId); - if(categoryCustom!=null) { - categoryCustomList.add(categoryCustom); - } - if(categoryCustom2!=null) { - categoryCustomList.add(categoryCustom2); - } - articleListVo.setCategoryCustomList(categoryCustomList); - - //3、获得标签信息 - List tagCustomList = new ArrayList(); - String tagIds = articleCustomList.get(i).getArticleTagIds(); - //防止该文章没有分类,空指针 - if(tagIds!=null && tagIds!="") { - String[] tagId = tagIds.split(","); - for (int j = 0; j < tagId.length; j++) { - Tag tag = tagMapper.selectByPrimaryKey(Integer.valueOf(tagId[j])); - //防止标签不存在,被删除 - if (tag != null) { - TagCustom tagCustom = new TagCustom(); - BeanUtils.copyProperties(tag, tagCustom); - tagCustomList.add(tagCustom); - } - } - } - articleListVo.setTagCustomList(tagCustomList); - - //4、获得作者信息 - User user = userMapper.selectByPrimaryKey(articleCustom.getArticleUserId()); - UserCustom userCustom = new UserCustom(); - BeanUtils.copyProperties(user,userCustom); - articleListVo.setUserCustom(userCustom); - - - articleListVoList.add(articleListVo); - } - - if(articleListVoList.size()>0) { - //4、将Page信息存储在第一个元素中 - articleListVoList.get(0).setPage(page); - } - return articleListVoList; - } - - //文章详情页面显示 - @Override - public ArticleDetailVo getArticleDetailById(Integer id) throws Exception { - ArticleDetailVo articleDetailVo = new ArticleDetailVo(); - - //1、获得文章信息 - ArticleCustom articleCustom = articleMapperCustom.getArticleById(1,id); - if(articleCustom ==null) { - return null; - } - articleDetailVo.setArticleCustom(articleCustom); - - - //2、将分类信息装到 articleListVoList 中 - List categoryCustomList = new ArrayList(); - Integer cate =articleCustom.getArticleParentCategoryId(); - Integer cate2 =articleCustom.getArticleChildCategoryId(); - CategoryCustom categoryCustom = categoryMapperCustom.getCategoryById(1,cate); - CategoryCustom categoryCustom2 = categoryMapperCustom.getCategoryById(1,cate2); - if(categoryCustom!=null) { - categoryCustomList.add(categoryCustom); - } - if(categoryCustom2!=null) { - categoryCustomList.add(categoryCustom2); - } - articleDetailVo.setCategoryCustomList(categoryCustomList); - - //3、获得文章的标签 - String tag_ids = articleCustom.getArticleTagIds(); - List tagCustomList = new ArrayList(); - if (tag_ids != null && tag_ids != "") { - String[] tags = tag_ids.split(","); - int tagLength = tags.length; - - for (int i = 0; i < tagLength; i++) { - Tag tag= tagMapper.selectByPrimaryKey(Integer.valueOf(tags[i])); - if(tag!=null) { - TagCustom tagCustom = new TagCustom(); - BeanUtils.copyProperties(tag,tagCustom); - tagCustomList.add(tagCustom); - } - } - } - articleDetailVo.setTagCustomList(tagCustomList); - - //4、获得文章的作者 - Integer userId = articleCustom.getArticleUserId(); - User user = userMapper.selectByPrimaryKey(userId); - UserCustom userCustom = new UserCustom(); - BeanUtils.copyProperties(user,userCustom); - articleDetailVo.setUserCustom(userCustom); - - //5、获取评论信息列表 - List commentCustomList = commentMapperCustom.listCommentByArticleId(1,id); - //给每个评论用户添加头像 - for(int i=0;i listSearchResultByPage(Integer status,HttpServletRequest request, Model model,Integer pageNow,Integer pageSize,String query) throws Exception { - Page page = null; - List articleCustomList = new ArrayList(); - int totalCount = articleMapperCustom.getSearchResultCount(status,query); - - - if (pageNow != null) { - page = new Page(totalCount, pageNow, pageSize); - articleCustomList = this.articleMapperCustom.listSearchResultByPage(status,query, page.getStartPos(), page.getPageSize()); - } else { - page = new Page(totalCount, 1, pageSize); - articleCustomList = this.articleMapperCustom.listSearchResultByPage(status,query, page.getStartPos(), page.getPageSize()); - } - - List articleSearchVoList = new ArrayList(); - - //查询结果条数为0,下面的不执行,防止空指针 - if(totalCount!=0) { - for (int i = 0; i < articleCustomList.size(); i++) { - ArticleSearchVo articleSearchVo = new ArticleSearchVo(); - - //1、将文章信息装到 articleListVoList 中 - ArticleCustom articleCustom = articleCustomList.get(i); - articleSearchVo.setArticleCustom(articleCustom); - - //2、将分类信息装到 articleListVoList 中 - List categoryCustomList = new ArrayList(); - Integer cate =articleCustomList.get(i).getArticleParentCategoryId(); - Integer cate2 =articleCustomList.get(i).getArticleChildCategoryId(); - CategoryCustom categoryCustom = categoryMapperCustom.getCategoryById(status,cate); - CategoryCustom categoryCustom2 = categoryMapperCustom.getCategoryById(status,cate2); - if(categoryCustom!=null) { - categoryCustomList.add(categoryCustom); - } - if(categoryCustom2!=null) { - categoryCustomList.add(categoryCustom2); - } - articleSearchVo.setCategoryCustomList(categoryCustomList); - - //3、获得标签信息 - List tagCustomList = new ArrayList(); - String tagIds = articleCustomList.get(i).getArticleTagIds(); - if(tagIds!=null &&tagIds!="") { - String[] tagId = tagIds.split(","); - for (int j = 0; j < tagId.length; j++) { - Tag tag = tagMapper.selectByPrimaryKey(Integer.valueOf(tagId[j])); - if (tag != null) { - TagCustom tagCustom = new TagCustom(); - BeanUtils.copyProperties(tag, tagCustom); - tagCustomList.add(tagCustom); - } - } - } - articleSearchVo.setTagCustomList(tagCustomList); - - //4、获得作者信息 - User user = userMapper.selectByPrimaryKey(articleCustom.getArticleUserId()); - UserCustom userCustom = new UserCustom(); - BeanUtils.copyProperties(user, userCustom); - articleSearchVo.setUserCustom(userCustom); - - - articleSearchVoList.add(articleSearchVo); - } - } else { - //不执行的话,也要创建一个元素,存储分页信息和查询关键字 - ArticleSearchVo articleSearchVo = new ArticleSearchVo(); - articleSearchVoList.add(articleSearchVo); - } - //5、page信息存储在第一个元素中 - articleSearchVoList.get(0).setPage(page); - - //6、将查询的关键词存储到第一个元素 - articleSearchVoList.get(0).setQuery(query); - - - return articleSearchVoList; - - } - - //相似文章获取 - @Override - public List listArticleWithSameCategory(Integer status,Integer parentCategoryId,Integer childCategoryId, Integer limit) throws Exception { - List similarArticleList = articleMapperCustom.listArticleWithSameCategory(status,parentCategoryId,childCategoryId,limit); - return similarArticleList; - } - - - //访问量从多到少的文章获取 - @Override - public List listArticleByViewCount(Integer status,Integer limit) throws Exception { - List mostViewArticleList = articleMapperCustom.listArticleByViewCount(status,limit); - return mostViewArticleList; - } - - //获取下一篇文章 - @Override - public ArticleCustom getAfterArticle(Integer status,Integer id) throws Exception { - ArticleCustom articleCustom = articleMapperCustom.getAfterArticle(status,id); - return articleCustom; - } - - //获取上一篇文章 - @Override - public ArticleCustom getPreArticle(Integer status,Integer id) throws Exception { - ArticleCustom articleCustom = articleMapperCustom.getPreArticle(status,id); - return articleCustom; - } - - //获得随机文章 - @Override - public List listRandomArticle(Integer status,Integer limit) throws Exception { - List articleCustomsList = articleMapperCustom.listRandomArticle(status,limit); - return articleCustomsList; - } - - //获得热评文章列表 - @Override - public List listArticleByCommentCount(Integer status,Integer limit) throws Exception { - List articleCustomsList = articleMapperCustom.listArticleByCommentCount(status,limit); - return articleCustomsList; - } - - - //添加文章 - @Override - public void insertArticle(Article article) throws Exception { - articleMapper.insertSelective(article); - } - - //统计某个分类的文章数 - @Override - public Integer countArticleWithCategory(Integer status,Integer id) throws Exception { - int count = articleMapperCustom.countArticleByCategory(status,id); - return count; - } - - //统计某个标签的文章数 - @Override - public Integer countArticleWithTag(Integer status,Integer id) throws Exception { - int count = articleMapperCustom.countArticleByTag(status,id); - return count; - } - - @Override - public void updateCommentCount(Integer articleId) throws Exception { - articleMapperCustom.updateCommentCount(articleId); - } - - @Override - public ArticleCustom getLastUpdateArticle() throws Exception { - ArticleCustom articleCustom = articleMapperCustom.getLastUpdateArticle(); - return articleCustom; - } - - -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/impl/CategoryServiceImpl.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/service/impl/CategoryServiceImpl.java deleted file mode 100755 index bea91f24..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/impl/CategoryServiceImpl.java +++ /dev/null @@ -1,143 +0,0 @@ -package com.liuyanzhao.blog.service.impl; - -import com.liuyanzhao.blog.mapper.CategoryMapper; -import com.liuyanzhao.blog.mapper.custom.ArticleMapperCustom; -import com.liuyanzhao.blog.mapper.custom.CategoryMapperCustom; -import com.liuyanzhao.blog.entity.Category; -import com.liuyanzhao.blog.entity.custom.ArticleCustom; -import com.liuyanzhao.blog.entity.custom.ArticleListVo; -import com.liuyanzhao.blog.entity.custom.CategoryCustom; -import com.liuyanzhao.blog.service.CategoryService; -import com.liuyanzhao.blog.util.others.Page; -import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.List; - - -/** - * 用户管理 - * Created by 言曌 on 2017/8/24. - */ -@Service -public class CategoryServiceImpl implements CategoryService { - @Autowired - private CategoryMapperCustom categoryMapperCustom; - - @Autowired - private CategoryMapper categoryMapper; - - @Autowired - private ArticleMapperCustom articleMapperCustom; - - @Override - public Integer countCategory(Integer status) throws Exception { - Integer categoryCount = categoryMapperCustom.countCategory(status); - return categoryCount; - } - - @Override - public List listCategory(Integer status) throws Exception { - List categoryCustomList = categoryMapperCustom.listCategory(status); - for(int i=0;i listArticleWithCategoryByPage(Integer status,Integer pageNow, Integer pageSize,Integer cateId) throws Exception { - List articleListVoList = new ArrayList(); - List articleCustomList = new ArrayList(); - - //获得分类的信息 - Category category = categoryMapper.selectByPrimaryKey(cateId); - //如果没有这个分类,返回null - if(category==null) { - return null; - } - - //分页显示 - Page page = null; - int totalCount = articleMapperCustom.countArticleByCategory(status,cateId); - - if (pageNow != null) { - page = new Page(totalCount, pageNow,pageSize); - articleCustomList = categoryMapperCustom.listArticleWithCategoryByPage(status,cateId,page.getStartPos(), page.getPageSize()); - } else { - page = new Page(totalCount, 1,pageSize); - articleCustomList = categoryMapperCustom.listArticleWithCategoryByPage(status,cateId,page.getStartPos(), page.getPageSize()); - - } - for(int i=0;i categoryCustomList = new ArrayList(); - Integer parentCategoryId =articleCustomList.get(i).getArticleParentCategoryId(); - Integer childCategoryId =articleCustomList.get(i).getArticleChildCategoryId(); - CategoryCustom categoryCustom = categoryMapperCustom.getCategoryById(status, parentCategoryId); - CategoryCustom categoryCustom2 = categoryMapperCustom.getCategoryById(status,childCategoryId); - if(categoryCustom!=null) { - categoryCustomList.add(categoryCustom); - } - if(categoryCustom2!=null) { - categoryCustomList.add(categoryCustom2); - } - articleListVo.setCategoryCustomList(categoryCustomList); - - articleListVoList.add(articleListVo); - } - //如果该分类还没有文章 - if(totalCount!=0) { - //2、将Page信息存储在第一个元素中 - articleListVoList.get(0).setPage(page); - } - return articleListVoList; - } - - @Override - public CategoryCustom getCategory(Integer status,Integer id) throws Exception { - CategoryCustom categoryCustom = categoryMapperCustom.getCategoryById(status,id); - return categoryCustom; - } - - @Override - public void deleteCategory(Integer id) throws Exception { - categoryMapperCustom.deleteCategory(id); - } - - @Override - public CategoryCustom getCategoryById(Integer status,Integer id) throws Exception { - CategoryCustom categoryCustom = categoryMapperCustom.getCategoryById(status,id); - return categoryCustom; - } - - @Override - public void insertCategory(Category category) throws Exception { - categoryMapper.insertSelective(category); - } - - @Override - public void updateCategory(Category category) throws Exception { - categoryMapper.updateByPrimaryKeySelective(category); - } - - @Override - public Category getCategoryByName(String name) throws Exception { - Category category = categoryMapperCustom.getCategoryByName(name); - return category; - } - - -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/impl/CommentServiceImpl.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/service/impl/CommentServiceImpl.java deleted file mode 100755 index d942c52d..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/impl/CommentServiceImpl.java +++ /dev/null @@ -1,176 +0,0 @@ -package com.liuyanzhao.blog.service.impl; - -import com.liuyanzhao.blog.entity.Comment; -import com.liuyanzhao.blog.entity.custom.ArticleCustom; -import com.liuyanzhao.blog.entity.custom.CommentListVo; -import com.liuyanzhao.blog.mapper.ArticleMapper; -import com.liuyanzhao.blog.mapper.CommentMapper; -import com.liuyanzhao.blog.mapper.custom.ArticleMapperCustom; -import com.liuyanzhao.blog.mapper.custom.CommentMapperCustom; -import com.liuyanzhao.blog.entity.custom.CommentCustom; -import com.liuyanzhao.blog.service.CommentService; -import com.liuyanzhao.blog.util.others.Page; -import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; - -import com.liuyanzhao.blog.util.Functions; - -import javax.servlet.http.HttpServletRequest; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by 言曌 on 2017/9/10. - */ -public class CommentServiceImpl implements CommentService{ - @Autowired - private CommentMapperCustom commentMapperCustom; - - @Autowired - private CommentMapper commentMapper; - - @Autowired - private ArticleMapper articleMapper; - - @Autowired - private ArticleMapperCustom articleMapperCustom; - - @Override - public void insertComment(HttpServletRequest request, Comment comment) throws Exception { - String ip = Functions.getIpAddr(request); - comment.setCommentIp(ip); - commentMapper.insertSelective(comment); - } - - @Override - public List listCommentByArticleId(Integer status,Integer articleId) { - List commentCustomList = commentMapperCustom.listCommentByArticleId(status,articleId); - return commentCustomList; - } - - @Override - public CommentCustom getCommentById(Integer id) throws Exception { - CommentCustom commentCustom = new CommentCustom(); - Comment comment = commentMapper.selectByPrimaryKey(id); - BeanUtils.copyProperties(comment,commentCustom); - return commentCustom; - } - - @Override - public List listCommentByPage(Integer status, Integer pageNow, Integer pageSize) throws Exception { - List commentListVoList = new ArrayList(); - - List commentCustomList = new ArrayList(); - - - Page page = null; - int totalCount = commentMapperCustom.countComment(status); - if (pageNow != null) { - page = new Page(totalCount, pageNow,pageSize); - commentCustomList = commentMapperCustom.listCommentByPage(status,page.getStartPos(),pageSize); - } else { - page = new Page(totalCount, 1,pageSize); - commentCustomList = commentMapperCustom.listCommentByPage(status,page.getStartPos(), pageSize); - } - - - for(int i=0;i0) { - //4、将Page信息存储在第一个元素中 - commentListVoList.get(0).setPage(page); - } - return commentListVoList; - } - - @Override - public List listCommentVo(Integer status) throws Exception { - List commentListVoList = new ArrayList(); - - List commentCustomList = commentMapperCustom.listComment(status); - - for(int i=0;i listComment(Integer status) throws Exception { - List commentCustomList = commentMapperCustom.listComment(status); - return commentCustomList; - } - - @Override - public void deleteComment(Integer id) throws Exception { - commentMapper.deleteByPrimaryKey(id); - } - - @Override - public void updateComment(Comment comment) throws Exception { - commentMapper.updateByPrimaryKeySelective(comment); - } - - @Override - public Integer countComment(Integer status) throws Exception { - Integer commentCount = commentMapperCustom.countComment(status); - return commentCount; - } - - @Override - public List listRecentComment(Integer limit) throws Exception { - List recentCommentList = new ArrayList(); - List commentCustomList = commentMapperCustom.listRecentComment(limit); - for(int i=0;i listChildComment(Integer id) throws Exception { - List childCommentList = commentMapperCustom.listChildComment(id); - return childCommentList; - } - -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/impl/LinkServiceImpl.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/service/impl/LinkServiceImpl.java deleted file mode 100755 index 34b7412b..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/impl/LinkServiceImpl.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.liuyanzhao.blog.service.impl; - -import com.liuyanzhao.blog.entity.Link; -import com.liuyanzhao.blog.mapper.LinkMapper; -import com.liuyanzhao.blog.mapper.custom.LinkMapperCustom; -import com.liuyanzhao.blog.entity.custom.LinkCustom; -import com.liuyanzhao.blog.service.LinkService; -import org.apache.xpath.operations.Bool; -import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; - -import java.util.List; - -/** - * Created by 言曌 on 2017/9/4. - */ -public class LinkServiceImpl implements LinkService { - - @Autowired - private LinkMapperCustom linkMapperCustom; - - @Autowired - private LinkMapper linkMapper; - @Override - public Integer countLink(Integer status) throws Exception { - Integer linkCount = linkMapperCustom.countLink(status); - return linkCount; - } - - @Override - public List listLink(Integer status) throws Exception { - List linkList = linkMapperCustom.listLink(status); - return linkList; - } - - @Override - public void insertLink(Link link) throws Exception { - linkMapper.insertSelective(link); - } - - @Override - public void deleteLink(Integer id) throws Exception { - linkMapper.deleteByPrimaryKey(id); - } - - @Override - public void updateLink(Link link) throws Exception { - linkMapper.updateByPrimaryKeySelective(link); - } - - @Override - public LinkCustom getLinkById(Integer id) throws Exception { - Link link = linkMapper.selectByPrimaryKey(id); - LinkCustom linkCustom = new LinkCustom(); - BeanUtils.copyProperties(link,linkCustom); - return linkCustom; - } - -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/impl/MenuServiceImpl.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/service/impl/MenuServiceImpl.java deleted file mode 100755 index 2014d65d..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/impl/MenuServiceImpl.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.liuyanzhao.blog.service.impl; - -import com.liuyanzhao.blog.entity.Menu; -import com.liuyanzhao.blog.entity.custom.MenuCustom; -import com.liuyanzhao.blog.mapper.MenuMapper; -import com.liuyanzhao.blog.mapper.custom.MenuMapperCustom; -import com.liuyanzhao.blog.service.MenuService; -import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; - -import java.util.List; - -public class MenuServiceImpl implements MenuService { - - - @Autowired - private MenuMapperCustom menuMapperCustom; - - @Autowired - private MenuMapper menuMapper; - - @Override - public List listMenu(Integer status) throws Exception { - List menuCustomList = menuMapperCustom.listMenu(status); - return menuCustomList; - } - - @Override - public void insertMenu(Menu menu) throws Exception { - menuMapper.insertSelective(menu); - } - - @Override - public void deleteMenu(Integer id) throws Exception { - menuMapper.deleteByPrimaryKey(id); - } - - @Override - public void updateMenu(Menu menu) throws Exception { - menuMapper.updateByPrimaryKeySelective(menu); - } - - @Override - public MenuCustom getMenuById(Integer id) throws Exception { - MenuCustom menuCustom = new MenuCustom(); - Menu menu = menuMapper.selectByPrimaryKey(id); - BeanUtils.copyProperties(menu,menuCustom); - return menuCustom; - } -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/impl/NoticeServiceImpl.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/service/impl/NoticeServiceImpl.java deleted file mode 100755 index b0ef467a..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/impl/NoticeServiceImpl.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.liuyanzhao.blog.service.impl; - -import com.liuyanzhao.blog.entity.Notice; -import com.liuyanzhao.blog.entity.custom.NoticeCustom; -import com.liuyanzhao.blog.mapper.NoticeMapper; -import com.liuyanzhao.blog.mapper.custom.NoticeMapperCustom; -import com.liuyanzhao.blog.service.NoticeService; -import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; - -import java.util.List; - -public class NoticeServiceImpl implements NoticeService { - - @Autowired - private NoticeMapperCustom noticeMapperCustom; - - @Autowired - private NoticeMapper noticeMapper; - - - @Override - public List listNotice(Integer status) throws Exception { - List noticeList = noticeMapperCustom.listNotice(status); - return noticeList; - } - - @Override - public void insertNotice(Notice notice) throws Exception { - noticeMapper.insertSelective(notice); - } - - @Override - public void deleteNotice(Integer id) throws Exception { - noticeMapper.deleteByPrimaryKey(id); - } - - @Override - public void updateNotice(Notice notice) throws Exception { - noticeMapper.updateByPrimaryKeySelective(notice); - } - - @Override - public NoticeCustom getNoticeById(Integer id) throws Exception { - Notice notice = noticeMapper.selectByPrimaryKey(id); - NoticeCustom noticeCustom = new NoticeCustom(); - BeanUtils.copyProperties(notice,noticeCustom); - return noticeCustom; - } - -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/impl/OptionsServiceImpl.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/service/impl/OptionsServiceImpl.java deleted file mode 100755 index 7804871f..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/impl/OptionsServiceImpl.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.liuyanzhao.blog.service.impl; - -import com.liuyanzhao.blog.entity.Options; -import com.liuyanzhao.blog.entity.custom.OptionsCustom; -import com.liuyanzhao.blog.mapper.OptionsMapper; -import com.liuyanzhao.blog.mapper.custom.OptionsMapperCustom; -import com.liuyanzhao.blog.service.OptionsService; -import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; - -/** - * Created by 言曌 on 2017/9/7. - */ -public class OptionsServiceImpl implements OptionsService { - - @Autowired - private OptionsMapperCustom optionsMapperCustom; - - @Autowired - private OptionsMapper optionsMapper; - - @Override - public OptionsCustom getOptions() throws Exception { - Options options = optionsMapperCustom.getOptions(); - OptionsCustom optionsCustom = new OptionsCustom(); - if(options!=null) { - BeanUtils.copyProperties(options, optionsCustom); - } - return optionsCustom; - } - - @Override - public void insertOptions(Options options) throws Exception { - optionsMapper.insertSelective(options); - } - - @Override - public void updateOptions(Options options) throws Exception { - optionsMapper.updateByPrimaryKeySelective(options); - } -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/impl/PageServiceImpl.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/service/impl/PageServiceImpl.java deleted file mode 100755 index 6305f473..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/impl/PageServiceImpl.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.liuyanzhao.blog.service.impl; - -import com.liuyanzhao.blog.entity.Page; -import com.liuyanzhao.blog.mapper.PageMapper; -import com.liuyanzhao.blog.mapper.custom.PageMapperCustom; -import com.liuyanzhao.blog.entity.custom.PageCustom; -import com.liuyanzhao.blog.service.PageService; -import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; - -import java.util.List; - -/** - * Created by 言曌 on 2017/9/7. - */ -public class PageServiceImpl implements PageService{ - @Autowired - private PageMapperCustom pageMapperCustom; - - @Autowired - private PageMapper pageMapper; - - @Override - public PageCustom getPageByKey(Integer status,String key) throws Exception { - PageCustom pageCustom = pageMapperCustom.getPageByKey(status,key); - return pageCustom; - } - - @Override - public PageCustom getPageById(Integer id) throws Exception { - Page page = pageMapper.selectByPrimaryKey(id); - PageCustom pageCustom = new PageCustom(); - BeanUtils.copyProperties(page,pageCustom); - return pageCustom; - } - - @Override - public List listPage(Integer status) throws Exception { - List pageCustomList = pageMapperCustom.listPage(status); - return pageCustomList; - } - - - @Override - public void insertPage(Page page) throws Exception { - pageMapper.insert(page); - } - - @Override - public void deletePage(Integer id) throws Exception { - pageMapper.deleteByPrimaryKey(id); - } - - @Override - public void updatePage(Page page) throws Exception { - pageMapper.updateByPrimaryKeySelective(page); - } -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/impl/TagServiceImpl.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/service/impl/TagServiceImpl.java deleted file mode 100755 index a2a1f5a3..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/impl/TagServiceImpl.java +++ /dev/null @@ -1,155 +0,0 @@ -package com.liuyanzhao.blog.service.impl; - -import com.liuyanzhao.blog.mapper.CategoryMapper; -import com.liuyanzhao.blog.mapper.TagMapper; -import com.liuyanzhao.blog.mapper.custom.ArticleMapperCustom; -import com.liuyanzhao.blog.mapper.custom.CategoryMapperCustom; -import com.liuyanzhao.blog.mapper.custom.TagMapperCustom; -import com.liuyanzhao.blog.entity.Category; -import com.liuyanzhao.blog.entity.Tag; -import com.liuyanzhao.blog.entity.custom.ArticleCustom; -import com.liuyanzhao.blog.entity.custom.ArticleListVo; -import com.liuyanzhao.blog.entity.custom.CategoryCustom; -import com.liuyanzhao.blog.entity.custom.TagCustom; -import com.liuyanzhao.blog.service.TagService; -import com.liuyanzhao.blog.util.others.Page; -import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by 言曌 on 2017/9/2. - */ -public class TagServiceImpl implements TagService { - @Autowired - private TagMapper tagMapper; - - @Autowired - private CategoryMapper categoryMapper; - - @Autowired - private CategoryMapperCustom categoryMapperCustom; - - @Autowired - private TagMapperCustom tagMapperCustom; - - @Autowired - private ArticleMapperCustom articleMapperCustom; - - //获得标签总数 - @Override - public Integer countTag(Integer status) throws Exception { - Integer tagCount = tagMapperCustom.countTag(status); - return tagCount; - } - - //获得标签列表 - @Override - public List listTag(Integer status) throws Exception { - List tagList = tagMapperCustom.listTag(status); - for(int i=0;i getArticleListByPage(Integer status,Integer pageNow, Integer pageSize,Integer tagId) throws Exception { - List articleListVoList = new ArrayList(); - List articleCustomList = new ArrayList(); - - - //获得该标签的具体信息 - Tag tag = tagMapper.selectByPrimaryKey(tagId); - if(tag==null) { - return null; - } - - //分页显示 - Page page = null; - - int totalCount = articleMapperCustom.countArticleByTag(status,tagId); - if (pageNow != null) { - page = new Page(totalCount, pageNow,pageSize); - articleCustomList = tagMapperCustom.listArticleWithTagByPage(status,tagId,page.getStartPos(), page.getPageSize()); - } else { - page = new Page(totalCount, 1,pageSize); - articleCustomList = tagMapperCustom.listArticleWithTagByPage(status,tagId,page.getStartPos(), page.getPageSize()); - } - - for(int i=0;i categoryCustomList = new ArrayList(); - Integer cate =articleCustomList.get(i).getArticleParentCategoryId(); - Integer cate2 =articleCustomList.get(i).getArticleChildCategoryId(); - CategoryCustom categoryCustom = categoryMapperCustom.getCategoryById(status,cate); - CategoryCustom categoryCustom2 = categoryMapperCustom.getCategoryById(status,cate2); - if(categoryCustom!=null) { - categoryCustomList.add(categoryCustom); - } - if(categoryCustom2!=null) { - categoryCustomList.add(categoryCustom2); - } - articleListVo.setCategoryCustomList(categoryCustomList); - - articleListVoList.add(articleListVo); - } - //确保该标签有文章,防止空指针 - if(totalCount!=0) { - //3、将Page存储在 articleListVoList 第一个元素中 - articleListVoList.get(0).setPage(page); - - //4、将标签信息 装入 articleListVoList 第一个元素中 - List tagCustomList = new ArrayList(); - TagCustom tagCustom = new TagCustom(); - BeanUtils.copyProperties(tag, tagCustom); - tagCustomList.add(tagCustom); - articleListVoList.get(0).setTagCustomList(tagCustomList); - } - return articleListVoList; - } - - @Override - public TagCustom getTagById(Integer id) throws Exception { - TagCustom tagCustom = new TagCustom(); - Tag tag = tagMapper.selectByPrimaryKey(id); - if(tag==null) { - return null; - } - BeanUtils.copyProperties(tag,tagCustom); - return tagCustom; - } - - @Override - public void insertTag(Tag tag) throws Exception { - tagMapper.insertSelective(tag); - } - - @Override - public void updateTag(Tag tag) throws Exception { - tagMapper.updateByPrimaryKeySelective(tag); - } - - @Override - public void deleteTag(Integer id) throws Exception { - tagMapper.deleteByPrimaryKey(id); - } - - @Override - public Tag getTagByName(String name) throws Exception { - Tag tag = tagMapperCustom.getTagByName(name); - return tag; - } - - -} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/impl/UserServiceImpl.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/service/impl/UserServiceImpl.java deleted file mode 100755 index e6b520df..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/service/impl/UserServiceImpl.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.liuyanzhao.blog.service.impl; - -import com.liuyanzhao.blog.entity.custom.ArticleCustom; -import com.liuyanzhao.blog.mapper.UserMapper; -import com.liuyanzhao.blog.mapper.custom.UserMapperCustom; -import com.liuyanzhao.blog.entity.User; -import com.liuyanzhao.blog.entity.custom.UserCustom; -import com.liuyanzhao.blog.service.UserService; -import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.Date; -import java.util.List; - -/** - * 用户管理 - * Created by 言曌 on 2017/8/24. - */ -@Service -public class UserServiceImpl implements UserService { - @Autowired - private UserMapperCustom userMapperCustom; - - @Autowired - private UserMapper userMapper; - - @Override - public List listUser() throws Exception { - List userCustomList = userMapperCustom.listUser(); - for(int i=0;i15){ //"***.***.***.***".length() = 15 - if(ipAddress.indexOf(",")>0){ - ipAddress = ipAddress.substring(0,ipAddress.indexOf(",")); - } - } - return ipAddress; - } - - - //将字符串转为MD5 - public static String strToMd5(String str) { - String md5Str = null; - if (str != null && str.length() != 0) { - try { - MessageDigest md = MessageDigest.getInstance("MD5"); - md.update(str.getBytes()); - byte b[] = md.digest(); - - int i; - StringBuffer buf = new StringBuffer(""); - for (int offset = 0; offset < b.length; offset++) { - i = b[offset]; - if (i < 0) - i += 256; - if (i < 16) - buf.append("0"); - buf.append(Integer.toHexString(i)); - } - //32位 - md5Str = buf.toString(); - //16位 - // md5Str = buf.toString().substring(8, 24); - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - } - } - return md5Str; - } - - //根据email获取gravatar头像 - public static String getGravatar(String email) { - String emailMd5 = strToMd5(email); - //设置图片大小32px - String avatar = "http://cn.gravatar.com/avatar/"+emailMd5+"?s=128&d=identicon&r=PG"; - return avatar; - } - -} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/util/others/HtmlFilterTag.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/util/others/HtmlFilterTag.java deleted file mode 100755 index 8f2d4710..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/util/others/HtmlFilterTag.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.liuyanzhao.blog.util.others; - -/** - * Created by 言曌 on 2017/8/26. - */ - import java.io.IOException; - import java.io.StringWriter; - import java.util.regex.Matcher; - import java.util.regex.Pattern; - - import javax.servlet.jsp.JspException; - import javax.servlet.jsp.PageContext; - import javax.servlet.jsp.tagext.JspFragment; - import javax.servlet.jsp.tagext.SimpleTagSupport; - - -public class HtmlFilterTag extends SimpleTagSupport { - - private static final int subLength = 100; //截取字符串长度 - private static final String regEx_script = "]*?>[\\s\\S]*?<\\/script>"; // 定义script的正则表达式 - private static final String regEx_style = "]*?>[\\s\\S]*?<\\/style>"; // 定义style的正则表达式 - private static final String regEx_html = "<[^>]+>"; // 定义HTML标签的正则表达式 - private static final String regEx_space = "\\s*|\t|\r|\n";//定义空格回车换行符 - - public static String filter(String htmlStr) { - Pattern p_script = Pattern.compile(regEx_script, Pattern.CASE_INSENSITIVE); - Matcher m_script = p_script.matcher(htmlStr); - htmlStr = m_script.replaceAll(""); // 过滤script标签 - - Pattern p_style = Pattern.compile(regEx_style, Pattern.CASE_INSENSITIVE); - Matcher m_style = p_style.matcher(htmlStr); - htmlStr = m_style.replaceAll(""); // 过滤style标签 - - Pattern p_html = Pattern.compile(regEx_html, Pattern.CASE_INSENSITIVE); - Matcher m_html = p_html.matcher(htmlStr); - htmlStr = m_html.replaceAll(""); // 过滤html标签 - - Pattern p_space = Pattern.compile(regEx_space, Pattern.CASE_INSENSITIVE); - Matcher m_space = p_space.matcher(htmlStr); - htmlStr = m_space.replaceAll(""); // 过滤空格回车标签 - return htmlStr.trim(); // 返回文本字符串 - } - - @Override - public void doTag() throws JspException, IOException { - - StringWriter sw = new StringWriter(); - JspFragment jf = this.getJspBody(); - jf.invoke(sw); - String content = sw.getBuffer().toString(); - content = filter(content); - content = content.replaceAll(" ", ""); - int contentLength =content.length(); - if(contentLength>subLength) { - content = content.substring(0,subLength); - } else { - content = content.substring(0,contentLength); - } - ((PageContext) this.getJspContext()).getOut().write(content); - } - - -} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/util/others/Page.java b/ForestBlog/src/main/java/com/liuyanzhao/blog/util/others/Page.java deleted file mode 100755 index dbf0b1cf..00000000 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/util/others/Page.java +++ /dev/null @@ -1,144 +0,0 @@ -package com.liuyanzhao.blog.util.others; - -/** - * 分页 - * Created by 言曌 on 2017/8/26. - */ -import java.io.Serializable; - -public class Page implements Serializable { - - private static final long serialVersionUID = -3198048449643774660L; - - private int pageNow = 1; // 当前页数 - - private int pageSize; // 每页显示记录的条数 - - private int totalCount; // 总的记录条数 - - private int totalPageCount; // 总的页数 - - @SuppressWarnings("unused") - private int startPos; // 开始位置,从0开始 - - @SuppressWarnings("unused") - private boolean hasFirst;// 是否有首页 - - @SuppressWarnings("unused") - private boolean hasPre;// 是否有前一页 - - @SuppressWarnings("unused") - private boolean hasNext;// 是否有下一页 - - @SuppressWarnings("unused") - private boolean hasLast;// 是否有最后一页 - - /** - * 通过构造函数 传入 总记录数 和 当前页 - * @param totalCount - * @param pageNow - */ - public Page(int totalCount, int pageNow,int pageSize) { - this.totalCount = totalCount; - this.pageNow = pageNow; - this.pageSize = pageSize; - } - - /** - * 取得总页数,总页数=总记录数/总页数 - * @return - */ - public int getTotalPageCount() { - totalPageCount = getTotalCount() / getPageSize(); - return (totalCount % pageSize == 0) ? totalPageCount - : totalPageCount + 1; - } - - public void setTotalPageCount(int totalPageCount) { - this.totalPageCount = totalPageCount; - } - - public int getPageNow() { - return pageNow; - } - - public void setPageNow(int pageNow) { - this.pageNow = pageNow; - } - - public int getPageSize() { - return pageSize; - } - - public void setPageSize(int pageSize) { - this.pageSize = pageSize; - } - - public int getTotalCount() { - return totalCount; - } - - public void setTotalCount(int totalCount) { - this.totalCount = totalCount; - } - /** - * 取得选择记录的初始位置 - * @return - */ - public int getStartPos() { - return (pageNow - 1) * pageSize; - } - - public void setStartPos(int startPos) { - this.startPos = startPos; - } - - /** - * 是否是第一页 - * @return - */ - public boolean isHasFirst() { - return (pageNow == 1) ? false : true; - } - - public void setHasFirst(boolean hasFirst) { - this.hasFirst = hasFirst; - } - /** - * 是否有首页 - * @return - */ - public boolean isHasPre() { - // 如果有首页就有前一页,因为有首页就不是第一页 - return isHasFirst() ? true : false; - } - - public void setHasPre(boolean hasPre) { - this.hasPre = hasPre; - } - /** - * 是否有下一页 - * @return - */ - public boolean isHasNext() { - // 如果有尾页就有下一页,因为有尾页表明不是最后一页 - return isHasLast() ? true : false; - } - - public void setHasNext(boolean hasNext) { - this.hasNext = hasNext; - } - /** - * 是否有尾页 - * @return - */ - public boolean isHasLast() { - // 如果不是最后一页就有尾页 - return (pageNow == getTotalCount()) ? false : true; - } - - public void setHasLast(boolean hasLast) { - this.hasLast = hasLast; - } - -} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/admin/AdminController.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/admin/AdminController.java new file mode 100755 index 00000000..90882f82 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/admin/AdminController.java @@ -0,0 +1,248 @@ +package com.liuyanzhao.ssm.blog.controller.admin; + +import com.liuyanzhao.ssm.blog.dto.JsonResult; +import com.liuyanzhao.ssm.blog.entity.Article; +import com.liuyanzhao.ssm.blog.entity.Comment; +import com.liuyanzhao.ssm.blog.entity.User; +import com.liuyanzhao.ssm.blog.enums.UserRole; +import com.liuyanzhao.ssm.blog.service.ArticleService; +import com.liuyanzhao.ssm.blog.service.CommentService; +import com.liuyanzhao.ssm.blog.service.UserService; +import org.json.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static com.liuyanzhao.ssm.blog.util.MyUtils.getIpAddr; + +/** + * @author liuyanzhao + */ +@Controller +public class AdminController { + @Autowired + private UserService userService; + + @Autowired + private ArticleService articleService; + + @Autowired + private CommentService commentService; + + /** + * 后台首页 + * + * @return + */ + @RequestMapping("/admin") + public String index(Model model, HttpSession session) { + User user = (User) session.getAttribute("user"); + Integer userId = null; + if (!UserRole.ADMIN.getValue().equals(user.getUserRole())) { + // 用户查询自己的文章, 管理员查询所有的 + userId = user.getUserId(); + } + //文章列表 + List
articleList = articleService.listRecentArticle(userId, 5); + model.addAttribute("articleList", articleList); + + //评论列表 + List commentList = commentService.listRecentComment(userId, 5); + model.addAttribute("commentList", commentList); + return "Admin/index"; + } + + /** + * 登录页面显示 + * + * @return + */ + @RequestMapping("/login") + public String + loginPage() { + return "Admin/login"; + } + + + /** + * 登录页面显示 + * + * @return + */ + @RequestMapping("/register") + public String registerPage() { + return "Admin/register"; + } + + /** + * 登录验证 + * + * @param request + * @param response + * @return + */ + @RequestMapping(value = "/loginVerify", method = RequestMethod.POST, produces = {"text/plain;charset=UTF-8"}) + @ResponseBody + public String loginVerify(HttpServletRequest request, HttpServletResponse response) { + Map map = new HashMap(); + + String username = request.getParameter("username"); + String password = request.getParameter("password"); + String rememberme = request.getParameter("rememberme"); + User user = userService.getUserByNameOrEmail(username); + if (user == null) { + map.put("code", 0); + map.put("msg", "用户名无效!"); + } else if (!user.getUserPass().equals(password)) { + map.put("code", 0); + map.put("msg", "密码错误!"); + } else if (user.getUserStatus() == 0) { + map.put("code", 0); + map.put("msg", "账号已禁用!"); + } else { + //登录成功 + map.put("code", 1); + map.put("msg", ""); + //添加session + request.getSession().setAttribute("user", user); + //添加cookie + if (rememberme != null) { + //创建两个Cookie对象 + Cookie nameCookie = new Cookie("username", username); + //设置Cookie的有效期为3天 + nameCookie.setMaxAge(60 * 60 * 24 * 3); + Cookie pwdCookie = new Cookie("password", password); + pwdCookie.setMaxAge(60 * 60 * 24 * 3); + response.addCookie(nameCookie); + response.addCookie(pwdCookie); + } + user.setUserLastLoginTime(new Date()); + user.setUserLastLoginIp(getIpAddr(request)); + userService.updateUser(user); + + } + String result = new JSONObject(map).toString(); + return result; + } + + /** + * 登录验证 + * + * @param request + * @return + */ + @RequestMapping(value = "/registerSubmit", method = RequestMethod.POST) + @ResponseBody + public JsonResult registerSubmit(HttpServletRequest request) { + String username = request.getParameter("username"); + String nickname = request.getParameter("nickname"); + String email = request.getParameter("email"); + String password = request.getParameter("password"); + User checkUserName = userService.getUserByName(username); + if (checkUserName != null) { + return new JsonResult().fail("用户名已存在"); + } + User checkEmail = userService.getUserByEmail(username); + if (checkEmail != null) { + return new JsonResult().fail("电子邮箱已存在"); + } + + // 添加用户 + User user = new User(); + user.setUserAvatar("/img/avatar/avatar.png"); + user.setUserName(username); + user.setUserNickname(nickname); + user.setUserPass(password); + user.setUserEmail(email); + user.setUserStatus(1); + user.setArticleCount(0); + user.setUserRole(UserRole.USER.getValue()); + try { + userService.insertUser(user); + } catch (Exception e) { + e.printStackTrace(); + return new JsonResult().fail("系统异常"); + } + return new JsonResult().ok("注册成功"); + } + + /** + * 退出登录 + * + * @param session + * @return + */ + @RequestMapping(value = "/admin/logout") + public String logout(HttpSession session) { + session.removeAttribute("user"); + session.invalidate(); + return "redirect:/login"; + } + + + /** + * 基本信息页面显示 + * + * @return + */ + @RequestMapping(value = "/admin/profile") + public ModelAndView userProfileView(HttpSession session) { + + ModelAndView modelAndView = new ModelAndView(); + User sessionUser = (User) session.getAttribute("user"); + User user = userService.getUserById(sessionUser.getUserId()); + modelAndView.addObject("user", user); + + modelAndView.setViewName("Admin/User/profile"); + return modelAndView; + } + + /** + * 编辑个人信息页面显示 + * + * @param session + * @return + */ + @RequestMapping(value = "/admin/profile/edit") + public ModelAndView editUserView(HttpSession session) { + ModelAndView modelAndView = new ModelAndView(); + User loginUser = (User) session.getAttribute("user"); + User user = userService.getUserById(loginUser.getUserId()); + modelAndView.addObject("user", user); + + modelAndView.setViewName("Admin/User/editProfile"); + return modelAndView; + } + + + /** + * 编辑用户提交 + * + * @param user + * @return + */ + @RequestMapping(value = "/admin/profile/save", method = RequestMethod.POST) + public String saveProfile(User user, HttpSession session) { + User dbUser = (User) session.getAttribute("user"); + + user.setUserId(dbUser.getUserId()); + userService.updateUser(user); + return "redirect:/admin/profile"; + } + + +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/admin/BackArticleController.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/admin/BackArticleController.java new file mode 100755 index 00000000..55d82cca --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/admin/BackArticleController.java @@ -0,0 +1,296 @@ +package com.liuyanzhao.ssm.blog.controller.admin; + +import cn.hutool.http.HtmlUtil; +import com.github.pagehelper.PageInfo; +import com.liuyanzhao.ssm.blog.dto.ArticleParam; +import com.liuyanzhao.ssm.blog.dto.JsonResult; +import com.liuyanzhao.ssm.blog.entity.Article; +import com.liuyanzhao.ssm.blog.enums.UserRole; +import com.liuyanzhao.ssm.blog.service.ArticleService; +import com.liuyanzhao.ssm.blog.service.CategoryService; +import com.liuyanzhao.ssm.blog.service.TagService; + +import com.liuyanzhao.ssm.blog.entity.Category; +import com.liuyanzhao.ssm.blog.entity.Tag; +import com.liuyanzhao.ssm.blog.entity.User; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpSession; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Objects; + + +/** + * @author liuyanzhao + */ +@Controller +@RequestMapping("/admin/article") +public class BackArticleController { + @Autowired + private ArticleService articleService; + + @Autowired + private TagService tagService; + + @Autowired + private CategoryService categoryService; + + /** + * 后台文章列表显示 + * + * @return modelAndView + */ + @RequestMapping(value = "") + public String index(@RequestParam(required = false, defaultValue = "1") Integer pageIndex, + @RequestParam(required = false, defaultValue = "10") Integer pageSize, + @RequestParam(required = false) String status, Model model, + HttpSession session) { + HashMap criteria = new HashMap<>(1); + if (status == null) { + model.addAttribute("pageUrlPrefix", "/admin/article?pageIndex"); + } else { + criteria.put("status", status); + model.addAttribute("pageUrlPrefix", "/admin/article?status=" + status + "&pageIndex"); + } + + User user = (User) session.getAttribute("user"); + if (!UserRole.ADMIN.getValue().equals(user.getUserRole())) { + // 用户查询自己的文章, 管理员查询所有的 + criteria.put("userId", user.getUserId()); + } + PageInfo
articlePageInfo = articleService.pageArticle(pageIndex, pageSize, criteria); + model.addAttribute("pageInfo", articlePageInfo); + return "Admin/Article/index"; + } + + + /** + * 后台添加文章页面显示 + * + * @return + */ + @RequestMapping(value = "/insert") + public String insertArticleView(Model model) { + List categoryList = categoryService.listCategory(); + List tagList = tagService.listTag(); + model.addAttribute("categoryList", categoryList); + model.addAttribute("tagList", tagList); + return "Admin/Article/insert"; + } + + /** + * 后台添加文章提交操作 + * + * @param articleParam + * @return + */ + @RequestMapping(value = "/insertSubmit", method = RequestMethod.POST) + public String insertArticleSubmit(HttpSession session, ArticleParam articleParam) { + Article article = new Article(); + //用户ID + User user = (User) session.getAttribute("user"); + if (user != null) { + article.setArticleUserId(user.getUserId()); + } + article.setArticleTitle(articleParam.getArticleTitle()); + //文章摘要 + int summaryLength = 150; + String summaryText = HtmlUtil.cleanHtmlTag(articleParam.getArticleContent()); + if (summaryText.length() > summaryLength) { + String summary = summaryText.substring(0, summaryLength); + article.setArticleSummary(summary); + } else { + article.setArticleSummary(summaryText); + } + article.setArticleThumbnail(articleParam.getArticleThumbnail()); + article.setArticleContent(articleParam.getArticleContent()); + article.setArticleStatus(articleParam.getArticleStatus()); + //填充分类 + List categoryList = new ArrayList<>(); + if (articleParam.getArticleChildCategoryId() != null) { + categoryList.add(new Category(articleParam.getArticleParentCategoryId())); + } + if (articleParam.getArticleChildCategoryId() != null) { + categoryList.add(new Category(articleParam.getArticleChildCategoryId())); + } + article.setCategoryList(categoryList); + //填充标签 + List tagList = new ArrayList<>(); + if (articleParam.getArticleTagIds() != null) { + for (int i = 0; i < articleParam.getArticleTagIds().size(); i++) { + Tag tag = new Tag(articleParam.getArticleTagIds().get(i)); + tagList.add(tag); + } + } + article.setTagList(tagList); + + articleService.insertArticle(article); + return "redirect:/admin/article"; + } + + + /** + * 删除文章 + * + * @param id 文章ID + */ + @RequestMapping(value = "/delete/{id}", method = RequestMethod.POST) + public void deleteArticle(@PathVariable("id") Integer id, HttpSession session) { + Article dbArticle = articleService.getArticleByStatusAndId(null, id); + if (dbArticle == null) { + return; + } + User user = (User) session.getAttribute("user"); + // 如果不是管理员,访问其他用户的数据,则跳转403 + if (!Objects.equals(dbArticle.getArticleUserId(), user.getUserId()) && !Objects.equals(user.getUserRole(), UserRole.ADMIN.getValue())) { + return; + } + articleService.deleteArticle(id); + } + + + /** + * 编辑文章页面显示 + * + * @param id + * @return + */ + @RequestMapping(value = "/edit/{id}") + public String editArticleView(@PathVariable("id") Integer id, Model model, HttpSession session) { + + Article article = articleService.getArticleByStatusAndId(null, id); + if (article == null) { + return "redirect:/404"; + } + User user = (User) session.getAttribute("user"); + // 如果不是管理员,访问其他用户的数据,则跳转403 + if (!Objects.equals(article.getArticleUserId(), user.getUserId()) && !Objects.equals(user.getUserRole(), UserRole.ADMIN.getValue())) { + return "redirect:/403"; + } + + model.addAttribute("article", article); + + List categoryList = categoryService.listCategory(); + model.addAttribute("categoryList", categoryList); + + List tagList = tagService.listTag(); + model.addAttribute("tagList", tagList); + + return "Admin/Article/edit"; + } + + + /** + * 编辑文章提交 + * + * @param articleParam + * @return + */ + @RequestMapping(value = "/editSubmit", method = RequestMethod.POST) + public String editArticleSubmit(ArticleParam articleParam, HttpSession session) { + Article dbArticle = articleService.getArticleByStatusAndId(null, articleParam.getArticleId()); + if (dbArticle == null) { + return "redirect:/404"; + } + User user = (User) session.getAttribute("user"); + // 如果不是管理员,访问其他用户的数据,则跳转403 + if (!Objects.equals(dbArticle.getArticleUserId(), user.getUserId()) && !Objects.equals(user.getUserRole(), UserRole.ADMIN.getValue())) { + return "redirect:/403"; + } + Article article = new Article(); + article.setArticleThumbnail(articleParam.getArticleThumbnail()); + article.setArticleId(articleParam.getArticleId()); + article.setArticleTitle(articleParam.getArticleTitle()); + article.setArticleContent(articleParam.getArticleContent()); + article.setArticleStatus(articleParam.getArticleStatus()); + //文章摘要 + int summaryLength = 150; + String summaryText = HtmlUtil.cleanHtmlTag(article.getArticleContent()); + if (summaryText.length() > summaryLength) { + String summary = summaryText.substring(0, summaryLength); + article.setArticleSummary(summary); + } else { + article.setArticleSummary(summaryText); + } + //填充分类 + List categoryList = new ArrayList<>(); + if (articleParam.getArticleChildCategoryId() != null) { + categoryList.add(new Category(articleParam.getArticleParentCategoryId())); + } + if (articleParam.getArticleChildCategoryId() != null) { + categoryList.add(new Category(articleParam.getArticleChildCategoryId())); + } + article.setCategoryList(categoryList); + //填充标签 + List tagList = new ArrayList<>(); + if (articleParam.getArticleTagIds() != null) { + for (int i = 0; i < articleParam.getArticleTagIds().size(); i++) { + Tag tag = new Tag(articleParam.getArticleTagIds().get(i)); + tagList.add(tag); + } + } + article.setTagList(tagList); + articleService.updateArticleDetail(article); + return "redirect:/admin/article"; + } + + /** + * 后台添加文章提交操作 + * + * @param articleParam + * @return + */ + @RequestMapping(value = "/insertDraftSubmit", method = RequestMethod.POST) + public String insertDraftSubmit(HttpSession session, ArticleParam articleParam) { + Article article = new Article(); + //用户ID + User user = (User) session.getAttribute("user"); + if (user != null) { + article.setArticleUserId(user.getUserId()); + } + article.setArticleTitle(articleParam.getArticleTitle()); + //文章摘要 + int summaryLength = 150; + String summaryText = HtmlUtil.cleanHtmlTag(articleParam.getArticleContent()); + if (summaryText.length() > summaryLength) { + String summary = summaryText.substring(0, summaryLength); + article.setArticleSummary(summary); + } else { + article.setArticleSummary(summaryText); + } + article.setArticleThumbnail(articleParam.getArticleThumbnail()); + article.setArticleContent(articleParam.getArticleContent()); + article.setArticleStatus(articleParam.getArticleStatus()); + //填充分类 + List categoryList = new ArrayList<>(); + if (articleParam.getArticleChildCategoryId() != null) { + categoryList.add(new Category(articleParam.getArticleParentCategoryId())); + } + if (articleParam.getArticleChildCategoryId() != null) { + categoryList.add(new Category(articleParam.getArticleChildCategoryId())); + } + article.setCategoryList(categoryList); + //填充标签 + List tagList = new ArrayList<>(); + if (articleParam.getArticleTagIds() != null) { + for (int i = 0; i < articleParam.getArticleTagIds().size(); i++) { + Tag tag = new Tag(articleParam.getArticleTagIds().get(i)); + tagList.add(tag); + } + } + article.setTagList(tagList); + + articleService.insertArticle(article); + return "redirect:/admin"; + } + +} + + + diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Admin/BackCategoryController.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/admin/BackCategoryController.java similarity index 55% rename from ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Admin/BackCategoryController.java rename to ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/admin/BackCategoryController.java index d78af779..2ec0751b 100755 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Admin/BackCategoryController.java +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/admin/BackCategoryController.java @@ -1,11 +1,10 @@ -package com.liuyanzhao.blog.controller.Admin; +package com.liuyanzhao.ssm.blog.controller.admin; -import com.liuyanzhao.blog.entity.Category; -import com.liuyanzhao.blog.entity.custom.CategoryCustom; +import com.liuyanzhao.ssm.blog.entity.Category; -import com.liuyanzhao.blog.service.ArticleService; -import com.liuyanzhao.blog.service.CategoryService; +import com.liuyanzhao.ssm.blog.service.ArticleService; +import com.liuyanzhao.ssm.blog.service.CategoryService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -18,9 +17,13 @@ import java.util.List; +/** + * @author liuyanzhao + */ @Controller @RequestMapping("/admin/category") public class BackCategoryController { + @Autowired private ArticleService articleService; @@ -28,58 +31,79 @@ public class BackCategoryController { @Autowired private CategoryService categoryService; - //后台分类列表显示 + /** + * 后台分类列表显示 + * + * @return + */ @RequestMapping(value = "") - public ModelAndView categoryList() throws Exception { + public ModelAndView categoryList() { ModelAndView modelandview = new ModelAndView(); - - List categoryCustomList = categoryService.listCategory(null); - modelandview.addObject("categoryCustomList",categoryCustomList); - + List categoryList = categoryService.listCategoryWithCount(); + modelandview.addObject("categoryList",categoryList); modelandview.setViewName("Admin/Category/index"); return modelandview; } - //后台添加分类提交 + /** + * 后台添加分类提交 + * + * @param category + * @return + */ @RequestMapping(value = "/insertSubmit",method = RequestMethod.POST) - public String insertCategorySubmit(Category category) throws Exception { + public String insertCategorySubmit(Category category) { categoryService.insertCategory(category); return "redirect:/admin/category"; } - //删除分类 + /** + * 删除分类 + * + * @param id + * @return + */ @RequestMapping(value = "/delete/{id}") - public String deleteCategory(@PathVariable("id") Integer id) throws Exception { - + public String deleteCategory(@PathVariable("id") Integer id) { //禁止删除有文章的分类 - int count = articleService.countArticleWithCategory(null,id); + int count = articleService.countArticleByCategoryId(id); + if (count == 0) { categoryService.deleteCategory(id); } - return "redirect:/admin/category"; } - //编辑分类页面显示 + /** + * 编辑分类页面显示 + * + * @param id + * @return + */ @RequestMapping(value = "/edit/{id}") - public ModelAndView editCategoryView(@PathVariable("id") Integer id) throws Exception { + public ModelAndView editCategoryView(@PathVariable("id") Integer id) { ModelAndView modelAndView = new ModelAndView(); - CategoryCustom categoryCustom = categoryService.getCategoryById(null,id); - modelAndView.addObject("categoryCustom",categoryCustom); + Category category = categoryService.getCategoryById(id); + modelAndView.addObject("category",category); - List categoryCustomList = categoryService.listCategory(null); - modelAndView.addObject("categoryCustomList",categoryCustomList); + List categoryList = categoryService.listCategoryWithCount(); + modelAndView.addObject("categoryList",categoryList); modelAndView.setViewName("Admin/Category/edit"); return modelAndView; } - //编辑分类提交 + /** + * 编辑分类提交 + * + * @param category 分类 + * @return 重定向 + */ @RequestMapping(value = "/editSubmit",method = RequestMethod.POST) - public String editCategorySubmit(Category category) throws Exception { + public String editCategorySubmit(Category category) { categoryService.updateCategory(category); return "redirect:/admin/category"; } diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/admin/BackCommentController.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/admin/BackCommentController.java new file mode 100755 index 00000000..ebf5e59a --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/admin/BackCommentController.java @@ -0,0 +1,218 @@ +package com.liuyanzhao.ssm.blog.controller.admin; + + +import cn.hutool.http.HtmlUtil; +import com.github.pagehelper.PageInfo; +import com.liuyanzhao.ssm.blog.dto.JsonResult; +import com.liuyanzhao.ssm.blog.entity.Article; +import com.liuyanzhao.ssm.blog.entity.Comment; +import com.liuyanzhao.ssm.blog.entity.User; +import com.liuyanzhao.ssm.blog.enums.ArticleStatus; +import com.liuyanzhao.ssm.blog.enums.Role; +import com.liuyanzhao.ssm.blog.enums.UserRole; +import com.liuyanzhao.ssm.blog.util.MyUtils; +import com.liuyanzhao.ssm.blog.service.ArticleService; +import com.liuyanzhao.ssm.blog.service.CommentService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; +import java.util.*; + + +/** + * @author liuyanzhao + */ +@Controller +@RequestMapping("/admin/comment") +public class BackCommentController { + + @Autowired + private CommentService commentService; + + @Autowired + private ArticleService articleService; + + /** + * 评论页面 + * 我发送的评论 + * + * @param pageIndex 页码 + * @param pageSize 页大小 + * @return modelAndView + */ + @RequestMapping(value = "") + public String commentList(@RequestParam(required = false, defaultValue = "1") Integer pageIndex, + @RequestParam(required = false, defaultValue = "10") Integer pageSize, + HttpSession session, + Model model) { + User user = (User) session.getAttribute("user"); + HashMap criteria = new HashMap<>(); + if (!UserRole.ADMIN.getValue().equals(user.getUserRole())) { + // 用户查询自己的文章, 管理员查询所有的 + criteria.put("userId", user.getUserId()); + } + PageInfo commentPageInfo = commentService.listCommentByPage(pageIndex, pageSize, criteria); + model.addAttribute("pageInfo", commentPageInfo); + model.addAttribute("pageUrlPrefix", "/admin/comment?pageIndex"); + return "Admin/Comment/index"; + } + + + /** + * 评论页面 + * 我收到的评论 + * + * @param pageIndex 页码 + * @param pageSize 页大小 + * @return modelAndView + */ + @RequestMapping(value = "/receive") + public String myReceiveComment(@RequestParam(required = false, defaultValue = "1") Integer pageIndex, + @RequestParam(required = false, defaultValue = "10") Integer pageSize, + HttpSession session, + Model model) { + User user = (User) session.getAttribute("user"); + PageInfo commentPageInfo = commentService.listReceiveCommentByPage(pageIndex, pageSize, user.getUserId()); + model.addAttribute("pageInfo", commentPageInfo); + model.addAttribute("pageUrlPrefix", "/admin/comment?pageIndex"); + return "Admin/Comment/index"; + } + + + /** + * 添加评论 + * + * @param request + * @param comment + */ + @RequestMapping(value = "/insert", method = {RequestMethod.POST}, produces = {"text/plain;charset=UTF-8"}) + @ResponseBody + public void insertComment(HttpServletRequest request, Comment comment, HttpSession session) { + User user = (User) session.getAttribute("user"); + Article article = articleService.getArticleByStatusAndId(null, comment.getCommentArticleId()); + if (article == null) { + return; + } + + //添加评论 + comment.setCommentUserId(user.getUserId()); + comment.setCommentIp(MyUtils.getIpAddr(request)); + comment.setCommentCreateTime(new Date()); + commentService.insertComment(comment); + //更新文章的评论数 + articleService.updateCommentCount(article.getArticleId()); + } + + /** + * 删除评论 + * + * @param id 批量ID + */ + @RequestMapping(value = "/delete/{id}") + public void deleteComment(@PathVariable("id") Integer id, HttpSession session) { + Comment comment = commentService.getCommentById(id); + User user = (User) session.getAttribute("user"); + // 如果不是管理员,访问其他用户的数据,没有权限 + if (!Objects.equals(user.getUserRole(), UserRole.ADMIN.getValue()) && !Objects.equals(comment.getCommentUserId(), user.getUserId())) { + return; + } + //删除评论 + commentService.deleteComment(id); + //删除其子评论 + List childCommentList = commentService.listChildComment(id); + for (int i = 0; i < childCommentList.size(); i++) { + commentService.deleteComment(childCommentList.get(i).getCommentId()); + } + //更新文章的评论数 + Article article = articleService.getArticleByStatusAndId(null, comment.getCommentArticleId()); + articleService.updateCommentCount(article.getArticleId()); + } + + /** + * 编辑评论页面显示 + * + * @param id + * @return + */ + @RequestMapping(value = "/edit/{id}") + public String editCommentView(@PathVariable("id") Integer id, Model model, HttpSession session) { + // 没有权限操作,只有管理员可以操作 + User user = (User) session.getAttribute("user"); + if (!Objects.equals(user.getUserRole(), UserRole.ADMIN.getValue())) { + return "redirect:/403"; + } + Comment comment = commentService.getCommentById(id); + model.addAttribute("comment", comment); + return "Admin/Comment/edit"; + } + + + /** + * 编辑评论提交 + * + * @param comment + * @return + */ + @RequestMapping(value = "/editSubmit", method = RequestMethod.POST) + public String editCommentSubmit(Comment comment, HttpSession session) { + User user = (User) session.getAttribute("user"); + // 没有权限操作,只有管理员可以操作 + if (!Objects.equals(user.getUserRole(), UserRole.ADMIN.getValue())) { + return "redirect:/403"; + } + commentService.updateComment(comment); + return "redirect:/admin/comment"; + } + + + /** + * 回复评论页面显示 + * + * @param id + * @return + */ + @RequestMapping(value = "/reply/{id}") + public String replyCommentView(@PathVariable("id") Integer id, Model model) { + Comment comment = commentService.getCommentById(id); + model.addAttribute("comment", comment); + return "Admin/Comment/reply"; + } + + /** + * 回复评论提交 + * + * @param request + * @param comment + * @return + */ + @RequestMapping(value = "/replySubmit", method = RequestMethod.POST) + public String replyCommentSubmit(HttpServletRequest request, Comment comment, HttpSession session) { + //文章评论数+1 + Article article = articleService.getArticleByStatusAndId(ArticleStatus.PUBLISH.getValue(), comment.getCommentArticleId()); + if (article == null) { + return "redirect:/404"; + } + User user = (User) session.getAttribute("user"); + comment.setCommentContent(HtmlUtil.escape(comment.getCommentContent())); + comment.setCommentAuthorName(user.getUserNickname()); + comment.setCommentAuthorEmail(user.getUserEmail()); + comment.setCommentAuthorUrl(user.getUserUrl()); + article.setArticleCommentCount(article.getArticleCommentCount() + 1); + articleService.updateArticle(article); + //添加评论 + comment.setCommentCreateTime(new Date()); + comment.setCommentIp(MyUtils.getIpAddr(request)); + if (Objects.equals(user.getUserId(), article.getArticleUserId())) { + comment.setCommentRole(Role.OWNER.getValue()); + } else { + comment.setCommentRole(Role.VISITOR.getValue()); + } + commentService.insertComment(comment); + return "redirect:/admin/comment"; + } + +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Admin/BackLinkController.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/admin/BackLinkController.java similarity index 56% rename from ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Admin/BackLinkController.java rename to ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/admin/BackLinkController.java index ce0ed606..65bba8e3 100755 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Admin/BackLinkController.java +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/admin/BackLinkController.java @@ -1,9 +1,8 @@ -package com.liuyanzhao.blog.controller.Admin; +package com.liuyanzhao.ssm.blog.controller.admin; -import com.liuyanzhao.blog.entity.Link; -import com.liuyanzhao.blog.entity.custom.LinkCustom; -import com.liuyanzhao.blog.service.LinkService; +import com.liuyanzhao.ssm.blog.entity.Link; +import com.liuyanzhao.ssm.blog.service.LinkService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; @@ -11,11 +10,13 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; -import javax.servlet.http.HttpServletRequest; import java.util.Date; import java.util.List; +/** + * @author liuyanzhao + */ @Controller @RequestMapping("/admin/link") public class BackLinkController { @@ -23,34 +24,47 @@ public class BackLinkController { @Autowired private LinkService linkService; - //后台链接列表显示 + /** + * 后台链接列表显示 + * + * @return modelAndView + */ @RequestMapping(value = "") - public ModelAndView linkList() throws Exception { + public ModelAndView linkList() { ModelAndView modelandview = new ModelAndView(); - List linkCustomList = linkService.listLink(null); - modelandview.addObject("linkCustomList",linkCustomList); + List linkList = linkService.listLink(null); + modelandview.addObject("linkList",linkList); modelandview.setViewName("Admin/Link/index"); return modelandview; } - //后台添加链接页面显示 + /** + * 后台添加链接页面显示 + * + * @return modelAndView + */ @RequestMapping(value = "/insert") - public ModelAndView insertLinkView() throws Exception { + public ModelAndView insertLinkView() { ModelAndView modelAndView = new ModelAndView(); - List linkCustomList = linkService.listLink(null); - modelAndView.addObject("linkCustomList",linkCustomList); + List linkList = linkService.listLink(null); + modelAndView.addObject("linkList",linkList); modelAndView.setViewName("Admin/Link/insert"); return modelAndView; } - //后台添加链接页面提交 + /** + * 后台添加链接页面提交 + * + * @param link 链接 + * @return 响应 + */ @RequestMapping(value = "/insertSubmit",method = RequestMethod.POST) - public String insertLinkSubmit(Link link) throws Exception { + public String insertLinkSubmit(Link link) { link.setLinkCreateTime(new Date()); link.setLinkUpdateTime(new Date()); link.setLinkStatus(1); @@ -58,33 +72,48 @@ public String insertLinkSubmit(Link link) throws Exception { return "redirect:/admin/link/insert"; } - //删除链接 + /** + * 删除链接 + * + * @param id 链接ID + * @return 响应 + */ @RequestMapping(value = "/delete/{id}") - public String deleteLink(@PathVariable("id") Integer id) throws Exception { + public String deleteLink(@PathVariable("id") Integer id) { linkService.deleteLink(id); return "redirect:/admin/link"; } - //编辑链接页面显示 + /** + * 编辑链接页面显示 + * + * @param id + * @return modelAndVIew + */ @RequestMapping(value = "/edit/{id}") - public ModelAndView editLinkView(@PathVariable("id") Integer id) throws Exception { + public ModelAndView editLinkView(@PathVariable("id") Integer id) { ModelAndView modelAndView = new ModelAndView(); - LinkCustom linkCustom = linkService.getLinkById(id); + Link linkCustom = linkService.getLinkById(id); modelAndView.addObject("linkCustom",linkCustom); - List linkCustomList = linkService.listLink(null); - modelAndView.addObject("linkCustomList",linkCustomList); + List linkList = linkService.listLink(null); + modelAndView.addObject("linkList",linkList); modelAndView.setViewName("Admin/Link/edit"); return modelAndView; } - //编辑链接提交 + /** + * 编辑链接提交 + * + * @param link 链接 + * @return 响应 + */ @RequestMapping(value = "/editSubmit",method = RequestMethod.POST) - public String editLinkSubmit(Link link) throws Exception { + public String editLinkSubmit(Link link) { link.setLinkUpdateTime(new Date()); linkService.updateLink(link); return "redirect:/admin/link"; diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/admin/BackMenuController.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/admin/BackMenuController.java new file mode 100755 index 00000000..076aae26 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/admin/BackMenuController.java @@ -0,0 +1,100 @@ +package com.liuyanzhao.ssm.blog.controller.admin; + +import com.liuyanzhao.ssm.blog.entity.Menu; +import com.liuyanzhao.ssm.blog.enums.MenuLevel; +import com.liuyanzhao.ssm.blog.service.MenuService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.servlet.ModelAndView; + +import java.util.List; + +/** + * @author liuyanzhao + */ +@Controller +@RequestMapping("/admin/menu") +public class BackMenuController { + + @Autowired + private MenuService menuService; + + /** + * 后台菜单列表显示 + * + * @return + */ + @RequestMapping(value = "") + public String menuList(Model model) { + List menuList = menuService.listMenu(); + model.addAttribute("menuList",menuList); + return "Admin/Menu/index"; + } + + /** + * 添加菜单内容提交 + * + * @param menu + * @return + */ + @RequestMapping(value = "/insertSubmit",method = RequestMethod.POST) + public String insertMenuSubmit(Menu menu) { + if(menu.getMenuOrder() == null) { + menu.setMenuOrder(MenuLevel.TOP_MENU.getValue()); + } + menuService.insertMenu(menu); + return "redirect:/admin/menu"; + } + + /** + * 删除菜单内容 + * + * @param id + * @return + */ + @RequestMapping(value = "/delete/{id}") + public String deleteMenu(@PathVariable("id") Integer id) { + menuService.deleteMenu(id); + return "redirect:/admin/menu"; + } + + /** + * 编辑菜单内容显示 + * + * @param id + * @return + */ + @RequestMapping(value = "/edit/{id}") + public ModelAndView editMenuView(@PathVariable("id") Integer id) { + ModelAndView modelAndView = new ModelAndView(); + + Menu menu = menuService.getMenuById(id); + modelAndView.addObject("menu",menu); + + List menuList = menuService.listMenu(); + modelAndView.addObject("menuList",menuList); + + modelAndView.setViewName("Admin/Menu/edit"); + return modelAndView; + } + + + /** + * 编辑菜单内容提交 + * + * @param menu + * @return + */ + @RequestMapping(value = "/editSubmit",method = RequestMethod.POST) + public String editMenuSubmit(Menu menu) { + menuService.updateMenu(menu); + return "redirect:/admin/menu"; + } + + + +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/admin/BackNoticeController.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/admin/BackNoticeController.java new file mode 100755 index 00000000..5fdbd1df --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/admin/BackNoticeController.java @@ -0,0 +1,105 @@ +package com.liuyanzhao.ssm.blog.controller.admin; + + +import com.liuyanzhao.ssm.blog.entity.Notice; +import com.liuyanzhao.ssm.blog.enums.NoticeStatus; +import com.liuyanzhao.ssm.blog.service.NoticeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +import java.util.Date; +import java.util.List; + + +@Controller +@RequestMapping("/admin/notice") +public class BackNoticeController { + + @Autowired + private NoticeService noticeService; + + /** + * 后台公告列表显示 + * + * @return + */ + @RequestMapping(value = "") + public String index(Model model) { + List noticeList = noticeService.listNotice(null); + model.addAttribute("noticeList", noticeList); + return "Admin/Notice/index"; + + } + + /** + * 添加公告显示 + * + * @return + */ + @RequestMapping(value = "/insert") + public String insertNoticeView() { + return "Admin/Notice/insert"; + } + + /** + * 添加公告提交 + * + * @param notice + * @return + */ + @RequestMapping(value = "/insertSubmit", method = RequestMethod.POST) + public String insertNoticeSubmit(Notice notice) { + notice.setNoticeCreateTime(new Date()); + notice.setNoticeUpdateTime(new Date()); + notice.setNoticeStatus(NoticeStatus.NORMAL.getValue()); + notice.setNoticeOrder(1); + noticeService.insertNotice(notice); + return "redirect:/admin/notice"; + } + + /** + * 删除公告 + * + * @param id + * @return + */ + @RequestMapping(value = "/delete/{id}") + public String deleteNotice(@PathVariable("id") Integer id) { + noticeService.deleteNotice(id); + + return "redirect:/admin/notice"; + } + + /** + * 编辑公告页面显示 + * + * @param id + * @return + */ + @RequestMapping(value = "/edit/{id}") + public String editNoticeView(@PathVariable("id") Integer id, Model model) { + Notice notice = noticeService.getNoticeById(id); + model.addAttribute("notice", notice); + return "Admin/Notice/edit"; + } + + + /** + * 编辑公告页面显示 + * + * @param notice + * @return + */ + @RequestMapping(value = "/editSubmit", method = RequestMethod.POST) + public String editNoticeSubmit(Notice notice) { + notice.setNoticeUpdateTime(new Date()); + noticeService.updateNotice(notice); + return "redirect:/admin/notice"; + } + + +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Admin/BackOptionsController.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/admin/BackOptionsController.java similarity index 58% rename from ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Admin/BackOptionsController.java rename to ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/admin/BackOptionsController.java index d33350fe..7d98fc1b 100755 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Admin/BackOptionsController.java +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/admin/BackOptionsController.java @@ -1,8 +1,7 @@ -package com.liuyanzhao.blog.controller.Admin; +package com.liuyanzhao.ssm.blog.controller.admin; -import com.liuyanzhao.blog.entity.Options; -import com.liuyanzhao.blog.entity.custom.OptionsCustom; -import com.liuyanzhao.blog.service.OptionsService; +import com.liuyanzhao.ssm.blog.entity.Options; +import com.liuyanzhao.ssm.blog.service.OptionsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @@ -10,6 +9,9 @@ import org.springframework.web.servlet.ModelAndView; +/** + * @author liuyanzhao + */ @Controller @RequestMapping("/admin/options") public class BackOptionsController { @@ -18,33 +20,46 @@ public class BackOptionsController { private OptionsService optionsService; - //基本信息显示 + /** + * 基本信息显示 + * + * @return + */ @RequestMapping(value = "") - public ModelAndView index() throws Exception { + public ModelAndView index() { ModelAndView modelAndView = new ModelAndView(); - OptionsCustom optionCustom = optionsService.getOptions(); - modelAndView.addObject("optionCustom",optionCustom); + Options option = optionsService.getOptions(); + modelAndView.addObject("option",option); modelAndView.setViewName("Admin/Options/index"); return modelAndView; } - //编辑基本信息显示 + /** + * 编辑基本信息显示 + * + * @return + */ @RequestMapping(value = "/edit") - public ModelAndView editOptionView() throws Exception { + public ModelAndView editOptionView() { ModelAndView modelAndView = new ModelAndView(); - OptionsCustom optionCustom = optionsService.getOptions(); - modelAndView.addObject("optionCustom",optionCustom); + Options option = optionsService.getOptions(); + modelAndView.addObject("option",option); modelAndView.setViewName("Admin/Options/edit"); return modelAndView; } - //编辑基本信息提交 + /** + * 编辑基本信息提交 + * + * @param options + * @return + */ @RequestMapping(value = "/editSubmit",method = RequestMethod.POST) - public String editOptionSubmit(Options options) throws Exception { + public String editOptionSubmit(Options options) { //如果记录不存在,那就新建 - OptionsCustom optionsCustom = optionsService.getOptions(); + Options optionsCustom = optionsService.getOptions(); if(optionsCustom.getOptionId()==null) { optionsService.insertOptions(options); } else { diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Admin/BackPageController.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/admin/BackPageController.java similarity index 51% rename from ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Admin/BackPageController.java rename to ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/admin/BackPageController.java index 30557fa6..02056946 100755 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Admin/BackPageController.java +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/admin/BackPageController.java @@ -1,8 +1,8 @@ -package com.liuyanzhao.blog.controller.Admin; +package com.liuyanzhao.ssm.blog.controller.admin; -import com.liuyanzhao.blog.entity.Page; -import com.liuyanzhao.blog.entity.custom.*; -import com.liuyanzhao.blog.service.PageService; +import com.liuyanzhao.ssm.blog.entity.Page; +import com.liuyanzhao.ssm.blog.enums.PageStatus; +import com.liuyanzhao.ssm.blog.service.PageService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; @@ -12,8 +12,12 @@ import java.util.Date; import java.util.List; +import java.util.Objects; +/** + * @author liuyanzhao + */ @Controller @RequestMapping("/admin/page") public class BackPageController { @@ -21,69 +25,96 @@ public class BackPageController { @Autowired private PageService pageService; - //后台页面列表显示 + /** + * 后台页面列表显示 + * + * @return + */ @RequestMapping(value = "") - public ModelAndView index() throws Exception { + public ModelAndView index() { ModelAndView modelAndView = new ModelAndView(); - List pageCustomList = pageService.listPage(null); - modelAndView.addObject("pageCustomList",pageCustomList); + List pageList = pageService.listPage(null); + modelAndView.addObject("pageList", pageList); modelAndView.setViewName("Admin/Page/index"); return modelAndView; } - - //后台添加页面页面显示 + + /** + * 后台添加页面页面显示 + * + * @return + */ @RequestMapping(value = "/insert") - public ModelAndView insertPageView() throws Exception { + public ModelAndView insertPageView() { ModelAndView modelAndView = new ModelAndView(); - modelAndView.setViewName("Admin/Page/insert"); return modelAndView; } - //后台添加页面提交操作 - @RequestMapping(value = "/insertSubmit",method = RequestMethod.POST) - public String insertPageSubmit(Page page) throws Exception { + /** + * 后台添加页面提交操作 + * + * @param page + * @return + */ + @RequestMapping(value = "/insertSubmit", method = RequestMethod.POST) + public String insertPageSubmit(Page page) { //判断别名是否存在 - PageCustom checkPage = pageService.getPageByKey(null,page.getPageKey()); - if(checkPage==null) { + Page checkPage = pageService.getPageByKey(null, page.getPageKey()); + if (checkPage == null) { page.setPageCreateTime(new Date()); page.setPageUpdateTime(new Date()); - page.setPageStatus(1); + page.setPageStatus(PageStatus.NORMAL.getValue()); pageService.insertPage(page); } return "redirect:/admin/page"; } - //删除页面 + /** + * 删除页面 + * + * @param id + * @return + */ @RequestMapping(value = "/delete/{id}") - public String deletePage(@PathVariable("id") Integer id) throws Exception { + public String deletePage(@PathVariable("id") Integer id) { //调用service批量删除 pageService.deletePage(id); return "redirect:/admin/page"; } - - //编辑页面页面显示 + + /** + * 编辑页面页面显示 + * + * @param id + * @return + */ @RequestMapping(value = "/edit/{id}") - public ModelAndView editPageView(@PathVariable("id") Integer id) throws Exception { + public ModelAndView editPageView(@PathVariable("id") Integer id) { ModelAndView modelAndView = new ModelAndView(); - PageCustom pageCustom = pageService.getPageById(id); - modelAndView.addObject("pageCustom",pageCustom); + Page page = pageService.getPageById(id); + modelAndView.addObject("page", page); modelAndView.setViewName("Admin/Page/edit"); return modelAndView; } - //编辑页面提交 - @RequestMapping(value = "/editSubmit",method = RequestMethod.POST) - public String editPageSubmit(Page page) throws Exception { - PageCustom checkPage = pageService.getPageByKey(null,page.getPageKey()); + /** + * 编辑页面提交 + * + * @param page + * @return + */ + @RequestMapping(value = "/editSubmit", method = RequestMethod.POST) + public String editPageSubmit(Page page) { + Page checkPage = pageService.getPageByKey(null, page.getPageKey()); //判断别名是否存在且不是这篇文章 - if(checkPage.getPageId()==page.getPageId()) { + if (Objects.equals(checkPage.getPageId(), page.getPageId())) { page.setPageUpdateTime(new Date()); pageService.updatePage(page); } diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Admin/BackTagController.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/admin/BackTagController.java similarity index 54% rename from ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Admin/BackTagController.java rename to ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/admin/BackTagController.java index 7436b818..4ec40515 100755 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Admin/BackTagController.java +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/admin/BackTagController.java @@ -1,10 +1,9 @@ -package com.liuyanzhao.blog.controller.Admin; +package com.liuyanzhao.ssm.blog.controller.admin; -import com.liuyanzhao.blog.entity.Tag; -import com.liuyanzhao.blog.entity.custom.TagCustom; -import com.liuyanzhao.blog.service.ArticleService; -import com.liuyanzhao.blog.service.TagService; +import com.liuyanzhao.ssm.blog.entity.Tag; +import com.liuyanzhao.ssm.blog.service.ArticleService; +import com.liuyanzhao.ssm.blog.service.TagService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; @@ -15,23 +14,28 @@ import java.util.List; +/** + * @author liuyanzhao + */ @Controller @RequestMapping("/admin/tag") public class BackTagController { + @Autowired private ArticleService articleService; - @Autowired private TagService tagService; - //后台标签列表显示 + /** + * 后台标签列表显示 + * @return + */ @RequestMapping(value = "") - public ModelAndView index() throws Exception { + public ModelAndView index() { ModelAndView modelandview = new ModelAndView(); - - List tagCustomList = tagService.listTag(null); - modelandview.addObject("tagCustomList",tagCustomList); + List tagList = tagService.listTagWithCount(); + modelandview.addObject("tagList",tagList); modelandview.setViewName("Admin/Tag/index"); return modelandview; @@ -39,45 +43,62 @@ public ModelAndView index() throws Exception { } - //后台添加分类页面显示 + /** + * 后台添加分类页面显示 + * + * @param tag + * @return + */ @RequestMapping(value = "/insertSubmit",method = RequestMethod.POST) - public String insertTagSubmit(Tag tag) throws Exception { + public String insertTagSubmit(Tag tag) { tagService.insertTag(tag); return "redirect:/admin/tag"; } - //删除标签 + /** + * 删除标签 + * + * @param id 标签ID + * @return + */ @RequestMapping(value = "/delete/{id}") - public String deleteTag(@PathVariable("id") Integer id) throws Exception { - - //禁止删除有文章的分类 - int count = articleService.countArticleWithTag(null,id); + public String deleteTag(@PathVariable("id") Integer id) { + Integer count = articleService.countArticleByTagId(id); if (count == 0) { tagService.deleteTag(id); } - return "redirect:/admin/tag"; } - //编辑标签页面显示 + /** + * 编辑标签页面显示 + * + * @param id + * @return + */ @RequestMapping(value = "/edit/{id}") - public ModelAndView editTagView(@PathVariable("id") Integer id) throws Exception { + public ModelAndView editTagView(@PathVariable("id") Integer id) { ModelAndView modelAndView = new ModelAndView(); - TagCustom tagCustom = tagService.getTagById(id); - modelAndView.addObject("tagCustom",tagCustom); + Tag tag = tagService.getTagById(id); + modelAndView.addObject("tag",tag); - List tagCustomList = tagService.listTag(null); - modelAndView.addObject("tagCustomList",tagCustomList); + List tagList = tagService.listTagWithCount(); + modelAndView.addObject("tagList",tagList); modelAndView.setViewName("Admin/Tag/edit"); return modelAndView; } - //编辑标签提交 + /** + * 编辑标签提交 + * + * @param tag + * @return + */ @RequestMapping(value = "/editSubmit",method = RequestMethod.POST) - public String editTagSubmit(Tag tag) throws Exception { + public String editTagSubmit(Tag tag) { tagService.updateTag(tag); return "redirect:/admin/tag"; } diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Admin/BackUserController.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/admin/BackUserController.java similarity index 55% rename from ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Admin/BackUserController.java rename to ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/admin/BackUserController.java index 8037ddca..852b438a 100755 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/controller/Admin/BackUserController.java +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/admin/BackUserController.java @@ -1,9 +1,9 @@ -package com.liuyanzhao.blog.controller.Admin; +package com.liuyanzhao.ssm.blog.controller.admin; -import com.liuyanzhao.blog.entity.User; -import com.liuyanzhao.blog.entity.custom.UserCustom; -import com.liuyanzhao.blog.service.UserService; +import com.liuyanzhao.ssm.blog.entity.User; +import com.liuyanzhao.ssm.blog.enums.UserRole; +import com.liuyanzhao.ssm.blog.service.UserService; import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -11,12 +11,16 @@ import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; +/** + * @author liuyanzhao + */ @Controller @RequestMapping("/admin/user") public class BackUserController { @@ -24,119 +28,149 @@ public class BackUserController { @Autowired private UserService userService; - //后台用户列表显示 + /** + * 后台用户列表显示 + * + * @return + */ @RequestMapping(value = "") - public ModelAndView userList() throws Exception { + public ModelAndView userList() { ModelAndView modelandview = new ModelAndView(); - List userCustomList = userService.listUser(); - modelandview.addObject("userCustomList",userCustomList); + List userList = userService.listUser(); + modelandview.addObject("userList", userList); modelandview.setViewName("Admin/User/index"); return modelandview; } - //后台添加用户页面显示 + /** + * 后台添加用户页面显示 + * + * @return + */ @RequestMapping(value = "/insert") - public ModelAndView insertUserView() throws Exception { + public ModelAndView insertUserView() { ModelAndView modelAndView = new ModelAndView(); modelAndView.setViewName("Admin/User/insert"); return modelAndView; } - @RequestMapping(value = "/checkUserName",method = RequestMethod.POST) + /** + * 检查用户名是否存在 + * + * @param request + * @return + */ + @RequestMapping(value = "/checkUserName", method = RequestMethod.POST, produces = {"text/plain;charset=UTF-8"}) @ResponseBody - public String checkUserName(HttpServletRequest request) throws Exception { + public String checkUserName(HttpServletRequest request) { Map map = new HashMap(); String username = request.getParameter("username"); User user = userService.getUserByName(username); int id = Integer.valueOf(request.getParameter("id")); //用户名已存在,但不是当前用户(编辑用户的时候,不提示) - if(user!=null) { - if(user.getUserId()!=id) { + if (user != null) { + if (user.getUserId() != id) { map.put("code", 1); map.put("msg", "用户名已存在!"); } } else { - map.put("code",0); - map.put("msg",""); + map.put("code", 0); + map.put("msg", ""); } String result = new JSONObject(map).toString(); return result; } - @RequestMapping(value = "/checkUserEmail",method = RequestMethod.POST) + /** + * 检查Email是否存在 + * + * @param request + * @return + */ + @RequestMapping(value = "/checkUserEmail", method = RequestMethod.POST, produces = {"text/plain;charset=UTF-8"}) @ResponseBody - public String checkUserEmail(HttpServletRequest request) throws Exception { + public String checkUserEmail(HttpServletRequest request) { Map map = new HashMap(); String email = request.getParameter("email"); User user = userService.getUserByEmail(email); int id = Integer.valueOf(request.getParameter("id")); //用户名已存在,但不是当前用户(编辑用户的时候,不提示) - if(user!=null) { - if(user.getUserId()!=id) { + if (user != null) { + if (user.getUserId() != id) { map.put("code", 1); map.put("msg", "电子邮箱已存在!"); } } else { - map.put("code",0); - map.put("msg",""); + map.put("code", 0); + map.put("msg", ""); } String result = new JSONObject(map).toString(); return result; } - //后台添加用户页面提交 - @RequestMapping(value = "/insertSubmit",method = RequestMethod.POST) - public String insertUserSubmit(User user) throws Exception { + /** + * 后台添加用户页面提交 + * + * @param user + * @return + */ + @RequestMapping(value = "/insertSubmit", method = RequestMethod.POST) + public String insertUserSubmit(User user) { User user2 = userService.getUserByName(user.getUserName()); User user3 = userService.getUserByEmail(user.getUserEmail()); - if(user2==null&&user3==null) { + if (user2 == null && user3 == null) { user.setUserRegisterTime(new Date()); user.setUserStatus(1); + user.setUserRole(UserRole.USER.getValue()); userService.insertUser(user); } return "redirect:/admin/user"; } - //删除用户 + /** + * 删除用户 + * + * @param id + * @return + */ @RequestMapping(value = "/delete/{id}") - public String deleteUser(@PathVariable("id") Integer id) throws Exception { + public String deleteUser(@PathVariable("id") Integer id) { userService.deleteUser(id); return "redirect:/admin/user"; } - //编辑用户页面显示 + /** + * 编辑用户页面显示 + * + * @param id + * @return + */ @RequestMapping(value = "/edit/{id}") - public ModelAndView editUserView(@PathVariable("id") Integer id) throws Exception { + public ModelAndView editUserView(@PathVariable("id") Integer id) { ModelAndView modelAndView = new ModelAndView(); - UserCustom userCustom = userService.getUserById(id); - modelAndView.addObject("userCustom",userCustom); + User user = userService.getUserById(id); + modelAndView.addObject("user", user); modelAndView.setViewName("Admin/User/edit"); return modelAndView; } - //编辑用户提交 - @RequestMapping(value = "/editSubmit",method = RequestMethod.POST) - public String editUserSubmit(User user) throws Exception { + /** + * 编辑用户提交 + * + * @param user + * @return + */ + @RequestMapping(value = "/editSubmit", method = RequestMethod.POST) + public String editUserSubmit(User user) { userService.updateUser(user); return "redirect:/admin/user"; } - //基本信息页面显示 - @RequestMapping(value = "/profile/{id}") - public ModelAndView userProfileView(@PathVariable("id") Integer id) throws Exception { - ModelAndView modelAndView = new ModelAndView(); - - UserCustom userCustom = userService.getUserById(id); - modelAndView.addObject("userCustom",userCustom); - - modelAndView.setViewName("Admin/User/profile"); - return modelAndView; - } } diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/admin/UploadFileController.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/admin/UploadFileController.java new file mode 100755 index 00000000..7431f47f --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/admin/UploadFileController.java @@ -0,0 +1,93 @@ +package com.liuyanzhao.ssm.blog.controller.admin; + +import com.liuyanzhao.ssm.blog.dto.JsonResult; +import com.liuyanzhao.ssm.blog.dto.UploadFileVO; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + + +import java.io.File; +import java.io.IOException; +import java.util.Calendar; + +/** + * @author liuyanzhao + */ +@Slf4j +@RestController +@RequestMapping("/admin/upload") +public class UploadFileController { + + /** + * 文件保存目录,物理路径 + */ +// public final String rootPath = "/Users/liuyanzhao/Documents/uploads"; + public final String rootPath = "D:\\uploads"; + + public final String allowSuffix = ".bmp.jpg.jpeg.png.gif.pdf.doc.zip.rar.gz"; + + /** + * 上传文件 + * + * @param file + * @return + * @throws IOException + */ + @RequestMapping(value = "/img", method = RequestMethod.POST) + public JsonResult uploadFile(@RequestParam("file") MultipartFile file) { + + //1.文件后缀过滤,只允许部分后缀 + //文件的完整名称,如spring.jpeg + String filename = file.getOriginalFilename(); + //文件名,如spring + String name = filename.substring(0, filename.indexOf(".")); + //文件后缀,如.jpeg + String suffix = filename.substring(filename.lastIndexOf(".")); + + if (allowSuffix.indexOf(suffix) == -1) { + return new JsonResult().fail("不允许上传该后缀的文件!"); + } + + + //2.创建文件目录 + //创建年月文件夹 + Calendar date = Calendar.getInstance(); + File dateDirs = new File(date.get(Calendar.YEAR) + + File.separator + (date.get(Calendar.MONTH) + 1)); + + //目标文件 + File descFile = new File(rootPath + File.separator + dateDirs + File.separator + filename); + int i = 1; + //若文件存在重命名 + String newFilename = filename; + while (descFile.exists()) { + newFilename = name + "(" + i + ")" + suffix; + String parentPath = descFile.getParent(); + descFile = new File(parentPath + File.separator + newFilename); + i++; + } + //判断目标文件所在的目录是否存在 + if (!descFile.getParentFile().exists()) { + //如果目标文件所在的目录不存在,则创建父目录 + descFile.getParentFile().mkdirs(); + } + + //3.存储文件 + //将内存中的数据写入磁盘 + try { + file.transferTo(descFile); + } catch (Exception e) { + e.printStackTrace(); + log.error("上传失败,cause:{}", e); + } + //完整的url + String fileUrl = "/uploads/" + dateDirs + "/" + newFilename; + + //4.返回URL + UploadFileVO uploadFileVO = new UploadFileVO(); + uploadFileVO.setTitle(filename); + uploadFileVO.setSrc(fileUrl); + return new JsonResult().ok(uploadFileVO); + } +} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/home/ArticleController.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/home/ArticleController.java new file mode 100755 index 00000000..38c78fff --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/home/ArticleController.java @@ -0,0 +1,134 @@ +package com.liuyanzhao.ssm.blog.controller.home; + + +import com.alibaba.fastjson.JSON; + +import com.liuyanzhao.ssm.blog.enums.ArticleStatus; + +import com.liuyanzhao.ssm.blog.entity.Article; +import com.liuyanzhao.ssm.blog.entity.Comment; +import com.liuyanzhao.ssm.blog.entity.Tag; +import com.liuyanzhao.ssm.blog.entity.User; +import com.liuyanzhao.ssm.blog.service.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 文章的controller + * + * @author 言曌 + * @date 2017/8/24 + */ +@Controller +public class ArticleController { + + @Autowired + private ArticleService articleService; + + @Autowired + private CommentService commentService; + + @Autowired + private UserService userService; + + @Autowired + private TagService tagService; + + @Autowired + private CategoryService categoryService; + + /** + * 文章详情页显示 + * + * @param articleId 文章ID + * @return modelAndView + */ + @RequestMapping(value = "/article/{articleId}") + public String getArticleDetailPage(@PathVariable("articleId") Integer articleId, Model model) { + + //文章信息,分类,标签,作者,评论 + Article article = articleService.getArticleByStatusAndId(ArticleStatus.PUBLISH.getValue(), articleId); + if (article == null) { + return "Home/Error/404"; + } + + //用户信息 + User user = userService.getUserById(article.getArticleUserId()); + article.setUser(user); + + //文章信息 + model.addAttribute("article", article); + + //评论列表 + List commentList = commentService.listCommentByArticleId(articleId); + model.addAttribute("commentList", commentList); + + //相关文章 + List categoryIds = articleService.listCategoryIdByArticleId(articleId); + List
similarArticleList = articleService.listArticleByCategoryIds(categoryIds, 5); + model.addAttribute("similarArticleList", similarArticleList); + + //猜你喜欢 + List
mostViewArticleList = articleService.listArticleByViewCount(5); + model.addAttribute("mostViewArticleList", mostViewArticleList); + + //获取下一篇文章 + Article afterArticle = articleService.getAfterArticle(articleId); + model.addAttribute("afterArticle", afterArticle); + + //获取上一篇文章 + Article preArticle = articleService.getPreArticle(articleId); + model.addAttribute("preArticle", preArticle); + + //侧边栏 + //标签列表显示 + List allTagList = tagService.listTag(); + model.addAttribute("allTagList", allTagList); + //获得随机文章 + List
randomArticleList = articleService.listRandomArticle(8); + model.addAttribute("randomArticleList", randomArticleList); + //获得热评文章 + List
mostCommentArticleList = articleService.listArticleByCommentCount(8); + model.addAttribute("mostCommentArticleList", mostCommentArticleList); + + return "Home/Page/articleDetail"; + } + + /** + * 点赞增加 + * + * @param id 文章ID + * @return 点赞量数量 + */ + @RequestMapping(value = "/article/like/{id}", method = {RequestMethod.POST}, produces = {"text/plain;charset=UTF-8"}) + @ResponseBody + public String increaseLikeCount(@PathVariable("id") Integer id) { + Article article = articleService.getArticleByStatusAndId(ArticleStatus.PUBLISH.getValue(), id); + Integer articleCount = article.getArticleLikeCount() + 1; + article.setArticleLikeCount(articleCount); + articleService.updateArticle(article); + return JSON.toJSONString(articleCount); + } + + /** + * 文章访问量数增加 + * + * @param id 文章ID + * @return 访问量数量 + */ + @RequestMapping(value = "/article/view/{id}", method = {RequestMethod.POST}, produces = {"text/plain;charset=UTF-8"}) + @ResponseBody + public String increaseViewCount(@PathVariable("id") Integer id) { + Article article = articleService.getArticleByStatusAndId(ArticleStatus.PUBLISH.getValue(), id); + Integer articleCount = article.getArticleViewCount() + 1; + article.setArticleViewCount(articleCount); + articleService.updateArticle(article); + return JSON.toJSONString(articleCount); + } + + +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/home/CategoryController.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/home/CategoryController.java new file mode 100755 index 00000000..310c361e --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/home/CategoryController.java @@ -0,0 +1,83 @@ +package com.liuyanzhao.ssm.blog.controller.home; + + +import com.github.pagehelper.PageInfo; + +import com.liuyanzhao.ssm.blog.enums.ArticleStatus; + + +import com.liuyanzhao.ssm.blog.entity.Article; +import com.liuyanzhao.ssm.blog.entity.Category; +import com.liuyanzhao.ssm.blog.entity.Tag; +import com.liuyanzhao.ssm.blog.service.ArticleService; +import com.liuyanzhao.ssm.blog.service.CategoryService; +import com.liuyanzhao.ssm.blog.service.TagService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; +import java.util.List; + + +/** + * 文章分类目录的controller + * + * @author 言曌 + * @date 2017/8/24 + */ +@Controller +public class CategoryController { + + @Autowired + private CategoryService categoryService; + + @Autowired + private ArticleService articleService; + + @Autowired + private TagService tagService; + + /** + * 根据分类查询文章 + * + * @param cateId 分类ID + * @return 模板 + */ + @RequestMapping("/category/{cateId}") + public String getArticleListByCategory(@PathVariable("cateId") Integer cateId, + @RequestParam(required = false, defaultValue = "1") Integer pageIndex, + @RequestParam(required = false, defaultValue = "10") Integer pageSize, + Model model) { + + //该分类信息 + Category category = categoryService.getCategoryById(cateId); + if (category == null) { + return "redirect:/404"; + } + model.addAttribute("category", category); + + //文章列表 + HashMap criteria = new HashMap<>(2); + criteria.put("categoryId", cateId); + criteria.put("status", ArticleStatus.PUBLISH.getValue()); + PageInfo
articlePageInfo = articleService.pageArticle(pageIndex, pageSize, criteria); + model.addAttribute("pageInfo", articlePageInfo); + + //侧边栏 + //标签列表显示 + List allTagList = tagService.listTag(); + model.addAttribute("allTagList", allTagList); + //获得随机文章 + List
randomArticleList = articleService.listRandomArticle(8); + model.addAttribute("randomArticleList", randomArticleList); + //获得热评文章 + List
mostCommentArticleList = articleService.listArticleByCommentCount(8); + model.addAttribute("mostCommentArticleList", mostCommentArticleList); + model.addAttribute("pageUrlPrefix", "/category/"+cateId+"?pageIndex"); + return "Home/Page/articleListByCategory"; + } + + +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/home/CommentController.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/home/CommentController.java new file mode 100755 index 00000000..9e76d921 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/home/CommentController.java @@ -0,0 +1,85 @@ +package com.liuyanzhao.ssm.blog.controller.home; + +import cn.hutool.http.HtmlUtil; +import com.liuyanzhao.ssm.blog.dto.JsonResult; +import com.liuyanzhao.ssm.blog.entity.Article; +import com.liuyanzhao.ssm.blog.entity.Comment; +import com.liuyanzhao.ssm.blog.entity.User; +import com.liuyanzhao.ssm.blog.enums.ArticleStatus; +import com.liuyanzhao.ssm.blog.enums.Role; +import com.liuyanzhao.ssm.blog.service.ArticleService; +import com.liuyanzhao.ssm.blog.service.CommentService; +import com.liuyanzhao.ssm.blog.util.MyUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; +import java.util.Date; +import java.util.Objects; + +/** + * @author 言曌 + * @date 2017/9/10 + */ + +@Controller +@RestController +public class CommentController { + @Autowired + private CommentService commentService; + + @Autowired + private ArticleService articleService; + + /** + * 添加评论 + * + * @param request + * @param comment + */ + @RequestMapping(value = "/comment", method = {RequestMethod.POST}) + public JsonResult insertComment(HttpServletRequest request, Comment comment, HttpSession session) { + User user = (User) session.getAttribute("user"); + if (user == null) { + return new JsonResult().fail("请先登录"); + } + Article article = articleService.getArticleByStatusAndId(ArticleStatus.PUBLISH.getValue(), comment.getCommentArticleId()); + if (article == null) { + return new JsonResult().fail("文章不存在"); + } + + + //添加评论 + comment.setCommentUserId(user.getUserId()); + comment.setCommentCreateTime(new Date()); + comment.setCommentIp(MyUtils.getIpAddr(request)); + if (Objects.equals(user.getUserId(), article.getArticleUserId())) { + comment.setCommentRole(Role.OWNER.getValue()); + } else { + comment.setCommentRole(Role.VISITOR.getValue()); + } + comment.setCommentAuthorAvatar(user.getUserAvatar()); + + //过滤字符,防止XSS攻击 + comment.setCommentContent(HtmlUtil.escape(comment.getCommentContent())); + + comment.setCommentAuthorName(user.getUserNickname()); + comment.setCommentAuthorEmail(user.getUserEmail()); + comment.setCommentAuthorUrl(user.getUserUrl()); + try { + commentService.insertComment(comment); + //更新文章的评论数 + articleService.updateCommentCount(article.getArticleId()); + } catch (Exception e) { + e.printStackTrace(); + return new JsonResult().fail(); + } + return new JsonResult().ok(); + } + + +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/home/IndexController.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/home/IndexController.java new file mode 100755 index 00000000..aec1455c --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/home/IndexController.java @@ -0,0 +1,124 @@ +package com.liuyanzhao.ssm.blog.controller.home; + +import com.github.pagehelper.PageInfo; +import com.liuyanzhao.ssm.blog.entity.Link; + +import com.liuyanzhao.ssm.blog.enums.ArticleStatus; +import com.liuyanzhao.ssm.blog.enums.LinkStatus; +import com.liuyanzhao.ssm.blog.enums.NoticeStatus; + +import com.liuyanzhao.ssm.blog.entity.*; +import com.liuyanzhao.ssm.blog.service.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; +import java.util.List; + +/** + * 用户的controller + * + * @author 言曌 + * @date 2017/8/24 + */ +@Controller +public class IndexController { + + @Autowired + private ArticleService articleService; + + @Autowired + private LinkService linkService; + + @Autowired + private NoticeService noticeService; + + @Autowired + private TagService tagService; + + @Autowired + private CommentService commentService; + + @RequestMapping(value = {"/", "/article"}) + public String index(@RequestParam(required = false, defaultValue = "1") Integer pageIndex, + @RequestParam(required = false, defaultValue = "10") Integer pageSize, Model model) { + HashMap criteria = new HashMap<>(1); + criteria.put("status", ArticleStatus.PUBLISH.getValue()); + //文章列表 + PageInfo
articleList = articleService.pageArticle(pageIndex, pageSize, criteria); + model.addAttribute("pageInfo", articleList); + + //公告 + List noticeList = noticeService.listNotice(NoticeStatus.NORMAL.getValue()); + model.addAttribute("noticeList", noticeList); + //友情链接 + List linkList = linkService.listLink(LinkStatus.NORMAL.getValue()); + model.addAttribute("linkList", linkList); + + //侧边栏显示 + //标签列表显示 + List allTagList = tagService.listTag(); + model.addAttribute("allTagList", allTagList); + //最新评论 + List recentCommentList = commentService.listRecentComment(null, 10); + model.addAttribute("recentCommentList", recentCommentList); + model.addAttribute("pageUrlPrefix", "/article?pageIndex"); + return "Home/index"; + } + + @RequestMapping(value = "/search") + public String search( + @RequestParam("keywords") String keywords, + @RequestParam(required = false, defaultValue = "1") Integer pageIndex, + @RequestParam(required = false, defaultValue = "10") Integer pageSize, Model model) { + //文章列表 + HashMap criteria = new HashMap<>(2); + criteria.put("status", ArticleStatus.PUBLISH.getValue()); + criteria.put("keywords", keywords); + PageInfo
articlePageInfo = articleService.pageArticle(pageIndex, pageSize, criteria); + model.addAttribute("pageInfo", articlePageInfo); + + //侧边栏显示 + //标签列表显示 + List allTagList = tagService.listTag(); + model.addAttribute("allTagList", allTagList); + //获得随机文章 + List
randomArticleList = articleService.listRandomArticle(8); + model.addAttribute("randomArticleList", randomArticleList); + //获得热评文章 + List
mostCommentArticleList = articleService.listArticleByCommentCount(8); + model.addAttribute("mostCommentArticleList", mostCommentArticleList); + //最新评论 + List recentCommentList = commentService.listRecentComment(null, 10); + model.addAttribute("recentCommentList", recentCommentList); + model.addAttribute("pageUrlPrefix", "/search?keywords=" + keywords + "&pageIndex"); + return "Home/Page/search"; + } + + @RequestMapping("/404") + public String NotFound(@RequestParam(required = false) String message, Model model) { + model.addAttribute("message", message); + return "Home/Error/404"; + } + + + @RequestMapping("/403") + public String Page403(@RequestParam(required = false) String message, Model model) { + model.addAttribute("message", message); + return "Home/Error/403"; + } + + @RequestMapping("/500") + public String ServerError(@RequestParam(required = false) String message, Model model) { + model.addAttribute("message", message); + return "Home/Error/500"; + } + + +} + + + + diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/home/LinkController.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/home/LinkController.java new file mode 100755 index 00000000..f0f07f0f --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/home/LinkController.java @@ -0,0 +1,49 @@ +package com.liuyanzhao.ssm.blog.controller.home; + +import com.liuyanzhao.ssm.blog.entity.Article; +import com.liuyanzhao.ssm.blog.entity.Link; +import com.liuyanzhao.ssm.blog.enums.LinkStatus; +import com.liuyanzhao.ssm.blog.service.ArticleService; +import com.liuyanzhao.ssm.blog.service.LinkService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.util.Date; +import java.util.List; + +/** + * + * @author 言曌 + * @date 2017/9/5 + */ +@Controller +public class LinkController { + @Autowired + private LinkService linkService; + + @Autowired + private ArticleService articleService; + + @RequestMapping("/applyLink") + public String applyLinkView(Model model) { + //侧边栏显示 + //获得热评文章 + List
mostCommentArticleList = articleService.listArticleByCommentCount(8); + model.addAttribute("mostCommentArticleList", mostCommentArticleList); + return "Home/Page/applyLink"; + } + + + @RequestMapping(value = "/applyLinkSubmit",method = {RequestMethod.POST}, produces = {"text/plain;charset=UTF-8"}) + @ResponseBody + public void applyLinkSubmit(Link link) { + link.setLinkStatus(LinkStatus.HIDDEN.getValue()); + link.setLinkCreateTime(new Date()); + link.setLinkUpdateTime(new Date()); + linkService.insertLink(link); + } +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/home/NoticeController.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/home/NoticeController.java new file mode 100755 index 00000000..1d8e64b0 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/home/NoticeController.java @@ -0,0 +1,46 @@ +package com.liuyanzhao.ssm.blog.controller.home; + +import com.liuyanzhao.ssm.blog.entity.Article; +import com.liuyanzhao.ssm.blog.entity.Notice; +import com.liuyanzhao.ssm.blog.service.ArticleService; +import com.liuyanzhao.ssm.blog.service.NoticeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; + +import java.util.List; + +/** + * @author liuyanzhao + */ +@Controller +public class NoticeController { + + @Autowired + private NoticeService noticeService; + + @Autowired + private ArticleService articleService; + + /** + * 公告详情页显示 + * + * @param noticeId + * @return + */ + @RequestMapping(value = "/notice/{noticeId}") + public String NoticeDetailView(@PathVariable("noticeId") Integer noticeId, + Model model) { + //公告内容和信息显示 + Notice notice = noticeService.getNoticeById(noticeId); + model.addAttribute("notice",notice); + + //侧边栏显示 + //获得热评文章 + List
mostCommentArticleList = articleService.listArticleByCommentCount(8); + model.addAttribute("mostCommentArticleList", mostCommentArticleList); + return "Home/Page/noticeDetail"; + } +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/home/PageController.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/home/PageController.java new file mode 100755 index 00000000..5f4ee195 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/home/PageController.java @@ -0,0 +1,119 @@ +package com.liuyanzhao.ssm.blog.controller.home; + + + + +import com.liuyanzhao.ssm.blog.entity.Article; +import com.liuyanzhao.ssm.blog.entity.Category; +import com.liuyanzhao.ssm.blog.entity.Page; +import com.liuyanzhao.ssm.blog.entity.Tag; +import com.liuyanzhao.ssm.blog.service.ArticleService; +import com.liuyanzhao.ssm.blog.service.CategoryService; +import com.liuyanzhao.ssm.blog.service.PageService; +import com.liuyanzhao.ssm.blog.service.TagService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; + +import java.util.List; + +/** + * @author 言曌 + * @date 2017/9/7 + */ +@Controller +public class PageController { + + @Autowired + private PageService pageService; + + @Autowired + private ArticleService articleService; + + @Autowired + private CategoryService categoryService; + + + @Autowired + private TagService tagService; + + /** + * 页面详情页面 + * + * @param key + * @return + */ + @RequestMapping(value = "/{key}") + public String pageDetail(@PathVariable("key") String key, Model model) { + Page page = pageService.getPageByKey(1, key); + if (page == null) { + return "redirect:/404"; + } + model.addAttribute("page", page); + + //侧边栏显示 + //获得热评文章 + List
mostCommentArticleList = articleService.listArticleByCommentCount(8); + model.addAttribute("mostCommentArticleList", mostCommentArticleList); + return "Home/Page/page"; + + } + + + /** + * 文章归档页面显示 + * + * @return + */ + @RequestMapping(value = "/articleFile") + public String articleFile(Model model) { + List
articleList = articleService.listAllNotWithContent(); + model.addAttribute("articleList", articleList); + //侧边栏显示 + //获得热评文章 + List
mostCommentArticleList = articleService.listArticleByCommentCount(10); + model.addAttribute("mostCommentArticleList", mostCommentArticleList); + return "Home/Page/articleFile"; + } + + /** + * 站点地图显示 + * + * @return + */ + @RequestMapping(value = "/map") + public String siteMap(Model model) { + //文章显示 + List
articleList = articleService.listAllNotWithContent(); + model.addAttribute("articleList", articleList); + //分类显示 + List categoryList = categoryService.listCategory(); + model.addAttribute("categoryList", categoryList); + //标签显示 + List tagList = tagService.listTag(); + model.addAttribute("tagList", tagList); + + //侧边栏显示 + //获得热评文章 + List
mostCommentArticleList = articleService.listArticleByCommentCount(10); + model.addAttribute("mostCommentArticleList", mostCommentArticleList); + return "Home/Page/siteMap"; + } + + /** + * 留言板 + * + * @return + */ + @RequestMapping(value = "/message") + public String message(Model model) { + + //侧边栏显示 + //获得热评文章 + List
mostCommentArticleList = articleService.listArticleByCommentCount(8); + model.addAttribute("mostCommentArticleList", mostCommentArticleList); + return "Home/Page/message"; + } +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/home/TagController.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/home/TagController.java new file mode 100755 index 00000000..cfa3c3c4 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/controller/home/TagController.java @@ -0,0 +1,72 @@ +package com.liuyanzhao.ssm.blog.controller.home; + +import com.github.pagehelper.PageInfo; +import com.liuyanzhao.ssm.blog.entity.Article; +import com.liuyanzhao.ssm.blog.entity.Tag; +import com.liuyanzhao.ssm.blog.enums.ArticleStatus; + + +import com.liuyanzhao.ssm.blog.service.ArticleService; +import com.liuyanzhao.ssm.blog.service.TagService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; +import java.util.List; + +/** + * @author 言曌 + * @date 2017/9/2 + */ +@Controller +public class TagController { + + @Autowired + private TagService tagService; + + @Autowired + private ArticleService articleService; + + /** + * 根据标签查询文章 + * + * @param tagId 标签ID + * @return 模板 + */ + @RequestMapping("/tag/{tagId}") + public String getArticleListByTag(@PathVariable("tagId") Integer tagId, + @RequestParam(required = false, defaultValue = "1") Integer pageIndex, + @RequestParam(required = false, defaultValue = "10") Integer pageSize, + Model model) { + //该标签信息 + Tag tag = tagService.getTagById(tagId); + if (tag == null) { + return "redirect:/404"; + } + model.addAttribute("tag", tag); + + //文章列表 + HashMap criteria = new HashMap<>(2); + criteria.put("tagId", tagId); + criteria.put("status", ArticleStatus.PUBLISH.getValue()); + PageInfo
articlePageInfo = articleService.pageArticle(pageIndex, pageSize, criteria); + model.addAttribute("pageInfo", articlePageInfo); + + //侧边栏 + //标签列表显示 + List allTagList = tagService.listTag(); + model.addAttribute("allTagList", allTagList); + //获得随机文章 + List
randomArticleList = articleService.listRandomArticle(8); + model.addAttribute("randomArticleList", randomArticleList); + //获得热评文章 + List
mostCommentArticleList = articleService.listArticleByCommentCount(8); + model.addAttribute("mostCommentArticleList", mostCommentArticleList); + model.addAttribute("pageUrlPrefix", "/tag/"+tagId+"?pageIndex"); + + return "Home/Page/articleListByTag"; + } + +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/dto/ArticleParam.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/dto/ArticleParam.java new file mode 100644 index 00000000..835e09f9 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/dto/ArticleParam.java @@ -0,0 +1,32 @@ +package com.liuyanzhao.ssm.blog.dto; + +import lombok.Data; + +import java.util.List; + +/** + * @author 言曌 + * @date 2018/11/25 下午3:56 + */ +@Data +public class ArticleParam { + + private Integer articleId; + + private String articleTitle; + + private String articleContent; + + private Integer articleParentCategoryId; + + private Integer articleChildCategoryId; + + private Integer articleOrder; + + private Integer articleStatus; + + private String articleThumbnail; + + private List articleTagIds; + +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/dto/JsonResult.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/dto/JsonResult.java new file mode 100644 index 00000000..fda76faa --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/dto/JsonResult.java @@ -0,0 +1,56 @@ +package com.liuyanzhao.ssm.blog.dto; + +import lombok.Data; + +/** + * @author 言曌 + * @date 2017/11/30 下午7:04 + */ + +@Data +public class JsonResult { + + + /** + * 错误码 + */ + private Integer code; + + /** + * 提示信息 + */ + private String msg; + + /** + * 返回的具体内容 + */ + private T data; + + + public JsonResult(Integer code, String msg, T data) { + this.code = code; + this.msg = msg; + this.data = data; + } + + public JsonResult() { + } + + + public JsonResult fail() { + return new JsonResult(1, "操作失败", null); + } + + public JsonResult fail(String msg) { + return new JsonResult(1, msg, null); + } + + public JsonResult ok() { + return new JsonResult(0, "操作成功", null); + } + + + public JsonResult ok(T data) { + return new JsonResult(0, "操作成功", data); + } +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/dto/ResultVO.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/dto/ResultVO.java new file mode 100644 index 00000000..ce93cb3e --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/dto/ResultVO.java @@ -0,0 +1,37 @@ +package com.liuyanzhao.ssm.blog.dto; + +import lombok.Data; + +/** + * @author 言曌 + * @date 2017/11/30 下午7:04 + */ + +@Data +public class ResultVO { + + /** + * 错误码 + */ + private Integer code; + + /** + * 提示信息 + */ + private String msg; + + /** + * 返回的具体内容 + */ + private T data; + + + public ResultVO(Integer code, String msg, T data) { + this.code = code; + this.msg = msg; + this.data = data; + } + + public ResultVO() { + } +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/dto/UploadFileVO.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/dto/UploadFileVO.java new file mode 100644 index 00000000..b05fabd5 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/dto/UploadFileVO.java @@ -0,0 +1,17 @@ +package com.liuyanzhao.ssm.blog.dto; + +import lombok.Data; + +/** + * @author 言曌 + * @date 2017/11/30 下午7:41 + */ + +@Data +public class UploadFileVO { + + private String src; + + private String title; + +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/entity/Article.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/entity/Article.java new file mode 100644 index 00000000..7b852a30 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/entity/Article.java @@ -0,0 +1,51 @@ +package com.liuyanzhao.ssm.blog.entity; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * @author liuyanzhao + */ +@Data +public class Article implements Serializable{ + + private static final long serialVersionUID = 5207865247400761539L; + + private Integer articleId; + + private Integer articleUserId; + + private String articleTitle; + + private Integer articleViewCount; + + private Integer articleCommentCount; + + private Integer articleLikeCount; + + private Date articleCreateTime; + + private Date articleUpdateTime; + + private Integer articleIsComment; + + private Integer articleStatus; + + private Integer articleOrder; + + private String articleContent; + + private String articleSummary; + + private String articleThumbnail; + + private User user; + + private List tagList; + + private List categoryList; + +} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/entity/ArticleCategoryRef.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/entity/ArticleCategoryRef.java new file mode 100644 index 00000000..04f19c87 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/entity/ArticleCategoryRef.java @@ -0,0 +1,28 @@ +package com.liuyanzhao.ssm.blog.entity; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 文章分类关联表 + * + * @author liuyanzhao + */ +@Data +public class ArticleCategoryRef implements Serializable{ + + private static final long serialVersionUID = -6809206515467725995L; + + private Integer articleId; + + private Integer categoryId; + + public ArticleCategoryRef() { + } + + public ArticleCategoryRef(Integer articleId, Integer categoryId) { + this.articleId = articleId; + this.categoryId = categoryId; + } +} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/entity/ArticleTagRef.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/entity/ArticleTagRef.java new file mode 100644 index 00000000..f775f3ac --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/entity/ArticleTagRef.java @@ -0,0 +1,28 @@ +package com.liuyanzhao.ssm.blog.entity; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 文章和标签关联 + * + * @author 言曌 + * @date 2018/11/17 下午5:20 + */ +@Data +public class ArticleTagRef implements Serializable { + private static final long serialVersionUID = -5816783232020910492L; + + private Integer articleId; + + private Integer tagId; + + public ArticleTagRef() { + } + + public ArticleTagRef(Integer articleId, Integer tagId) { + this.articleId = articleId; + this.tagId = tagId; + } +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/entity/Category.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/entity/Category.java new file mode 100755 index 00000000..904f7676 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/entity/Category.java @@ -0,0 +1,64 @@ +package com.liuyanzhao.ssm.blog.entity; + + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author liuyanzhao + */ +@Data +public class Category implements Serializable { + + private static final long serialVersionUID = 6687286913317513141L; + + private Integer categoryId; + + private Integer categoryPid; + + private String categoryName; + + private String categoryDescription; + + private Integer categoryOrder; + + private String categoryIcon; + + /** + * 文章数量(非数据库字段) + */ + private Integer articleCount; + + public Category(Integer categoryId, Integer categoryPid, String categoryName, String categoryDescription, Integer categoryOrder, String categoryIcon,Integer articleCount) { + this.categoryId = categoryId; + this.categoryPid = categoryPid; + this.categoryName = categoryName; + this.categoryDescription = categoryDescription; + this.categoryOrder = categoryOrder; + this.categoryIcon = categoryIcon; + this.articleCount = articleCount; + } + + public Category(Integer categoryId, String categoryName) { + this.categoryId = categoryId; + this.categoryName = categoryName; + } + + public Category(Integer categoryId) { + this.categoryId = categoryId; + } + + public Category() {} + + /** + * 未分类 + * + * @return 分类 + */ + public static Category Default() { + return new Category(100000000, "未分类"); + } + + +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/entity/Comment.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/entity/Comment.java new file mode 100755 index 00000000..31f17798 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/entity/Comment.java @@ -0,0 +1,55 @@ +package com.liuyanzhao.ssm.blog.entity; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 文章评论 + * + * @author liuyanzhao + */ +@Data +public class Comment implements Serializable { + + private static final long serialVersionUID = -1038897351672911219L; + private Integer commentId; + + private Integer commentPid; + + private String commentPname; + + private Integer commentArticleId; + + private String commentAuthorName; + + private String commentAuthorEmail; + + private String commentAuthorUrl; + + private String commentAuthorAvatar; + + private String commentContent; + + private String commentAgent; + + private String commentIp; + + private Date commentCreateTime; + + /** + * 角色(管理员1,访客0) + */ + private Integer commentRole; + + /** + * 评论用户ID + */ + private Integer commentUserId; + + /** + * 非数据库字段 + */ + private Article article; +} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/entity/Link.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/entity/Link.java new file mode 100755 index 00000000..0af817fa --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/entity/Link.java @@ -0,0 +1,39 @@ +package com.liuyanzhao.ssm.blog.entity; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @author liuyanzhao + */ +@Data +public class Link implements Serializable{ + + + private static final long serialVersionUID = -259829372268790508L; + + private Integer linkId; + + private String linkUrl; + + private String linkName; + + private String linkImage; + + private String linkDescription; + + private String linkOwnerNickname; + + private String linkOwnerContact; + + private Date linkUpdateTime; + + private Date linkCreateTime; + + private Integer linkOrder; + + private Integer linkStatus; + +} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/entity/Menu.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/entity/Menu.java new file mode 100755 index 00000000..228a3667 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/entity/Menu.java @@ -0,0 +1,25 @@ +package com.liuyanzhao.ssm.blog.entity; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author liuyanzhao + */ +@Data +public class Menu implements Serializable { + private static final long serialVersionUID = 489914127235951698L; + private Integer menuId; + + private String menuName; + + private String menuUrl; + + private Integer menuLevel; + + private String menuIcon; + + private Integer menuOrder; + +} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/entity/Notice.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/entity/Notice.java new file mode 100755 index 00000000..7f01130f --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/entity/Notice.java @@ -0,0 +1,28 @@ +package com.liuyanzhao.ssm.blog.entity; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @author liuyanzhao + */ +@Data +public class Notice implements Serializable{ + + private static final long serialVersionUID = -4901560494243593100L; + private Integer noticeId; + + private String noticeTitle; + + private String noticeContent; + + private Date noticeCreateTime; + + private Date noticeUpdateTime; + + private Integer noticeStatus; + + private Integer noticeOrder; +} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/entity/Options.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/entity/Options.java new file mode 100755 index 00000000..ad69ad44 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/entity/Options.java @@ -0,0 +1,41 @@ +package com.liuyanzhao.ssm.blog.entity; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author liuyanzhao + */ +@Data +public class Options implements Serializable{ + private static final long serialVersionUID = -776792869602511933L; + private Integer optionId; + + private String optionSiteTitle; + + private String optionSiteDescrption; + + private String optionMetaDescrption; + + private String optionMetaKeyword; + + private String optionAboutsiteAvatar; + + private String optionAboutsiteTitle; + + private String optionAboutsiteContent; + + private String optionAboutsiteWechat; + + private String optionAboutsiteQq; + + private String optionAboutsiteGithub; + + private String optionAboutsiteWeibo; + + private String optionTongji; + + private Integer optionStatus; + +} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/entity/Page.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/entity/Page.java new file mode 100755 index 00000000..16ddd383 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/entity/Page.java @@ -0,0 +1,33 @@ +package com.liuyanzhao.ssm.blog.entity; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @author liuyanzhao + */ +@Data +public class Page implements Serializable{ + + private static final long serialVersionUID = 3927496662110298634L; + private Integer pageId; + + private String pageKey; + + private String pageTitle; + + private String pageContent; + + private Date pageCreateTime; + + private Date pageUpdateTime; + + private Integer pageViewCount; + + private Integer pageCommentCount; + + private Integer pageStatus; + +} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/entity/Tag.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/entity/Tag.java new file mode 100755 index 00000000..10aa8bae --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/entity/Tag.java @@ -0,0 +1,37 @@ +package com.liuyanzhao.ssm.blog.entity; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author liuyanzhao + */ +@Data +public class Tag implements Serializable{ + private static final long serialVersionUID = 605449151900057035L; + private Integer tagId; + + private String tagName; + + private String tagDescription; + + /** + * 文章数量(不是数据库字段) + */ + private Integer articleCount; + + public Tag() { + } + + public Tag(Integer tagId) { + this.tagId = tagId; + } + + public Tag(Integer tagId, String tagName, String tagDescription, Integer articleCount) { + this.tagId = tagId; + this.tagName = tagName; + this.tagDescription = tagDescription; + this.articleCount = articleCount; + } +} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/entity/User.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/entity/User.java new file mode 100755 index 00000000..326ef3c4 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/entity/User.java @@ -0,0 +1,46 @@ +package com.liuyanzhao.ssm.blog.entity; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @author liuyanzhao + */ +@Data +public class User implements Serializable{ + private static final long serialVersionUID = -4415517704211731385L; + private Integer userId; + + private String userName; + + private String userPass; + + private String userNickname; + + private String userEmail; + + private String userUrl; + + private String userAvatar; + + private String userLastLoginIp; + + private Date userRegisterTime; + + private Date userLastLoginTime; + + private Integer userStatus; + + /** + * 用户角色:admin/user + */ + private String userRole; + + /** + * 文章数量(不是数据库字段) + */ + private Integer articleCount; + +} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/enums/ArticleCommentStatus.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/enums/ArticleCommentStatus.java new file mode 100644 index 00000000..0c0718bd --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/enums/ArticleCommentStatus.java @@ -0,0 +1,37 @@ +package com.liuyanzhao.ssm.blog.enums; + +/** + * @author 言曌 + * @date 2018/11/17 下午4:47 + */ + +public enum ArticleCommentStatus { + + ALLOW(1, "允许"), + NOT_ALLOW(0, "不允许"); + + private Integer value; + + private String message; + + ArticleCommentStatus(Integer value, String message) { + this.value = value; + this.message = message; + } + + public Integer getValue() { + return value; + } + + public void setValue(Integer value) { + this.value = value; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/enums/ArticleStatus.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/enums/ArticleStatus.java new file mode 100644 index 00000000..2e792c5f --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/enums/ArticleStatus.java @@ -0,0 +1,37 @@ +package com.liuyanzhao.ssm.blog.enums; + +/** + * @author 言曌 + * @date 2018/11/17 下午4:47 + */ + +public enum ArticleStatus { + + PUBLISH(1, "已发布"), + DRAFT(0, "草稿"); + + private Integer value; + + private String message; + + ArticleStatus(Integer value, String message) { + this.value = value; + this.message = message; + } + + public Integer getValue() { + return value; + } + + public void setValue(Integer value) { + this.value = value; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/enums/CategoryStatus.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/enums/CategoryStatus.java new file mode 100644 index 00000000..10321901 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/enums/CategoryStatus.java @@ -0,0 +1,39 @@ +package com.liuyanzhao.ssm.blog.enums; + +import lombok.Data; + +/** + * @author 言曌 + * @date 2018/11/17 下午4:47 + */ + +public enum CategoryStatus { + + NORMAL(1, "正常"), + HIDDEN(0, "隐藏"); + + private Integer value; + + private String message; + + CategoryStatus(Integer value, String message) { + this.value = value; + this.message = message; + } + + public Integer getValue() { + return value; + } + + public void setValue(Integer value) { + this.value = value; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/enums/LinkStatus.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/enums/LinkStatus.java new file mode 100644 index 00000000..f73f5b44 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/enums/LinkStatus.java @@ -0,0 +1,37 @@ +package com.liuyanzhao.ssm.blog.enums; + +/** + * @author 言曌 + * @date 2018/11/17 下午4:47 + */ + +public enum LinkStatus { + + NORMAL(1, "显示"), + HIDDEN(0, "隐藏"); + + private Integer value; + + private String message; + + LinkStatus(Integer value, String message) { + this.value = value; + this.message = message; + } + + public Integer getValue() { + return value; + } + + public void setValue(Integer value) { + this.value = value; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/enums/MenuLevel.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/enums/MenuLevel.java new file mode 100644 index 00000000..f21f2c72 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/enums/MenuLevel.java @@ -0,0 +1,37 @@ +package com.liuyanzhao.ssm.blog.enums; + +/** + * @author 言曌 + * @date 2018/11/17 下午4:47 + */ + +public enum MenuLevel { + + TOP_MENU(1, "顶部菜单"), + MAIN_MENU(2, "主体菜单"); + + private Integer value; + + private String message; + + MenuLevel(Integer value, String message) { + this.value = value; + this.message = message; + } + + public Integer getValue() { + return value; + } + + public void setValue(Integer value) { + this.value = value; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/enums/NoticeStatus.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/enums/NoticeStatus.java new file mode 100644 index 00000000..fb1e694c --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/enums/NoticeStatus.java @@ -0,0 +1,37 @@ +package com.liuyanzhao.ssm.blog.enums; + +/** + * @author 言曌 + * @date 2018/11/17 下午4:47 + */ + +public enum NoticeStatus { + + NORMAL(1, "显示"), + HIDDEN(0, "隐藏"); + + private Integer value; + + private String message; + + NoticeStatus(Integer value, String message) { + this.value = value; + this.message = message; + } + + public Integer getValue() { + return value; + } + + public void setValue(Integer value) { + this.value = value; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/enums/PageStatus.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/enums/PageStatus.java new file mode 100644 index 00000000..fb2c98fc --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/enums/PageStatus.java @@ -0,0 +1,37 @@ +package com.liuyanzhao.ssm.blog.enums; + +/** + * @author 言曌 + * @date 2018/11/17 下午4:47 + */ + +public enum PageStatus { + + NORMAL(1, "显示"), + HIDDEN(0, "隐藏"); + + private Integer value; + + private String message; + + PageStatus(Integer value, String message) { + this.value = value; + this.message = message; + } + + public Integer getValue() { + return value; + } + + public void setValue(Integer value) { + this.value = value; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/enums/Role.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/enums/Role.java new file mode 100644 index 00000000..a95b01ff --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/enums/Role.java @@ -0,0 +1,37 @@ +package com.liuyanzhao.ssm.blog.enums; + +/** + * @author 言曌 + * @date 2018/11/17 下午4:47 + */ + +public enum Role { + + OWNER(1, "博主"), + VISITOR(0, "其他用户"); + + private Integer value; + + private String message; + + Role(Integer value, String message) { + this.value = value; + this.message = message; + } + + public Integer getValue() { + return value; + } + + public void setValue(Integer value) { + this.value = value; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/enums/UserRole.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/enums/UserRole.java new file mode 100644 index 00000000..3de0d5a0 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/enums/UserRole.java @@ -0,0 +1,40 @@ +package com.liuyanzhao.ssm.blog.enums; + +/** + * 角色枚举 + * + * @author 言曌 + * @date 2021/2/25 2:31 下午 + */ + +public enum UserRole { + + ADMIN("admin", "管理员"), + + USER("user", "用户"); + + private String value; + + private String message; + + UserRole(String value, String message) { + this.value = value; + this.message = message; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/interceptor/AdminInterceptor.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/interceptor/AdminInterceptor.java new file mode 100755 index 00000000..7c151209 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/interceptor/AdminInterceptor.java @@ -0,0 +1,45 @@ +package com.liuyanzhao.ssm.blog.interceptor; + +import com.liuyanzhao.ssm.blog.entity.User; +import com.liuyanzhao.ssm.blog.enums.UserRole; +import org.springframework.stereotype.Component; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Objects; + + +/** + * @author liuyanzhao + */ +@Component +public class AdminInterceptor extends HandlerInterceptorAdapter { + + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object o) throws IOException { + //这里可以根据session的用户来判断角色的权限,根据权限来转发不同的页面 + User user = (User) request.getSession().getAttribute("user"); + if (user == null) { + response.sendRedirect("/login"); + return false; + } + if (!Objects.equals(user.getUserRole(), UserRole.ADMIN.getValue())) { + return false; + } + return true; + } + + @Override + public void postHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, ModelAndView modelAndView) { + + } + + @Override + public void afterCompletion(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) { + + } +} + diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/interceptor/HomeResourceInterceptor.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/interceptor/HomeResourceInterceptor.java new file mode 100755 index 00000000..992c1bdd --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/interceptor/HomeResourceInterceptor.java @@ -0,0 +1,87 @@ +package com.liuyanzhao.ssm.blog.interceptor; + +import com.liuyanzhao.ssm.blog.entity.Article; +import com.liuyanzhao.ssm.blog.entity.Options; + +import com.liuyanzhao.ssm.blog.enums.ArticleStatus; +import com.liuyanzhao.ssm.blog.enums.LinkStatus; + +import com.liuyanzhao.ssm.blog.entity.Category; +import com.liuyanzhao.ssm.blog.entity.Menu; +import com.liuyanzhao.ssm.blog.service.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.web.servlet.HandlerInterceptor; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +/** + * @author liuyanzhao + */ +@Component +public class HomeResourceInterceptor implements HandlerInterceptor { + @Autowired + private ArticleService articleService; + + @Autowired + private CategoryService categoryService; + + @Autowired + private TagService tagService; + + @Autowired + private LinkService linkService; + + @Autowired + private OptionsService optionsService; + + @Autowired + private MenuService menuService; + + /** + * 在请求处理之前执行,该方法主要是用于准备资源数据的,然后可以把它们当做请求属性放到WebRequest中 + */ + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object o) throws IOException { + + // 菜单显示 + List menuList = menuService.listMenu(); + request.setAttribute("menuList", menuList); + + List categoryList = categoryService.listCategory(); + request.setAttribute("allCategoryList", categoryList); + + //获得网站概况 + List siteBasicStatistics = new ArrayList(); + siteBasicStatistics.add(articleService.countArticle(ArticleStatus.PUBLISH.getValue()) + ""); + siteBasicStatistics.add(articleService.countArticleComment() + ""); + siteBasicStatistics.add(categoryService.countCategory() + ""); + siteBasicStatistics.add(tagService.countTag() + ""); + siteBasicStatistics.add(linkService.countLink(LinkStatus.NORMAL.getValue()) + ""); + siteBasicStatistics.add(articleService.countArticleView() + ""); + request.setAttribute("siteBasicStatistics", siteBasicStatistics); + //最后更新的文章 + Article lastUpdateArticle = articleService.getLastUpdateArticle(); + request.setAttribute("lastUpdateArticle", lastUpdateArticle); + + //页脚显示 + //博客基本信息显示(Options) + Options options = optionsService.getOptions(); + request.setAttribute("options", options); + return true; + } + + @Override + public void postHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, ModelAndView modelAndView) { + } + + @Override + public void afterCompletion(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) { + + } +} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/blog/Interceptor/SecurityInterceptor.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/interceptor/LoginInterceptor.java similarity index 67% rename from ForestBlog/src/main/java/com/liuyanzhao/blog/Interceptor/SecurityInterceptor.java rename to ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/interceptor/LoginInterceptor.java index 31188633..1201d869 100755 --- a/ForestBlog/src/main/java/com/liuyanzhao/blog/Interceptor/SecurityInterceptor.java +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/interceptor/LoginInterceptor.java @@ -1,32 +1,38 @@ -package com.liuyanzhao.blog.Interceptor; +package com.liuyanzhao.ssm.blog.interceptor; -import org.springframework.web.servlet.HandlerInterceptor; +import org.springframework.stereotype.Component; import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.io.IOException; -public class SecurityInterceptor implements HandlerInterceptor { +/** + * @author liuyanzhao + */ +@Component +public class LoginInterceptor extends HandlerInterceptorAdapter { @Override - public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object o) throws Exception { - System.out.println("SecurityInterceptor...preHandle..."); + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object o) throws IOException { //这里可以根据session的用户来判断角色的权限,根据权限来转发不同的页面 if(request.getSession().getAttribute("user") == null) { response.sendRedirect("/login"); return false; } + return true; } @Override - public void postHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, ModelAndView modelAndView) throws Exception { + public void postHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, ModelAndView modelAndView) { } @Override - public void afterCompletion(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) throws Exception { + public void afterCompletion(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) { } } diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/mapper/ArticleCategoryRefMapper.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/mapper/ArticleCategoryRefMapper.java new file mode 100644 index 00000000..1fe83790 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/mapper/ArticleCategoryRefMapper.java @@ -0,0 +1,70 @@ +package com.liuyanzhao.ssm.blog.mapper; + + +import com.liuyanzhao.ssm.blog.entity.ArticleCategoryRef; +import com.liuyanzhao.ssm.blog.entity.Category; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 文章分类关联表Mapper + * @author liuyanzhao + */ +@Mapper +public interface ArticleCategoryRefMapper { + + /** + * 添加文章和分类关联记录 + * @param record 关联对象 + * @return 影响行数 + */ + int insert(ArticleCategoryRef record); + + /** + * 根据分类ID删除记录 + * @param categoryId 分类ID + * @return 影响行数 + */ + int deleteByCategoryId(Integer categoryId); + + /** + * 根据文章ID删除记录 + * @param articleId 文章ID + * @return 影响行数 + */ + int deleteByArticleId(Integer articleId); + + /** + * 根据分类ID统计文章数 + * @param categoryId 分类ID + * @return 文章数量 + */ + int countArticleByCategoryId(Integer categoryId); + + + /** + * 根据文章ID查询分类ID + * + * @param articleId 文章ID + * @return 分类ID列表 + */ + List selectCategoryIdByArticleId(Integer articleId); + + /** + * 根据分类ID查询文章ID + * + * @param categoryId 分类ID + * @return 文章ID列表 + */ + List selectArticleIdByCategoryId(Integer categoryId); + + /** + * 根据文章ID获得分类列表 + * + * @param articleId 文章ID + * @return 分类列表 + */ + List listCategoryByArticleId(Integer articleId); + +} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/mapper/ArticleMapper.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/mapper/ArticleMapper.java new file mode 100644 index 00000000..c6930dae --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/mapper/ArticleMapper.java @@ -0,0 +1,223 @@ +package com.liuyanzhao.ssm.blog.mapper; + +import com.liuyanzhao.ssm.blog.entity.Article; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.HashMap; +import java.util.List; + +/** + * 文章Mapper + * + * @author liuyanzhao + */ +@Mapper +public interface ArticleMapper { + + /** + * 根据ID删除 + * + * @param articleId 文章ID + * @return 影响函数 + */ + Integer deleteById(Integer articleId); + + /** + * 根据用户ID删除 + * + * @param userId 用户ID + * @return 影响函数 + */ + Integer deleteByUserId(Integer userId); + + /** + * 添加文章 + * + * @param article 文章 + * @return 文章 + */ + Integer insert(Article article); + + /** + * 更新文章 + * + * @param article 文章 + * @return 影响行数 + */ + Integer update(Article article); + + /** + * 获得所有的文章 + * + * @param criteria 查询条件 + * @return 文章列表 + */ + List
findAll(HashMap criteria); + + /** + * 文章归档 + * + * @return + */ + List
listAllNotWithContent(); + + /** + * 获取文章总数 + * + * @param status 状态 + * @return 数量 + */ + Integer countArticle(@Param(value = "status") Integer status); + + /** + * 获得留言总数 + * + * @return 数量 + */ + Integer countArticleComment(); + + /** + * 获得浏览量总数 + * + * @return 文章数量 + */ + Integer countArticleView(); + + /** + * 获得所有文章(文章归档) + * + * @return 文章列表 + */ + List
listArticle(); + + /** + * 根据id查询用户信息 + * + * @param status 状态 + * @param id 文章ID + * @return 文章 + */ + Article getArticleByStatusAndId(@Param(value = "status") Integer status, @Param(value = "id") Integer id); + + /** + * 分页操作 + * + * @param status 状态 + * @param pageIndex 从第几页开始 + * @param pageSize 数量 + * @return 文章列表 + */ + @Deprecated + List
pageArticle(@Param(value = "status") Integer status, + @Param(value = "pageIndex") Integer pageIndex, + @Param(value = "pageSize") Integer pageSize); + + + /** + * 获得访问最多的文章(猜你喜欢) + * + * @param limit 查询数量 + * @return 文章列表 + */ + List
listArticleByViewCount(@Param(value = "limit") Integer limit); + + /** + * 获得上一篇文章 + * + * @param id 文章ID + * @return 文章 + */ + Article getAfterArticle(@Param(value = "id") Integer id); + + /** + * 获得下一篇文章 + * + * @param id 文章ID + * @return 文章 + */ + Article getPreArticle(@Param(value = "id") Integer id); + + /** + * 获得随机文章 + * + * @param limit 查询数量 + * @return 文章列表 + */ + List
listRandomArticle(@Param(value = "limit") Integer limit); + + /** + * 热评文章 + * + * @param limit 查询数量 + * @return 文章列表 + */ + List
listArticleByCommentCount(@Param(value = "limit") Integer limit); + + + /** + * 更新文章的评论数 + * + * @param articleId 文章ID + */ + void updateCommentCount(@Param(value = "articleId") Integer articleId); + + /** + * 获得最后更新的记录 + * + * @return 文章 + */ + Article getLastUpdateArticle(); + + /** + * 用户的文章数 + * + * @param id 用户ID + * @return 数量 + */ + Integer countArticleByUser(@Param(value = "id") Integer id); + + /** + * 根据分类ID + * + * @param categoryId 分类ID + * @param limit 查询数量 + * @return 文章列表 + */ + List
findArticleByCategoryId(@Param("categoryId") Integer categoryId, + @Param("limit") Integer limit); + + /** + * 根据分类ID + * + * @param categoryIds 分类ID集合 + * @param limit 查询数量 + * @return 文章列表 + */ + List
findArticleByCategoryIds(@Param("categoryIds") List categoryIds, + @Param("limit") Integer limit); + + /** + * 获得最新文章 + * + * @param limit 查询数量 + * @return 列表 + */ + List
listArticleByLimit(@Param("userId") Integer userId, @Param("limit") Integer limit); + + /** + * 批量删除文章 + * + * @param ids 文章Id列表 + * @return 影响行数 + */ + Integer deleteBatch(@Param("ids") List ids); + + /** + * 获得一个用户的文章id集合 + * + * @param userId + * @return + */ + List listArticleIdsByUserId(Integer userId); +} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/mapper/ArticleTagRefMapper.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/mapper/ArticleTagRefMapper.java new file mode 100644 index 00000000..6738b205 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/mapper/ArticleTagRefMapper.java @@ -0,0 +1,54 @@ +package com.liuyanzhao.ssm.blog.mapper; + + +import com.liuyanzhao.ssm.blog.entity.ArticleTagRef; +import com.liuyanzhao.ssm.blog.entity.Tag; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 文章标签关联表Mapper + * @author liuyanzhao + */ +@Mapper +public interface ArticleTagRefMapper { + + /** + * 添加文章和标签关联记录 + * @param record 关联对象 + * @return 影响行数 + */ + int insert(ArticleTagRef record); + + /** + * 根据标签ID删除记录 + * @param tagId 标签ID + * @return 影响行数 + */ + int deleteByTagId(Integer tagId); + + /** + * 根据文章ID删除记录 + * @param articleId 文章ID + * @return 影响行数 + */ + int deleteByArticleId(Integer articleId); + + /** + * 根据标签ID统计文章数 + * @param tagId 标签ID + * @return 文章数量 + */ + int countArticleByTagId(Integer tagId); + + /** + * 根据文章获得标签列表 + * + * @param articleId 文章ID + * @return 标签列表 + */ + List listTagByArticleId(Integer articleId); + + +} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/mapper/CategoryMapper.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/mapper/CategoryMapper.java new file mode 100755 index 00000000..e3f5b155 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/mapper/CategoryMapper.java @@ -0,0 +1,79 @@ +package com.liuyanzhao.ssm.blog.mapper; + +import com.liuyanzhao.ssm.blog.entity.Category; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + + +import java.util.List; + +/** + * @author liuyanzhao + */ +@Mapper +public interface CategoryMapper { + + + /** + * 添加 + * + * @param category 分类 + * @return 影响行数 + */ + int insert(Category category); + + + /** + * 更新 + * + * @param category 分类 + * @return 影响行数 + */ + int update(Category category); + + /** + * 根据分类id获得分类信息 + * + * @param id ID + * @return 分类 + */ + Category getCategoryById(Integer id); + + + /** + * 删除分类 + * + * @param id 文章ID + */ + int deleteCategory(Integer id); + + /** + * 查询分类总数 + * + * @return 数量 + */ + Integer countCategory(); + + /** + * 获得分类列表 + * + * @return 列表 + */ + List listCategory(); + + /** + * 根据父分类找子分类 + * + * @param id 分类ID + * @return 列表 + */ + List findChildCategory(@Param(value = "id") Integer id); + + /** + * 根据标签名获取标签 + * + * @param name 名称 + * @return 分类 + */ + Category getCategoryByName(String name); +} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/mapper/CommentMapper.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/mapper/CommentMapper.java new file mode 100755 index 00000000..e8976b35 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/mapper/CommentMapper.java @@ -0,0 +1,111 @@ +package com.liuyanzhao.ssm.blog.mapper; + +import com.liuyanzhao.ssm.blog.entity.Comment; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.HashMap; +import java.util.List; + +@Mapper +public interface CommentMapper { + + /** + * 根据ID删除 + * + * @param commentId 评论ID + * @return 影响行数 + */ + int deleteById(Integer commentId); + + /** + * 添加 + * + * @param comment 评论 + * @return 影响行数 + */ + int insert(Comment comment); + + /** + * 根据ID查询 + * + * @param commentId 评论ID + * @return 评论 + */ + Comment getCommentById(Integer commentId); + + /** + * 更新 + * + * @param comment 评论 + * @return 影响行数 + */ + int update(Comment comment); + + /** + * 根据文章id获取评论列表 + * + * @param id ID + * @return 列表 + */ + List listCommentByArticleId(@Param(value = "id") Integer id); + + + /** + * 获得评论列表 + * + * @return 列表 + */ + List listComment(HashMap criteria); + + + /** + * 获得某个用户收到的评论 + * + * @return 列表 + */ + List getReceiveComment(List articleIds); + + + /** + * 统计评论数 + * + * @return 数量 + */ + Integer countComment(); + + /** + * 获得最近评论 + * + * @param limit 查询数量 + * @return 列表 + */ + List listRecentComment(@Param(value = "userId") Integer userId, + @Param(value = "limit") Integer limit); + + /** + * 获得评论的子评论 + * + * @param id 评论ID + * @return 列表 + */ + List listChildComment(@Param(value = "id") Integer id); + + + /** + * 根据用户ID删除 + * + * @param userId 用户ID + * @return 影响函数 + */ + Integer deleteByUserId(Integer userId); + + + /** + * 根据文章ID删除 + * + * @param articleId 文章ID + * @return 影响函数 + */ + Integer deleteByArticleId(Integer articleId); +} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/mapper/LinkMapper.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/mapper/LinkMapper.java new file mode 100755 index 00000000..dba04b8b --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/mapper/LinkMapper.java @@ -0,0 +1,61 @@ +package com.liuyanzhao.ssm.blog.mapper; + +import com.liuyanzhao.ssm.blog.entity.Link; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @author liuyanzhao + */ +@Mapper +public interface LinkMapper { + + /** + * 删除 + * @param linkId 链接ID + * @return 影响行数 + */ + int deleteById(Integer linkId); + + /** + * 添加 + * + * @param link 链接 + * @return 影响行数 + */ + int insert(Link link); + + /** + * 根据ID查询 + * + * @param linkId 链接ID + * @return 影响行数 + */ + Link getLinkById(Integer linkId); + + /** + * 更新 + * + * @param link 链接ID + * @return 影响行数 + */ + int update(Link link); + + /** + * 获得链接总数 + * + * @param status 状态 + * @return 数量 + */ + Integer countLink(@Param(value = "status") Integer status); + + /** + * 获得链接列表 + * + * @param status 状态 + * @return 列表 + */ + List listLink(@Param(value = "status") Integer status); +} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/mapper/MenuMapper.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/mapper/MenuMapper.java new file mode 100755 index 00000000..d39a48ac --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/mapper/MenuMapper.java @@ -0,0 +1,49 @@ +package com.liuyanzhao.ssm.blog.mapper; + +import com.liuyanzhao.ssm.blog.entity.Menu; + +import java.util.List; + +/** + * @author liuyanzhao + */ +public interface MenuMapper { + + /** + * 删除 + * + * @param menuId 菜单ID + * @return 影响行数 + */ + int deleteById(Integer menuId); + + /** + * 添加 + * @param menu 菜单 + * @return 影响行数 + */ + int insert(Menu menu); + + /** + * 根据ID查询 + * + * @param menuId 菜单ID + * @return 菜单 + */ + Menu getMenuById(Integer menuId); + + /** + * 更新 + * + * @param menu 菜单 + * @return 影响行数 + */ + int update(Menu menu); + + /** + * 获得菜单列表 + * + * @return 列表 + */ + List listMenu() ; +} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/mapper/NoticeMapper.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/mapper/NoticeMapper.java new file mode 100755 index 00000000..e50d80b2 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/mapper/NoticeMapper.java @@ -0,0 +1,70 @@ +package com.liuyanzhao.ssm.blog.mapper; + +import com.liuyanzhao.ssm.blog.entity.Notice; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @author liuyanzhao + */ +@Mapper +public interface NoticeMapper { + + /** + * 根据ID删除 + * + * @param noticeId 公告ID + * @return 影响行数 + */ + int deleteById(Integer noticeId); + + /** + * 添加 + * + * @param notice 公告 + * @return 影响行数 + */ + int insert(Notice notice); + + /** + * 根据ID查询 + * + * @param noticeId 公告ID + * @return 公告 + */ + Notice getNoticeById(Integer noticeId); + + /** + * 获得公告列表 + * + * @param notice 公告 + * @return 影响行数 + */ + int update(Notice notice); + + /** + * 获得公告列表 + * + * @param notice 公告 + * @return 影响行数 + */ + int updateByPrimaryKey(Notice notice); + + /** + * 获得公告总数 + * + * @param status 状态 + * @return 影响行数 + */ + Integer countNotice(@Param(value = "status") Integer status); + + /** + * 获得公告列表 + * + * @param status 状态 + * @return 公告列表 + */ + List listNotice(@Param(value = "status") Integer status); +} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/mapper/OptionsMapper.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/mapper/OptionsMapper.java new file mode 100755 index 00000000..dbbaf4d9 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/mapper/OptionsMapper.java @@ -0,0 +1,48 @@ +package com.liuyanzhao.ssm.blog.mapper; + +import com.liuyanzhao.ssm.blog.entity.Options; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author liuyanzhao + */ +@Mapper +public interface OptionsMapper { + + /** + * 根据ID删除 + * @param optionId 系统设置ID + * @return 影响行数 + */ + int deleteById(Integer optionId); + + /** + * 添加 + * @param options 系统设置 + * @return 影响行数 + */ + int insert(Options options); + + /** + * 根据ID查询 + * + * @param optionId 系统设置ID + * @return 系统设置 + */ + Options getOptionsById(Integer optionId); + + /** + * 更新 + * + * @param options 系统信息 + * @return 影响行数 + */ + int update(Options options); + + /** + * 获得记录 + * + * @return 系统信息 + */ + Options getOptions(); +} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/mapper/PageMapper.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/mapper/PageMapper.java new file mode 100755 index 00000000..58c6ba24 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/mapper/PageMapper.java @@ -0,0 +1,63 @@ +package com.liuyanzhao.ssm.blog.mapper; + +import com.liuyanzhao.ssm.blog.entity.Page; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @author liuyanzhao + */ +@Mapper +public interface PageMapper { + /** + * 根据ID删除 + * + * @param pageId 页面ID + * @return 影响行数 + */ + int deleteById(Integer pageId); + + /** + * 添加 + * + * @param page 页面 + * @return 影响行数 + */ + int insert(Page page); + + /** + * 根据ID查询 + * + * @param pageId 页面ID + * @return 页面 + */ + Page getPageById(Integer pageId); + + /** + * 更新 + * + * @param page 页面 + * @return 影响行数 + */ + int update(Page page); + + /** + * 获得页面列表 + * + * @param status 状态 + * @return 页面列表 + */ + List listPage(@Param(value = "status") Integer status); + + /** + * 根据key获得页面 + * + * @param status 状态 + * @param key 别名 + * @return 页面 + */ + Page getPageByKey(@Param(value = "status") Integer status, + @Param(value = "key") String key); +} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/mapper/TagMapper.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/mapper/TagMapper.java new file mode 100755 index 00000000..8de7f08d --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/mapper/TagMapper.java @@ -0,0 +1,67 @@ +package com.liuyanzhao.ssm.blog.mapper; + +import com.liuyanzhao.ssm.blog.entity.Tag; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * @author liuyanzhao + */ +@Mapper +public interface TagMapper { + + /** + * 根据ID删除 + * + * @param tagId 标签ID + * @return 影响行数 + */ + int deleteById(Integer tagId); + + /** + * 添加 + * + * @param tag 标签 + * @return 影响行数 + */ + int insert(Tag tag); + + /** + * 根据ID查询 + * + * @param tagId 标签ID + * @return 标签 + */ + Tag getTagById(Integer tagId); + + /** + * 更新 + * @param tag 标签 + * @return 影响行数 + */ + int update(Tag tag); + + /** + * 获得标签总数 + * + * @return 数量 + */ + Integer countTag() ; + + /** + * 获得标签列表 + * + * @return 列表 + */ + List listTag() ; + + + /** + * 根据标签名获取标签 + * + * @param name 名称 + * @return 标签 + */ + Tag getTagByName(String name) ; +} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/mapper/UserMapper.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/mapper/UserMapper.java new file mode 100755 index 00000000..8adbc49a --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/mapper/UserMapper.java @@ -0,0 +1,79 @@ +package com.liuyanzhao.ssm.blog.mapper; + +import com.liuyanzhao.ssm.blog.entity.User; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * @author liuyanzhao + */ +@Mapper +public interface UserMapper { + + /** + * 根据ID删除 + * + * @param userId 用户ID + * @return 影响行数 + */ + int deleteById(Integer userId); + + /** + * 添加 + * + * @param user 用户 + * @return 影响行数 + */ + int insert(User user); + + /** + * 根据ID查询 + * + * @param userId 用户ID + * @return 用户 + */ + User getUserById(Integer userId); + + /** + * 更新 + * + * @param user 用户 + * @return 影响行数 + */ + int update(User user); + + + /** + * 获得用户列表 + * + * @return 用户列表 + */ + List listUser() ; + + + /** + * 根据用户名或Email获得用户 + * + * @param str 用户名或Email + * @return 用户 + */ + User getUserByNameOrEmail(String str) ; + + /** + * 根据用户名查用户 + * + * @param name 用户名 + * @return 用户 + */ + User getUserByName(String name) ; + + /** + * 根据Email查询用户 + * + * @param email 邮箱 + * @return 用户 + */ + User getUserByEmail(String email) ; + +} \ No newline at end of file diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/ArticleService.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/ArticleService.java new file mode 100755 index 00000000..f489bdce --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/ArticleService.java @@ -0,0 +1,217 @@ +package com.liuyanzhao.ssm.blog.service; + +import com.github.pagehelper.PageInfo; +import com.liuyanzhao.ssm.blog.entity.Article; + +import java.util.HashMap; +import java.util.List; + +/** + * 文章Service + * + * @author 言曌 + * @date 2017/8/24 + */ +public interface ArticleService { + + /** + * 获取文章总数 + * + * @param status 状态 + * @return 数量 + */ + Integer countArticle(Integer status); + + /** + * 获取评论总数 + * + * @return 数量 + */ + Integer countArticleComment(); + + /** + * 获得浏览量总数 + * + * @return 数量 + */ + Integer countArticleView(); + + /** + * 统计有这个分类的文章数 + * + * @param categoryId 分类ID + * @return 数量 + */ + Integer countArticleByCategoryId(Integer categoryId); + + /** + * 统计有这个表情的文章数 + * + * @param tagId 标签ID + * @return 数量 + */ + Integer countArticleByTagId(Integer tagId); + + + /** + * 获得所有文章不分页 + * + * @param criteria 查询条件 + * @return 列表 + */ + List
listArticle(HashMap criteria); + + /** + * 获得最新文章 + * + * @param limit 查询数量 + * @return 列表 + */ + List
listRecentArticle(Integer userId, Integer limit); + + + /** + * 修改文章详细信息 + * + * @param article 文章 + */ + void updateArticleDetail(Article article); + + /** + * 修改文章简单信息 + * + * @param article 文章 + */ + void updateArticle(Article article); + + /** + * 批量删除文章 + * + * @param ids 文章ID + */ + void deleteArticleBatch(List ids); + + /** + * 删除文章 + * + * @param id 文章ID + */ + void deleteArticle(Integer id); + + /** + * 分页显示 + * + * @param pageIndex 第几页开始 + * @param pageSize 一页显示多少 + * @param criteria 查询条件 + * @return 文章列表 + */ + PageInfo
pageArticle(Integer pageIndex, + Integer pageSize, + HashMap criteria); + + /** + * 文章详情页面显示 + * + * @param status 状态 + * @param id 文章ID + * @return 文章 + */ + Article getArticleByStatusAndId(Integer status, Integer id); + + /** + * 获取访问量较多的文章 + * + * @param limit 查询数量 + * @return 列表 + */ + List
listArticleByViewCount(Integer limit); + + /** + * 获得上一篇文章 + * + * @param id 文章ID + * @return 文章 + */ + Article getAfterArticle(Integer id); + + /** + * 获得下一篇文章 + * + * @param id 文章ID + * @return 文章 + */ + Article getPreArticle(Integer id); + + /** + * 获得随机文章 + * + * @param limit 查询数量 + * @return 列表 + */ + List
listRandomArticle(Integer limit); + + /** + * 获得评论数较多的文章 + * + * @param limit 查询数量 + * @return 列表 + */ + List
listArticleByCommentCount(Integer limit); + + /** + * 添加文章 + * + * @param article 文章 + */ + void insertArticle(Article article); + + + /** + * 更新文章的评论数 + * + * @param articleId 文章ID + */ + void updateCommentCount(Integer articleId); + + /** + * 获得最后更新记录 + * + * @return 文章 + */ + Article getLastUpdateArticle(); + + /** + * 获得相关文章 + * + * @param cateId 分类ID + * @param limit 查询数量 + * @return 列表 + */ + List
listArticleByCategoryId(Integer cateId, Integer limit); + + /** + * 获得相关文章 + * + * @param cateIds 分类ID集合 + * @param limit 数量 + * @return 列表 + */ + List
listArticleByCategoryIds(List cateIds, Integer limit); + + + /** + * 根据文章ID获得分类ID列表 + * + * @param articleId 文章Id + * @return 列表 + */ + List listCategoryIdByArticleId(Integer articleId); + + /** + * 获得所有的文章 + * + * @return 列表 + */ + List
listAllNotWithContent(); +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/CategoryService.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/CategoryService.java new file mode 100755 index 00000000..faaa1dda --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/CategoryService.java @@ -0,0 +1,76 @@ +package com.liuyanzhao.ssm.blog.service; + + +import com.liuyanzhao.ssm.blog.entity.Category; + + +import java.util.List; + +/** + * @author 言曌 + * @date 2017/8/24 + */ +public interface CategoryService { + /** + * 获得分类总数 + * + * @return + */ + Integer countCategory(); + + + /** + * 获得分类列表 + * + * @return 分类列表 + */ + List listCategory(); + + /** + * 获得分类列表 + * + * @return 分类列表 + */ + List listCategoryWithCount(); + + /** + * 删除分类 + * + * @param id ID + */ + + void deleteCategory(Integer id); + + /** + * 根据id查询分类信息 + * + * @param id ID + * @return 分类 + */ + Category getCategoryById(Integer id); + + /** + * 添加分类 + * + * @param category 分类 + * @return 分类 + */ + Category insertCategory(Category category); + + /** + * 更新分类 + * + * @param category 分类 + */ + void updateCategory(Category category); + + /** + * 根据分类名获取分类 + * + * @param name 名称 + * @return 分类 + */ + Category getCategoryByName(String name); + + +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/CommentService.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/CommentService.java new file mode 100755 index 00000000..17613a83 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/CommentService.java @@ -0,0 +1,105 @@ +package com.liuyanzhao.ssm.blog.service; + +import com.github.pagehelper.PageInfo; +import com.liuyanzhao.ssm.blog.entity.Comment; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.List; + + +/** + * @author 言曌 + * @date 2017/9/10 + */ +@Service +public interface CommentService { + + /** + * 添加评论 + * + * @param comment 评论 + */ + void insertComment(Comment comment); + + /** + * 根据文章id获取评论列表 + * + * @param articleId 文章ID + * @return 列表 + */ + List listCommentByArticleId(Integer articleId); + + /** + * 根据id获取评论 + * + * @param id + * @return + */ + Comment getCommentById(Integer id); + + + /** + * 获取所有评论列表 + * + * @param pageIndex 第几页开始 + * @param pageSize 一页显示数量 + * @return 列表 + */ + PageInfo listCommentByPage( + Integer pageIndex, + Integer pageSize, + HashMap criteria); + + /** + * 获得某个用户收到的评论 + * + * @param pageIndex 第几页开始 + * @param pageSize 一页显示数量 + * @return 列表 + */ + PageInfo listReceiveCommentByPage( + Integer pageIndex, + Integer pageSize, + Integer userId); + + + /** + * 删除评论 + * + * @param id ID + */ + void deleteComment(Integer id); + + /** + * 修改评论 + * + * @param comment 评论 + */ + void updateComment(Comment comment); + + /** + * 统计评论数 + * + * @return 数量 + */ + Integer countComment(); + + /** + * 获得最近评论 + * + * @param limit 查询数量 + * @return 列表 + */ + List listRecentComment(Integer userId, Integer limit); + + /** + * 获得评论的子评论 + * + * @param id 评论ID + * @return 列表 + */ + List listChildComment(Integer id); + + +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/LinkService.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/LinkService.java new file mode 100755 index 00000000..113b944b --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/LinkService.java @@ -0,0 +1,60 @@ +package com.liuyanzhao.ssm.blog.service; + +import com.liuyanzhao.ssm.blog.entity.Link; + +import java.util.List; + +/** + * + * @author 言曌 + * @date 2017/9/4 + */ +public interface LinkService { + + /** + * 获得链接总数 + * + * @param status 状态 + * @return 数量 + */ + Integer countLink(Integer status); + + /** + * 获得链接列表 + * + * @param status 状态 + * @return 链接列表 + */ + List listLink(Integer status); + + /** + * 添加链接 + * + * @param link 链接 + */ + void insertLink(Link link); + + /** + * 删除链接 + * + * @param id 链接ID + */ + void deleteLink(Integer id); + + /** + * 更新链接 + * + * @param link 链接 + */ + void updateLink(Link link); + + /** + * 根据id查询链接 + * + * @param id 链接ID + * @return 链接 + */ + Link getLinkById(Integer id); + + +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/MenuService.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/MenuService.java new file mode 100755 index 00000000..1355fd75 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/MenuService.java @@ -0,0 +1,46 @@ +package com.liuyanzhao.ssm.blog.service; + +import com.liuyanzhao.ssm.blog.entity.Menu; + +import java.util.List; + + /** + * @author liuyanzhao + */ + public interface MenuService { + /** + * 获得菜单列表 + * + * @return 列表 + */ + List listMenu() ; + + /** + * 添加菜单项目 + * + * @param menu 菜单 + */ + Menu insertMenu(Menu menu) ; + + /** + * 删除菜单项目 + * + * @param id 菜单ID + */ + void deleteMenu(Integer id) ; + + /** + * 更新菜单项目 + * + * @param menu 菜单 + */ + void updateMenu(Menu menu) ; + + /** + * 根据id获得菜单项目信息 + * + * @param id 菜单ID + * @return 菜单 + */ + Menu getMenuById(Integer id) ; +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/NoticeService.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/NoticeService.java new file mode 100755 index 00000000..d7c767d2 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/NoticeService.java @@ -0,0 +1,50 @@ +package com.liuyanzhao.ssm.blog.service; + +import com.liuyanzhao.ssm.blog.entity.Notice; + +import java.util.List; + +/** + * @author liuyanzhao + */ +public interface NoticeService { + + + /** + * 获得公告列表 + * + * @param status 状态 + * @return 列表 + */ + List listNotice(Integer status); + + /** + * 添加公告 + * + * @param notice 公告 + */ + void insertNotice(Notice notice); + + /** + * 删除公告 + * + * @param id + */ + void deleteNotice(Integer id); + + /** + * 更新公告 + * + * @param notice + */ + void updateNotice(Notice notice); + + /** + * 根据id查询公告 + * + * @param id ID + * @return 公告 + */ + Notice getNoticeById(Integer id); + +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/OptionsService.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/OptionsService.java new file mode 100755 index 00000000..ac9ec5b3 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/OptionsService.java @@ -0,0 +1,32 @@ +package com.liuyanzhao.ssm.blog.service; + +import com.liuyanzhao.ssm.blog.entity.Options; + + +/** + * + * @author 言曌 + * @date 2017/9/7 + */ +public interface OptionsService { + /** + * 获得基本信息 + * + * @return 系统设置 + */ + Options getOptions(); + + /** + * 新建基本信息 + * + * @param options 系统设置 + */ + void insertOptions(Options options); + + /** + * 更新基本信息 + * + * @param options 系统设置 + */ + void updateOptions(Options options); +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/PageService.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/PageService.java new file mode 100755 index 00000000..da845088 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/PageService.java @@ -0,0 +1,58 @@ +package com.liuyanzhao.ssm.blog.service; + +import com.liuyanzhao.ssm.blog.entity.Page; + +import java.util.List; + +/** + * + * @author 言曌 + * @date 2017/9/7 + */ +public interface PageService { + /** + * 获得页面列表 + * + * @param status 状态 + * @return 列表 + */ + List listPage(Integer status); + + /** + * 根据页面key获得页面 + * + * @param status 状态 + * @param key 别名 + * @return 页面 + */ + Page getPageByKey(Integer status, String key); + + /** + * 根据id获取页面 + * + * @param id 页面ID + * @return 页面 + */ + Page getPageById(Integer id); + + /** + * 添加页面 + * + * @param page 页面 + */ + void insertPage(Page page); + + /** + * 删除页面 + * + * @param id 页面ID + */ + void deletePage(Integer id); + + /** + * 编辑页面 + * + * @param page 分页 + */ + void updatePage(Page page); +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/TagService.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/TagService.java new file mode 100755 index 00000000..4bf6e512 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/TagService.java @@ -0,0 +1,82 @@ +package com.liuyanzhao.ssm.blog.service; + +import com.liuyanzhao.ssm.blog.entity.Tag; + + +import java.util.List; + +/** + * + * @author 言曌 + * @date 2017/9/2 + */ +public interface TagService { + + /** + * 获得标签总数 + * + * @return 数量 + */ + Integer countTag() ; + + /** + * 获得标签列表 + * + * @return 标签列表 + */ + List listTag() ; + + /** + * 获得标签列表 + * + * @return 标签列表 + */ + List listTagWithCount() ; + + /** + * 根据id获得标签信息 + * + * @param id 标签ID + * @return 标签 + */ + Tag getTagById(Integer id) ; + + /** + * 添加标签 + * + * @param tag 标签 + * @return 标签 + */ + Tag insertTag(Tag tag) ; + + /** + * 修改标签 + * + * @param tag 标签 + */ + void updateTag(Tag tag) ; + + /** + * 删除标签 + * + * @param id 标签iD + */ + void deleteTag(Integer id) ; + + /** + * 根据标签名获取标签 + * + * @param name 标签名称 + * @return 标签 + */ + Tag getTagByName(String name) ; + + /** + * 根据文章ID获得标签 + * + * @param articleId 文章ID + * @return 标签列表 + */ + List listTagByArticleId(Integer articleId); + +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/UserService.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/UserService.java new file mode 100755 index 00000000..e0a60a15 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/UserService.java @@ -0,0 +1,73 @@ +package com.liuyanzhao.ssm.blog.service; + +import com.liuyanzhao.ssm.blog.entity.User; + +import java.util.List; + +/** + * @author 言曌 + * @date 2017/8/24 + */ + +public interface UserService { + /** + * 获得用户列表 + * + * @return 用户列表 + */ + List listUser(); + + /** + * 根据id查询用户信息 + * + * @param id 用户ID + * @return 用户 + */ + User getUserById(Integer id); + + /** + * 修改用户信息 + * + * @param user 用户 + */ + void updateUser(User user); + + /** + * 删除用户 + * + * @param id 用户ID + */ + void deleteUser(Integer id); + + /** + * 添加用户 + * + * @param user 用户 + * @return 用户 + */ + User insertUser(User user); + + /** + * 根据用户名和邮箱查询用户 + * + * @param str 用户名或Email + * @return 用户 + */ + User getUserByNameOrEmail(String str); + + /** + * 根据用户名查询用户 + * + * @param name 用户名 + * @return 用户 + */ + User getUserByName(String name); + + /** + * 根据邮箱查询用户 + * + * @param email Email + * @return 用户 + */ + User getUserByEmail(String email); +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/impl/ArticleServiceImpl.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/impl/ArticleServiceImpl.java new file mode 100755 index 00000000..b1c5e94e --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/impl/ArticleServiceImpl.java @@ -0,0 +1,286 @@ +package com.liuyanzhao.ssm.blog.service.impl; + +import cn.hutool.core.util.RandomUtil; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.liuyanzhao.ssm.blog.enums.ArticleCommentStatus; +import com.liuyanzhao.ssm.blog.mapper.*; +import com.liuyanzhao.ssm.blog.service.ArticleService; +import com.liuyanzhao.ssm.blog.entity.*; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.StringUtils; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +/** + * 文章Servie实现 + * + * @author 言曌 + * @date 2017/8/24 + */ +@Service +@Slf4j +public class ArticleServiceImpl implements ArticleService { + + @Autowired + private ArticleMapper articleMapper; + + @Autowired + private ArticleCategoryRefMapper articleCategoryRefMapper; + + @Autowired + private ArticleTagRefMapper articleTagRefMapper; + + @Autowired + private UserMapper userMapper; + + @Autowired + private CommentMapper commentMapper; + + @Override + public Integer countArticle(Integer status) { + Integer count = 0; + try { + count = articleMapper.countArticle(status); + } catch (Exception e) { + e.printStackTrace(); + log.error("根据状态统计文章数, status:{}, cause:{}", status, e); + } + return count; + } + + @Override + public Integer countArticleComment() { + Integer count = 0; + try { + count = articleMapper.countArticleComment(); + } catch (Exception e) { + e.printStackTrace(); + log.error("统计文章评论数失败, cause:{}", e); + } + return count; + } + + + @Override + public Integer countArticleView() { + Integer count = 0; + try { + count = articleMapper.countArticleView(); + } catch (Exception e) { + e.printStackTrace(); + log.error("统计文章访问量失败, cause:{}", e); + } + return count; + } + + @Override + public Integer countArticleByCategoryId(Integer categoryId) { + Integer count = 0; + try { + count = articleCategoryRefMapper.countArticleByCategoryId(categoryId); + } catch (Exception e) { + e.printStackTrace(); + log.error("根据分类统计文章数量失败, categoryId:{}, cause:{}", categoryId, e); + } + return count; + } + + @Override + public Integer countArticleByTagId(Integer tagId) { + return articleTagRefMapper.countArticleByTagId(tagId); + + } + + @Override + public List
listArticle(HashMap criteria) { + return articleMapper.findAll(criteria); + } + + @Override + public List
listRecentArticle(Integer userId, Integer limit) { + return articleMapper.listArticleByLimit(userId, limit); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void updateArticleDetail(Article article) { + article.setArticleUpdateTime(new Date()); + articleMapper.update(article); + + if (article.getTagList() != null) { + //删除标签和文章关联 + articleTagRefMapper.deleteByArticleId(article.getArticleId()); + //添加标签和文章关联 + for (int i = 0; i < article.getTagList().size(); i++) { + ArticleTagRef articleTagRef = new ArticleTagRef(article.getArticleId(), article.getTagList().get(i).getTagId()); + articleTagRefMapper.insert(articleTagRef); + } + } + + if (article.getCategoryList() != null) { + //添加分类和文章关联 + articleCategoryRefMapper.deleteByArticleId(article.getArticleId()); + //删除分类和文章关联 + for (int i = 0; i < article.getCategoryList().size(); i++) { + ArticleCategoryRef articleCategoryRef = new ArticleCategoryRef(article.getArticleId(), article.getCategoryList().get(i).getCategoryId()); + articleCategoryRefMapper.insert(articleCategoryRef); + } + } + } + + @Override + public void updateArticle(Article article) { + articleMapper.update(article); + } + + @Override + public void deleteArticleBatch(List ids) { + articleMapper.deleteBatch(ids); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteArticle(Integer id) { + articleMapper.deleteById(id); + // 删除分类关联 + articleCategoryRefMapper.deleteByArticleId(id); + // 删除标签管理 + articleTagRefMapper.deleteByArticleId(id); + // 删除评论 + commentMapper.deleteByArticleId(id); + } + + + @Override + public PageInfo
pageArticle(Integer pageIndex, + Integer pageSize, + HashMap criteria) { + PageHelper.startPage(pageIndex, pageSize); + List
articleList = articleMapper.findAll(criteria); + for (int i = 0; i < articleList.size(); i++) { + //封装CategoryList + List categoryList = articleCategoryRefMapper.listCategoryByArticleId(articleList.get(i).getArticleId()); + if (categoryList == null || categoryList.size() == 0) { + categoryList = new ArrayList<>(); + categoryList.add(Category.Default()); + } + articleList.get(i).setCategoryList(categoryList); + + articleList.get(i).setUser(userMapper.getUserById(articleList.get(i).getArticleUserId())); +// //封装TagList +// List tagList = articleTagRefMapper.listTagByArticleId(articleList.get(i).getArticleId()); +// articleList.get(i).setTagList(tagList); + } + return new PageInfo<>(articleList); + } + + @Override + public Article getArticleByStatusAndId(Integer status, Integer id) { + Article article = articleMapper.getArticleByStatusAndId(status, id); + if (article != null) { + List categoryList = articleCategoryRefMapper.listCategoryByArticleId(article.getArticleId()); + List tagList = articleTagRefMapper.listTagByArticleId(article.getArticleId()); + article.setCategoryList(categoryList); + article.setTagList(tagList); + } + return article; + } + + + @Override + public List
listArticleByViewCount(Integer limit) { + return articleMapper.listArticleByViewCount(limit); + } + + @Override + public Article getAfterArticle(Integer id) { + return articleMapper.getAfterArticle(id); + } + + @Override + public Article getPreArticle(Integer id) { + return articleMapper.getPreArticle(id); + } + + @Override + public List
listRandomArticle(Integer limit) { + return articleMapper.listRandomArticle(limit); + } + + @Override + public List
listArticleByCommentCount(Integer limit) { + return articleMapper.listArticleByCommentCount(limit); + } + + + @Override + @Transactional(rollbackFor = Exception.class) + public void insertArticle(Article article) { + //添加文章 + article.setArticleCreateTime(new Date()); + article.setArticleUpdateTime(new Date()); + article.setArticleIsComment(ArticleCommentStatus.ALLOW.getValue()); + article.setArticleViewCount(0); + article.setArticleLikeCount(0); + article.setArticleCommentCount(0); + article.setArticleOrder(1); + if (StringUtils.isEmpty(article.getArticleThumbnail())) { + article.setArticleThumbnail("/img/thumbnail/random/img_" + RandomUtil.randomNumbers(1) + ".jpg"); + } + + articleMapper.insert(article); + //添加分类和文章关联 + for (int i = 0; i < article.getCategoryList().size(); i++) { + ArticleCategoryRef articleCategoryRef = new ArticleCategoryRef(article.getArticleId(), article.getCategoryList().get(i).getCategoryId()); + articleCategoryRefMapper.insert(articleCategoryRef); + } + //添加标签和文章关联 + for (int i = 0; i < article.getTagList().size(); i++) { + ArticleTagRef articleTagRef = new ArticleTagRef(article.getArticleId(), article.getTagList().get(i).getTagId()); + articleTagRefMapper.insert(articleTagRef); + } + } + + + @Override + public void updateCommentCount(Integer articleId) { + articleMapper.updateCommentCount(articleId); + } + + @Override + public Article getLastUpdateArticle() { + return articleMapper.getLastUpdateArticle(); + } + + @Override + public List
listArticleByCategoryId(Integer cateId, Integer limit) { + return articleMapper.findArticleByCategoryId(cateId, limit); + } + + @Override + public List
listArticleByCategoryIds(List cateIds, Integer limit) { + if (cateIds == null || cateIds.size() == 0) { + return null; + } + return articleMapper.findArticleByCategoryIds(cateIds, limit); + } + + @Override + public List listCategoryIdByArticleId(Integer articleId) { + return articleCategoryRefMapper.selectCategoryIdByArticleId(articleId); + } + + @Override + public List
listAllNotWithContent() { + return articleMapper.listAllNotWithContent(); + } + + +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/impl/CategoryServiceImpl.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/impl/CategoryServiceImpl.java new file mode 100755 index 00000000..6cd6cd70 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/impl/CategoryServiceImpl.java @@ -0,0 +1,133 @@ +package com.liuyanzhao.ssm.blog.service.impl; + +import com.liuyanzhao.ssm.blog.mapper.ArticleCategoryRefMapper; +import com.liuyanzhao.ssm.blog.mapper.CategoryMapper; +import com.liuyanzhao.ssm.blog.entity.Category; +import com.liuyanzhao.ssm.blog.service.CategoryService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.transaction.interceptor.TransactionAspectSupport; + +import java.util.List; + + +/** + * 用户管理 + * + * @author 言曌 + * @date 2017/8/24 + */ +@Service +@Slf4j +public class CategoryServiceImpl implements CategoryService { + + @Autowired + private CategoryMapper categoryMapper; + + @Autowired + private ArticleCategoryRefMapper articleCategoryRefMapper; + + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteCategory(Integer id) { + try { + categoryMapper.deleteCategory(id); + articleCategoryRefMapper.deleteByCategoryId(id); + } catch (Exception e) { + e.printStackTrace(); + log.error("删除分类失败, id:{}, cause:{}", id, e); + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + } + } + + @Override + public Category getCategoryById(Integer id) { + Category category = null; + try { + category = categoryMapper.getCategoryById(id); + } catch (Exception e) { + e.printStackTrace(); + log.error("根据分类ID获得分类, id:{}, cause:{}", id, e); + } + return category; + } + + @Override + public void updateCategory(Category category) { + try { + categoryMapper.update(category); + } catch (Exception e) { + e.printStackTrace(); + log.error("更新分类失败, category:{}, cause:{}", category, e); + } + } + + @Override + public Category insertCategory(Category category) { + try { + categoryMapper.insert(category); + } catch (Exception e) { + e.printStackTrace(); + log.error("创建分类失败, category:{}, cause:{}", category, e); + } + return category; + } + + + @Override + public Integer countCategory() { + Integer count = 0; + try { + count = categoryMapper.countCategory(); + } catch (Exception e) { + e.printStackTrace(); + log.error("统计分类失败, cause:{}", e); + } + return count; + } + + + @Override + public List listCategory() { + List categoryList = null; + try { + categoryList = categoryMapper.listCategory(); + } catch (Exception e) { + e.printStackTrace(); + log.error("根据文章获得分类列表失败, cause:{}", e); + } + return categoryList; + } + + @Override + public List listCategoryWithCount() { + List categoryList = null; + try { + categoryList = categoryMapper.listCategory(); + for (int i = 0; i < categoryList.size(); i++) { + Integer count = articleCategoryRefMapper.countArticleByCategoryId(categoryList.get(i).getCategoryId()); + categoryList.get(i).setArticleCount(count); + } + } catch (Exception e) { + e.printStackTrace(); + log.error("根据文章获得分类列表失败, cause:{}", e); + } + return categoryList; + } + + @Override + public Category getCategoryByName(String name) { + Category category = null; + try { + category = categoryMapper.getCategoryByName(name); + } catch (Exception e) { + e.printStackTrace(); + log.error("更新分类失败, category:{}, cause:{}", category, e); + } + return category; + } + + +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/impl/CommentServiceImpl.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/impl/CommentServiceImpl.java new file mode 100755 index 00000000..20f9015d --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/impl/CommentServiceImpl.java @@ -0,0 +1,165 @@ +package com.liuyanzhao.ssm.blog.service.impl; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.liuyanzhao.ssm.blog.entity.Article; +import com.liuyanzhao.ssm.blog.entity.Comment; +import com.liuyanzhao.ssm.blog.enums.ArticleStatus; +import com.liuyanzhao.ssm.blog.mapper.CommentMapper; +import com.liuyanzhao.ssm.blog.mapper.ArticleMapper; +import com.liuyanzhao.ssm.blog.service.CommentService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; + +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +/** + * @author 言曌 + * @date 2017/9/10 + */ +@Service +@Slf4j +public class CommentServiceImpl implements CommentService { + + @Autowired + private CommentMapper commentMapper; + + @Autowired + private ArticleMapper articleMapper; + + @Override + public void insertComment(Comment comment) { + try { + commentMapper.insert(comment); + } catch (Exception e) { + e.printStackTrace(); + log.error("创建评论失败:comment:{}, cause:{}", comment, e); + } + } + + @Override + public List listCommentByArticleId(Integer articleId) { + List commentList = null; + try { + commentList = commentMapper.listCommentByArticleId(articleId); + } catch (Exception e) { + e.printStackTrace(); + log.error("根据文章ID获得评论列表失败,articleId:{},cause:{}", articleId, e); + } + return commentList; + } + + @Override + public Comment getCommentById(Integer id) { + Comment comment = null; + try { + comment = commentMapper.getCommentById(id); + } catch (Exception e) { + e.printStackTrace(); + log.error("根据评论ID获得评论,id:{}, cause:{}", id, e); + } + return comment; + } + + @Override + public PageInfo listCommentByPage(Integer pageIndex, Integer pageSize, HashMap criteria) { + PageHelper.startPage(pageIndex, pageSize); + List commentList = null; + try { + commentList = commentMapper.listComment(criteria); + for (int i = 0; i < commentList.size(); i++) { + Article article = articleMapper.getArticleByStatusAndId(ArticleStatus.PUBLISH.getValue(), commentList.get(i).getCommentArticleId()); + commentList.get(i).setArticle(article); + } + } catch (Exception e) { + e.printStackTrace(); + log.error("分页获得评论失败,pageIndex:{}, pageSize:{}, cause:{}", pageIndex, pageSize, e); + } + return new PageInfo<>(commentList); + } + + @Override + public PageInfo listReceiveCommentByPage(Integer pageIndex, Integer pageSize, Integer userId) { + PageHelper.startPage(pageIndex, pageSize); + List commentList = new ArrayList<>(); + try { + List articleIds = articleMapper.listArticleIdsByUserId(userId); + if (articleIds != null && articleIds.size() > 0) { + commentList = commentMapper.getReceiveComment(articleIds); + for (int i = 0; i < commentList.size(); i++) { + Article article = articleMapper.getArticleByStatusAndId(ArticleStatus.PUBLISH.getValue(), commentList.get(i).getCommentArticleId()); + commentList.get(i).setArticle(article); + } + } + } catch (Exception e) { + e.printStackTrace(); + log.error("分页获得评论失败,pageIndex:{}, pageSize:{}, cause:{}", pageIndex, pageSize, e); + } + return new PageInfo<>(commentList); + } + + @Override + public void deleteComment(Integer id) { + try { + commentMapper.deleteById(id); + } catch (Exception e) { + e.printStackTrace(); + log.error("删除评论失败, id:{}, cause:{}", id, e); + } + } + + @Override + public void updateComment(Comment comment) { + try { + commentMapper.update(comment); + } catch (Exception e) { + e.printStackTrace(); + log.error("更新评论,comment:{}, cause:{}", comment, e); + } + } + + @Override + public Integer countComment() { + Integer commentCount = null; + try { + commentCount = commentMapper.countComment(); + } catch (Exception e) { + e.printStackTrace(); + log.error("统计评论数量失败, cause:{}", e); + } + return commentCount; + } + + @Override + public List listRecentComment(Integer userId, Integer limit) { + List commentList = null; + try { + commentList = commentMapper.listRecentComment(userId, limit); + for (int i = 0; i < commentList.size(); i++) { + Article article = articleMapper.getArticleByStatusAndId(ArticleStatus.PUBLISH.getValue(), commentList.get(i).getCommentArticleId()); + commentList.get(i).setArticle(article); + } + } catch (Exception e) { + e.printStackTrace(); + log.error("获得最新评论失败, limit:{}, cause:{}", limit, e); + } + return commentList; + } + + @Override + public List listChildComment(Integer id) { + List childCommentList = null; + try { + childCommentList = commentMapper.listChildComment(id); + } catch (Exception e) { + e.printStackTrace(); + log.error("获得子评论失败, id:{}, cause:{}", id, e); + } + return childCommentList; + } + +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/impl/LinkServiceImpl.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/impl/LinkServiceImpl.java new file mode 100755 index 00000000..ef0ad3eb --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/impl/LinkServiceImpl.java @@ -0,0 +1,53 @@ +package com.liuyanzhao.ssm.blog.service.impl; + +import com.liuyanzhao.ssm.blog.entity.Link; +import com.liuyanzhao.ssm.blog.mapper.LinkMapper; +import com.liuyanzhao.ssm.blog.service.LinkService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + + +import java.util.List; + +/** + * + * @author 言曌 + * @date 2017/9/4 + */ +@Service +public class LinkServiceImpl implements LinkService { + + @Autowired + private LinkMapper linkMapper; + + @Override + public Integer countLink(Integer status) { + return linkMapper.countLink(status); + } + + @Override + public List listLink(Integer status) { + return linkMapper.listLink(status); + } + + @Override + public void insertLink(Link link) { + linkMapper.insert(link); + } + + @Override + public void deleteLink(Integer id) { + linkMapper.deleteById(id); + } + + @Override + public void updateLink(Link link) { + linkMapper.update(link); + } + + @Override + public Link getLinkById(Integer id) { + return linkMapper.getLinkById(id); + } + +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/impl/MenuServiceImpl.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/impl/MenuServiceImpl.java new file mode 100755 index 00000000..baf2cbdf --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/impl/MenuServiceImpl.java @@ -0,0 +1,48 @@ +package com.liuyanzhao.ssm.blog.service.impl; + +import com.liuyanzhao.ssm.blog.entity.Menu; +import com.liuyanzhao.ssm.blog.mapper.MenuMapper; +import com.liuyanzhao.ssm.blog.service.MenuService; +import org.springframework.beans.factory.annotation.Autowired; + +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @author liuyanzhao + */ +@Service +public class MenuServiceImpl implements MenuService { + + + @Autowired + private MenuMapper menuMapper; + + @Override + public List listMenu() { + List menuList = menuMapper.listMenu(); + return menuList; + } + + @Override + public Menu insertMenu(Menu menu) { + menuMapper.insert(menu); + return menu; + } + + @Override + public void deleteMenu(Integer id) { + menuMapper.deleteById(id); + } + + @Override + public void updateMenu(Menu menu) { + menuMapper.update(menu); + } + + @Override + public Menu getMenuById(Integer id) { + return menuMapper.getMenuById(id); + } +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/impl/NoticeServiceImpl.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/impl/NoticeServiceImpl.java new file mode 100755 index 00000000..f460fcb0 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/impl/NoticeServiceImpl.java @@ -0,0 +1,46 @@ +package com.liuyanzhao.ssm.blog.service.impl; + +import com.liuyanzhao.ssm.blog.entity.Notice; +import com.liuyanzhao.ssm.blog.mapper.NoticeMapper; +import com.liuyanzhao.ssm.blog.service.NoticeService; +import org.springframework.beans.factory.annotation.Autowired; + +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @author liuyanzhao + */ +@Service +public class NoticeServiceImpl implements NoticeService { + + @Autowired + private NoticeMapper noticeMapper; + + @Override + public List listNotice(Integer status) { + return noticeMapper.listNotice(status); + } + + @Override + public void insertNotice(Notice notice) { + noticeMapper.insert(notice); + } + + @Override + public void deleteNotice(Integer id) { + noticeMapper.deleteById(id); + } + + @Override + public void updateNotice(Notice notice) { + noticeMapper.update(notice); + } + + @Override + public Notice getNoticeById(Integer id) { + return noticeMapper.getNoticeById(id); + } + +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/impl/OptionsServiceImpl.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/impl/OptionsServiceImpl.java new file mode 100755 index 00000000..de8892f1 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/impl/OptionsServiceImpl.java @@ -0,0 +1,40 @@ +package com.liuyanzhao.ssm.blog.service.impl; + +import com.liuyanzhao.ssm.blog.entity.Options; +import com.liuyanzhao.ssm.blog.mapper.OptionsMapper; +import com.liuyanzhao.ssm.blog.service.OptionsService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; + +/** + * + * @author 言曌 + * @date 2017/9/7 + */ +@Service +public class OptionsServiceImpl implements OptionsService { + + + @Autowired + private OptionsMapper optionsMapper; + + @Override + @Cacheable(value = "default", key = "'options'") + public Options getOptions() { + return optionsMapper.getOptions(); + } + + @Override + @CacheEvict(value = "default", key = "'options'") + public void insertOptions(Options options) { + optionsMapper.insert(options); + } + + @Override + @CacheEvict(value = "default", key = "'options'") + public void updateOptions(Options options) { + optionsMapper.update(options); + } +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/impl/PageServiceImpl.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/impl/PageServiceImpl.java new file mode 100755 index 00000000..2d2b8827 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/impl/PageServiceImpl.java @@ -0,0 +1,52 @@ +package com.liuyanzhao.ssm.blog.service.impl; + +import com.liuyanzhao.ssm.blog.entity.Page; +import com.liuyanzhao.ssm.blog.mapper.PageMapper; +import com.liuyanzhao.ssm.blog.service.PageService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + + +import java.util.List; + +/** + * @author 言曌 + * @date 2017/9/7 + */ +@Service +public class PageServiceImpl implements PageService { + + @Autowired + private PageMapper pageMapper; + + @Override + public Page getPageByKey(Integer status, String key) { + return pageMapper.getPageByKey(status, key); + } + + @Override + public Page getPageById(Integer id) { + return pageMapper.getPageById(id); + } + + @Override + public List listPage(Integer status) { + return pageMapper.listPage(status); + } + + + @Override + public void insertPage(Page page) { + pageMapper.insert(page); + } + + @Override + public void deletePage(Integer id) { + pageMapper.deleteById(id); + } + + @Override + public void updatePage(Page page) { + pageMapper.update(page); + } +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/impl/TagServiceImpl.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/impl/TagServiceImpl.java new file mode 100755 index 00000000..6cc1bd6c --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/impl/TagServiceImpl.java @@ -0,0 +1,133 @@ +package com.liuyanzhao.ssm.blog.service.impl; + +import com.liuyanzhao.ssm.blog.mapper.ArticleTagRefMapper; +import com.liuyanzhao.ssm.blog.mapper.TagMapper; +import com.liuyanzhao.ssm.blog.entity.Tag; +import com.liuyanzhao.ssm.blog.service.TagService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.transaction.interceptor.TransactionAspectSupport; + +import java.util.List; + +/** + * @author 言曌 + * @date 2017/9/2 + */ +@Service +@Slf4j +public class TagServiceImpl implements TagService { + + @Autowired + private TagMapper tagMapper; + + @Autowired + private ArticleTagRefMapper articleTagRefMapper; + + @Override + public Integer countTag() { + return tagMapper.countTag(); + } + + @Override + public List listTag() { + List tagList = null; + try { + tagList = tagMapper.listTag(); + } catch (Exception e) { + e.printStackTrace(); + log.error("获得所有标签失败, cause:{}", e); + } + return tagList; + } + + @Override + public List listTagWithCount() { + List tagList = null; + try { + tagList = tagMapper.listTag(); + for (int i = 0; i < tagList.size(); i++) { + Integer count = articleTagRefMapper.countArticleByTagId(tagList.get(i).getTagId()); + tagList.get(i).setArticleCount(count); + } + } catch (Exception e) { + e.printStackTrace(); + log.error("获得所有标签失败, cause:{}", e); + } + return tagList; + } + + + @Override + public Tag getTagById(Integer id) { + Tag tag = null; + try { + tag = tagMapper.getTagById(id); + } catch (Exception e) { e.printStackTrace(); + log.error("根据ID获得标签失败, id:{}, cause:{}", id, e); + } + return tag; + } + + @Override + public Tag insertTag(Tag tag) { + try { + tagMapper.insert(tag); + } catch (Exception e) { + e.printStackTrace(); + log.error("添加标签失败, tag:{}, cause:{}", tag, e); + } + return tag; + } + + @Override + public void updateTag(Tag tag) { + try { + tagMapper.update(tag); + } catch (Exception e) { + e.printStackTrace(); + log.error("更新标签失败, tag:{}, cause:{}", tag, e); + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteTag(Integer id) { + try { + tagMapper.deleteById(id); + articleTagRefMapper.deleteByTagId(id); + } catch (Exception e) { + e.printStackTrace(); + log.error("删除标签失败, id:{}, cause:{}", id, e); + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + } + + } + + @Override + public Tag getTagByName(String name) { + Tag tag = null; + try { + tag = tagMapper.getTagByName(name); + } catch (Exception e) { e.printStackTrace(); + log.error("根据名称获得标签, name:{}, cause:{}", name, e); + } + return tag; + } + + @Override + public List listTagByArticleId(Integer articleId) { + List tagList = null; + try { + tagList = articleTagRefMapper.listTagByArticleId(articleId); + } catch (Exception e) { + e.printStackTrace(); + log.error("根据文章ID获得标签失败,articleId:{}, cause:{}", articleId, e); + } + return tagList; + } + + +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/impl/UserServiceImpl.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/impl/UserServiceImpl.java new file mode 100755 index 00000000..5fe8e2f5 --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/service/impl/UserServiceImpl.java @@ -0,0 +1,95 @@ +package com.liuyanzhao.ssm.blog.service.impl; + +import com.liuyanzhao.ssm.blog.mapper.ArticleMapper; +import com.liuyanzhao.ssm.blog.mapper.CommentMapper; +import com.liuyanzhao.ssm.blog.mapper.UserMapper; +import com.liuyanzhao.ssm.blog.entity.User; +import com.liuyanzhao.ssm.blog.service.ArticleService; +import com.liuyanzhao.ssm.blog.service.UserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Date; +import java.util.List; + +/** + * 用户管理 + * + * @author 言曌 + * @date 2017/8/24 + */ +@Service +public class UserServiceImpl implements UserService { + + @Autowired + private UserMapper userMapper; + + @Autowired + private ArticleMapper articleMapper; + + @Autowired + private ArticleService articleService; + @Autowired + private CommentMapper commentMapper; + + @Override + public List listUser() { + List userList = userMapper.listUser(); + for (int i = 0; i < userList.size(); i++) { + Integer articleCount = articleMapper.countArticleByUser(userList.get(i).getUserId()); + userList.get(i).setArticleCount(articleCount); + } + return userList; + } + + @Override + public User getUserById(Integer id) { + return userMapper.getUserById(id); + } + + @Override + public void updateUser(User user) { + userMapper.update(user); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteUser(Integer id) { + // 删除用户 + userMapper.deleteById(id); + // 删除评论 + commentMapper.deleteByUserId(id); + // 删除文章 + List articleIds = articleMapper.listArticleIdsByUserId(id); + if (articleIds != null && articleIds.size() > 0) { + for (Integer articleId : articleIds) { + articleService.deleteArticle(articleId); + } + } + } + + @Override + public User insertUser(User user) { + user.setUserRegisterTime(new Date()); + userMapper.insert(user); + return user; + } + + @Override + public User getUserByNameOrEmail(String str) { + return userMapper.getUserByNameOrEmail(str); + } + + @Override + public User getUserByName(String name) { + return userMapper.getUserByName(name); + } + + @Override + public User getUserByEmail(String email) { + return userMapper.getUserByEmail(email); + } + + +} diff --git a/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/util/MyUtils.java b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/util/MyUtils.java new file mode 100755 index 00000000..49d7704e --- /dev/null +++ b/ForestBlog/src/main/java/com/liuyanzhao/ssm/blog/util/MyUtils.java @@ -0,0 +1,92 @@ +package com.liuyanzhao.ssm.blog.util; + +import javax.servlet.http.HttpServletRequest; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; + +/** + * 常用的方法 + * Created by 言曌 on 2017/8/24. + */ + +public class MyUtils { + + /** + * 获得IP地址 + * + * @param request + * @return + */ + public static String getIpAddr(HttpServletRequest request) { + String ipAddress = request.getHeader("x-forwarded-for"); + if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) { + ipAddress = request.getHeader("Proxy-Client-IP"); + } + if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) { + ipAddress = request.getHeader("WL-Proxy-Client-IP"); + } + if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) { + ipAddress = request.getRemoteAddr(); + } + //对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割 + if (ipAddress != null && ipAddress.length() > 15) { + if (ipAddress.indexOf(",") > 0) { + ipAddress = ipAddress.substring(0, ipAddress.indexOf(",")); + } + } + return ipAddress; + } + + + /** + * 获得Md5加密 + * + * @param str 原字符串 + * @return 加密后的字符串 + */ + public static String strToMd5(String str) { + String md5Str = null; + if (str != null && str.length() != 0) { + try { + MessageDigest md = MessageDigest.getInstance("MD5"); + md.update(str.getBytes()); + byte b[] = md.digest(); + + int i; + StringBuffer buf = new StringBuffer(""); + for (int offset = 0; offset < b.length; offset++) { + i = b[offset]; + if (i < 0) { + i += 256; + } + if (i < 16) { + buf.append("0"); + } + buf.append(Integer.toHexString(i)); + } + //32位 + md5Str = buf.toString(); + //16位 + //md5Str = buf.toString().substring(8, 24); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } + } + return md5Str; + } + + /** + * 根据email获取gravatar头像 + * + * @param email Email + * @return 头像URL + */ + public static String getGravatar(String email) { + String emailMd5 = strToMd5(email); + //设置图片大小32px + String avatar = "http://cn.gravatar.com/avatar/" + emailMd5 + "?s=128&d=identicon&r=PG"; + return avatar; + } + + +} \ No newline at end of file diff --git a/ForestBlog/src/main/resources/db.properties b/ForestBlog/src/main/resources/db.properties index 412ac5a3..cec7879c 100755 --- a/ForestBlog/src/main/resources/db.properties +++ b/ForestBlog/src/main/resources/db.properties @@ -1,3 +1,5 @@ -jdbc_url=jdbc:mysql://localhost:3306/forest_blog?useUnicode=true&characterEncoding=utf8 -jdbc_user=forest_blog -jdbc_password=forest_blog \ No newline at end of file +#MySQL +mysql.driver=com.mysql.cj.jdbc.Driver +mysql.url=jdbc:mysql://127.0.0.1:3306/forest_blog?useUnicode=true&characterEncoding=utf8&serverTimezone=UTC +mysql.username=root +mysql.password=123456 diff --git a/ForestBlog/src/main/resources/log4j.properties b/ForestBlog/src/main/resources/log4j.properties deleted file mode 100755 index 09a581bc..00000000 --- a/ForestBlog/src/main/resources/log4j.properties +++ /dev/null @@ -1,12 +0,0 @@ -# Configure logging for testing: optionally with log file -log4j.rootLogger=WARN, stdout -# log4j.rootLogger=WARN, stdout, logfile - -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n - -log4j.appender.logfile=org.apache.log4j.FileAppender -log4j.appender.logfile.File=target/spring.log -log4j.appender.logfile.layout=org.apache.log4j.PatternLayout -log4j.appender.logfile.layout.ConversionPattern=%d %p [%c] - %m%n \ No newline at end of file diff --git a/ForestBlog/src/main/resources/logback.xml b/ForestBlog/src/main/resources/logback.xml new file mode 100644 index 00000000..a7df509b --- /dev/null +++ b/ForestBlog/src/main/resources/logback.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + %date{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%thread]%logger{56}.%method:%L -%msg%n + + + + + + ${log.base}/${log.moduleName}.log + + + + ${log.base}/archive/${log.moduleName}_all_%d{yyyy-MM-dd}.%i.log.zip + + + + ${log.max.size} + + + + + %date{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%thread]%logger{56}.%method:%L -%msg%n + + + + \ No newline at end of file diff --git a/ForestBlog/src/main/resources/mapper/ArticleCategoryRefMapper.xml b/ForestBlog/src/main/resources/mapper/ArticleCategoryRefMapper.xml new file mode 100644 index 00000000..677456d7 --- /dev/null +++ b/ForestBlog/src/main/resources/mapper/ArticleCategoryRefMapper.xml @@ -0,0 +1,60 @@ + + + + + + + + + article_category_ref + + + insert into + + (article_id, category_id) + values (#{articleId}, #{categoryId}) + + + + delete from + + where category_id = #{value} + + + + delete from + + where article_id = #{value} + + + + + + + + + + + + + \ No newline at end of file diff --git a/ForestBlog/src/main/resources/mapper/ArticleMapper.xml b/ForestBlog/src/main/resources/mapper/ArticleMapper.xml new file mode 100644 index 00000000..aa2dda6d --- /dev/null +++ b/ForestBlog/src/main/resources/mapper/ArticleMapper.xml @@ -0,0 +1,347 @@ + + + + + + + + + + + + + + + + + + + + + article + + + article_id, article_user_id, article_title, article_content,article_summary, article_view_count, article_comment_count, article_like_count, article_create_time, + article_update_time, article_is_comment, article_status, article_order, article_thumbnail + + + + + + + + + delete from + + where article_id = #{articleId,jdbcType=INTEGER} + + + + DELETE FROM + + + WHERE article_id IN + + #{id} + + + + + DELETE FROM + WHERE article_user_id = #{userId} + + + + insert into + + (article_user_id, article_title, + article_view_count, article_comment_count, + article_like_count, article_create_time, article_update_time, + article_is_comment, article_status, article_order, + article_content, article_summary,article_thumbnail) + values (#{articleUserId,jdbcType=INTEGER}, #{articleTitle,jdbcType=VARCHAR}, + #{articleViewCount,jdbcType=INTEGER}, + #{articleCommentCount,jdbcType=INTEGER}, + #{articleLikeCount,jdbcType=INTEGER}, #{articleCreateTime,jdbcType=TIMESTAMP}, + #{articleUpdateTime,jdbcType=TIMESTAMP}, + #{articleIsComment,jdbcType=INTEGER}, #{articleStatus,jdbcType=INTEGER}, #{articleOrder,jdbcType=INTEGER}, + #{articleContent,jdbcType=LONGVARCHAR}, #{articleSummary,jdbcType=VARCHAR}, #{articleThumbnail}) + + + + + update + + + article_user_id = #{articleUserId,jdbcType=INTEGER}, + article_title = #{articleTitle,jdbcType=VARCHAR}, + article_view_count = #{articleViewCount,jdbcType=INTEGER}, + article_comment_count = #{articleCommentCount,jdbcType=INTEGER}, + article_like_count = #{articleLikeCount,jdbcType=INTEGER}, + article_create_time = #{articleCreateTime,jdbcType=TIMESTAMP}, + article_update_time = #{articleUpdateTime,jdbcType=TIMESTAMP}, + article_is_comment = #{articleIsComment,jdbcType=INTEGER}, + article_status = #{articleStatus,jdbcType=INTEGER}, + article_order = #{articleOrder,jdbcType=INTEGER}, + article_content = #{articleContent,jdbcType=LONGVARCHAR}, + article_summary = #{articleSummary,jdbcType=VARCHAR}, + article_thumbnail = #{articleThumbnail,jdbcType=VARCHAR}, + + where article_id = #{articleId,jdbcType=INTEGER} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + UPDATE + + SET article_comment_count = + ( + SELECT count(*) FROM `comment` + WHERE article.article_id=comment.comment_article_id + ) + WHERE article_id=#{articleId} + + + + + + + + + + + + + + + + diff --git a/ForestBlog/src/main/resources/mapper/ArticleTagRefMapper.xml b/ForestBlog/src/main/resources/mapper/ArticleTagRefMapper.xml new file mode 100644 index 00000000..93fb9f25 --- /dev/null +++ b/ForestBlog/src/main/resources/mapper/ArticleTagRefMapper.xml @@ -0,0 +1,37 @@ + + + + + + + + + article_tag_ref + + + insert into + (article_id, tag_id) + values (#{articleId}, #{tagId}) + + + + delete from where tag_id = #{value} + + + + delete from where article_id = #{value} + + + + + + + + \ No newline at end of file diff --git a/ForestBlog/src/main/resources/mapper/CategoryMapper.xml b/ForestBlog/src/main/resources/mapper/CategoryMapper.xml new file mode 100755 index 00000000..72faa9f2 --- /dev/null +++ b/ForestBlog/src/main/resources/mapper/CategoryMapper.xml @@ -0,0 +1,95 @@ + + + + + + + + + + + + + category + + + category_id, category_pid, category_name, category_description, category_order, category_icon + + + + + insert into + + (category_pid, category_name,category_description, category_order, category_icon) + values (#{categoryPid,jdbcType=INTEGER}, #{categoryName,jdbcType=VARCHAR}, + #{categoryDescription,jdbcType=VARCHAR}, #{categoryOrder,jdbcType=INTEGER}, #{categoryIcon,jdbcType=VARCHAR}) + + + + + update + + + category_pid = #{categoryPid,jdbcType=INTEGER}, + category_name = #{categoryName,jdbcType=VARCHAR}, + category_description = #{categoryDescription,jdbcType=VARCHAR}, + category_order = #{categoryOrder,jdbcType=INTEGER}, + category_icon = #{categoryIcon,jdbcType=VARCHAR}, + + where category_id = #{categoryId,jdbcType=INTEGER} + + + + + + + + + + + + + + + DELETE FROM + + WHERE category_id=#{value} + + + + + + + + \ No newline at end of file diff --git a/ForestBlog/src/main/resources/mapper/CommentMapper.xml b/ForestBlog/src/main/resources/mapper/CommentMapper.xml new file mode 100755 index 00000000..266d4d17 --- /dev/null +++ b/ForestBlog/src/main/resources/mapper/CommentMapper.xml @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + comment + + + comment_id, comment_pid, comment_pname, comment_article_id, comment_author_name, + comment_author_email, comment_author_url, comment_author_avatar, comment_content, comment_agent, + comment_ip,comment_create_time, comment_role,comment_user_id + + + + + + delete from + + where comment_id = #{commentId,jdbcType=INTEGER} + + + delete from + + WHERE comment_user_id = #{userId} + + + delete from + + WHERE comment_article_id = #{articleId} + + + + insert into + + (comment_pid, comment_pname, comment_article_id, + comment_author_name, comment_author_email, + comment_author_url, comment_author_avatar, comment_content, comment_agent, + comment_ip, comment_create_time, comment_role, comment_user_id) + values (#{commentPid,jdbcType=INTEGER}, #{commentPname,jdbcType=VARCHAR}, #{commentArticleId,jdbcType=INTEGER}, + #{commentAuthorName,jdbcType=VARCHAR}, #{commentAuthorEmail,jdbcType=VARCHAR}, + #{commentAuthorUrl,jdbcType=VARCHAR},#{commentAuthorAvatar}, #{commentContent,jdbcType=VARCHAR}, + #{commentAgent,jdbcType=VARCHAR}, + #{commentIp,jdbcType=VARCHAR}, #{commentCreateTime,jdbcType=TIMESTAMP}, #{commentRole,jdbcType=INTEGER}, + #{commentUserId,jdbcType=INTEGER}) + + + + update + + + comment_pid = #{commentPid,jdbcType=INTEGER}, + comment_pname = #{commentPname,jdbcType=VARCHAR}, + comment_article_id = #{commentArticleId,jdbcType=INTEGER}, + comment_author_name = #{commentAuthorName,jdbcType=VARCHAR}, + comment_author_email = #{commentAuthorEmail,jdbcType=VARCHAR}, + comment_author_url = #{commentAuthorUrl,jdbcType=VARCHAR}, + comment_content = #{commentContent,jdbcType=VARCHAR}, + comment_agent = #{commentAgent,jdbcType=VARCHAR}, + comment_ip = #{commentIp,jdbcType=VARCHAR}, + comment_create_time = #{commentCreateTime,jdbcType=TIMESTAMP}, + comment_author_avatar = #{commentAuthorAvatar}, + comment_role = #{commentRole,jdbcType=INTEGER}, + comment_user_id = #{commentUserId,jdbcType=INTEGER}, + + where comment_id = #{commentId,jdbcType=INTEGER} + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ForestBlog/src/main/resources/mapper/LinkMapper.xml b/ForestBlog/src/main/resources/mapper/LinkMapper.xml new file mode 100755 index 00000000..b2308d91 --- /dev/null +++ b/ForestBlog/src/main/resources/mapper/LinkMapper.xml @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + link_id, link_url, link_name, link_image, link_description, link_owner_nickname, + link_owner_contact, link_update_time, link_create_time, link_order, link_status + + + link + + + + + delete from link + where link_id = #{linkId,jdbcType=INTEGER} + + + + insert into link (link_id, link_url, link_name, + link_image, link_description, link_owner_nickname, + link_owner_contact, link_update_time, link_create_time, + link_order, link_status) + values (#{linkId,jdbcType=INTEGER}, #{linkUrl,jdbcType=VARCHAR}, #{linkName,jdbcType=VARCHAR}, + #{linkImage,jdbcType=VARCHAR}, #{linkDescription,jdbcType=VARCHAR}, #{linkOwnerNickname,jdbcType=VARCHAR}, + #{linkOwnerContact,jdbcType=VARCHAR}, #{linkUpdateTime,jdbcType=TIMESTAMP}, #{linkCreateTime,jdbcType=TIMESTAMP}, + #{linkOrder,jdbcType=INTEGER}, #{linkStatus,jdbcType=INTEGER}) + + + + update link + + link_url = #{linkUrl,jdbcType=VARCHAR}, + link_name = #{linkName,jdbcType=VARCHAR}, + link_image = #{linkImage,jdbcType=VARCHAR}, + link_description = #{linkDescription,jdbcType=VARCHAR}, + link_owner_nickname = #{linkOwnerNickname,jdbcType=VARCHAR}, + link_owner_contact = #{linkOwnerContact,jdbcType=VARCHAR}, + link_update_time = #{linkUpdateTime,jdbcType=TIMESTAMP}, + link_create_time = #{linkCreateTime,jdbcType=TIMESTAMP}, + link_order = #{linkOrder,jdbcType=INTEGER}, + link_status = #{linkStatus,jdbcType=INTEGER}, + + where link_id = #{linkId,jdbcType=INTEGER} + + + + + + + + \ No newline at end of file diff --git a/ForestBlog/src/main/resources/mapper/MenuMapper.xml b/ForestBlog/src/main/resources/mapper/MenuMapper.xml new file mode 100755 index 00000000..306ef57c --- /dev/null +++ b/ForestBlog/src/main/resources/mapper/MenuMapper.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + menu_id, menu_name, menu_url, menu_level, menu_icon, menu_order + + + menu + + + + delete from + where menu_id = #{menuId,jdbcType=INTEGER} + + + insert into + (menu_id, menu_name, menu_url, + menu_level, menu_icon, menu_order) + values (#{menuId,jdbcType=INTEGER}, #{menuName,jdbcType=VARCHAR}, #{menuUrl,jdbcType=VARCHAR}, + #{menuLevel,jdbcType=INTEGER}, #{menuIcon,jdbcType=VARCHAR}, #{menuOrder,jdbcType=INTEGER}) + + + + update + + menu_name = #{menuName,jdbcType=VARCHAR}, + menu_url = #{menuUrl,jdbcType=VARCHAR}, + menu_level = #{menuLevel,jdbcType=INTEGER}, + menu_icon = #{menuIcon,jdbcType=VARCHAR}, + menu_order = #{menuOrder,jdbcType=INTEGER}, + + where menu_id = #{menuId,jdbcType=INTEGER} + + + + + + + \ No newline at end of file diff --git a/ForestBlog/src/main/resources/mapper/NoticeMapper.xml b/ForestBlog/src/main/resources/mapper/NoticeMapper.xml new file mode 100755 index 00000000..112129e8 --- /dev/null +++ b/ForestBlog/src/main/resources/mapper/NoticeMapper.xml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + notice_id, notice_title, notice_content, notice_create_time, notice_update_time, + notice_status, notice_order + + + notice + + + + + delete from + where notice_id = #{noticeId,jdbcType=INTEGER} + + + + insert into + (notice_id, notice_title, notice_content, + notice_create_time, notice_update_time, + notice_status, notice_order) + values (#{noticeId,jdbcType=INTEGER}, #{noticeTitle,jdbcType=VARCHAR}, #{noticeContent,jdbcType=VARCHAR}, + #{noticeCreateTime,jdbcType=TIMESTAMP}, #{noticeUpdateTime,jdbcType=TIMESTAMP}, + #{noticeStatus,jdbcType=INTEGER}, #{noticeOrder,jdbcType=INTEGER}) + + + + update + + notice_title = #{noticeTitle,jdbcType=VARCHAR}, + notice_content = #{noticeContent,jdbcType=VARCHAR}, + notice_create_time = #{noticeCreateTime,jdbcType=TIMESTAMP}, + notice_update_time = #{noticeUpdateTime,jdbcType=TIMESTAMP}, + notice_status = #{noticeStatus,jdbcType=INTEGER}, + notice_order = #{noticeOrder,jdbcType=INTEGER}, + + where notice_id = #{noticeId,jdbcType=INTEGER} + + + + update + set notice_title = #{noticeTitle,jdbcType=VARCHAR}, + notice_content = #{noticeContent,jdbcType=VARCHAR}, + notice_create_time = #{noticeCreateTime,jdbcType=TIMESTAMP}, + notice_update_time = #{noticeUpdateTime,jdbcType=TIMESTAMP}, + notice_status = #{noticeStatus,jdbcType=INTEGER}, + notice_order = #{noticeOrder,jdbcType=INTEGER} + where notice_id = #{noticeId,jdbcType=INTEGER} + + + + + + + + + + + \ No newline at end of file diff --git a/ForestBlog/src/main/resources/mapper/OptionsMapper.xml b/ForestBlog/src/main/resources/mapper/OptionsMapper.xml new file mode 100755 index 00000000..fdd73c6b --- /dev/null +++ b/ForestBlog/src/main/resources/mapper/OptionsMapper.xml @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + + + + + + option_id, option_site_title, option_site_descrption, option_meta_descrption, option_meta_keyword, + option_aboutsite_avatar, option_aboutsite_title, option_aboutsite_content, option_aboutsite_wechat, + option_aboutsite_qq, option_aboutsite_github, option_aboutsite_weibo, option_tongji, + option_status + + + options + + + + + delete from + + where option_id = #{optionId,jdbcType=INTEGER} + + + + insert into + + (option_id, option_site_title, option_site_descrption, + option_meta_descrption, option_meta_keyword, + option_aboutsite_avatar, option_aboutsite_title, + option_aboutsite_content, option_aboutsite_wechat, + option_aboutsite_qq, option_aboutsite_github, + option_aboutsite_weibo, option_tongji, option_status + ) + values (#{optionId,jdbcType=INTEGER}, #{optionSiteTitle,jdbcType=VARCHAR}, + #{optionSiteDescrption,jdbcType=VARCHAR}, + #{optionMetaDescrption,jdbcType=VARCHAR}, #{optionMetaKeyword,jdbcType=VARCHAR}, + #{optionAboutsiteAvatar,jdbcType=VARCHAR}, #{optionAboutsiteTitle,jdbcType=VARCHAR}, + #{optionAboutsiteContent,jdbcType=VARCHAR}, #{optionAboutsiteWechat,jdbcType=VARCHAR}, + #{optionAboutsiteQq,jdbcType=VARCHAR}, #{optionAboutsiteGithub,jdbcType=VARCHAR}, + #{optionAboutsiteWeibo,jdbcType=VARCHAR}, #{optionTongji,jdbcType=VARCHAR}, #{optionStatus,jdbcType=INTEGER} + ) + + + + update + + + option_site_title = #{optionSiteTitle,jdbcType=VARCHAR}, + option_site_descrption = #{optionSiteDescrption,jdbcType=VARCHAR}, + + option_meta_descrption = #{optionMetaDescrption,jdbcType=VARCHAR}, + + option_meta_keyword = #{optionMetaKeyword,jdbcType=VARCHAR}, + option_aboutsite_avatar = + #{optionAboutsiteAvatar,jdbcType=VARCHAR}, + + option_aboutsite_title = #{optionAboutsiteTitle,jdbcType=VARCHAR}, + + option_aboutsite_content = + #{optionAboutsiteContent,jdbcType=VARCHAR}, + + option_aboutsite_wechat = + #{optionAboutsiteWechat,jdbcType=VARCHAR}, + + option_aboutsite_qq = #{optionAboutsiteQq,jdbcType=VARCHAR}, + option_aboutsite_github = + #{optionAboutsiteGithub,jdbcType=VARCHAR}, + + option_aboutsite_weibo = #{optionAboutsiteWeibo,jdbcType=VARCHAR}, + + option_tongji = #{optionTongji,jdbcType=VARCHAR}, + option_status = #{optionStatus,jdbcType=INTEGER} + + where option_id = #{optionId,jdbcType=INTEGER} + + + + + + \ No newline at end of file diff --git a/ForestBlog/src/main/resources/mapper/PageMapper.xml b/ForestBlog/src/main/resources/mapper/PageMapper.xml new file mode 100755 index 00000000..741591d6 --- /dev/null +++ b/ForestBlog/src/main/resources/mapper/PageMapper.xml @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + page_id, page_key, page_title, page_content, page_create_time, page_update_time, + page_view_count, page_comment_count, page_status + + + page + + + + + delete from + where page_id = #{pageId,jdbcType=INTEGER} + + + + insert into + (page_id, page_key, page_title, + page_content, page_create_time, page_update_time, + page_view_count, page_comment_count, page_status + ) + values (#{pageId,jdbcType=INTEGER}, #{pageKey,jdbcType=VARCHAR}, #{pageTitle,jdbcType=VARCHAR}, + #{pageContent,jdbcType=VARCHAR}, #{pageCreateTime,jdbcType=TIMESTAMP}, #{pageUpdateTime,jdbcType=TIMESTAMP}, + #{pageViewCount,jdbcType=INTEGER}, #{pageCommentCount,jdbcType=INTEGER}, #{pageStatus,jdbcType=INTEGER} + ) + + + + + update + + page_key = #{pageKey,jdbcType=VARCHAR}, + page_title = #{pageTitle,jdbcType=VARCHAR}, + page_content = #{pageContent,jdbcType=VARCHAR}, + page_create_time = #{pageCreateTime,jdbcType=TIMESTAMP}, + page_update_time = #{pageUpdateTime,jdbcType=TIMESTAMP}, + page_view_count = #{pageViewCount,jdbcType=INTEGER}, + page_comment_count = #{pageCommentCount,jdbcType=INTEGER}, + page_status = #{pageStatus,jdbcType=INTEGER} + + where page_id = #{pageId,jdbcType=INTEGER} + + + + + + + + \ No newline at end of file diff --git a/ForestBlog/src/main/resources/mapper/TagMapper.xml b/ForestBlog/src/main/resources/mapper/TagMapper.xml new file mode 100755 index 00000000..d5396e20 --- /dev/null +++ b/ForestBlog/src/main/resources/mapper/TagMapper.xml @@ -0,0 +1,68 @@ + + + + + + + + + + tag_id, tag_name, tag_description + + + tag + + + + + delete from + where tag_id = #{tagId,jdbcType=INTEGER} + + + + insert into + (tag_name, tag_description) + values (#{tagName,jdbcType=VARCHAR}, #{tagDescription,jdbcType=VARCHAR}) + + + + + update + + + tag_name = #{tagName,jdbcType=VARCHAR}, + + + tag_description = #{tagDescription,jdbcType=VARCHAR} + + + where tag_id = #{tagId,jdbcType=INTEGER} + + + + + + + + + + + \ No newline at end of file diff --git a/ForestBlog/src/main/resources/mapper/UserMapper.xml b/ForestBlog/src/main/resources/mapper/UserMapper.xml new file mode 100755 index 00000000..aab46d88 --- /dev/null +++ b/ForestBlog/src/main/resources/mapper/UserMapper.xml @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + user + + + user_id, user_name, user_pass, user_nickname, user_email, user_url, user_avatar, + user_last_login_ip, user_register_time, user_last_login_time, user_status, user_role + + + + + + delete from + + where user_id = #{userId,jdbcType=INTEGER} + + + + insert into + + (user_id, user_name, user_pass, + user_nickname, user_email, user_url, + user_avatar, user_last_login_ip, user_register_time, + user_last_login_time, user_status, user_role) + values (#{userId,jdbcType=INTEGER}, #{userName,jdbcType=VARCHAR}, #{userPass,jdbcType=VARCHAR}, + #{userNickname,jdbcType=VARCHAR}, #{userEmail,jdbcType=VARCHAR}, #{userUrl,jdbcType=VARCHAR}, + #{userAvatar,jdbcType=VARCHAR}, #{userLastLoginIp,jdbcType=VARCHAR}, #{userRegisterTime,jdbcType=TIMESTAMP}, + #{userLastLoginTime,jdbcType=TIMESTAMP}, #{userStatus,jdbcType=INTEGER}, #{userRole,jdbcType=VARCHAR}) + + + + update + + + user_name = #{userName,jdbcType=VARCHAR}, + user_pass = #{userPass,jdbcType=VARCHAR}, + user_nickname = #{userNickname,jdbcType=VARCHAR}, + user_email = #{userEmail,jdbcType=VARCHAR}, + user_url = #{userUrl,jdbcType=VARCHAR}, + user_avatar = #{userAvatar,jdbcType=VARCHAR}, + user_last_login_ip = #{userLastLoginIp,jdbcType=VARCHAR}, + user_register_time = #{userRegisterTime,jdbcType=TIMESTAMP}, + user_last_login_time = #{userLastLoginTime,jdbcType=TIMESTAMP}, + user_status = #{userStatus,jdbcType=INTEGER}, + user_role = #{userRole,jdbcType=VARCHAR}, + + where user_id = #{userId,jdbcType=INTEGER} + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ForestBlog/src/main/resources/mybatis/Configuration.xml b/ForestBlog/src/main/resources/mybatis/Configuration.xml deleted file mode 100755 index 7dc6c906..00000000 --- a/ForestBlog/src/main/resources/mybatis/Configuration.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ForestBlog/src/main/resources/mybatis/mybatis-config.xml b/ForestBlog/src/main/resources/mybatis/mybatis-config.xml new file mode 100644 index 00000000..07ec9eef --- /dev/null +++ b/ForestBlog/src/main/resources/mybatis/mybatis-config.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ForestBlog/src/main/resources/spring/applicationContext-service.xml b/ForestBlog/src/main/resources/spring/applicationContext-service.xml deleted file mode 100755 index 2872eed8..00000000 --- a/ForestBlog/src/main/resources/spring/applicationContext-service.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ForestBlog/src/main/resources/spring/applicationContext-transaction.xml b/ForestBlog/src/main/resources/spring/applicationContext-transaction.xml deleted file mode 100755 index e57978e7..00000000 --- a/ForestBlog/src/main/resources/spring/applicationContext-transaction.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ForestBlog/src/main/resources/spring/spring-mvc.xml b/ForestBlog/src/main/resources/spring/spring-mvc.xml new file mode 100644 index 00000000..e49ec124 --- /dev/null +++ b/ForestBlog/src/main/resources/spring/spring-mvc.xml @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ForestBlog/src/main/resources/spring/applicationContext-dao.xml b/ForestBlog/src/main/resources/spring/spring-mybatis.xml old mode 100755 new mode 100644 similarity index 62% rename from ForestBlog/src/main/resources/spring/applicationContext-dao.xml rename to ForestBlog/src/main/resources/spring/spring-mybatis.xml index 7fe05d34..9a245215 --- a/ForestBlog/src/main/resources/spring/applicationContext-dao.xml +++ b/ForestBlog/src/main/resources/spring/spring-mybatis.xml @@ -1,70 +1,101 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ForestBlog/src/main/resources/spring/springmvc.xml b/ForestBlog/src/main/resources/spring/springmvc.xml deleted file mode 100755 index a3897510..00000000 --- a/ForestBlog/src/main/resources/spring/springmvc.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ForestBlog/src/main/webapp/WEB-INF/lib/c3p0-0.9.2.1.jar b/ForestBlog/src/main/webapp/WEB-INF/lib/c3p0-0.9.2.1.jar deleted file mode 100755 index 10ec0dc7..00000000 Binary files a/ForestBlog/src/main/webapp/WEB-INF/lib/c3p0-0.9.2.1.jar and /dev/null differ diff --git a/ForestBlog/src/main/webapp/WEB-INF/lib/mchange-commons-java-0.2.3.4.jar b/ForestBlog/src/main/webapp/WEB-INF/lib/mchange-commons-java-0.2.3.4.jar deleted file mode 100755 index f03ed884..00000000 Binary files a/ForestBlog/src/main/webapp/WEB-INF/lib/mchange-commons-java-0.2.3.4.jar and /dev/null differ diff --git a/ForestBlog/src/main/webapp/WEB-INF/myTag.tld b/ForestBlog/src/main/webapp/WEB-INF/myTag.tld deleted file mode 100755 index b5e74159..00000000 --- a/ForestBlog/src/main/webapp/WEB-INF/myTag.tld +++ /dev/null @@ -1,18 +0,0 @@ - - 1.0 - 1.2 - SimpleTag - - - htmlFilter - com.liuyanzhao.blog.util.others.HtmlFilterTag - scriptless - - - - htmlFilter - com.liuyanzhao.blog.util.others.HtmlFilterTag - scriptless - - - diff --git a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Article/edit.jsp b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Article/edit.jsp index 7ede2c9f..0fee1f52 100755 --- a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Article/edit.jsp +++ b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Article/edit.jsp @@ -23,45 +23,48 @@ - -
- + +
- +
- +
- +
- +
- +
- - - + + + + selected + >${c.categoryName}
- + + + >${c.categoryName} @@ -69,12 +72,12 @@
-
- - - checked + + + checked >
@@ -82,39 +85,85 @@
- +
输入1-10的数字,order越大排序越前
+
+ +
+
+
+ +

+
+ + +
+
+
- checked> - checked> + checked> + checked>
- +
-
- 温馨提示: - 1、插入代码前,可以点击 代码高亮,将代码转成HTML格式 -
+ + <%--此句必须放在最后--%> -<%@ include file="../Public/framework.jsp"%> +<%@ include file="../Public/framework.jsp" %> diff --git a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Article/index.jsp b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Article/index.jsp index a3768800..732c5853 100755 --- a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Article/index.jsp +++ b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Article/index.jsp @@ -32,244 +32,84 @@
-
    -
  • 已发布(${publishedArticleListVoList[0].page.totalCount})
  • -
  • 草稿(${draftArticleList.size()})
  • -
-
-
-
-
-
- - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
id标题所属分类所带标签order发布时间操作
${a.articleCustom.articleId} - - ${a.articleCustom.articleTitle} - - - - ${c.categoryName} -   - - - - ${t.tagName} -   - - ${a.articleCustom.articleOrder} - - - 编辑 - 删除 -
-
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
用户标题所属分类状态发布时间操作id
+ ${a.user.userNickname} + + + ${a.articleTitle} - - <%--分页 start--%> - + + ${c.categoryName} +   + + - - ${i} + + + 已发布 + - ${i} + + 草稿 + - - <%-- 显示点点点 --%> - - - - <%-- 显示最后一页的数字 --%> - - - ${publishedArticleListVoList[0].page.totalPageCount} - - - <%--下一页 --%> - - - <%--到了尾页隐藏,下一页按钮--%> - - - - - - - - - - - <%--分页 end--%> - - -
- - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - -
id标题所属分类所带标签发布时间操作 + + + 编辑 + 删除 + ${a.articleId}
${a.articleCustom.articleId} - ${a.articleCustom.articleTitle} - - - - ${c.categoryName} -   - - - - ${t.tagName} -   - - - - - 编辑 - 删除 -
-
- + +
+
+ <%@ include file="../Public/paging.jsp" %>
- - + <%@ include file="../Public/framework.jsp" %> diff --git a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Article/insert.jsp b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Article/insert.jsp index c73bcfdc..0d31f631 100755 --- a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Article/insert.jsp +++ b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Article/insert.jsp @@ -43,7 +43,7 @@
+ +
+
+ +
+
+
+ +

+
+ + +
+
+
@@ -75,16 +89,9 @@
- +
-
- 温馨提示:
- 1、文章内容的数据表字段类型为MEDIUMTEXT,每篇文章内容请不要超过500万字
- 2、写文章之前,请确保标签和分类存在,否则可以先新建;请勿刷新页面,博客不会自动保存
- 3、插入代码前,可以点击 代码高亮,将代码转成HTML格式 - -
@@ -93,6 +100,39 @@ + + - - -<%@ include file="../Public/framework.jsp"%> diff --git a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Category/edit.jsp b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Category/edit.jsp index 69762883..5427dc3d 100755 --- a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Category/edit.jsp +++ b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Category/edit.jsp @@ -27,24 +27,24 @@
-
+
修改分类
- +
名称 * - +

父节点 *

分类描述 - +

图标样式 - +

-
- 状态
- checked> - checked> -

@@ -80,76 +75,62 @@


-
- 温馨提示: -
    -
  • 如果该分类为一级分类,父节点将不可修改
  • -
  • 如果该分类为二级分类,父节点可选择其对应的一级目录
  • -
-
-
+
- - - + + + - - - + + - + - - - + + - + - - - + + @@ -167,6 +148,7 @@ + diff --git a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Category/index.jsp b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Category/index.jsp index cd425034..32ab5e02 100755 --- a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Category/index.jsp +++ b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Category/index.jsp @@ -54,7 +54,7 @@ 父节点 *
idpid 名称 文章数状态 操作IDpid
${c.categoryId}${c.categoryPid} ${c.categoryName} ${c.articleCount} - ${c.categoryStatus} - 编辑 删除 ${c.categoryId}${c.categoryPid}
${c2.categoryId}${c2.categoryPid} - ${c2.categoryName} + ——${c2.categoryName} ${c2.articleCount} - ${c2.categoryStatus} - 编辑 删除 ${c2.categoryId}${c2.categoryPid}
- - + + - - - + + - + - - - + + - + - - - + + diff --git a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Comment/edit.jsp b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Comment/edit.jsp index 76f5364f..3a3049d4 100755 --- a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Comment/edit.jsp +++ b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Comment/edit.jsp @@ -1,6 +1,6 @@ <%@ page import="java.security.MessageDigest" %> <%@ page import="java.security.NoSuchAlgorithmException" %> -<%@ page import="com.liuyanzhao.blog.util.Functions" %> +<%@ page import="com.liuyanzhao.ssm.blog.util.MyUtils" %> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> @@ -32,36 +32,29 @@ - +
- +
- +
- +
- -
-
-
- -
- checked> - checked> +
diff --git a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Comment/index.jsp b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Comment/index.jsp index bd4ba5c9..f4044978 100755 --- a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Comment/index.jsp +++ b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Comment/index.jsp @@ -1,6 +1,6 @@ <%@ page import="java.security.MessageDigest" %> <%@ page import="java.security.NoSuchAlgorithmException" %> -<%@ page import="com.liuyanzhao.blog.util.Functions" %> +<%@ page import="com.liuyanzhao.ssm.blog.util.MyUtils" %> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> @@ -17,7 +17,6 @@ .layui-table { margin-top: 0; } - @@ -29,250 +28,78 @@
-
    -
  • 全部评论(${commentListVoList.size()})
  • -
  • 待审评论(${hiddenCommentListVoList.size()})
  • -
-
-
-
IDpid 名称 文章数状态 操作IDpid
${c.categoryId}${c.categoryPid} ${c.categoryName} ${c.articleCount} - - - 显示 - - - 隐藏 - - - 编辑 删除 ${c.categoryId}${c.categoryPid}
${c2.categoryId}${c2.categoryPid} - ${c2.categoryName} + ——${c2.categoryName} ${c2.articleCount} - - - 显示 - - - 隐藏 - - - 编辑 删除 ${c2.categoryId}${c2.categoryPid}
- - - - - - - - - - - - - - - - - - - - -
作者评论内容回复至提交于ID
- - ${c.commentCustom.commentAuthorName} - - [待审] - -
- ${c.commentCustom.commentAuthorUrl}
- ${c.commentCustom.commentAuthorEmail}
- ${c.commentCustom.commentIp} -
- - @ ${c.commentCustom.commentPname} - - ${c.commentCustom.commentContent} -
- - - - 批准 - - - 屏蔽 - - - | + + + + + + + + + + + + + + + + + + + + + + - - - - - - - -
作者评论内容回复至提交于ID
+ + ${c.commentAuthorName} +
+ ${c.commentAuthorUrl}
+ ${c.commentAuthorEmail}
+ ${c.commentIp} +
+ + @ ${c.commentPname} + + ${c.commentContent} +
- + 回复 - | - 编辑 - - | - 删除 - -
-
- ${c.articleCustom.articleTitle} - - - - ${c.commentCustom.commentId} -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + - - - -
作者评论内容回复至提交于ID
- - ${c.commentCustom.commentAuthorName}
- ${c.commentCustom.commentAuthorUrl}
- ${c.commentCustom.commentAuthorEmail}
- ${c.commentCustom.commentIp} -
- - @ ${c.commentCustom.commentPname} - - ${c.commentCustom.commentContent} -
- - - - 批准 - - - 屏蔽 - - - - | - 回复 - - | - 编辑 - - | - 删除 - -
-
- ${c.articleCustom.articleTitle} - - - - ${c.commentCustom.commentId} - + ${c.article.articleTitle} + + + ${c.commentId}
-
+
+ +
- - - <%@ include file="../Public/framework.jsp" %> diff --git a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Comment/reply.jsp b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Comment/reply.jsp index d8730993..11f84bde 100755 --- a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Comment/reply.jsp +++ b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Comment/reply.jsp @@ -1,6 +1,6 @@ <%@ page import="java.security.MessageDigest" %> <%@ page import="java.security.NoSuchAlgorithmException" %> -<%@ page import="com.liuyanzhao.blog.util.Functions" %> +<%@ page import="com.liuyanzhao.ssm.blog.util.MyUtils" %> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> @@ -32,36 +32,17 @@ - - - - + + +
- +
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
diff --git a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Link/edit.jsp b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Link/edit.jsp index 34b2e5b3..ae6e3dd2 100755 --- a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Link/edit.jsp +++ b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Link/edit.jsp @@ -110,7 +110,7 @@ - + ${l.linkId} diff --git a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Link/index.jsp b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Link/index.jsp index cfe66c10..8ab7debb 100755 --- a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Link/index.jsp +++ b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Link/index.jsp @@ -54,7 +54,7 @@ - + ${l.linkName} diff --git a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Link/insert.jsp b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Link/insert.jsp index 98a7ba74..835ca965 100755 --- a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Link/insert.jsp +++ b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Link/insert.jsp @@ -105,7 +105,7 @@ - + ${l.linkId} diff --git a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Menu/edit.jsp b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Menu/edit.jsp index c386c47c..00ff601d 100755 --- a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Menu/edit.jsp +++ b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Menu/edit.jsp @@ -41,49 +41,43 @@
-
+
修改菜单项目
- +
名称 * - +

URL * - +

图标 - +

菜单位置

Order - +

- -
- 状态
- checked> - checked> -

@@ -114,7 +108,6 @@ - @@ -122,12 +115,11 @@ 名称 URL Order - 状态 操作 - + @@ -138,16 +130,6 @@ ${m.menuUrl} ${m.menuOrder} - - - - 隐藏 - - - 显示 - - - 编辑 删除 @@ -172,12 +154,11 @@ 名称 URL Order - 状态 操作 - + @@ -188,16 +169,6 @@ ${m.menuUrl} ${m.menuOrder} - - - - 隐藏 - - - 显示 - - - 编辑 删除 diff --git a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Menu/index.jsp b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Menu/index.jsp index bd8fc737..55dbeab8 100755 --- a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Menu/index.jsp +++ b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Menu/index.jsp @@ -84,7 +84,7 @@
-
+
    @@ -99,7 +99,6 @@ - @@ -108,14 +107,13 @@ 名称 URL Order - 状态 操作 ID - - + + @@ -125,16 +123,6 @@ ${m.menuUrl} ${m.menuOrder} - - - - 隐藏 - - - 显示 - - - 编辑 删除 @@ -158,7 +146,6 @@ - @@ -167,15 +154,14 @@ 名称 URL Order - 状态 操作 ID - - + + @@ -185,16 +171,6 @@ ${m.menuUrl} ${m.menuOrder} - - - - 隐藏 - - - 显示 - - - 编辑 删除 diff --git a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Notice/edit.jsp b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Notice/edit.jsp index f22dd847..de3be767 100755 --- a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Notice/edit.jsp +++ b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Notice/edit.jsp @@ -25,32 +25,32 @@ - +
    - +
    - +
    - +
    输入1-10的数字,order越大排序越前
    - checked> - checked> + checked> + checked>
    @@ -75,7 +75,7 @@ //上传图片,必须放在 创建一个编辑器前面 layedit.set({ uploadImage: { - url: '/uploadFile' //接口url + url: '/admin/upload/img' //接口url ,type: 'post' //默认post } }); diff --git a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Notice/index.jsp b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Notice/index.jsp index 3a068a77..885b5234 100755 --- a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Notice/index.jsp +++ b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Notice/index.jsp @@ -34,17 +34,15 @@ - - - + + - @@ -52,28 +50,24 @@ - + - - + @@ -101,7 +101,7 @@ - + diff --git a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Page/insert.jsp b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Page/insert.jsp index 88eff73d..ca0407c5 100755 --- a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Page/insert.jsp +++ b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Page/insert.jsp @@ -72,7 +72,7 @@ //上传图片,必须放在 创建一个编辑器前面 layedit.set({ uploadImage: { - url: '/uploadFile' //接口url + url: '/admin/upload/img' //接口url , type: 'post' //默认post } }); diff --git a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Public/framework.jsp b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Public/framework.jsp index 3f6d64ad..5785279d 100755 --- a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Public/framework.jsp +++ b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Public/framework.jsp @@ -36,7 +36,6 @@
    文章
    页面
    分类
    -
    标签
    公告
    链接
    @@ -45,11 +44,11 @@
    • - - ${loginUser.userName} + + ${sessionScope.user.userName}
      -
      基本资料
      +
      基本资料
    • @@ -61,7 +60,9 @@
      -
      @@ -130,7 +149,7 @@ @@ -147,4 +166,4 @@ - \ No newline at end of file + diff --git a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Public/paging.jsp b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Public/paging.jsp new file mode 100644 index 00000000..058b9dfc --- /dev/null +++ b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Public/paging.jsp @@ -0,0 +1,82 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8" %> + + <%--分页 start--%> + + <%--分页 end--%> + diff --git a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Tag/edit.jsp b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Tag/edit.jsp index 752e552f..3f5a9381 100755 --- a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Tag/edit.jsp +++ b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Tag/edit.jsp @@ -39,27 +39,21 @@
      -
      +
      编辑标签
      - +
      名称 * - +

      标签描述 - -
      -
      -
      - 状态
      - checked> - checked> +

      @@ -71,42 +65,36 @@
    标题内容 Order 状态 操作
    ${c.noticeTitle} - ${fn:substring(c.noticeContent,0 ,30 )}...... - ${c.noticeOrder} - + 显示 隐藏 - 编辑 diff --git a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Notice/insert.jsp b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Notice/insert.jsp index b7406276..4b5fd432 100755 --- a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Notice/insert.jsp +++ b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Notice/insert.jsp @@ -74,7 +74,7 @@ //上传图片,必须放在 创建一个编辑器前面 layedit.set({ uploadImage: { - url: '/uploadFile' //接口url + url: '/admin/upload/img' //接口url ,type: 'post' //默认post } }); diff --git a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Options/index.jsp b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Options/index.jsp index c3b56e1e..a383623b 100755 --- a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Options/index.jsp +++ b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Options/index.jsp @@ -30,8 +30,8 @@


    - - + + <%--给一个默认值,这个地方很奇怪,本来不需要加的--%> @@ -43,25 +43,25 @@
    - +
    - +
    - +
    - +
    @@ -71,12 +71,12 @@
    -

    - +
    建议 150px*150px
    @@ -85,13 +85,13 @@
    - +
    - +
    @@ -99,12 +99,12 @@
    -

    - +
    建议 430px*430px
    @@ -113,19 +113,19 @@
    - +
    - +
    - +
    @@ -152,7 +152,7 @@ upload = layui.upload; var uploadInst = upload.render({ elem: '#test1', - url: '/uploadFile', + url: '/admin/upload/img', before: function (obj) { obj.preview(function (index, file, result) { $('#demo1').attr('src', result); @@ -182,7 +182,7 @@ upload = layui.upload; var uploadInst = upload.render({ elem: '#test2', - url: '/uploadFile', + url: '/admin/upload/img', before: function (obj) { obj.preview(function (index, file, result) { $('#demo2').attr('src', result); diff --git a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Page/edit.jsp b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Page/edit.jsp index 1f802b59..077ef2ab 100755 --- a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Page/edit.jsp +++ b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Page/edit.jsp @@ -22,11 +22,11 @@ - +
    -
    请填写2到20位,仅允许字母、下划线和减号组成(请确保别名没重复
    @@ -34,7 +34,7 @@
    -
    @@ -43,7 +43,7 @@
    + id="content">${page.pageContent}
    @@ -52,9 +52,9 @@
    checked> + checked> checked> + checked>
    @@ -84,7 +84,7 @@ //上传图片,必须放在 创建一个编辑器前面 layedit.set({ uploadImage: { - url: '/uploadFile' //接口url + url: '/admin/upload/img' //接口url , type: 'post' //默认post } }); diff --git a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Page/index.jsp b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Page/index.jsp index 04fd1bb1..39684497 100755 --- a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Page/index.jsp +++ b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Page/index.jsp @@ -43,7 +43,7 @@
    ${p.pageId}
    ${p.pageKey}
    - - + - - + - + - - + diff --git a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Tag/index.jsp b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Tag/index.jsp index 97d948f8..bad9f95b 100755 --- a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Tag/index.jsp +++ b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/Tag/index.jsp @@ -67,12 +67,11 @@ -
    +
    id 名称 文章数状态 操作id
    ${c.tagId} ${c.tagName} ${c.articleCount} - ${c.tagStatus} - 编辑 删除 - ${c.tagId}
    - - + @@ -81,13 +80,12 @@ - - + -
    名称 文章数状态 操作 ID
    @@ -96,16 +94,6 @@ ${c.articleCount} - - - 显示 - - - 隐藏 - - - 编辑 diff --git a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/User/edit.jsp b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/User/edit.jsp index 381460e5..75fe23fd 100755 --- a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/User/edit.jsp +++ b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/User/edit.jsp @@ -34,25 +34,25 @@

    - +
    -

    - +
    -
    @@ -61,7 +61,7 @@
    -
    @@ -69,7 +69,7 @@
    -
    @@ -78,7 +78,7 @@
    -
    @@ -87,15 +87,15 @@
    -
    - checked> - checked> + checked> + checked>
    @@ -117,7 +117,7 @@ upload = layui.upload; var uploadInst = upload.render({ elem: '#test1', - url: '/uploadFile', + url: '/admin/upload/img', before: function (obj) { obj.preview(function (index, file, result) { $('#demo1').attr('src', result); diff --git a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/User/editProfile.jsp b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/User/editProfile.jsp new file mode 100755 index 00000000..952a4072 --- /dev/null +++ b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/User/editProfile.jsp @@ -0,0 +1,147 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> +<%@ taglib prefix="rapid" uri="http://www.rapid-framework.org.cn/rapid" %> + + + - 编辑个人信息 + + + + + + + +
    + + 首页 + 个人信息 + 编辑用户信息 + +
    +

    + + +
    + +
    +
    +
    + +

    +
    + + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    + +
    + checked> + checked> +
    +
    +
    +
    + + +
    +
    + + + +
    + + + + + +<%@ include file="../Public/framework.jsp" %> diff --git a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/User/index.jsp b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/User/index.jsp index 136e076a..d01182e3 100755 --- a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/User/index.jsp +++ b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/User/index.jsp @@ -1,100 +1,100 @@ -<%@ page language="java" contentType="text/html; charset=UTF-8" - pageEncoding="UTF-8" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> -<%@ taglib prefix="rapid" uri="http://www.rapid-framework.org.cn/rapid" %> - - - - 用户列表 - - - - - - -
    - - 首页 - 用户列表 - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    用户名昵称电子邮件文章状态操作ID
    - - ${u.userName} - - ${u.userNickname} - - ${u.userEmail} - - ${u.articleCount} - - - - 禁用 - - - 正常 - - - - 编辑 - 删除 - - ${u.userId} -
    - -
    - - - - -<%@ include file="../Public/framework.jsp"%> +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> +<%@ taglib prefix="rapid" uri="http://www.rapid-framework.org.cn/rapid" %> + + + - 用户列表 + + + + + + +
    + + 首页 + 用户列表 + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    用户名昵称电子邮件文章状态操作ID
    + + ${u.userName} + + ${u.userNickname} + + ${u.userEmail} + + ${u.articleCount} + + + + 禁用 + + + 正常 + + + + 编辑 + 删除 + + ${u.userId} +
    + +
    + + + + +<%@ include file="../Public/framework.jsp"%> diff --git a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/User/insert.jsp b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/User/insert.jsp index ae3abf65..bd1e429c 100755 --- a/ForestBlog/src/main/webapp/WEB-INF/view/Admin/User/insert.jsp +++ b/ForestBlog/src/main/webapp/WEB-INF/view/Admin/User/insert.jsp @@ -6,7 +6,7 @@ <%@ taglib prefix="rapid" uri="http://www.rapid-framework.org.cn/rapid" %> - - 编辑用户 + - 添加用户 + + + + + +
    +

    ${options.optionSiteTitle}

    +
    +

    + +

    +

    + +

    +

    + +

    +

    + +

    +

    + +

    +

    + +

    +
    + +

    ← 返回到风吟博客 | 登录

    + +
    + + +
    + + + + + + diff --git a/ForestBlog/src/main/webapp/WEB-INF/view/Home/Error/403.jsp b/ForestBlog/src/main/webapp/WEB-INF/view/Home/Error/403.jsp new file mode 100755 index 00000000..362d852b --- /dev/null +++ b/ForestBlog/src/main/webapp/WEB-INF/view/Home/Error/403.jsp @@ -0,0 +1,62 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8" %> + + + + + + 403 没有权限操作 + + + +
    +
    +
    +

    + 403很抱歉,您没有权限操作! +

    +
    +
    +

    可能原因:

    +
      +
    1. 访问了其他用户的数据
    2. +
    3. 系统异常
    4. +
    5. 输入的网址不正确
    6. +
    +
    +
    +

    可以尝试:

    +
      +
    1. 返回首页
    2. +
    3. 留言反馈
    4. +
    5. + 联系站长 +
    6. +
    +
    +
    +
    +
    +
    + + \ No newline at end of file diff --git a/ForestBlog/src/main/webapp/WEB-INF/view/Home/Error/404.jsp b/ForestBlog/src/main/webapp/WEB-INF/view/Home/Error/404.jsp index 422470c4..075db061 100755 --- a/ForestBlog/src/main/webapp/WEB-INF/view/Home/Error/404.jsp +++ b/ForestBlog/src/main/webapp/WEB-INF/view/Home/Error/404.jsp @@ -1,69 +1,62 @@ <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> -<%@ taglib uri="/WEB-INF/myTag.tld" prefix="lyz" %> -<%@ taglib prefix="rapid" uri="http://www.rapid-framework.org.cn/rapid" %> - + - - - - - - 抱歉,无法找到该页面! - - - - -
    - - -
    - - <%--博客主体-左侧正文 start--%> -
    -
    - -
    -

    !404page not found

    -
    -
    -

    您打开的这个的页面不存在!

    -

    当您看到这个页面,表示您的访问出错,这个错误是您打开的页面不存在,请确认您输入的地址是正确的,如果是在本站点击后出现这个页面,请联系站长进行处理,或者请通过下边的搜索重新查找资源。

    -
    -
    -
    -
    - - -
    -
    -
    -       - 返回首页 - 联系站长 -
    -
    -
    -
    +
    +
    +
    +

    + 404很抱歉,您要访问的页面不存在! +

    +
    +
    +

    可能原因:

    +
      +
    1. 网络信号差不稳定
    2. +
    3. 找不到请求的页面
    4. +
    5. 输入的网址不正确
    6. +
    -
    - +
    +

    可以尝试:

    +
      +
    1. 返回首页
    2. +
    3. 留言反馈
    4. +
    5. + 联系站长 +
    6. +
    +
    +
    - <%-- 博客主体-左侧正文 end--%> - - -
    -
    - +
    - + \ No newline at end of file diff --git a/ForestBlog/src/main/webapp/WEB-INF/view/Home/Error/500.jsp b/ForestBlog/src/main/webapp/WEB-INF/view/Home/Error/500.jsp new file mode 100755 index 00000000..de8e43d4 --- /dev/null +++ b/ForestBlog/src/main/webapp/WEB-INF/view/Home/Error/500.jsp @@ -0,0 +1,67 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> +<%@ taglib prefix="rapid" uri="http://www.rapid-framework.org.cn/rapid" %> + + + + + + + + + 抱歉,无法找到该页面! + + + + + + +
    + + +
    + + <%--博客主体-左侧正文 start--%> +
    +
    + +
    +

    !500page not found

    +
    +
    +

    系统内容错误!

    +
    +
    +
    +
    + + +
    +
    +
    +       + 返回首页 + 联系站长 +
    +
    +
    +
    +
    +
    + +
    + <%-- 博客主体-左侧正文 end--%> + + +
    +
    + +
    + + diff --git a/ForestBlog/src/main/webapp/WEB-INF/view/Home/Page/applyLink.jsp b/ForestBlog/src/main/webapp/WEB-INF/view/Home/Page/applyLink.jsp index 37ce5ca7..dd5af816 100755 --- a/ForestBlog/src/main/webapp/WEB-INF/view/Home/Page/applyLink.jsp +++ b/ForestBlog/src/main/webapp/WEB-INF/view/Home/Page/applyLink.jsp @@ -105,6 +105,12 @@ <%--博客主体-左侧文章正文end--%> +<%--侧边栏 start--%> + + <%@include file="../Public/part/sidebar-3.jsp" %> + +<%--侧边栏 end--%> + diff --git a/ForestBlog/src/main/webapp/WEB-INF/view/Home/Page/articleFile.jsp b/ForestBlog/src/main/webapp/WEB-INF/view/Home/Page/articleFile.jsp index 0cbc0940..1c598c0b 100755 --- a/ForestBlog/src/main/webapp/WEB-INF/view/Home/Page/articleFile.jsp +++ b/ForestBlog/src/main/webapp/WEB-INF/view/Home/Page/articleFile.jsp @@ -5,48 +5,54 @@ <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> <%@ taglib prefix="rapid" uri="http://www.rapid-framework.org.cn/rapid" %> - - - + + + - - - + + + - - 文章归档--${options.optionSiteTitle} - + + 文章归档--${options.optionSiteTitle} + - - <%--面包屑导航 start--%> - - <%--面包屑导航 end--%> - + + <%--面包屑导航 start--%> + + <%--面包屑导航 end--%> + - - <%--博客主体-左侧正文 start--%> -
    -
    - -
    -
    -
    + + <%--博客主体-左侧正文 start--%> +
    +
    + +
    +
    +
    + +<%--侧边栏 start--%> + + <%@include file="../Public/part/sidebar-3.jsp" %> + +<%--侧边栏 end--%> <%@ include file="../Public/framework.jsp" %> \ No newline at end of file diff --git a/ForestBlog/src/main/webapp/WEB-INF/view/Home/Page/articleListByCategory.jsp b/ForestBlog/src/main/webapp/WEB-INF/view/Home/Page/articleListByCategory.jsp index e447de59..0e424c7c 100755 --- a/ForestBlog/src/main/webapp/WEB-INF/view/Home/Page/articleListByCategory.jsp +++ b/ForestBlog/src/main/webapp/WEB-INF/view/Home/Page/articleListByCategory.jsp @@ -3,17 +3,16 @@ <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> -<%@ taglib uri="/WEB-INF/myTag.tld" prefix="lyz" %> <%@ taglib prefix="rapid" uri="http://www.rapid-framework.org.cn/rapid" %> - + - + - ${categoryCustom.categoryName} + ${category.categoryName} <%--面包屑导航 start--%> @@ -23,17 +22,9 @@ 首页 - - - - ${articleListVoList[0].categoryCustomList[0].categoryName} - - - ${categoryCustom.categoryName} - - - - 文章 + + ${category.categoryName} + 文章 该分类不存在 @@ -46,212 +37,122 @@ <%--面包屑导航 end--%> - - <%--博客主体-左侧正文 start--%> -
    -
    + + <%--博客主体-左侧正文 start--%> + + + 阅读全文 - - - <%--文章列表-end--%> - - -
    -
    -

    该分类目前还没有文章!

    -



















    -
    -
    -
    - + + + <%--文章列表-end--%>
    -

    该分类不存在

    +

    该分类目前还没有文章!





















    - -
    - - - - <%--分页 start--%> - - <%--分页 end--%> - + +
    +
    +

    该分类不存在

    +



















    +
    +
    +
    -
    - <%-- 博客主体-左侧正文 end--%> -
    + + + <%@ include file="../Public/part/paging.jsp" %> + +
    + <%-- 博客主体-左侧正文 end--%> + <%@ include file="../Public/framework.jsp" %> \ No newline at end of file diff --git a/ForestBlog/src/main/webapp/WEB-INF/view/Home/Page/articleListByTag.jsp b/ForestBlog/src/main/webapp/WEB-INF/view/Home/Page/articleListByTag.jsp index 80f5eec8..70ac7fa2 100755 --- a/ForestBlog/src/main/webapp/WEB-INF/view/Home/Page/articleListByTag.jsp +++ b/ForestBlog/src/main/webapp/WEB-INF/view/Home/Page/articleListByTag.jsp @@ -3,259 +3,135 @@ <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> -<%@ taglib uri="/WEB-INF/myTag.tld" prefix="lyz" %> <%@ taglib prefix="rapid" uri="http://www.rapid-framework.org.cn/rapid" %> - - - - - - - - - - ${tagCustom.tagName} - - - - <%--面包屑导航 start--%> - - <%--面包屑导航 end--%> - - - - - <%--博客主体-左侧正文 start--%> -
    -
    - - - - - - <%--文章列表-start--%> - - - - - <%--文章列表-end--%> - - -
    -
    -

    该标签目前还没有文章!

    -



















    -
    -
    -
    -
    -
    - -
    -
    -

    该标签不存在!

    -



















    -
    -
    -
    -
    - -
    - + + + + + + + + ${category.categoryName} + + +<%--面包屑导航 start--%> + + + +<%--面包屑导航 end--%> + + + + <%--博客主体-左侧正文 start--%> +
    +
    - - - <%--分页 start--%> - - <%--分页 end--%> - + + + + <%--文章列表-end--%> +
    + <%@ include file="../Public/part/paging.jsp" %> - -
    - <%-- 博客主体-左侧正文 end--%> -
    - - - - +
    + <%-- 博客主体-左侧正文 end--%> +
    <%@ include file="../Public/framework.jsp" %> \ No newline at end of file diff --git a/ForestBlog/src/main/webapp/WEB-INF/view/Home/Page/message.jsp b/ForestBlog/src/main/webapp/WEB-INF/view/Home/Page/message.jsp index 94db38f3..312cd154 100755 --- a/ForestBlog/src/main/webapp/WEB-INF/view/Home/Page/message.jsp +++ b/ForestBlog/src/main/webapp/WEB-INF/view/Home/Page/message.jsp @@ -81,6 +81,13 @@ <%--博客主体-左侧文章正文end--%> + +<%--侧边栏 start--%> + + <%@include file="../Public/part/sidebar-3.jsp" %> + +<%--侧边栏 end--%> + - - - + + + + + + diff --git a/ForestBlog/src/main/webapp/WEB-INF/view/Home/Public/part/header.jsp b/ForestBlog/src/main/webapp/WEB-INF/view/Home/Public/part/header.jsp index f08344f3..f4be5852 100755 --- a/ForestBlog/src/main/webapp/WEB-INF/view/Home/Public/part/header.jsp +++ b/ForestBlog/src/main/webapp/WEB-INF/view/Home/Public/part/header.jsp @@ -13,16 +13,17 @@