main
tamguo 7 years ago
parent e909468b4a
commit f7191c7c19

@ -0,0 +1,48 @@
package com.tamguo.web;
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.servlet.ModelAndView;
import com.baomidou.mybatisplus.mapper.Condition;
import com.baomidou.mybatisplus.plugins.Page;
import com.tamguo.modules.book.model.BookEntity;
import com.tamguo.modules.book.service.IBookCategoryService;
import com.tamguo.modules.book.service.IBookService;
import com.tamguo.modules.member.model.MemberEntity;
import com.tamguo.modules.member.service.IMemberService;
@Controller
public class BookCategoryController {
@Autowired
IBookService iBookService;
@Autowired
IMemberService iMemberService;
@Autowired
IBookCategoryService iBookCategoryService;
@SuppressWarnings("unchecked")
@RequestMapping(value="category/{id}.html")
public ModelAndView bookCategory(@PathVariable String id , Integer current , ModelAndView model) {
if(current == null) {
current = 1;
}
model.setViewName("category");
Page<BookEntity> bookPage = iBookService.selectPage(new Page<>(current, 18));
for(BookEntity book : bookPage.getRecords()) {
MemberEntity member = iMemberService.selectById(book.getOwner());
if(member != null) {
book.setMemberName(member.getUsername());
}
}
// 查询分类
model.addObject("bookCategoryList", iBookCategoryService.selectList(Condition.create().eq("parent_id", "0")));
model.addObject("categoryId", id);
model.addObject("bookPage", bookPage);
return model;
}
}

@ -6,8 +6,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import com.baomidou.mybatisplus.mapper.Condition;
import com.baomidou.mybatisplus.plugins.Page;
import com.tamguo.modules.book.model.BookEntity;
import com.tamguo.modules.book.service.IBookCategoryService;
import com.tamguo.modules.book.service.IBookService;
import com.tamguo.modules.member.model.MemberEntity;
import com.tamguo.modules.member.service.IMemberService;
@ -25,7 +27,10 @@ public class IndexController {
IBookService iBookService;
@Autowired
IMemberService iMemberService;
@Autowired
IBookCategoryService iBookCategoryService;
@SuppressWarnings("unchecked")
@RequestMapping(path= {"index" , "/" , "index.html"})
public ModelAndView index(Integer current , ModelAndView model) {
if(current == null) {
@ -40,6 +45,9 @@ public class IndexController {
}
}
model.addObject("bookPage", bookPage);
// 查询分类
model.addObject("bookCategoryList", iBookCategoryService.selectList(Condition.create().eq("parent_id", "0")));
model.setViewName("index");
return model;

@ -0,0 +1,184 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<title>专业的高中书籍托管平台_探书网</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="renderer" content="webkit">
<meta name="author" content="tamguo" />
<meta name="site" content="https://book.tamguo.com" />
<meta name="keywords" content="书籍管理、章节管理、知识点管理、真题解析、试卷管理、专业文档">
<meta name="description" content="book.tamguo.com 是一个面向高中学生的书籍托管平台,提供书籍 、文章、博客、章节、试卷分析、试题分析、知识点分享、打印、下载服务">
<link th:href="${domainName + 'bootstrap/css/bootstrap.min.css'}" rel="stylesheet">
<link th:href="${domainName + 'font-awesome/css/font-awesome.min.css'}" rel="stylesheet">
<link th:href="${domainName + 'css/main.css'}" rel="stylesheet">
<link type="favicon" rel="shortcut icon" th:href="${domainName + 'images/favicon.png'}" />
</head>
<body>
<div class="manual-reader manual-container">
<header class="navbar navbar-static-top navbar-fixed-top manual-header" role="banner">
<div class="container">
<div class="navbar-header col-sm-12 col-md-9 col-lg-8">
<a th:href="${domainName}" class="navbar-brand" title="探果网">
<img alt="logo" src="https://www.tamguo.com/images/logo_731bc32.png">
</a>
<nav class="collapse navbar-collapse col-sm-10">
<ul class="nav navbar-nav">
<li>
<a th:href="${domainName}" title="首页">首页</a>
</li>
<li th:class="${categoryId == category.id} ? 'active' : '' " th:each="category,categoryStatus:${bookCategoryList}">
<a th:href="${domainName + 'category/' + category.id + '.html'}" th:title="${category.name}" th:text="${category.name}">文章</a>
</li>
</ul>
<div class="searchbar pull-left visible-lg-inline-block visible-md-inline-block">
<form class="form-inline" th:action="${domainName}" method="get">
<input class="form-control" name="keyword" type="search" style="width: 230px;" placeholder="请输入关键词..." value="">
<button class="search-btn">
<i class="fa fa-search"></i>
</button>
</form>
</div>
</nav>
<div class="btn-group dropdown-menu-right pull-right slidebar visible-xs-inline-block visible-sm-inline-block">
<button class="btn btn-default dropdown-toggle hidden-lg" type="button" data-toggle="dropdown"><i class="fa fa-align-justify"></i></button>
<ul th:if="${session.currMember == null}" class="dropdown-menu" role="menu">
<li><a th:href="${memberDomain + 'login.html?redirectUrl=' + domainName}" title="用户登录">登录</a></li>
</ul>
<ul th:if="${session.currMember != null}" class="dropdown-menu" role="menu">
<li>
<a th:href="${memberDomain}" title="个人中心"><i class="fa fa-user" aria-hidden="true"></i> 个人中心</a>
</li>
<li>
<a th:href="${memberDomain + 'booklist.html'}" title="我的书籍"><i class="fa fa-book" aria-hidden="true"></i> 我的项目</a>
</li>
<li>
<a th:href="${memberDomain + 'logout.html'}" title="退出登录"><i class="fa fa-sign-out"></i> 退出登录</a>
</li>
</ul>
</div>
</div>
<nav class="navbar-collapse hidden-xs hidden-sm" role="navigation">
<ul th:if="${session.currMember == null}" class="nav navbar-nav navbar-right">
<li><a th:href="${memberDomain + 'login.html?redirectUrl=' + domainName}" title="用户登录">登录</a></li>
</ul>
<ul th:if="${session.currMember != null}" class="nav navbar-nav navbar-right">
<li>
<div class="img user-info" data-toggle="dropdown">
<img th:src="${tamguoDomain + session.currMember.avatar}" onerror="this.src='https://book.tamguo.com/images/avatar.png';" class="img-circle userbar-avatar" th:alt="${session.currMember.nickName}">
<div class="userbar-content">
<span th:text="${session.currMember.nickName}">admin</span>
<div></div>
</div>
<i class="fa fa-chevron-down" aria-hidden="true"></i>
</div>
<ul class="dropdown-menu user-info-dropdown" role="menu">
<li>
<a th:href="${memberDomain}" title="个人中心"><i class="fa fa-user" aria-hidden="true"></i> 个人中心</a>
</li>
<li>
<a th:href="${memberDomain + 'booklist.html'}" title="我的书籍"><i class="fa fa-book" aria-hidden="true"></i> 我的项目</a>
</li>
<li>
<a th:href="${memberDomain + 'logout.html'}" title="退出登录"><i class="fa fa-sign-out"></i> 退出登录</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
</header>
<div class="container manual-body">
<div class="row">
<div class="manual-list">
<div class="list-item" th:each="book,bookstatus:${bookPage.records}">
<dl class="manual-item-standard">
<dt>
<a th:href="${domainName + 'book/' + book.id + '.html'}" th:title="${book.name}" target="_blank">
<img th:src="${book.bookImage}" class="cover" th:alt="${book.name}" onerror="this.src='https://book.tamguo.com/images/book.jpg';">
</a>
</dt>
<dd>
<a th:href="${domainName + 'book/' + book.id + '.html'}" class="name" th:title="${book.name}" target="_blank" th:text="${book.name}">运行支持组</a>
</dd>
<dd>
<span class="author">
<b class="text">作者</b>
<b class="text">-</b>
<b class="text" th:text="${book.memberName}">mayun12</b>
</span>
</dd>
</dl>
</div>
<div class="clearfix"></div>
</div>
<nav class="pagination-container">
<ul class="pagination pagination-lg" >
<li th:class="${bookPage.current==1}?'disabled' : ''"><a href="#">上一页</a></li>
<li th:if="${bookPage.current-3 >=1}" ><a th:href="@{${domainName}+'category/'+${categoryId}+'.html?current=' + ${bookPage.current-3}}" th:text="${bookPage.current -3}" >1</a></li>
<li th:if="${bookPage.current-2 >=1}" ><a th:href="@{${domainName}+'category/'+${categoryId}+'.html?current=' + ${bookPage.current-2}}" th:text="${bookPage.current -2}" >1</a></li>
<li th:if="${bookPage.current-1 >=1}" ><a th:href="@{${domainName}+'category/'+${categoryId}+'.html?current=' + ${bookPage.current-1}}" th:text="${bookPage.current -1}" >1</a></li>
<li class="active"><a href="#" th:text="${bookPage.current}" >1</a></li>
<li th:if="${bookPage.current+1 <=bookPage.pages}" ><a th:href="@{${domainName}+'category/'+${categoryId}+'.html?current=' + ${bookPage.current+1}}" th:text="${bookPage.current +1}" >1</a></li>
<li th:if="${bookPage.current+2 <=bookPage.pages}" ><a th:href="@{${domainName}+'category/'+${categoryId}+'.html?current=' + ${bookPage.current+2}}" th:text="${bookPage.current +2}" >1</a></li>
<li th:if="${bookPage.current+3 <=bookPage.pages}" ><a th:href="@{${domainName}+'category/'+${categoryId}+'.html?current=' + ${bookPage.current+3}}" th:text="${bookPage.current +3}" >1</a></li>
<li th:class="${bookPage.current==bookPage.total}?'disabled' : ''" ><a href="#">下一页</a></li>
</ul>
<div class="clearfix"></div>
</nav>
</div>
</div>
<div class="footer">
<div class="container">
<div class="row text-center border-top">
<span><a href="https://www.tamguo.com/" target="_blank">官方网站</a></span>
<span>&nbsp;·&nbsp;</span>
<span><a th:href="${domainName}" target="_blank">意见反馈</a></span>
<span>&nbsp;·&nbsp;</span>
<span><a th:href="${domainName}" target="_blank">项目源码</a></span>
<span>&nbsp;·&nbsp;</span>
<span><a th:href="${domainName}" target="_blank">使用手册</a></span>
</div>
<div class="row text-center">
<a href="http://www.miitbeian.gov.cn" target="_blank">沪备案号 沪ICP备14022608号-1 Copyright © 2018 Tamguo</a>
</div>
</div>
</div>
</div>
<script th:src="${domainName + 'js/jquery-1.12.4.min.js'}" type="text/javascript"></script>
<script th:src="${domainName + 'bootstrap/js/bootstrap.min.js'}" type="text/javascript"></script>
<script type="text/javascript" th:inline="javascript" th:fragment="footer">
//百度统计 www.tamguo.com
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?98bdca900a06a89f5169831007a557dc";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
(function(){
var bp = document.createElement('script');
var curProtocol = window.location.protocol.split(':')[0];
if (curProtocol === 'https') {
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
}
else {
bp.src = 'http://push.zhanzhang.baidu.com/push.js';
}
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(bp, s);
})();
</script>
</body>
</html>

@ -29,6 +29,9 @@
<li class="active">
<a th:href="${domainName}" title="首页">首页</a>
</li>
<li th:each="category,categoryStatus:${bookCategoryList}">
<a th:href="${domainName + 'category/' + category.id + '.html'}" th:title="${category.name}" th:text="${category.name}">文章</a>
</li>
</ul>
<div class="searchbar pull-left visible-lg-inline-block visible-md-inline-block">
<form class="form-inline" th:action="${domainName}" method="get">

Loading…
Cancel
Save