From 87d1b3a207ec1df1139b2c70facc340956a83842 Mon Sep 17 00:00:00 2001 From: shuzheng <469741414@qq.com> Date: Sun, 19 Mar 2017 14:19:37 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E5=A2=9E=E5=8A=A0=E6=89=80?= =?UTF-8?q?=E6=9C=89=E5=88=86=E7=B1=BB=E3=80=81=E6=89=80=E6=9C=89=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cms/web/controller/IndexController.java | 21 +++++++++++++++++-- .../src/main/webapp/WEB-INF/jsp/index.jsp | 13 +++++++++++- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/controller/IndexController.java b/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/controller/IndexController.java index 9675eb4c..67a87f76 100644 --- a/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/controller/IndexController.java +++ b/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/controller/IndexController.java @@ -1,8 +1,9 @@ package com.zheng.cms.web.controller; -import com.zheng.cms.dao.model.CmsMenu; -import com.zheng.cms.dao.model.CmsMenuExample; +import com.zheng.cms.dao.model.*; +import com.zheng.cms.rpc.api.CmsCategoryService; import com.zheng.cms.rpc.api.CmsMenuService; +import com.zheng.cms.rpc.api.CmsTagService; import com.zheng.common.base.BaseController; import io.swagger.annotations.Api; import org.slf4j.Logger; @@ -26,6 +27,12 @@ public class IndexController extends BaseController { @Autowired private CmsMenuService cmsMenuService; + @Autowired + private CmsCategoryService cmsCategoryService; + + @Autowired + private CmsTagService cmsTagService; + @RequestMapping(value = {"", "/index"}) public String index(Model model) { // 菜单 @@ -33,6 +40,16 @@ public class IndexController extends BaseController { cmsMenuExample.setOrderByClause("orders asc"); List menus = cmsMenuService.selectByExample(cmsMenuExample); model.addAttribute("menus", menus); + // 所有分类 + CmsCategoryExample cmsCategoryExample = new CmsCategoryExample(); + cmsCategoryExample.setOrderByClause("orders asc"); + List categories = cmsCategoryService.selectByExample(cmsCategoryExample); + model.addAttribute("categories", categories); + // 所有标签 + CmsTagExample cmsTagExample = new CmsTagExample(); + cmsTagExample.setOrderByClause("orders asc"); + List tags = cmsTagService.selectByExample(cmsTagExample); + model.addAttribute("tags", tags); return "/index"; } diff --git a/zheng-cms/zheng-cms-web/src/main/webapp/WEB-INF/jsp/index.jsp b/zheng-cms/zheng-cms-web/src/main/webapp/WEB-INF/jsp/index.jsp index 625cb379..372ac2cd 100644 --- a/zheng-cms/zheng-cms-web/src/main/webapp/WEB-INF/jsp/index.jsp +++ b/zheng-cms/zheng-cms-web/src/main/webapp/WEB-INF/jsp/index.jsp @@ -110,7 +110,18 @@
- +
+
所有类目
+ +
${category.name}
+
+
+
+
所有标签
+ +
${tag.name}
+
+