首页增加所有分类、所有标签测试
This commit is contained in:
parent
a21d318d49
commit
87d1b3a207
|
@ -1,8 +1,9 @@
|
||||||
package com.zheng.cms.web.controller;
|
package com.zheng.cms.web.controller;
|
||||||
|
|
||||||
import com.zheng.cms.dao.model.CmsMenu;
|
import com.zheng.cms.dao.model.*;
|
||||||
import com.zheng.cms.dao.model.CmsMenuExample;
|
import com.zheng.cms.rpc.api.CmsCategoryService;
|
||||||
import com.zheng.cms.rpc.api.CmsMenuService;
|
import com.zheng.cms.rpc.api.CmsMenuService;
|
||||||
|
import com.zheng.cms.rpc.api.CmsTagService;
|
||||||
import com.zheng.common.base.BaseController;
|
import com.zheng.common.base.BaseController;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -26,6 +27,12 @@ public class IndexController extends BaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private CmsMenuService cmsMenuService;
|
private CmsMenuService cmsMenuService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CmsCategoryService cmsCategoryService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CmsTagService cmsTagService;
|
||||||
|
|
||||||
@RequestMapping(value = {"", "/index"})
|
@RequestMapping(value = {"", "/index"})
|
||||||
public String index(Model model) {
|
public String index(Model model) {
|
||||||
// 菜单
|
// 菜单
|
||||||
|
@ -33,6 +40,16 @@ public class IndexController extends BaseController {
|
||||||
cmsMenuExample.setOrderByClause("orders asc");
|
cmsMenuExample.setOrderByClause("orders asc");
|
||||||
List<CmsMenu> menus = cmsMenuService.selectByExample(cmsMenuExample);
|
List<CmsMenu> menus = cmsMenuService.selectByExample(cmsMenuExample);
|
||||||
model.addAttribute("menus", menus);
|
model.addAttribute("menus", menus);
|
||||||
|
// 所有分类
|
||||||
|
CmsCategoryExample cmsCategoryExample = new CmsCategoryExample();
|
||||||
|
cmsCategoryExample.setOrderByClause("orders asc");
|
||||||
|
List<CmsCategory> categories = cmsCategoryService.selectByExample(cmsCategoryExample);
|
||||||
|
model.addAttribute("categories", categories);
|
||||||
|
// 所有标签
|
||||||
|
CmsTagExample cmsTagExample = new CmsTagExample();
|
||||||
|
cmsTagExample.setOrderByClause("orders asc");
|
||||||
|
List<CmsTag> tags = cmsTagService.selectByExample(cmsTagExample);
|
||||||
|
model.addAttribute("tags", tags);
|
||||||
return "/index";
|
return "/index";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -110,7 +110,18 @@
|
||||||
<!-- /.navbar -->
|
<!-- /.navbar -->
|
||||||
<!-- .container -->
|
<!-- .container -->
|
||||||
<div class="container" style="min-height: 900px;">
|
<div class="container" style="min-height: 900px;">
|
||||||
|
<dl>
|
||||||
|
<dt>所有类目</dt>
|
||||||
|
<c:forEach var="category" items="${categories}">
|
||||||
|
<dd><a href="${basePath}/category-${category.alias}">${category.name}</a></dd>
|
||||||
|
</c:forEach>
|
||||||
|
</dl>
|
||||||
|
<dl>
|
||||||
|
<dt>所有标签</dt>
|
||||||
|
<c:forEach var="tag" items="${tags}">
|
||||||
|
<dd><a href="${basePath}/tag-${tag.alias}">${tag.name}</a></dd>
|
||||||
|
</c:forEach>
|
||||||
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<!-- /.container -->
|
<!-- /.container -->
|
||||||
<!-- footer -->
|
<!-- footer -->
|
||||||
|
|
Loading…
Reference in New Issue