This commit is contained in:
xxy 2019-09-04 18:44:04 +08:00
parent 7ba6028f26
commit 2ff67f56ef
280 changed files with 33099 additions and 1 deletions

View File

@ -4,7 +4,7 @@
该项目包括了一个小说网站代理和一个独立的小说弹幕网站包括小说在线阅读、TXT下载、小说弹幕、小说自动爬取、小说内容自动分享到微博、链接自动推送到百度搜索引擎等功能。现公布web端代码需要移动端和小程序代码的也可以找我。
#### 软件架构
Springboot+mybatis+Mysql+Ehcache
Springboot+mybatis+Mysql+Ehcache+Layui
#### 安装教程

BIN
books.ndm Normal file

Binary file not shown.

BIN
books_v2.ndm Normal file

Binary file not shown.

BIN
books_v3.ndm Normal file

Binary file not shown.

113
pom.xml Normal file
View File

@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>xyz.zinglizingli</groupId>
<artifactId>search</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>search</name>
<description>搜索引擎</description>
<properties>
<!--开始没加这三个报错Fatal error compiling: 无效的标记: -parameters ->-->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<!--分页助手启动器-->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>com.cuisongliu</groupId>
<artifactId>orderbyhelper-spring-boot-starter</artifactId>
<version>1.0.2</version>
</dependency>
<!--mysql驱动-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.11</version>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.10</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.6</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</repository>
</repositories>
</project>

2
runSearchJava.sh Normal file
View File

@ -0,0 +1,2 @@
setsid java -jar -Dserver.port=8080 -Dbrowser.cookie="SINAGLOBAL=5945695441587.724.1559298271897; __guid=109181959.2094437407894937900.1565875017257.2095; un=13560421324; _s_tentry=-; Apache=8157572449986.1455.1566918991846; ULV=1566918991855:7:6:1:8157572449986.1455.1566918991846:1566086532731; login_sid_t=0cc80b9f5ea5f473e83fce3054291c03; cross_origin_proto=SSL; un=13560421324; YF-Widget-G0=4aade6ec367f09ec0a5eec921227137f; WBtopGlobal_register_version=307744aa77dd5677; SSOLoginState=1566928337; wvr=6; SUBP=0033WrSXqPxfM725Ws9jqgMF55529P9D9WFRg9065OjUyD0aaGsKRxPW5JpX5KMhUgL.Fo-f1hB7SKMp1h52dJLoI0qLxK-L1KqL1-eLxKMLB.-L122LxKMLB.-L122LxK-LBo5L12qLxKnLB-qLBoBLxKMLB.BL1K2t; ALF=1598668299; SCF=AsBEGOtiUG1hPLyZCxI1FunZd9Hg9hWWkgyzcAZjG6AxG74hLk9rofaMoHwpFHFbRkgXJHKRhZp9zaMBBunBaKY.; SUB=_2A25wbPrdDeRhGeNL41YR9SnNwzyIHXVTGGsVrDV8PUNbmtANLXbAkW9NSM603pUp_xGzlKh9nLI6ZnBMRUpaP35e; SUHB=0V5VPdN2jI6D4n; monitor_count=1; UOR=,,book.zinglizingli.xyz; webim_unReadCount=%7B%22time%22%3A1567132442878%2C%22dm_pub_total%22%3A0%2C%22chat_group_client%22%3A0%2C%22allcountNum%22%3A10%2C%22msgbox%22%3A0%7D" search-0.0.1-SNAPSHOT.jar

View File

@ -0,0 +1,36 @@
package xyz.zinglizingli;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import java.io.UnsupportedEncodingException;
@SpringBootApplication
@EnableCaching
@EnableScheduling
@MapperScan({"xyz.zinglizingli.*.mapper"})
public class SearchApplication {
public static void main(String[] args) {
SpringApplication.run(SearchApplication.class, args);
}
/**
* 解决同一时间只能一个定时任务执行的问题
* */
@Bean
public TaskScheduler taskScheduler() {
ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
taskScheduler.setPoolSize(5);
return taskScheduler;
}
}

View File

@ -0,0 +1,8 @@
package xyz.zinglizingli.books.constant;
public class CacheKeyConstans {
public static final String HOT_BOOK_LIST_KEY = "hotBookListKey";
public static final String NEWST_BOOK_LIST_KEY = "newstBookListKey";
public static final String BOOK_CONTENT_KEY_PREFIX = "bookContentKeyPrefix";
public static final String EMAIL_URL_PREFIX_KEY = "emailUrlPrefixKey";
}

View File

@ -0,0 +1,33 @@
package xyz.zinglizingli.books.mapper;
import org.apache.ibatis.annotations.Param;
import xyz.zinglizingli.books.po.BookContent;
import xyz.zinglizingli.books.po.BookContentExample;
import java.util.List;
public interface BookContentMapper {
int countByExample(BookContentExample example);
int deleteByExample(BookContentExample example);
int deleteByPrimaryKey(Long id);
int insert(BookContent record);
int insertSelective(BookContent record);
List<BookContent> selectByExample(BookContentExample example);
BookContent selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") BookContent record, @Param("example") BookContentExample example);
int updateByExample(@Param("record") BookContent record, @Param("example") BookContentExample example);
int updateByPrimaryKeySelective(BookContent record);
int updateByPrimaryKey(BookContent record);
void insertBatch(List<BookContent> bookContent);
}

View File

@ -0,0 +1,35 @@
package xyz.zinglizingli.books.mapper;
import org.apache.ibatis.annotations.Param;
import xyz.zinglizingli.books.po.BookIndex;
import xyz.zinglizingli.books.po.BookIndexExample;
import java.util.List;
public interface BookIndexMapper {
int countByExample(BookIndexExample example);
int deleteByExample(BookIndexExample example);
int deleteByPrimaryKey(Long id);
int insert(BookIndex record);
int insertSelective(BookIndex record);
List<BookIndex> selectByExample(BookIndexExample example);
BookIndex selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") BookIndex record, @Param("example") BookIndexExample example);
int updateByExample(@Param("record") BookIndex record, @Param("example") BookIndexExample example);
int updateByPrimaryKeySelective(BookIndex record);
int updateByPrimaryKey(BookIndex record);
void insertBatch(List<BookIndex> bookIndex);
String queryNewstIndexName(@Param("bookId") Long bookId);
}

View File

@ -0,0 +1,44 @@
package xyz.zinglizingli.books.mapper;
import org.apache.ibatis.annotations.Param;
import xyz.zinglizingli.books.po.Book;
import xyz.zinglizingli.books.po.BookExample;
import java.util.List;
import java.util.Set;
public interface BookMapper {
int countByExample(BookExample example);
int deleteByExample(BookExample example);
int deleteByPrimaryKey(Long id);
int insert(Book record);
int insertSelective(Book record);
List<Book> selectByExample(BookExample example);
Book selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") Book record, @Param("example") BookExample example);
int updateByExample(@Param("record") Book record, @Param("example") BookExample example);
int updateByPrimaryKeySelective(Book record);
int updateByPrimaryKey(Book record);
List<Book> search(@Param("userId") String userId, @Param("ids") String ids, @Param("keyword") String keyword, @Param("catId") Integer catId, @Param("softCat") Integer softCat,@Param("softTag") String softTag, @Param("bookStatus") String bookStatus);
void addVisitCount(@Param("bookId") Long bookId);
Book queryRandomBook();
Book queryNewstBook(Set<Long> sendIds);
List<String> queryNewstBookIdList();
List<String> queryEndBookIdList();
}

View File

@ -0,0 +1,31 @@
package xyz.zinglizingli.books.mapper;
import org.apache.ibatis.annotations.Param;
import xyz.zinglizingli.books.po.Category;
import xyz.zinglizingli.books.po.CategoryExample;
import java.util.List;
public interface CategoryMapper {
int countByExample(CategoryExample example);
int deleteByExample(CategoryExample example);
int deleteByPrimaryKey(Integer id);
int insert(Category record);
int insertSelective(Category record);
List<Category> selectByExample(CategoryExample example);
Category selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("record") Category record, @Param("example") CategoryExample example);
int updateByExample(@Param("record") Category record, @Param("example") CategoryExample example);
int updateByPrimaryKeySelective(Category record);
int updateByPrimaryKey(Category record);
}

View File

@ -0,0 +1,31 @@
package xyz.zinglizingli.books.mapper;
import org.apache.ibatis.annotations.Param;
import xyz.zinglizingli.books.po.ScreenBullet;
import xyz.zinglizingli.books.po.ScreenBulletExample;
import java.util.List;
public interface ScreenBulletMapper {
int countByExample(ScreenBulletExample example);
int deleteByExample(ScreenBulletExample example);
int deleteByPrimaryKey(Long id);
int insert(ScreenBullet record);
int insertSelective(ScreenBullet record);
List<ScreenBullet> selectByExample(ScreenBulletExample example);
ScreenBullet selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") ScreenBullet record, @Param("example") ScreenBulletExample example);
int updateByExample(@Param("record") ScreenBullet record, @Param("example") ScreenBulletExample example);
int updateByPrimaryKeySelective(ScreenBullet record);
int updateByPrimaryKey(ScreenBullet record);
}

View File

@ -0,0 +1,31 @@
package xyz.zinglizingli.books.mapper;
import org.apache.ibatis.annotations.Param;
import xyz.zinglizingli.books.po.User;
import xyz.zinglizingli.books.po.UserExample;
import java.util.List;
public interface UserMapper {
int countByExample(UserExample example);
int deleteByExample(UserExample example);
int deleteByPrimaryKey(Long id);
int insert(User record);
int insertSelective(User record);
List<User> selectByExample(UserExample example);
User selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") User record, @Param("example") UserExample example);
int updateByExample(@Param("record") User record, @Param("example") UserExample example);
int updateByPrimaryKeySelective(User record);
int updateByPrimaryKey(User record);
}

View File

@ -0,0 +1,31 @@
package xyz.zinglizingli.books.mapper;
import org.apache.ibatis.annotations.Param;
import xyz.zinglizingli.books.po.UserRefBook;
import xyz.zinglizingli.books.po.UserRefBookExample;
import java.util.List;
public interface UserRefBookMapper {
int countByExample(UserRefBookExample example);
int deleteByExample(UserRefBookExample example);
int deleteByPrimaryKey(Long id);
int insert(UserRefBook record);
int insertSelective(UserRefBook record);
List<UserRefBook> selectByExample(UserRefBookExample example);
UserRefBook selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") UserRefBook record, @Param("example") UserRefBookExample example);
int updateByExample(@Param("record") UserRefBook record, @Param("example") UserRefBookExample example);
int updateByPrimaryKeySelective(UserRefBook record);
int updateByPrimaryKey(UserRefBook record);
}

View File

@ -0,0 +1,149 @@
package xyz.zinglizingli.books.po;
import java.io.Serializable;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class Book implements Serializable{
private Long id;
private Integer catid;
private String picUrl;
private String bookName;
private String author;
private String bookDesc;
private Float score;
private String bookStatus;
private Long visitCount;
private Date updateTime;
private String updateTimeStr;
private Integer softCat;
private String softTag;
public Integer getSoftCat() {
return softCat;
}
public void setSoftCat(Integer softCat) {
this.softCat = softCat;
}
public String getSoftTag() {
return softTag;
}
public void setSoftTag(String softTag) {
this.softTag = softTag;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Integer getCatid() {
return catid;
}
public void setCatid(Integer catid) {
this.catid = catid;
}
public String getPicUrl() {
return picUrl;
}
public void setPicUrl(String picUrl) {
this.picUrl = picUrl == null ? null : picUrl.trim();
}
public String getBookName() {
return bookName;
}
public void setBookName(String bookName) {
this.bookName = bookName == null ? null : bookName.trim();
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author == null ? null : author.trim();
}
public String getBookDesc() {
return bookDesc;
}
public void setBookDesc(String bookDesc) {
this.bookDesc = bookDesc == null ? null : bookDesc.trim();
}
public Float getScore() {
return score;
}
public void setScore(Float score) {
this.score = score;
}
public String getBookStatus() {
return bookStatus;
}
public void setBookStatus(String bookStatus) {
this.bookStatus = bookStatus == null ? null : bookStatus.trim();
}
public Long getVisitCount() {
return visitCount;
}
public void setVisitCount(Long visitCount) {
this.visitCount = visitCount;
}
public Date getUpdateTime()
{
SimpleDateFormat format = new SimpleDateFormat();
try {
if(this.updateTimeStr != null) {
updateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(this.updateTimeStr);
}
} catch (ParseException e) {
e.printStackTrace();
}
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getUpdateTimeStr() {
return updateTimeStr;
}
public void setUpdateTimeStr(String updateTimeStr) {
this.updateTimeStr = updateTimeStr;
}
}

View File

@ -0,0 +1,55 @@
package xyz.zinglizingli.books.po;
import java.io.Serializable;
public class BookContent implements Serializable {
private Long id;
private Long bookId;
private Long indexId;
private Integer indexNum;
private String content;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getBookId() {
return bookId;
}
public void setBookId(Long bookId) {
this.bookId = bookId;
}
public Long getIndexId() {
return indexId;
}
public void setIndexId(Long indexId) {
this.indexId = indexId;
}
public Integer getIndexNum() {
return indexNum;
}
public void setIndexNum(Integer indexNum) {
this.indexNum = indexNum;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content == null ? null : content.trim();
}
}

View File

@ -0,0 +1,510 @@
package xyz.zinglizingli.books.po;
import java.util.ArrayList;
import java.util.List;
public class BookContentExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public BookContentExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andBookIdIsNull() {
addCriterion("book_id is null");
return (Criteria) this;
}
public Criteria andBookIdIsNotNull() {
addCriterion("book_id is not null");
return (Criteria) this;
}
public Criteria andBookIdEqualTo(Long value) {
addCriterion("book_id =", value, "bookId");
return (Criteria) this;
}
public Criteria andBookIdNotEqualTo(Long value) {
addCriterion("book_id <>", value, "bookId");
return (Criteria) this;
}
public Criteria andBookIdGreaterThan(Long value) {
addCriterion("book_id >", value, "bookId");
return (Criteria) this;
}
public Criteria andBookIdGreaterThanOrEqualTo(Long value) {
addCriterion("book_id >=", value, "bookId");
return (Criteria) this;
}
public Criteria andBookIdLessThan(Long value) {
addCriterion("book_id <", value, "bookId");
return (Criteria) this;
}
public Criteria andBookIdLessThanOrEqualTo(Long value) {
addCriterion("book_id <=", value, "bookId");
return (Criteria) this;
}
public Criteria andBookIdIn(List<Long> values) {
addCriterion("book_id in", values, "bookId");
return (Criteria) this;
}
public Criteria andBookIdNotIn(List<Long> values) {
addCriterion("book_id not in", values, "bookId");
return (Criteria) this;
}
public Criteria andBookIdBetween(Long value1, Long value2) {
addCriterion("book_id between", value1, value2, "bookId");
return (Criteria) this;
}
public Criteria andBookIdNotBetween(Long value1, Long value2) {
addCriterion("book_id not between", value1, value2, "bookId");
return (Criteria) this;
}
public Criteria andIndexIdIsNull() {
addCriterion("index_id is null");
return (Criteria) this;
}
public Criteria andIndexIdIsNotNull() {
addCriterion("index_id is not null");
return (Criteria) this;
}
public Criteria andIndexIdEqualTo(Long value) {
addCriterion("index_id =", value, "indexId");
return (Criteria) this;
}
public Criteria andIndexIdNotEqualTo(Long value) {
addCriterion("index_id <>", value, "indexId");
return (Criteria) this;
}
public Criteria andIndexIdGreaterThan(Long value) {
addCriterion("index_id >", value, "indexId");
return (Criteria) this;
}
public Criteria andIndexIdGreaterThanOrEqualTo(Long value) {
addCriterion("index_id >=", value, "indexId");
return (Criteria) this;
}
public Criteria andIndexIdLessThan(Long value) {
addCriterion("index_id <", value, "indexId");
return (Criteria) this;
}
public Criteria andIndexIdLessThanOrEqualTo(Long value) {
addCriterion("index_id <=", value, "indexId");
return (Criteria) this;
}
public Criteria andIndexIdIn(List<Long> values) {
addCriterion("index_id in", values, "indexId");
return (Criteria) this;
}
public Criteria andIndexIdNotIn(List<Long> values) {
addCriterion("index_id not in", values, "indexId");
return (Criteria) this;
}
public Criteria andIndexIdBetween(Long value1, Long value2) {
addCriterion("index_id between", value1, value2, "indexId");
return (Criteria) this;
}
public Criteria andIndexIdNotBetween(Long value1, Long value2) {
addCriterion("index_id not between", value1, value2, "indexId");
return (Criteria) this;
}
public Criteria andIndexNumIsNull() {
addCriterion("index_num is null");
return (Criteria) this;
}
public Criteria andIndexNumIsNotNull() {
addCriterion("index_num is not null");
return (Criteria) this;
}
public Criteria andIndexNumEqualTo(Integer value) {
addCriterion("index_num =", value, "indexNum");
return (Criteria) this;
}
public Criteria andIndexNumNotEqualTo(Integer value) {
addCriterion("index_num <>", value, "indexNum");
return (Criteria) this;
}
public Criteria andIndexNumGreaterThan(Integer value) {
addCriterion("index_num >", value, "indexNum");
return (Criteria) this;
}
public Criteria andIndexNumGreaterThanOrEqualTo(Integer value) {
addCriterion("index_num >=", value, "indexNum");
return (Criteria) this;
}
public Criteria andIndexNumLessThan(Integer value) {
addCriterion("index_num <", value, "indexNum");
return (Criteria) this;
}
public Criteria andIndexNumLessThanOrEqualTo(Integer value) {
addCriterion("index_num <=", value, "indexNum");
return (Criteria) this;
}
public Criteria andIndexNumIn(List<Integer> values) {
addCriterion("index_num in", values, "indexNum");
return (Criteria) this;
}
public Criteria andIndexNumNotIn(List<Integer> values) {
addCriterion("index_num not in", values, "indexNum");
return (Criteria) this;
}
public Criteria andIndexNumBetween(Integer value1, Integer value2) {
addCriterion("index_num between", value1, value2, "indexNum");
return (Criteria) this;
}
public Criteria andIndexNumNotBetween(Integer value1, Integer value2) {
addCriterion("index_num not between", value1, value2, "indexNum");
return (Criteria) this;
}
public Criteria andContentIsNull() {
addCriterion("content is null");
return (Criteria) this;
}
public Criteria andContentIsNotNull() {
addCriterion("content is not null");
return (Criteria) this;
}
public Criteria andContentEqualTo(String value) {
addCriterion("content =", value, "content");
return (Criteria) this;
}
public Criteria andContentNotEqualTo(String value) {
addCriterion("content <>", value, "content");
return (Criteria) this;
}
public Criteria andContentGreaterThan(String value) {
addCriterion("content >", value, "content");
return (Criteria) this;
}
public Criteria andContentGreaterThanOrEqualTo(String value) {
addCriterion("content >=", value, "content");
return (Criteria) this;
}
public Criteria andContentLessThan(String value) {
addCriterion("content <", value, "content");
return (Criteria) this;
}
public Criteria andContentLessThanOrEqualTo(String value) {
addCriterion("content <=", value, "content");
return (Criteria) this;
}
public Criteria andContentLike(String value) {
addCriterion("content like", value, "content");
return (Criteria) this;
}
public Criteria andContentNotLike(String value) {
addCriterion("content not like", value, "content");
return (Criteria) this;
}
public Criteria andContentIn(List<String> values) {
addCriterion("content in", values, "content");
return (Criteria) this;
}
public Criteria andContentNotIn(List<String> values) {
addCriterion("content not in", values, "content");
return (Criteria) this;
}
public Criteria andContentBetween(String value1, String value2) {
addCriterion("content between", value1, value2, "content");
return (Criteria) this;
}
public Criteria andContentNotBetween(String value1, String value2) {
addCriterion("content not between", value1, value2, "content");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -0,0 +1,851 @@
package xyz.zinglizingli.books.po;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class BookExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public BookExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andCatidIsNull() {
addCriterion("catId is null");
return (Criteria) this;
}
public Criteria andCatidIsNotNull() {
addCriterion("catId is not null");
return (Criteria) this;
}
public Criteria andCatidEqualTo(Integer value) {
addCriterion("catId =", value, "catid");
return (Criteria) this;
}
public Criteria andCatidNotEqualTo(Integer value) {
addCriterion("catId <>", value, "catid");
return (Criteria) this;
}
public Criteria andCatidGreaterThan(Integer value) {
addCriterion("catId >", value, "catid");
return (Criteria) this;
}
public Criteria andCatidGreaterThanOrEqualTo(Integer value) {
addCriterion("catId >=", value, "catid");
return (Criteria) this;
}
public Criteria andCatidLessThan(Integer value) {
addCriterion("catId <", value, "catid");
return (Criteria) this;
}
public Criteria andCatidLessThanOrEqualTo(Integer value) {
addCriterion("catId <=", value, "catid");
return (Criteria) this;
}
public Criteria andCatidIn(List<Integer> values) {
addCriterion("catId in", values, "catid");
return (Criteria) this;
}
public Criteria andCatidNotIn(List<Integer> values) {
addCriterion("catId not in", values, "catid");
return (Criteria) this;
}
public Criteria andCatidBetween(Integer value1, Integer value2) {
addCriterion("catId between", value1, value2, "catid");
return (Criteria) this;
}
public Criteria andCatidNotBetween(Integer value1, Integer value2) {
addCriterion("catId not between", value1, value2, "catid");
return (Criteria) this;
}
public Criteria andPicUrlIsNull() {
addCriterion("pic_url is null");
return (Criteria) this;
}
public Criteria andPicUrlIsNotNull() {
addCriterion("pic_url is not null");
return (Criteria) this;
}
public Criteria andPicUrlEqualTo(String value) {
addCriterion("pic_url =", value, "picUrl");
return (Criteria) this;
}
public Criteria andPicUrlNotEqualTo(String value) {
addCriterion("pic_url <>", value, "picUrl");
return (Criteria) this;
}
public Criteria andPicUrlGreaterThan(String value) {
addCriterion("pic_url >", value, "picUrl");
return (Criteria) this;
}
public Criteria andPicUrlGreaterThanOrEqualTo(String value) {
addCriterion("pic_url >=", value, "picUrl");
return (Criteria) this;
}
public Criteria andPicUrlLessThan(String value) {
addCriterion("pic_url <", value, "picUrl");
return (Criteria) this;
}
public Criteria andPicUrlLessThanOrEqualTo(String value) {
addCriterion("pic_url <=", value, "picUrl");
return (Criteria) this;
}
public Criteria andPicUrlLike(String value) {
addCriterion("pic_url like", value, "picUrl");
return (Criteria) this;
}
public Criteria andPicUrlNotLike(String value) {
addCriterion("pic_url not like", value, "picUrl");
return (Criteria) this;
}
public Criteria andPicUrlIn(List<String> values) {
addCriterion("pic_url in", values, "picUrl");
return (Criteria) this;
}
public Criteria andPicUrlNotIn(List<String> values) {
addCriterion("pic_url not in", values, "picUrl");
return (Criteria) this;
}
public Criteria andPicUrlBetween(String value1, String value2) {
addCriterion("pic_url between", value1, value2, "picUrl");
return (Criteria) this;
}
public Criteria andPicUrlNotBetween(String value1, String value2) {
addCriterion("pic_url not between", value1, value2, "picUrl");
return (Criteria) this;
}
public Criteria andBookNameIsNull() {
addCriterion("book_name is null");
return (Criteria) this;
}
public Criteria andBookNameIsNotNull() {
addCriterion("book_name is not null");
return (Criteria) this;
}
public Criteria andBookNameEqualTo(String value) {
addCriterion("book_name =", value, "bookName");
return (Criteria) this;
}
public Criteria andBookNameNotEqualTo(String value) {
addCriterion("book_name <>", value, "bookName");
return (Criteria) this;
}
public Criteria andBookNameGreaterThan(String value) {
addCriterion("book_name >", value, "bookName");
return (Criteria) this;
}
public Criteria andBookNameGreaterThanOrEqualTo(String value) {
addCriterion("book_name >=", value, "bookName");
return (Criteria) this;
}
public Criteria andBookNameLessThan(String value) {
addCriterion("book_name <", value, "bookName");
return (Criteria) this;
}
public Criteria andBookNameLessThanOrEqualTo(String value) {
addCriterion("book_name <=", value, "bookName");
return (Criteria) this;
}
public Criteria andBookNameLike(String value) {
addCriterion("book_name like", value, "bookName");
return (Criteria) this;
}
public Criteria andBookNameNotLike(String value) {
addCriterion("book_name not like", value, "bookName");
return (Criteria) this;
}
public Criteria andBookNameIn(List<String> values) {
addCriterion("book_name in", values, "bookName");
return (Criteria) this;
}
public Criteria andBookNameNotIn(List<String> values) {
addCriterion("book_name not in", values, "bookName");
return (Criteria) this;
}
public Criteria andBookNameBetween(String value1, String value2) {
addCriterion("book_name between", value1, value2, "bookName");
return (Criteria) this;
}
public Criteria andBookNameNotBetween(String value1, String value2) {
addCriterion("book_name not between", value1, value2, "bookName");
return (Criteria) this;
}
public Criteria andAuthorIsNull() {
addCriterion("author is null");
return (Criteria) this;
}
public Criteria andAuthorIsNotNull() {
addCriterion("author is not null");
return (Criteria) this;
}
public Criteria andAuthorEqualTo(String value) {
addCriterion("author =", value, "author");
return (Criteria) this;
}
public Criteria andAuthorNotEqualTo(String value) {
addCriterion("author <>", value, "author");
return (Criteria) this;
}
public Criteria andAuthorGreaterThan(String value) {
addCriterion("author >", value, "author");
return (Criteria) this;
}
public Criteria andAuthorGreaterThanOrEqualTo(String value) {
addCriterion("author >=", value, "author");
return (Criteria) this;
}
public Criteria andAuthorLessThan(String value) {
addCriterion("author <", value, "author");
return (Criteria) this;
}
public Criteria andAuthorLessThanOrEqualTo(String value) {
addCriterion("author <=", value, "author");
return (Criteria) this;
}
public Criteria andAuthorLike(String value) {
addCriterion("author like", value, "author");
return (Criteria) this;
}
public Criteria andAuthorNotLike(String value) {
addCriterion("author not like", value, "author");
return (Criteria) this;
}
public Criteria andAuthorIn(List<String> values) {
addCriterion("author in", values, "author");
return (Criteria) this;
}
public Criteria andAuthorNotIn(List<String> values) {
addCriterion("author not in", values, "author");
return (Criteria) this;
}
public Criteria andAuthorBetween(String value1, String value2) {
addCriterion("author between", value1, value2, "author");
return (Criteria) this;
}
public Criteria andAuthorNotBetween(String value1, String value2) {
addCriterion("author not between", value1, value2, "author");
return (Criteria) this;
}
public Criteria andBookDescIsNull() {
addCriterion("book_desc is null");
return (Criteria) this;
}
public Criteria andBookDescIsNotNull() {
addCriterion("book_desc is not null");
return (Criteria) this;
}
public Criteria andBookDescEqualTo(String value) {
addCriterion("book_desc =", value, "bookDesc");
return (Criteria) this;
}
public Criteria andBookDescNotEqualTo(String value) {
addCriterion("book_desc <>", value, "bookDesc");
return (Criteria) this;
}
public Criteria andBookDescGreaterThan(String value) {
addCriterion("book_desc >", value, "bookDesc");
return (Criteria) this;
}
public Criteria andBookDescGreaterThanOrEqualTo(String value) {
addCriterion("book_desc >=", value, "bookDesc");
return (Criteria) this;
}
public Criteria andBookDescLessThan(String value) {
addCriterion("book_desc <", value, "bookDesc");
return (Criteria) this;
}
public Criteria andBookDescLessThanOrEqualTo(String value) {
addCriterion("book_desc <=", value, "bookDesc");
return (Criteria) this;
}
public Criteria andBookDescLike(String value) {
addCriterion("book_desc like", value, "bookDesc");
return (Criteria) this;
}
public Criteria andBookDescNotLike(String value) {
addCriterion("book_desc not like", value, "bookDesc");
return (Criteria) this;
}
public Criteria andBookDescIn(List<String> values) {
addCriterion("book_desc in", values, "bookDesc");
return (Criteria) this;
}
public Criteria andBookDescNotIn(List<String> values) {
addCriterion("book_desc not in", values, "bookDesc");
return (Criteria) this;
}
public Criteria andBookDescBetween(String value1, String value2) {
addCriterion("book_desc between", value1, value2, "bookDesc");
return (Criteria) this;
}
public Criteria andBookDescNotBetween(String value1, String value2) {
addCriterion("book_desc not between", value1, value2, "bookDesc");
return (Criteria) this;
}
public Criteria andScoreIsNull() {
addCriterion("score is null");
return (Criteria) this;
}
public Criteria andScoreIsNotNull() {
addCriterion("score is not null");
return (Criteria) this;
}
public Criteria andScoreEqualTo(Float value) {
addCriterion("score =", value, "score");
return (Criteria) this;
}
public Criteria andScoreNotEqualTo(Float value) {
addCriterion("score <>", value, "score");
return (Criteria) this;
}
public Criteria andScoreGreaterThan(Float value) {
addCriterion("score >", value, "score");
return (Criteria) this;
}
public Criteria andScoreGreaterThanOrEqualTo(Float value) {
addCriterion("score >=", value, "score");
return (Criteria) this;
}
public Criteria andScoreLessThan(Float value) {
addCriterion("score <", value, "score");
return (Criteria) this;
}
public Criteria andScoreLessThanOrEqualTo(Float value) {
addCriterion("score <=", value, "score");
return (Criteria) this;
}
public Criteria andScoreIn(List<Float> values) {
addCriterion("score in", values, "score");
return (Criteria) this;
}
public Criteria andScoreNotIn(List<Float> values) {
addCriterion("score not in", values, "score");
return (Criteria) this;
}
public Criteria andScoreBetween(Float value1, Float value2) {
addCriterion("score between", value1, value2, "score");
return (Criteria) this;
}
public Criteria andScoreNotBetween(Float value1, Float value2) {
addCriterion("score not between", value1, value2, "score");
return (Criteria) this;
}
public Criteria andBookStatusIsNull() {
addCriterion("book_status is null");
return (Criteria) this;
}
public Criteria andBookStatusIsNotNull() {
addCriterion("book_status is not null");
return (Criteria) this;
}
public Criteria andBookStatusEqualTo(String value) {
addCriterion("book_status =", value, "bookStatus");
return (Criteria) this;
}
public Criteria andBookStatusNotEqualTo(String value) {
addCriterion("book_status <>", value, "bookStatus");
return (Criteria) this;
}
public Criteria andBookStatusGreaterThan(String value) {
addCriterion("book_status >", value, "bookStatus");
return (Criteria) this;
}
public Criteria andBookStatusGreaterThanOrEqualTo(String value) {
addCriterion("book_status >=", value, "bookStatus");
return (Criteria) this;
}
public Criteria andBookStatusLessThan(String value) {
addCriterion("book_status <", value, "bookStatus");
return (Criteria) this;
}
public Criteria andBookStatusLessThanOrEqualTo(String value) {
addCriterion("book_status <=", value, "bookStatus");
return (Criteria) this;
}
public Criteria andBookStatusLike(String value) {
addCriterion("book_status like", value, "bookStatus");
return (Criteria) this;
}
public Criteria andBookStatusNotLike(String value) {
addCriterion("book_status not like", value, "bookStatus");
return (Criteria) this;
}
public Criteria andBookStatusIn(List<String> values) {
addCriterion("book_status in", values, "bookStatus");
return (Criteria) this;
}
public Criteria andBookStatusNotIn(List<String> values) {
addCriterion("book_status not in", values, "bookStatus");
return (Criteria) this;
}
public Criteria andBookStatusBetween(String value1, String value2) {
addCriterion("book_status between", value1, value2, "bookStatus");
return (Criteria) this;
}
public Criteria andBookStatusNotBetween(String value1, String value2) {
addCriterion("book_status not between", value1, value2, "bookStatus");
return (Criteria) this;
}
public Criteria andVisitCountIsNull() {
addCriterion("visit_count is null");
return (Criteria) this;
}
public Criteria andVisitCountIsNotNull() {
addCriterion("visit_count is not null");
return (Criteria) this;
}
public Criteria andVisitCountEqualTo(Long value) {
addCriterion("visit_count =", value, "visitCount");
return (Criteria) this;
}
public Criteria andVisitCountNotEqualTo(Long value) {
addCriterion("visit_count <>", value, "visitCount");
return (Criteria) this;
}
public Criteria andVisitCountGreaterThan(Long value) {
addCriterion("visit_count >", value, "visitCount");
return (Criteria) this;
}
public Criteria andVisitCountGreaterThanOrEqualTo(Long value) {
addCriterion("visit_count >=", value, "visitCount");
return (Criteria) this;
}
public Criteria andVisitCountLessThan(Long value) {
addCriterion("visit_count <", value, "visitCount");
return (Criteria) this;
}
public Criteria andVisitCountLessThanOrEqualTo(Long value) {
addCriterion("visit_count <=", value, "visitCount");
return (Criteria) this;
}
public Criteria andVisitCountIn(List<Long> values) {
addCriterion("visit_count in", values, "visitCount");
return (Criteria) this;
}
public Criteria andVisitCountNotIn(List<Long> values) {
addCriterion("visit_count not in", values, "visitCount");
return (Criteria) this;
}
public Criteria andVisitCountBetween(Long value1, Long value2) {
addCriterion("visit_count between", value1, value2, "visitCount");
return (Criteria) this;
}
public Criteria andVisitCountNotBetween(Long value1, Long value2) {
addCriterion("visit_count not between", value1, value2, "visitCount");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNull() {
addCriterion("update_time is null");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNotNull() {
addCriterion("update_time is not null");
return (Criteria) this;
}
public Criteria andUpdateTimeEqualTo(Date value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(Date value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(Date value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(Date value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(Date value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<Date> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Date> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(Date value1, Date value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(Date value1, Date value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -0,0 +1,45 @@
package xyz.zinglizingli.books.po;
import java.io.Serializable;
public class BookIndex implements Serializable {
private Long id;
private Long bookId;
private Integer indexNum;
private String indexName;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getBookId() {
return bookId;
}
public void setBookId(Long bookId) {
this.bookId = bookId;
}
public Integer getIndexNum() {
return indexNum;
}
public void setIndexNum(Integer indexNum) {
this.indexNum = indexNum;
}
public String getIndexName() {
return indexName;
}
public void setIndexName(String indexName) {
this.indexName = indexName == null ? null : indexName.trim();
}
}

View File

@ -0,0 +1,450 @@
package xyz.zinglizingli.books.po;
import java.util.ArrayList;
import java.util.List;
public class BookIndexExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public BookIndexExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andBookIdIsNull() {
addCriterion("book_id is null");
return (Criteria) this;
}
public Criteria andBookIdIsNotNull() {
addCriterion("book_id is not null");
return (Criteria) this;
}
public Criteria andBookIdEqualTo(Long value) {
addCriterion("book_id =", value, "bookId");
return (Criteria) this;
}
public Criteria andBookIdNotEqualTo(Long value) {
addCriterion("book_id <>", value, "bookId");
return (Criteria) this;
}
public Criteria andBookIdGreaterThan(Long value) {
addCriterion("book_id >", value, "bookId");
return (Criteria) this;
}
public Criteria andBookIdGreaterThanOrEqualTo(Long value) {
addCriterion("book_id >=", value, "bookId");
return (Criteria) this;
}
public Criteria andBookIdLessThan(Long value) {
addCriterion("book_id <", value, "bookId");
return (Criteria) this;
}
public Criteria andBookIdLessThanOrEqualTo(Long value) {
addCriterion("book_id <=", value, "bookId");
return (Criteria) this;
}
public Criteria andBookIdIn(List<Long> values) {
addCriterion("book_id in", values, "bookId");
return (Criteria) this;
}
public Criteria andBookIdNotIn(List<Long> values) {
addCriterion("book_id not in", values, "bookId");
return (Criteria) this;
}
public Criteria andBookIdBetween(Long value1, Long value2) {
addCriterion("book_id between", value1, value2, "bookId");
return (Criteria) this;
}
public Criteria andBookIdNotBetween(Long value1, Long value2) {
addCriterion("book_id not between", value1, value2, "bookId");
return (Criteria) this;
}
public Criteria andIndexNumIsNull() {
addCriterion("index_num is null");
return (Criteria) this;
}
public Criteria andIndexNumIsNotNull() {
addCriterion("index_num is not null");
return (Criteria) this;
}
public Criteria andIndexNumEqualTo(Integer value) {
addCriterion("index_num =", value, "indexNum");
return (Criteria) this;
}
public Criteria andIndexNumNotEqualTo(Integer value) {
addCriterion("index_num <>", value, "indexNum");
return (Criteria) this;
}
public Criteria andIndexNumGreaterThan(Integer value) {
addCriterion("index_num >", value, "indexNum");
return (Criteria) this;
}
public Criteria andIndexNumGreaterThanOrEqualTo(Integer value) {
addCriterion("index_num >=", value, "indexNum");
return (Criteria) this;
}
public Criteria andIndexNumLessThan(Integer value) {
addCriterion("index_num <", value, "indexNum");
return (Criteria) this;
}
public Criteria andIndexNumLessThanOrEqualTo(Integer value) {
addCriterion("index_num <=", value, "indexNum");
return (Criteria) this;
}
public Criteria andIndexNumIn(List<Integer> values) {
addCriterion("index_num in", values, "indexNum");
return (Criteria) this;
}
public Criteria andIndexNumNotIn(List<Integer> values) {
addCriterion("index_num not in", values, "indexNum");
return (Criteria) this;
}
public Criteria andIndexNumBetween(Integer value1, Integer value2) {
addCriterion("index_num between", value1, value2, "indexNum");
return (Criteria) this;
}
public Criteria andIndexNumNotBetween(Integer value1, Integer value2) {
addCriterion("index_num not between", value1, value2, "indexNum");
return (Criteria) this;
}
public Criteria andIndexNameIsNull() {
addCriterion("index_name is null");
return (Criteria) this;
}
public Criteria andIndexNameIsNotNull() {
addCriterion("index_name is not null");
return (Criteria) this;
}
public Criteria andIndexNameEqualTo(String value) {
addCriterion("index_name =", value, "indexName");
return (Criteria) this;
}
public Criteria andIndexNameNotEqualTo(String value) {
addCriterion("index_name <>", value, "indexName");
return (Criteria) this;
}
public Criteria andIndexNameGreaterThan(String value) {
addCriterion("index_name >", value, "indexName");
return (Criteria) this;
}
public Criteria andIndexNameGreaterThanOrEqualTo(String value) {
addCriterion("index_name >=", value, "indexName");
return (Criteria) this;
}
public Criteria andIndexNameLessThan(String value) {
addCriterion("index_name <", value, "indexName");
return (Criteria) this;
}
public Criteria andIndexNameLessThanOrEqualTo(String value) {
addCriterion("index_name <=", value, "indexName");
return (Criteria) this;
}
public Criteria andIndexNameLike(String value) {
addCriterion("index_name like", value, "indexName");
return (Criteria) this;
}
public Criteria andIndexNameNotLike(String value) {
addCriterion("index_name not like", value, "indexName");
return (Criteria) this;
}
public Criteria andIndexNameIn(List<String> values) {
addCriterion("index_name in", values, "indexName");
return (Criteria) this;
}
public Criteria andIndexNameNotIn(List<String> values) {
addCriterion("index_name not in", values, "indexName");
return (Criteria) this;
}
public Criteria andIndexNameBetween(String value1, String value2) {
addCriterion("index_name between", value1, value2, "indexName");
return (Criteria) this;
}
public Criteria andIndexNameNotBetween(String value1, String value2) {
addCriterion("index_name not between", value1, value2, "indexName");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -0,0 +1,53 @@
package xyz.zinglizingli.books.po;
public class Category {
private Integer id;
private String name;
private Byte sort;
private String getUrl;
private String reqUrl;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public Byte getSort() {
return sort;
}
public void setSort(Byte sort) {
this.sort = sort;
}
public String getGetUrl() {
return getUrl;
}
public void setGetUrl(String getUrl) {
this.getUrl = getUrl == null ? null : getUrl.trim();
}
public String getReqUrl() {
return reqUrl;
}
public void setReqUrl(String reqUrl) {
this.reqUrl = reqUrl == null ? null : reqUrl.trim();
}
}

View File

@ -0,0 +1,530 @@
package xyz.zinglizingli.books.po;
import java.util.ArrayList;
import java.util.List;
public class CategoryExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public CategoryExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Integer value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("name is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("name is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("name =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("name <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("name >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("name >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("name <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("name <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("name like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("name not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("name in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("name not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("name between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("name not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andSortIsNull() {
addCriterion("sort is null");
return (Criteria) this;
}
public Criteria andSortIsNotNull() {
addCriterion("sort is not null");
return (Criteria) this;
}
public Criteria andSortEqualTo(Byte value) {
addCriterion("sort =", value, "sort");
return (Criteria) this;
}
public Criteria andSortNotEqualTo(Byte value) {
addCriterion("sort <>", value, "sort");
return (Criteria) this;
}
public Criteria andSortGreaterThan(Byte value) {
addCriterion("sort >", value, "sort");
return (Criteria) this;
}
public Criteria andSortGreaterThanOrEqualTo(Byte value) {
addCriterion("sort >=", value, "sort");
return (Criteria) this;
}
public Criteria andSortLessThan(Byte value) {
addCriterion("sort <", value, "sort");
return (Criteria) this;
}
public Criteria andSortLessThanOrEqualTo(Byte value) {
addCriterion("sort <=", value, "sort");
return (Criteria) this;
}
public Criteria andSortIn(List<Byte> values) {
addCriterion("sort in", values, "sort");
return (Criteria) this;
}
public Criteria andSortNotIn(List<Byte> values) {
addCriterion("sort not in", values, "sort");
return (Criteria) this;
}
public Criteria andSortBetween(Byte value1, Byte value2) {
addCriterion("sort between", value1, value2, "sort");
return (Criteria) this;
}
public Criteria andSortNotBetween(Byte value1, Byte value2) {
addCriterion("sort not between", value1, value2, "sort");
return (Criteria) this;
}
public Criteria andGetUrlIsNull() {
addCriterion("get_url is null");
return (Criteria) this;
}
public Criteria andGetUrlIsNotNull() {
addCriterion("get_url is not null");
return (Criteria) this;
}
public Criteria andGetUrlEqualTo(String value) {
addCriterion("get_url =", value, "getUrl");
return (Criteria) this;
}
public Criteria andGetUrlNotEqualTo(String value) {
addCriterion("get_url <>", value, "getUrl");
return (Criteria) this;
}
public Criteria andGetUrlGreaterThan(String value) {
addCriterion("get_url >", value, "getUrl");
return (Criteria) this;
}
public Criteria andGetUrlGreaterThanOrEqualTo(String value) {
addCriterion("get_url >=", value, "getUrl");
return (Criteria) this;
}
public Criteria andGetUrlLessThan(String value) {
addCriterion("get_url <", value, "getUrl");
return (Criteria) this;
}
public Criteria andGetUrlLessThanOrEqualTo(String value) {
addCriterion("get_url <=", value, "getUrl");
return (Criteria) this;
}
public Criteria andGetUrlLike(String value) {
addCriterion("get_url like", value, "getUrl");
return (Criteria) this;
}
public Criteria andGetUrlNotLike(String value) {
addCriterion("get_url not like", value, "getUrl");
return (Criteria) this;
}
public Criteria andGetUrlIn(List<String> values) {
addCriterion("get_url in", values, "getUrl");
return (Criteria) this;
}
public Criteria andGetUrlNotIn(List<String> values) {
addCriterion("get_url not in", values, "getUrl");
return (Criteria) this;
}
public Criteria andGetUrlBetween(String value1, String value2) {
addCriterion("get_url between", value1, value2, "getUrl");
return (Criteria) this;
}
public Criteria andGetUrlNotBetween(String value1, String value2) {
addCriterion("get_url not between", value1, value2, "getUrl");
return (Criteria) this;
}
public Criteria andReqUrlIsNull() {
addCriterion("req_url is null");
return (Criteria) this;
}
public Criteria andReqUrlIsNotNull() {
addCriterion("req_url is not null");
return (Criteria) this;
}
public Criteria andReqUrlEqualTo(String value) {
addCriterion("req_url =", value, "reqUrl");
return (Criteria) this;
}
public Criteria andReqUrlNotEqualTo(String value) {
addCriterion("req_url <>", value, "reqUrl");
return (Criteria) this;
}
public Criteria andReqUrlGreaterThan(String value) {
addCriterion("req_url >", value, "reqUrl");
return (Criteria) this;
}
public Criteria andReqUrlGreaterThanOrEqualTo(String value) {
addCriterion("req_url >=", value, "reqUrl");
return (Criteria) this;
}
public Criteria andReqUrlLessThan(String value) {
addCriterion("req_url <", value, "reqUrl");
return (Criteria) this;
}
public Criteria andReqUrlLessThanOrEqualTo(String value) {
addCriterion("req_url <=", value, "reqUrl");
return (Criteria) this;
}
public Criteria andReqUrlLike(String value) {
addCriterion("req_url like", value, "reqUrl");
return (Criteria) this;
}
public Criteria andReqUrlNotLike(String value) {
addCriterion("req_url not like", value, "reqUrl");
return (Criteria) this;
}
public Criteria andReqUrlIn(List<String> values) {
addCriterion("req_url in", values, "reqUrl");
return (Criteria) this;
}
public Criteria andReqUrlNotIn(List<String> values) {
addCriterion("req_url not in", values, "reqUrl");
return (Criteria) this;
}
public Criteria andReqUrlBetween(String value1, String value2) {
addCriterion("req_url between", value1, value2, "reqUrl");
return (Criteria) this;
}
public Criteria andReqUrlNotBetween(String value1, String value2) {
addCriterion("req_url not between", value1, value2, "reqUrl");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -0,0 +1,45 @@
package xyz.zinglizingli.books.po;
import java.util.Date;
public class ScreenBullet {
private Long id;
private Long contentId;
private String screenBullet;
private Date createTime;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getContentId() {
return contentId;
}
public void setContentId(Long contentId) {
this.contentId = contentId;
}
public String getScreenBullet() {
return screenBullet;
}
public void setScreenBullet(String screenBullet) {
this.screenBullet = screenBullet == null ? null : screenBullet.trim();
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}

View File

@ -0,0 +1,451 @@
package xyz.zinglizingli.books.po;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class ScreenBulletExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public ScreenBulletExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andContentIdIsNull() {
addCriterion("content_id is null");
return (Criteria) this;
}
public Criteria andContentIdIsNotNull() {
addCriterion("content_id is not null");
return (Criteria) this;
}
public Criteria andContentIdEqualTo(Long value) {
addCriterion("content_id =", value, "contentId");
return (Criteria) this;
}
public Criteria andContentIdNotEqualTo(Long value) {
addCriterion("content_id <>", value, "contentId");
return (Criteria) this;
}
public Criteria andContentIdGreaterThan(Long value) {
addCriterion("content_id >", value, "contentId");
return (Criteria) this;
}
public Criteria andContentIdGreaterThanOrEqualTo(Long value) {
addCriterion("content_id >=", value, "contentId");
return (Criteria) this;
}
public Criteria andContentIdLessThan(Long value) {
addCriterion("content_id <", value, "contentId");
return (Criteria) this;
}
public Criteria andContentIdLessThanOrEqualTo(Long value) {
addCriterion("content_id <=", value, "contentId");
return (Criteria) this;
}
public Criteria andContentIdIn(List<Long> values) {
addCriterion("content_id in", values, "contentId");
return (Criteria) this;
}
public Criteria andContentIdNotIn(List<Long> values) {
addCriterion("content_id not in", values, "contentId");
return (Criteria) this;
}
public Criteria andContentIdBetween(Long value1, Long value2) {
addCriterion("content_id between", value1, value2, "contentId");
return (Criteria) this;
}
public Criteria andContentIdNotBetween(Long value1, Long value2) {
addCriterion("content_id not between", value1, value2, "contentId");
return (Criteria) this;
}
public Criteria andScreenBulletIsNull() {
addCriterion("screen_bullet is null");
return (Criteria) this;
}
public Criteria andScreenBulletIsNotNull() {
addCriterion("screen_bullet is not null");
return (Criteria) this;
}
public Criteria andScreenBulletEqualTo(String value) {
addCriterion("screen_bullet =", value, "screenBullet");
return (Criteria) this;
}
public Criteria andScreenBulletNotEqualTo(String value) {
addCriterion("screen_bullet <>", value, "screenBullet");
return (Criteria) this;
}
public Criteria andScreenBulletGreaterThan(String value) {
addCriterion("screen_bullet >", value, "screenBullet");
return (Criteria) this;
}
public Criteria andScreenBulletGreaterThanOrEqualTo(String value) {
addCriterion("screen_bullet >=", value, "screenBullet");
return (Criteria) this;
}
public Criteria andScreenBulletLessThan(String value) {
addCriterion("screen_bullet <", value, "screenBullet");
return (Criteria) this;
}
public Criteria andScreenBulletLessThanOrEqualTo(String value) {
addCriterion("screen_bullet <=", value, "screenBullet");
return (Criteria) this;
}
public Criteria andScreenBulletLike(String value) {
addCriterion("screen_bullet like", value, "screenBullet");
return (Criteria) this;
}
public Criteria andScreenBulletNotLike(String value) {
addCriterion("screen_bullet not like", value, "screenBullet");
return (Criteria) this;
}
public Criteria andScreenBulletIn(List<String> values) {
addCriterion("screen_bullet in", values, "screenBullet");
return (Criteria) this;
}
public Criteria andScreenBulletNotIn(List<String> values) {
addCriterion("screen_bullet not in", values, "screenBullet");
return (Criteria) this;
}
public Criteria andScreenBulletBetween(String value1, String value2) {
addCriterion("screen_bullet between", value1, value2, "screenBullet");
return (Criteria) this;
}
public Criteria andScreenBulletNotBetween(String value1, String value2) {
addCriterion("screen_bullet not between", value1, value2, "screenBullet");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -0,0 +1,33 @@
package xyz.zinglizingli.books.po;
public class User {
private Long id;
private String loginName;
private String password;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getLoginName() {
return loginName;
}
public void setLoginName(String loginName) {
this.loginName = loginName == null ? null : loginName.trim();
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password == null ? null : password.trim();
}
}

View File

@ -0,0 +1,400 @@
package xyz.zinglizingli.books.po;
import java.util.ArrayList;
import java.util.List;
public class UserExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public UserExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andLoginNameIsNull() {
addCriterion("login_name is null");
return (Criteria) this;
}
public Criteria andLoginNameIsNotNull() {
addCriterion("login_name is not null");
return (Criteria) this;
}
public Criteria andLoginNameEqualTo(String value) {
addCriterion("login_name =", value, "loginName");
return (Criteria) this;
}
public Criteria andLoginNameNotEqualTo(String value) {
addCriterion("login_name <>", value, "loginName");
return (Criteria) this;
}
public Criteria andLoginNameGreaterThan(String value) {
addCriterion("login_name >", value, "loginName");
return (Criteria) this;
}
public Criteria andLoginNameGreaterThanOrEqualTo(String value) {
addCriterion("login_name >=", value, "loginName");
return (Criteria) this;
}
public Criteria andLoginNameLessThan(String value) {
addCriterion("login_name <", value, "loginName");
return (Criteria) this;
}
public Criteria andLoginNameLessThanOrEqualTo(String value) {
addCriterion("login_name <=", value, "loginName");
return (Criteria) this;
}
public Criteria andLoginNameLike(String value) {
addCriterion("login_name like", value, "loginName");
return (Criteria) this;
}
public Criteria andLoginNameNotLike(String value) {
addCriterion("login_name not like", value, "loginName");
return (Criteria) this;
}
public Criteria andLoginNameIn(List<String> values) {
addCriterion("login_name in", values, "loginName");
return (Criteria) this;
}
public Criteria andLoginNameNotIn(List<String> values) {
addCriterion("login_name not in", values, "loginName");
return (Criteria) this;
}
public Criteria andLoginNameBetween(String value1, String value2) {
addCriterion("login_name between", value1, value2, "loginName");
return (Criteria) this;
}
public Criteria andLoginNameNotBetween(String value1, String value2) {
addCriterion("login_name not between", value1, value2, "loginName");
return (Criteria) this;
}
public Criteria andPasswordIsNull() {
addCriterion("password is null");
return (Criteria) this;
}
public Criteria andPasswordIsNotNull() {
addCriterion("password is not null");
return (Criteria) this;
}
public Criteria andPasswordEqualTo(String value) {
addCriterion("password =", value, "password");
return (Criteria) this;
}
public Criteria andPasswordNotEqualTo(String value) {
addCriterion("password <>", value, "password");
return (Criteria) this;
}
public Criteria andPasswordGreaterThan(String value) {
addCriterion("password >", value, "password");
return (Criteria) this;
}
public Criteria andPasswordGreaterThanOrEqualTo(String value) {
addCriterion("password >=", value, "password");
return (Criteria) this;
}
public Criteria andPasswordLessThan(String value) {
addCriterion("password <", value, "password");
return (Criteria) this;
}
public Criteria andPasswordLessThanOrEqualTo(String value) {
addCriterion("password <=", value, "password");
return (Criteria) this;
}
public Criteria andPasswordLike(String value) {
addCriterion("password like", value, "password");
return (Criteria) this;
}
public Criteria andPasswordNotLike(String value) {
addCriterion("password not like", value, "password");
return (Criteria) this;
}
public Criteria andPasswordIn(List<String> values) {
addCriterion("password in", values, "password");
return (Criteria) this;
}
public Criteria andPasswordNotIn(List<String> values) {
addCriterion("password not in", values, "password");
return (Criteria) this;
}
public Criteria andPasswordBetween(String value1, String value2) {
addCriterion("password between", value1, value2, "password");
return (Criteria) this;
}
public Criteria andPasswordNotBetween(String value1, String value2) {
addCriterion("password not between", value1, value2, "password");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -0,0 +1,33 @@
package xyz.zinglizingli.books.po;
public class UserRefBook {
private Long id;
private Long userId;
private Long bookId;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Long getBookId() {
return bookId;
}
public void setBookId(Long bookId) {
this.bookId = bookId;
}
}

View File

@ -0,0 +1,380 @@
package xyz.zinglizingli.books.po;
import java.util.ArrayList;
import java.util.List;
public class UserRefBookExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public UserRefBookExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andUserIdIsNull() {
addCriterion("user_id is null");
return (Criteria) this;
}
public Criteria andUserIdIsNotNull() {
addCriterion("user_id is not null");
return (Criteria) this;
}
public Criteria andUserIdEqualTo(Long value) {
addCriterion("user_id =", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotEqualTo(Long value) {
addCriterion("user_id <>", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThan(Long value) {
addCriterion("user_id >", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThanOrEqualTo(Long value) {
addCriterion("user_id >=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThan(Long value) {
addCriterion("user_id <", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThanOrEqualTo(Long value) {
addCriterion("user_id <=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdIn(List<Long> values) {
addCriterion("user_id in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotIn(List<Long> values) {
addCriterion("user_id not in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdBetween(Long value1, Long value2) {
addCriterion("user_id between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotBetween(Long value1, Long value2) {
addCriterion("user_id not between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andBookIdIsNull() {
addCriterion("book_id is null");
return (Criteria) this;
}
public Criteria andBookIdIsNotNull() {
addCriterion("book_id is not null");
return (Criteria) this;
}
public Criteria andBookIdEqualTo(Long value) {
addCriterion("book_id =", value, "bookId");
return (Criteria) this;
}
public Criteria andBookIdNotEqualTo(Long value) {
addCriterion("book_id <>", value, "bookId");
return (Criteria) this;
}
public Criteria andBookIdGreaterThan(Long value) {
addCriterion("book_id >", value, "bookId");
return (Criteria) this;
}
public Criteria andBookIdGreaterThanOrEqualTo(Long value) {
addCriterion("book_id >=", value, "bookId");
return (Criteria) this;
}
public Criteria andBookIdLessThan(Long value) {
addCriterion("book_id <", value, "bookId");
return (Criteria) this;
}
public Criteria andBookIdLessThanOrEqualTo(Long value) {
addCriterion("book_id <=", value, "bookId");
return (Criteria) this;
}
public Criteria andBookIdIn(List<Long> values) {
addCriterion("book_id in", values, "bookId");
return (Criteria) this;
}
public Criteria andBookIdNotIn(List<Long> values) {
addCriterion("book_id not in", values, "bookId");
return (Criteria) this;
}
public Criteria andBookIdBetween(Long value1, Long value2) {
addCriterion("book_id between", value1, value2, "bookId");
return (Criteria) this;
}
public Criteria andBookIdNotBetween(Long value1, Long value2) {
addCriterion("book_id not between", value1, value2, "bookId");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -0,0 +1,502 @@
package xyz.zinglizingli.books.service;
import com.github.pagehelper.PageHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.util.StringUtils;
import org.springframework.web.client.RestTemplate;
import tk.mybatis.orderbyhelper.OrderByHelper;
import xyz.zinglizingli.books.constant.CacheKeyConstans;
import xyz.zinglizingli.books.mapper.BookContentMapper;
import xyz.zinglizingli.books.mapper.BookIndexMapper;
import xyz.zinglizingli.books.mapper.BookMapper;
import xyz.zinglizingli.books.mapper.ScreenBulletMapper;
import xyz.zinglizingli.books.po.*;
import xyz.zinglizingli.search.cache.CommonCacheUtil;
import xyz.zinglizingli.search.schedule.SendUrlSchedule;
import xyz.zinglizingli.search.utils.RestTemplateUtil;
import java.util.*;
@Service
public class BookService {
@Autowired
private BookMapper bookMapper;
@Autowired
private BookIndexMapper bookIndexMapper;
@Autowired
private BookContentMapper bookContentMapper;
@Autowired
private ScreenBulletMapper screenBulletMapper;
@Autowired
private CommonCacheUtil cacheUtil;
RestTemplate restTemplate = RestTemplateUtil.getInstance("utf-8");
private Logger log = LoggerFactory.getLogger(BookService.class);
public void saveBookAndIndexAndContent(Book book, List<BookIndex> bookIndex, List<BookContent> bookContent) {
//一次最多只允许插入100条记录,否则影响服务器响应,如果没有插入所有更新则更新时间设为昨天
/*if(bookIndex.size()>100){
book.setUpdateTime(new Date(book.getUpdateTime().getTime()-1000*60*60*24));
}
*/
boolean isUpdate = false;
Long bookId = -1l;
book.setBookName(book.getBookName().trim());
book.setAuthor(book.getAuthor().trim());
BookExample example = new BookExample();
example.createCriteria().andBookNameEqualTo(book.getBookName()).andAuthorEqualTo(book.getAuthor());
List<Book> books = bookMapper.selectByExample(example);
if (books.size() > 0) {
//更新
bookId = books.get(0).getId();
book.setId(bookId);
bookMapper.updateByPrimaryKeySelective(book);
isUpdate = true;
} else {
if (book.getVisitCount() == null) {
Long visitCount = generateVisiteCount(book.getScore());
book.setVisitCount(visitCount);
}
//插入
int rows = bookMapper.insertSelective(book);
if (rows > 0) {
bookId = book.getId();
}
}
if (bookId >= 0) {
//查询目录已存在数量
/* BookIndexExample bookIndexExample = new BookIndexExample();
bookIndexExample.createCriteria().andBookIdEqualTo(bookId);
int indexCount = bookIndexMapper.countByExample(bookIndexExample);*/
BookIndex lastIndex = null;
List<BookIndex> newBookIndexList = new ArrayList<>();
List<BookContent> newContentList = new ArrayList<>();
for (int i = 0; i < bookIndex.size(); i++) {
BookContent bookContentItem = bookContent.get(i);
if (!bookContentItem.getContent().contains("正在手打中,请稍等片刻,内容更新后,需要重新刷新页面,才能获取最新更新")) {
BookIndex bookIndexItem = bookIndex.get(i);
bookIndexItem.setBookId(bookId);
bookContentItem.setBookId(bookId);
//bookContentItem.setIndexId(bookIndexItem.getId());暂时使用bookId和IndexNum查询content
bookContentItem.setIndexNum(bookIndexItem.getIndexNum());
newBookIndexList.add(bookIndexItem);
newContentList.add(bookContentItem);
lastIndex = bookIndexItem;
}
//一次最多只允许插入100条记录,否则影响服务器响应
if (isUpdate && i % 100 == 0 && newBookIndexList.size() > 0) {
insertIndexListAndContentList(newBookIndexList, newContentList);
newBookIndexList = new ArrayList<>();
newContentList = new ArrayList<>();
try {
Thread.sleep(1000 * 60 * 5);
} catch (InterruptedException e) {
log.error(e.getMessage(), e);
throw new RuntimeException(e.getMessage());
}
}
}
if (newBookIndexList.size() > 0) {
insertIndexListAndContentList(newBookIndexList, newContentList);
}
if (isUpdate) {
sendNewstIndex(lastIndex);
} else {
sendNewstBook(bookId);
}
cacheUtil.del(CacheKeyConstans.NEWST_BOOK_LIST_KEY);
}
}
@Transactional
public void insertIndexListAndContentList(List<BookIndex> newBookIndexList, List<BookContent> newContentList) {
bookIndexMapper.insertBatch(newBookIndexList);
bookContentMapper.insertBatch(newContentList);
}
private Long generateVisiteCount(Float score) {
int baseNum = (int) (Math.pow(score * 10, (int) (score - 5)) / 2);
return Long.parseLong(baseNum + new Random().nextInt(1000) + "");
}
/**
* 分页查询
*/
public List<Book> search(int page, int pageSize,
String userId, String ids, String keyword, String bookStatus, Integer catId, Integer softCat, String softTag, String sortBy, String sort) {
if (!StringUtils.isEmpty(userId)) {
sortBy = "user_ref_book.id";
sort = "DESC";
}
PageHelper.startPage(page, pageSize);
// 排序设置[注意orderby 紧跟分页后面]
if (!StringUtils.isEmpty(sortBy)) {
OrderByHelper.orderBy(sortBy + " " + sort);
}
List<Book> books = bookMapper.search(userId, ids, keyword, catId, softCat, softTag, bookStatus);
return books;
}
public String getCatNameById(Integer catid) {
String catName = "其他";
switch (catid) {
case 1: {
catName = "玄幻奇幻";
break;
}
case 2: {
catName = "武侠仙侠";
break;
}
case 3: {
catName = "都市言情";
break;
}
case 4: {
catName = "历史军事";
break;
}
case 5: {
catName = "科幻灵异";
break;
}
case 6: {
catName = "网游竞技";
break;
}
case 7: {
catName = "女生频道";
break;
}
case 8: {
catName = "轻小说";
break;
}
default: {
break;
}
}
return catName;
}
public Book queryBaseInfo(Long bookId) {
return bookMapper.selectByPrimaryKey(bookId);
}
public List<BookIndex> queryNewIndexList(Long bookId) {
PageHelper.startPage(1, 15);
BookIndexExample example = new BookIndexExample();
example.createCriteria().andBookIdEqualTo(bookId);
example.setOrderByClause("index_num DESC");
return bookIndexMapper.selectByExample(example);
}
public List<BookIndex> queryAllIndexList(Long bookId) {
BookIndexExample example = new BookIndexExample();
example.createCriteria().andBookIdEqualTo(bookId);
example.setOrderByClause("index_num ASC");
return bookIndexMapper.selectByExample(example);
}
public BookContent queryBookContent(Long bookId, Integer indexNum) {
BookContent content = (BookContent) cacheUtil.getObject(CacheKeyConstans.BOOK_CONTENT_KEY_PREFIX + "_" + bookId + "_" + indexNum);
if (content == null) {
BookContentExample example = new BookContentExample();
example.createCriteria().andBookIdEqualTo(bookId).andIndexNumEqualTo(indexNum);
List<BookContent> bookContents = bookContentMapper.selectByExample(example);
content = bookContents.size()>0?bookContents.get(0):null;
cacheUtil.setObject(CacheKeyConstans.BOOK_CONTENT_KEY_PREFIX + "_" + bookId + "_" + indexNum, content, 60 * 60 * 24);
}
return content;
}
public void addVisitCount(Long bookId) {
bookMapper.addVisitCount(bookId);
}
public String queryIndexNameByBookIdAndIndexNum(Long bookId, Integer indexNum) {
BookIndexExample example = new BookIndexExample();
example.createCriteria().andBookIdEqualTo(bookId).andIndexNumEqualTo(indexNum);
return bookIndexMapper.selectByExample(example).get(0).getIndexName();
}
public List<Integer> queryMaxAndMinIndexNum(Long bookId) {
List<Integer> result = new ArrayList<>();
BookIndexExample example = new BookIndexExample();
example.createCriteria().andBookIdEqualTo(bookId);
example.setOrderByClause("index_num desc");
List<BookIndex> bookIndices = bookIndexMapper.selectByExample(example);
if(bookIndices.size()>0) {
result.add(bookIndices.get(0).getIndexNum());
result.add(bookIndices.get(bookIndices.size() - 1).getIndexNum());
}
return result;
}
/**
* 查询该书籍目录数量
*/
public List<Integer> queryIndexCountByBookNameAndBAuthor(String bookName, String author) {
List<Integer> result = new ArrayList<>();
BookExample example = new BookExample();
example.createCriteria().andBookNameEqualTo(bookName).andAuthorEqualTo(author);
List<Book> books = bookMapper.selectByExample(example);
if (books.size() > 0) {
Long bookId = books.get(0).getId();
BookIndexExample bookIndexExample = new BookIndexExample();
bookIndexExample.createCriteria().andBookIdEqualTo(bookId);
List<BookIndex> bookIndices = bookIndexMapper.selectByExample(bookIndexExample);
if (bookIndices != null && bookIndices.size() > 0) {
for (BookIndex bookIndex : bookIndices) {
result.add(bookIndex.getIndexNum());
}
}
}
return result;
}
public Book queryRandomBook() {
return bookMapper.queryRandomBook();
}
public Map<String, Object> queryNewstBook() {
final String SENDIDS = "sendWeiboIds";
Set<Long> sendIds = (Set<Long>) cacheUtil.getObject(SENDIDS);
if (sendIds == null) {
sendIds = new HashSet<>();
}
String newstIndexName = null;
Book book = null;
book = bookMapper.queryNewstBook(sendIds);
Map<String, Object> data = new HashMap<>();
if (book != null && book.getId() != null) {
newstIndexName = bookIndexMapper.queryNewstIndexName(book.getId());
if (!StringUtils.isEmpty(newstIndexName)) {
sendIds.add(book.getId());
cacheUtil.setObject(SENDIDS, sendIds, 60 * 60 * 24 * 2);
data.put("book", book);
data.put("newstIndexName", newstIndexName);
}
}
return data;
}
public String getSoftCatNameById(Integer softCat) {
String catName = "其他";
switch (softCat) {
case 21: {
catName = "魔幻";
break;
}
case 22: {
catName = "玄幻";
break;
}
case 23: {
catName = "古风";
break;
}
case 24: {
catName = "科幻";
break;
}
case 25: {
catName = "校园";
break;
}
case 26: {
catName = "都市";
break;
}
case 27: {
catName = "游戏";
break;
}
case 28: {
catName = "同人";
break;
}
case 29: {
catName = "悬疑";
break;
}
case 0: {
catName = "动漫";
break;
}
default: {
break;
}
}
return catName;
}
public void sendBullet(Long contentId, String bullet) {
ScreenBullet screenBullet = new ScreenBullet();
screenBullet.setContentId(contentId);
screenBullet.setScreenBullet(bullet);
screenBullet.setCreateTime(new Date());
screenBulletMapper.insertSelective(screenBullet);
}
public List<ScreenBullet> queryBullet(Long contentId) {
ScreenBulletExample example = new ScreenBulletExample();
example.createCriteria().andContentIdEqualTo(contentId);
example.setOrderByClause("create_time asc");
return screenBulletMapper.selectByExample(example);
}
public String queryIndexList(Long bookId, int count) {
BookIndexExample example = new BookIndexExample();
example.createCriteria().andBookIdEqualTo(bookId).andIndexNumEqualTo(count);
return bookIndexMapper.selectByExample(example).get(0).getIndexName();
}
public String queryContentList(Long bookId, int count) {
BookContentExample example = new BookContentExample();
example.createCriteria().andBookIdEqualTo(bookId).andIndexNumEqualTo(count);
return bookContentMapper.selectByExample(example).get(0).getContent();
}
public int countIndex(Long bookId) {
BookIndexExample example = new BookIndexExample();
example.createCriteria().andBookIdEqualTo(bookId);
return bookIndexMapper.countByExample(example);
}
public List<String> queryNewstBookIdList() {
return bookMapper.queryNewstBookIdList();
}
public List<String> queryEndBookIdList() {
return bookMapper.queryEndBookIdList();
}
private void sendNewstBook(Long bookId) {
if (bookId >= 0) {
//List<String> idList = queryEndBookIdList();
MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.TEXT_PLAIN);
//headers.add("User-Agent","curl/7.12.1");
headers.add("Host", "data.zz.baidu.com");
String reqBody = "";
reqBody += ("https://www.zinglizingli.xyz/book/" + bookId + ".html" + "\n");
//reqBody += ("http://www.zinglizingli.xyz/book/" + bookId + ".html" + "\n");
headers.setContentLength(reqBody.length());
HttpEntity<String> request = new HttpEntity<>(reqBody, headers);
System.out.println("推送数据:" + reqBody);
ResponseEntity<String> stringResponseEntity = restTemplate.postForEntity("http://data.zz.baidu.com/urls?site=www.zinglizingli.xyz&token=IuK7oVrPKe3U606x", request, String.class);
System.out.println("推送URL结果code:" + stringResponseEntity.getStatusCode().value() + ",body:" + stringResponseEntity.getBody());
}
}
private void sendNewstIndex(BookIndex bookIndex) {
if (bookIndex != null) {
MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.TEXT_PLAIN);
//headers.add("User-Agent","curl/7.12.1");
headers.add("Host", "data.zz.baidu.com");
String reqBody = "";
//目录只推送最新一条
reqBody += ("https://www.zinglizingli.xyz/book/" + bookIndex.getBookId() + "/" + bookIndex.getIndexNum() + ".html" + "\n");
//reqBody += ("http://www.zinglizingli.xyz/book/" + index.getBookId() + "/" + index.getIndexNum() + ".html" + "\n");
headers.setContentLength(reqBody.length());
HttpEntity<String> request = new HttpEntity<>(reqBody, headers);
System.out.println("推送数据:" + reqBody);
ResponseEntity<String> stringResponseEntity = restTemplate.postForEntity("http://data.zz.baidu.com/urls?site=www.zinglizingli.xyz&token=IuK7oVrPKe3U606x", request, String.class);
System.out.println("推送URL结果code:" + stringResponseEntity.getStatusCode().value() + ",body:" + stringResponseEntity.getBody());
}
}
public List<Integer> queryPreAndNextIndexNum(Long bookId, Integer indexNum) {
List<Integer> result = new ArrayList<>();
BookIndexExample example = new BookIndexExample();
example.createCriteria().andBookIdEqualTo(bookId).andIndexNumGreaterThan(indexNum);
example.setOrderByClause("index_num asc");
List<BookIndex> bookIndices = bookIndexMapper.selectByExample(example);
if(bookIndices.size()>0){
result.add(bookIndices.get(0).getIndexNum());
}else{
result.add(indexNum);
}
example = new BookIndexExample();
example.createCriteria().andBookIdEqualTo(bookId).andIndexNumLessThan(indexNum);
example.setOrderByClause("index_num DESC");
bookIndices = bookIndexMapper.selectByExample(example);
if(bookIndices.size()>0){
result.add(bookIndices.get(0).getIndexNum());
}else{
result.add(indexNum);
}
return result;
}
}

View File

@ -0,0 +1,113 @@
package xyz.zinglizingli.books.service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.FileSystemResource;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.stereotype.Service;
import javax.mail.MessagingException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import java.io.File;
import java.io.UnsupportedEncodingException;
@Service
public class MailService {
private final Logger logger = LoggerFactory.getLogger(MailService.class);
@Value("${spring.mail.username}")
//使用@Value注入application.properties中指定的用户名
private String from;
String nickName = "精品小说楼";
@Autowired
//用于发送文件
private JavaMailSender mailSender;
public void sendSimpleMail(String to, String subject, String content) {
SimpleMailMessage message = new SimpleMailMessage();
message.setTo(to);//收信人
message.setSubject(subject);//主题
message.setText(content);//内容
message.setFrom(from);//发信人
mailSender.send(message);
}
public void sendHtmlMail(String to, String subject, String content){
logger.info("发送HTML邮件开始{},{},{}", to, subject, content);
//使用MimeMessageMIME协议
MimeMessage message = mailSender.createMimeMessage();
MimeMessageHelper helper;
//MimeMessageHelper帮助我们设置更丰富的内容
try {
helper = new MimeMessageHelper(message, true);
helper.setFrom(new InternetAddress(from, nickName, "UTF-8"));
helper.setTo(to);
helper.setSubject(subject);
helper.setText(content, true);//true代表支持html
mailSender.send(message);
logger.info("发送HTMLto"+to+"邮件成功");
} catch (Exception e) {
logger.error("发送HTML邮件失败", e);
}
}
public void sendAttachmentMail(String to, String subject, String content, String filePath) {
logger.info("发送带附件邮件开始:{},{},{},{}", to, subject, content, filePath);
MimeMessage message = mailSender.createMimeMessage();
MimeMessageHelper helper;
try {
helper = new MimeMessageHelper(message, true);
//true代表支持多组件如附件图片等
helper.setFrom(from);
helper.setTo(to);
helper.setSubject(subject);
helper.setText(content, true);
FileSystemResource file = new FileSystemResource(new File(filePath));
String fileName = file.getFilename();
helper.addAttachment(fileName, file);//添加附件可多次调用该方法添加多个附件
mailSender.send(message);
logger.info("发送带附件邮件成功");
} catch (MessagingException e) {
logger.error("发送带附件邮件失败", e);
}
}
public void sendInlineResourceMail(String to, String subject, String content, String rscPath, String rscId) {
logger.info("发送带图片邮件开始:{},{},{},{},{}", to, subject, content, rscPath, rscId);
MimeMessage message = mailSender.createMimeMessage();
MimeMessageHelper helper;
try {
helper = new MimeMessageHelper(message, true);
helper.setFrom(new InternetAddress(from, nickName, "UTF-8"));
helper.setTo(to);
helper.setSubject(subject);
helper.setText(content, true);
FileSystemResource res = new FileSystemResource(new File(rscPath));
helper.addInline(rscId, res);//重复使用添加多个图片
mailSender.send(message);
logger.info("发送带图片邮件成功");
} catch (Exception e) {
logger.error("发送带图片邮件失败", e);
}
}
}

View File

@ -0,0 +1,86 @@
package xyz.zinglizingli.books.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import xyz.zinglizingli.books.mapper.UserMapper;
import xyz.zinglizingli.books.mapper.UserRefBookMapper;
import xyz.zinglizingli.books.po.User;
import xyz.zinglizingli.books.po.UserExample;
import xyz.zinglizingli.books.po.UserRefBook;
import xyz.zinglizingli.books.po.UserRefBookExample;
import xyz.zinglizingli.books.util.MD5Util;
import java.util.List;
@Service
public class UserService {
@Autowired
private UserMapper userMapper;
@Autowired
private UserRefBookMapper userRefBookMapper;
public boolean isExistLoginName(String loginName) {
UserExample example = new UserExample();
example.createCriteria().andLoginNameEqualTo(loginName);
return userMapper.countByExample(example)>0?true:false;
}
public void regist(User user) {
user.setPassword(MD5Util.MD5Encode(user.getPassword(),"utf-8"));
userMapper.insertSelective(user);
}
public void login(User user) {
UserExample example = new UserExample();
example.createCriteria().andLoginNameEqualTo(user.getLoginName())
.andPasswordEqualTo(MD5Util.MD5Encode(user.getPassword(),"utf-8"));
List<User> users = userMapper.selectByExample(example);
if(users.size() > 0){
user.setId(users.get(0).getId());
}else {
user.setId(null);
}
}
public void addToCollect(Long bookId, long userId) {
UserRefBook userRefBook = new UserRefBook();
userRefBook.setBookId(bookId);
userRefBook.setUserId(userId);
UserRefBookExample example = new UserRefBookExample();
example.createCriteria().andBookIdEqualTo(bookId).andUserIdEqualTo(userId);
userRefBookMapper.deleteByExample(example);
userRefBookMapper.insertSelective(userRefBook);
}
public boolean isCollect(Long bookId, long userId) {
UserRefBookExample example = new UserRefBookExample();
example.createCriteria().andBookIdEqualTo(bookId).andUserIdEqualTo(userId);
return userRefBookMapper.countByExample(example)>0?true:false;
}
public void cancelToCollect(Long bookId, long userId) {
UserRefBookExample example = new UserRefBookExample();
example.createCriteria().andBookIdEqualTo(bookId).andUserIdEqualTo(userId);
userRefBookMapper.deleteByExample(example);
}
public void collectOrCancelBook(Long userid, Long bookId) {
boolean collect = isCollect(bookId, userid);
if(collect){
cancelToCollect(bookId, userid);;
}else{
addToCollect(bookId, userid);
}
}
}

View File

@ -0,0 +1,20 @@
package xyz.zinglizingli.books.util;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class ExcutorUtils {
private static ExecutorService fixedThreadPool;
private static ExecutorService cachedThreadPool ;
static{
fixedThreadPool = Executors.newFixedThreadPool(5);
cachedThreadPool = Executors.newCachedThreadPool();
}
public static void excuteFixedTask(Runnable task){
fixedThreadPool.execute(task);
}
public static void excuteCachedTask(Runnable task){
cachedThreadPool.execute(task);
}
}

View File

@ -0,0 +1,39 @@
package xyz.zinglizingli.books.util;
import java.security.MessageDigest;
public class MD5Util {
private static String byteArrayToHexString(byte b[]) {
StringBuffer resultSb = new StringBuffer();
for (int i = 0; i < b.length; i++)
resultSb.append(byteToHexString(b[i]));
return resultSb.toString();
}
private static String byteToHexString(byte b) {
int n = b;
if (n < 0)
n += 256;
int d1 = n / 16;
int d2 = n % 16;
return hexDigits[d1] + hexDigits[d2];
}
public static String MD5Encode(String origin, String charsetname) {
String resultString = null;
try {
resultString = new String(origin);
MessageDigest md = MessageDigest.getInstance("MD5");
if (charsetname == null || "".equals(charsetname))
resultString = byteArrayToHexString(md.digest(resultString.getBytes()));
else
resultString = byteArrayToHexString(md.digest(resultString.getBytes(charsetname)));
} catch (Exception exception) {
}
return resultString;
}
private static final String hexDigits[] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d",
"e", "f" };
}

View File

@ -0,0 +1,152 @@
package xyz.zinglizingli.books.util;
/****
*
* Project Name:recruit-helper-util
* <p>随机数生成工具类,主要包括<br>
* 中文姓名性别Email手机号住址
* @ClassName: RandomValueUtil
* @date 2018年5月23日 下午2:11:12
*
* @version 1.0
* @since
*/
public class RandomValueUtil {
//public static String base = "abcdefghijklmnopqrstuvwxyz0123456789";
public static String base = "0123456789";
private static String firstName="赵钱孙李周吴郑王冯陈褚卫蒋沈韩杨朱秦尤许何吕施张孔曹严华金魏陶姜戚谢邹喻柏水窦章云苏潘葛奚范彭郎鲁韦昌马苗凤花方俞任袁柳酆鲍史唐费廉岑薛雷贺倪汤滕殷罗毕郝邬安常乐于时傅皮卞齐康伍余元卜顾孟平黄和穆萧尹姚邵湛汪祁毛禹狄米贝明臧计伏成戴谈宋茅庞熊纪舒屈项祝董梁杜阮蓝闵席季麻强贾路娄危江童颜郭梅盛林刁钟徐邱骆高夏蔡田樊胡凌霍虞万支柯咎管卢莫经房裘缪干解应宗宣丁贲邓郁单杭洪包诸左石崔吉钮龚程嵇邢滑裴陆荣翁荀羊於惠甄魏加封芮羿储靳汲邴糜松井段富巫乌焦巴弓牧隗山谷车侯宓蓬全郗班仰秋仲伊宫宁仇栾暴甘钭厉戎祖武符刘姜詹束龙叶幸司韶郜黎蓟薄印宿白怀蒲台从鄂索咸籍赖卓蔺屠蒙池乔阴郁胥能苍双闻莘党翟谭贡劳逄姬申扶堵冉宰郦雍却璩桑桂濮牛寿通边扈燕冀郏浦尚农温别庄晏柴瞿阎充慕连茹习宦艾鱼容向古易慎戈廖庚终暨居衡步都耿满弘匡国文寇广禄阙东殴殳沃利蔚越夔隆师巩厍聂晁勾敖融冷訾辛阚那简饶空曾毋沙乜养鞠须丰巢关蒯相查后江红游竺权逯盖益桓公万俟司马上官欧阳夏侯诸葛闻人东方赫连皇甫尉迟公羊澹台公冶宗政濮阳淳于仲孙太叔申屠公孙乐正轩辕令狐钟离闾丘长孙慕容鲜于宇文司徒司空亓官司寇仉督子车颛孙端木巫马公西漆雕乐正壤驷公良拓拔夹谷宰父谷粱晋楚阎法汝鄢涂钦段干百里东郭南门呼延归海羊舌微生岳帅缑亢况后有琴梁丘左丘东门西门商牟佘佴伯赏南宫墨哈谯笪年爱阳佟第五言福百家姓续";
private static String girl="秀娟英华慧巧美娜静淑惠珠翠雅芝玉萍红娥玲芬芳燕彩春菊兰凤洁梅琳素云莲真环雪荣爱妹霞香月莺媛艳瑞凡佳嘉琼勤珍贞莉桂娣叶璧璐娅琦晶妍茜秋珊莎锦黛青倩婷姣婉娴瑾颖露瑶怡婵雁蓓纨仪荷丹蓉眉君琴蕊薇菁梦岚苑婕馨瑗琰韵融园艺咏卿聪澜纯毓悦昭冰爽琬茗羽希宁欣飘育滢馥筠柔竹霭凝晓欢霄枫芸菲寒伊亚宜可姬舒影荔枝思丽 ";
public static String boy="伟刚勇毅俊峰强军平保东文辉力明永健世广志义兴良海山仁波宁贵福生龙元全国胜学祥才发武新利清飞彬富顺信子杰涛昌成康星光天达安岩中茂进林有坚和彪博诚先敬震振壮会思群豪心邦承乐绍功松善厚庆磊民友裕河哲江超浩亮政谦亨奇固之轮翰朗伯宏言若鸣朋斌梁栋维启克伦翔旭鹏泽晨辰士以建家致树炎德行时泰盛雄琛钧冠策腾楠榕风航弘";
//public static final String[] email_suffix="@gmail.com,@yahoo.com,@msn.com,@hotmail.com,@aol.com,@ask.com,@live.com,@qq.com,@0355.net,@163.com,@163.net,@263.net,@3721.net,@yeah.net,@googlemail.com,@126.com,@sina.com,@sohu.com,@yahoo.com.cn".split(",");
public static final String[] email_suffix="@126.com,@163.com,@139.com,@sina.com,@aliyun.com,@189.cn,@sohu.com,@qq.com,@sogou.com".split(",");
public static int getNum(int start,int end) {
return (int)(Math.random()*(end-start+1)+start);
}
/***
*
* Project Name: recruit-helper-util
* <p>随机生成Email
*
* @date 2018年5月23日 下午2:13:06
* @version v1.0
* @since
* @param lMin
* 最小长度
* @param lMax
* 最大长度
* @return
*/
public static String getEmail(int lMin,int lMax) {
int length=getNum(lMin,lMax);
StringBuffer sb = new StringBuffer();
for (int i = 0; i < length; i++) {
int number = (int)(Math.random()*base.length());
sb.append(base.charAt(number));
}
sb.append(email_suffix[(int)(Math.random()*email_suffix.length)]);
return sb.toString();
}
public static String getEmail() {
String emailTail = email_suffix[(int)(Math.random()*email_suffix.length)];
StringBuffer sb = new StringBuffer();
if(emailTail.equals("@qq.com")) {
int length = getNum(6, 10);
for (int i = 0; i < length; i++) {
int number = (int) (Math.random() * base.length());
sb.append(base.charAt(number));
}
}else{
sb.append(getTelephone());
}
sb.append(emailTail);
return sb.toString();
}
private static String[] telFirst="134,135,136,137,138,139,150,151,152,157,158,159,130,131,132,155,156,133,153".split(",");
/***
*
* Project Name: recruit-helper-util
* <p>随机生成手机号码
*
* @date 2018年5月23日 下午2:14:17
* @version v1.0
* @since
* @return
*/
public static String getTelephone() {
int index=getNum(0,telFirst.length-1);
String first=telFirst[index];
String second=String.valueOf(getNum(1,888)+10000).substring(1);
String thrid=String.valueOf(getNum(1,9100)+10000).substring(1);
return first+second+thrid;
}
/***
*
* Project Name: recruit-helper-util
* <p>随机生成8位电话号码
*
* @date 2018年5月23日 下午2:15:31
* @version v1.0
* @since
* @return
*/
public static String getLandline() {
int index=getNum(0,telFirst.length-1);
String first=telFirst[index];
String second=String.valueOf(getNum(1,888)+10000).substring(1);
String thrid=String.valueOf(getNum(1,9100)+10000).substring(1);
return first+second+thrid;
}
/**
* 返回中文姓名
*/
public static String name_sex = "";
/***
*
* Project Name: recruit-helper-util
* <p>返回中文姓名
*
* @date 2018年5月23日 下午2:16:16
* @version v1.0
* @since
* @return
*/
public static String getChineseName() {
int index = getNum(0, firstName.length() - 1);
String first = firstName.substring(index, index + 1);
int sex = getNum(0, 1);
String str = boy;
int length = boy.length();
if (sex == 0) {
str = girl;
length = girl.length();
name_sex = "";
} else {
name_sex = "";
}
index = getNum(0, length - 1);
String second = str.substring(index, index + 1);
int hasThird = getNum(0, 1);
String third = "";
if (hasThird == 1) {
index = getNum(0, length - 1);
third = str.substring(index, index + 1);
}
return first + second + third;
}
}

View File

@ -0,0 +1,93 @@
package xyz.zinglizingli.books.util;
import java.util.UUID;
public class UUIDUtils {
public static final String[] CHARS = new String[] { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l",
"m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6",
"7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R",
"S", "T", "U", "V", "W", "X", "Y", "Z" };
/**
* 生成指定长度的uuid
*
* @param length
* @return
*/
private static String getUUID(int length, UUID uuid) {
int groupLength = 32 / length;
StringBuilder sb = new StringBuilder();
String id = uuid.toString().replace("-", "");
for (int i = 0; i < length; i++) {
String str = id.substring(i * groupLength, i * groupLength + groupLength);
int x = Integer.parseInt(str, 16);
sb.append(CHARS[x % 0x3E]);
}
return sb.toString();
}
/**
* 8位UUID
*
* @return
*/
public static String getUUID8() {
return getUUID(8, UUID.randomUUID());
}
/**
* 8位UUID
*
* @return
*/
public static String getUUID8(byte[] bytes) {
return getUUID(8, UUID.nameUUIDFromBytes(bytes));
}
/**
* 8位UUID
*
* @return
*/
public static String getUUID8(String fromString) {
return getUUID(8, UUID.fromString(fromString));
}
/**
* 16位UUID
*
* @return
*/
public static String getUUID16() {
return getUUID(16, UUID.randomUUID());
}
/**
* 16位UUID
*
* @return
*/
public static String getUUID16(String fromString) {
return getUUID(16, UUID.fromString(fromString));
}
/**
* 16位UUID
*
* @return
*/
public static String getUUID16(byte[] bytes) {
return getUUID(16, UUID.nameUUIDFromBytes(bytes));
}
/**
* 32位UUID
*
* @return
*/
public static String getUUID32() {
return UUID.randomUUID().toString().replace("-", "");
}
}

View File

@ -0,0 +1,16 @@
package xyz.zinglizingli.books.vo;
import xyz.zinglizingli.books.po.Book;
public class BookVO extends Book {
private String cateName;
public String getCateName() {
return cateName;
}
public void setCateName(String cateName) {
this.cateName = cateName;
}
}

View File

@ -0,0 +1,187 @@
package xyz.zinglizingli.books.web;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import xyz.zinglizingli.books.po.Book;
import xyz.zinglizingli.books.po.BookContent;
import xyz.zinglizingli.books.po.BookIndex;
import xyz.zinglizingli.books.service.BookService;
import xyz.zinglizingli.books.vo.BookVO;
import xyz.zinglizingli.search.cache.CommonCacheUtil;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
@RestController
@RequestMapping("api/book")
public class ApiBookController {
@Autowired
private BookService bookService;
@Autowired
private CommonCacheUtil commonCacheUtil;
@RequestMapping("hotBook")
public List<Book> hotBooks () {
//查询热点数据
List<Book> hotBooks = bookService.search(1, 6, null, null, null, null, null, null, null, "visit_count DESC,score ", "DESC");
return hotBooks;
}
@RequestMapping("newstBook")
public List<Book> newstBook() {
//查询最近更新数据
List<Book> newBooks = bookService.search(1, 6, null, null, null, null, null, null, null, "update_time", "DESC");
return newBooks;
}
@RequestMapping("search")
public Map<String,Object> search(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "20") int pageSize,
@RequestParam(value = "keyword", required = false) String keyword,
@RequestParam(value = "bookStatus", required = false) String bookStatus,
@RequestParam(value = "catId", required = false) Integer catId,
@RequestParam(value = "historyBookIds", required = false) String ids,
@RequestParam(value = "token", required = false) String token,
@RequestParam(value = "sortBy", defaultValue = "update_time") String sortBy, @RequestParam(value = "sort", defaultValue = "DESC") String sort,
HttpServletRequest req, HttpServletResponse resp) {
Map<String,Object> modelMap = new HashMap<>();
String userId = null;
String titleType = "最近更新";
if (catId != null) {
titleType = bookService.getCatNameById(catId);
;
} else if (keyword != null) {
titleType = "搜索";
} else if ("score".equals(sortBy)) {
titleType = "小说排行榜";
} else if (ids != null) {
titleType = "阅读记录";
} else if (token != null) {
userId = commonCacheUtil.get(token);
titleType = "我的书架";
}
modelMap.put("titleType", titleType);
List<Book> books = bookService.search(page, pageSize, userId, ids, keyword,bookStatus, catId, null, null, sortBy, sort);
List<BookVO> bookVOList;
if (StringUtils.isEmpty(ids)) {
bookVOList = new ArrayList<>();
for (Book book : books) {
BookVO bookvo = new BookVO();
BeanUtils.copyProperties(book, bookvo);
bookvo.setCateName(bookService.getCatNameById(bookvo.getCatid()));
bookVOList.add(bookvo);
}
} else {
if (!ids.contains("-")) {
List<String> idsArr = Arrays.asList(ids.split(","));
int length = idsArr.size();
BookVO[] bookVOArr = new BookVO[length];
for (Book book : books) {
int index = idsArr.indexOf(book.getId() + "");
BookVO bookvo = new BookVO();
BeanUtils.copyProperties(book, bookvo);
bookvo.setCateName(bookService.getCatNameById(bookvo.getCatid()));
bookVOArr[length - index - 1] = bookvo;
}
bookVOList = Arrays.asList(bookVOArr);
} else {
bookVOList = new ArrayList<>();
}
}
PageInfo<Book> bookPageInfo = new PageInfo<>(books);
modelMap.put("limit", bookPageInfo.getPageSize());
modelMap.put("curr", bookPageInfo.getPageNum());
modelMap.put("total", bookPageInfo.getTotal());
modelMap.put("books", bookVOList);
modelMap.put("ids", ids);
modelMap.put("keyword", keyword);
modelMap.put("catId", catId);
modelMap.put("sortBy", sortBy);
modelMap.put("sort", sort);
return modelMap;
}
@RequestMapping("{bookId}.html")
public Map<String,Object> detail(@PathVariable("bookId") Long bookId) {
Map<String,Object> modelMap = new HashMap<>();
//查询基本信息
Book book = bookService.queryBaseInfo(bookId);
//查询最新目录信息
List<BookIndex> indexList = bookService.queryNewIndexList(bookId);
BookVO bookvo = new BookVO();
BeanUtils.copyProperties(book, bookvo);
bookvo.setCateName(bookService.getCatNameById(bookvo.getCatid()));
modelMap.put("bookId", bookId);
modelMap.put("book", bookvo);
modelMap.put("indexList", indexList);
return modelMap;
}
@RequestMapping("{bookId}/index.html")
public Map<String,Object> bookIndex(@PathVariable("bookId") Long bookId) {
Map<String,Object> modelMap = new HashMap<>();
List<BookIndex> indexList = bookService.queryAllIndexList(bookId);
String bookName = bookService.queryBaseInfo(bookId).getBookName();
modelMap.put("indexList", indexList);
modelMap.put("bookName", bookName);
modelMap.put("bookId", bookId);
return modelMap;
}
@RequestMapping("{bookId}/{indexNum}.html")
public Map<String,Object> bookContent(@PathVariable("bookId") Long bookId, @PathVariable("indexNum") Integer indexNum) {
Map<String,Object> modelMap = new HashMap<>();
//查询最大章节号
List<Integer> maxAndMinIndexNum = bookService.queryMaxAndMinIndexNum(bookId);
if(maxAndMinIndexNum.size()>0) {
int maxIndexNum = maxAndMinIndexNum.get(0);
int minIndexNum = maxAndMinIndexNum.get(1);
if (indexNum < minIndexNum) {
indexNum = maxIndexNum;
}
if (indexNum > maxIndexNum) {
indexNum = minIndexNum;
}
}
BookContent bookContent = bookService.queryBookContent(bookId, indexNum);
String indexName;
if(bookContent==null) {
bookContent = new BookContent();
bookContent.setId(-1l);
bookContent.setBookId(bookId);
bookContent.setIndexNum(indexNum);
bookContent.setContent("正在手打中,请稍等片刻,内容更新后,需要重新刷新页面,才能获取最新更新");
indexName="";
}else{
indexName = bookService.queryIndexNameByBookIdAndIndexNum(bookId, indexNum);
}
modelMap.put("indexName", indexName);
String bookName = bookService.queryBaseInfo(bookId).getBookName();
modelMap.put("bookName", bookName);
return modelMap;
}
@RequestMapping("addVisit")
public String addVisit(@RequestParam("bookId") Long bookId) {
bookService.addVisitCount(bookId);
return "ok";
}
}

View File

@ -0,0 +1,326 @@
package xyz.zinglizingli.books.web;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import xyz.zinglizingli.books.constant.CacheKeyConstans;
import xyz.zinglizingli.books.po.Book;
import xyz.zinglizingli.books.po.BookContent;
import xyz.zinglizingli.books.po.BookIndex;
import xyz.zinglizingli.books.po.ScreenBullet;
import xyz.zinglizingli.books.service.BookService;
import xyz.zinglizingli.books.vo.BookVO;
import xyz.zinglizingli.search.cache.CommonCacheUtil;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.util.*;
@Controller
@RequestMapping("book")
public class BookController {
@Autowired
private BookService bookService;
@Autowired
private CommonCacheUtil commonCacheUtil;
@RequestMapping("index.html")
public String index(ModelMap modelMap) {
List<Book> hotBooks = (List<Book>) commonCacheUtil.getObject(CacheKeyConstans.HOT_BOOK_LIST_KEY);
if (hotBooks == null) {
//查询热点数据
hotBooks = bookService.search(1, 9, null, null, null, null, null, null, null, "visit_count DESC,score ", "DESC");
commonCacheUtil.setObject(CacheKeyConstans.HOT_BOOK_LIST_KEY, hotBooks, 60 * 60 * 24);
}
List<Book> newBooks = (List<Book>) commonCacheUtil.getObject(CacheKeyConstans.NEWST_BOOK_LIST_KEY);
if (newBooks == null) {
//查询最近更新数据
newBooks = bookService.search(1, 20, null, null, null, null, null, null, null, "update_time", "DESC");
commonCacheUtil.setObject(CacheKeyConstans.NEWST_BOOK_LIST_KEY, newBooks, 60 * 30);
}
modelMap.put("hotBooks", hotBooks);
modelMap.put("newBooks", newBooks);
return "books/index";
}
@RequestMapping("search")
public String search(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "20") int pageSize,
@RequestParam(value = "keyword", required = false) String keyword, @RequestParam(value = "catId", required = false) Integer catId,
@RequestParam(value = "historyBookIds", required = false) String ids,
@RequestParam(value = "bookStatus", required = false) String bookStatus,
@RequestParam(value = "token", required = false) String token,
@RequestParam(value = "sortBy", defaultValue = "update_time") String sortBy, @RequestParam(value = "sort", defaultValue = "DESC") String sort,
HttpServletRequest req, HttpServletResponse resp, ModelMap modelMap) {
String userId = null;
String titleType = "最近更新";
if (catId != null) {
titleType = bookService.getCatNameById(catId) + "分类频道";
;
} else if ("score".equals(sortBy)) {
titleType = "小说排行";
} else if (ids != null) {
titleType = "阅读记录";
} else if (token != null) {
userId = commonCacheUtil.get(token);
titleType = "我的书架";
} else if (bookStatus != null && bookStatus.contains("完成")) {
titleType = "完本小说";
} else if (keyword != null) {
titleType = "搜索";
}
modelMap.put("titleType", titleType);
List<Book> books;
List<BookVO> bookVOList;
if (StringUtils.isEmpty(ids) || !StringUtils.isEmpty(keyword)) {
books = bookService.search(page, pageSize, userId, ids, keyword, bookStatus, catId, null, null, sortBy, sort);
bookVOList = new ArrayList<>();
for (Book book : books) {
BookVO bookvo = new BookVO();
BeanUtils.copyProperties(book, bookvo);
bookvo.setCateName(bookService.getCatNameById(bookvo.getCatid()));
bookVOList.add(bookvo);
}
} else {
if (!ids.contains("-")) {
books = bookService.search(page, 50, userId, ids, keyword, null, catId, null, null, sortBy, sort);
List<String> idsArr = Arrays.asList(ids.split(","));
int length = idsArr.size();
BookVO[] bookVOArr = new BookVO[books.size()];
for (Book book : books) {
int index = idsArr.indexOf(book.getId() + "");
BookVO bookvo = new BookVO();
BeanUtils.copyProperties(book, bookvo);
bookvo.setCateName(bookService.getCatNameById(bookvo.getCatid()));
bookVOArr[books.size() - index - 1] = bookvo;
}
bookVOList = Arrays.asList(bookVOArr);
} else {
books = new ArrayList<>();
bookVOList = new ArrayList<>();
}
}
PageInfo<Book> bookPageInfo = new PageInfo<>(books);
modelMap.put("limit", bookPageInfo.getPageSize());
modelMap.put("curr", bookPageInfo.getPageNum());
modelMap.put("total", bookPageInfo.getTotal());
modelMap.put("books", bookVOList);
modelMap.put("ids", ids);
modelMap.put("token", token);
modelMap.put("bookStatus", bookStatus);
modelMap.put("keyword", keyword);
modelMap.put("catId", catId);
modelMap.put("sortBy", sortBy);
modelMap.put("sort", sort);
return "books/book_search";
}
@RequestMapping("searchSoftBook.html")
public String searchSoftBook(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "20") int pageSize,
@RequestParam(value = "keyword", required = false) String keyword, @RequestParam(value = "catId", defaultValue = "8") Integer catId,
@RequestParam(value = "softCat", required = false) Integer softCat,
@RequestParam(value = "bookStatus", required = false) String bookStatus,
@RequestParam(value = "softTag", required = false) String softTag,
@RequestParam(value = "sortBy", defaultValue = "update_time") String sortBy, @RequestParam(value = "sort", defaultValue = "DESC") String sort,
HttpServletRequest req, HttpServletResponse resp, ModelMap modelMap) {
String userId = null;
List<Book> books = bookService.search(page, pageSize, userId, null, keyword, bookStatus, catId, softCat, softTag, sortBy, sort);
List<BookVO> bookVOList;
bookVOList = new ArrayList<>();
for (Book book : books) {
BookVO bookvo = new BookVO();
BeanUtils.copyProperties(book, bookvo);
bookvo.setCateName(bookService.getSoftCatNameById(bookvo.getSoftCat()));
bookVOList.add(bookvo);
}
PageInfo<Book> bookPageInfo = new PageInfo<>(books);
modelMap.put("limit", bookPageInfo.getPageSize());
modelMap.put("curr", bookPageInfo.getPageNum());
modelMap.put("total", bookPageInfo.getTotal());
modelMap.put("books", bookVOList);
modelMap.put("keyword", keyword);
modelMap.put("bookStatus", bookStatus);
modelMap.put("softCat", softCat);
modelMap.put("softTag", softTag);
modelMap.put("sortBy", sortBy);
modelMap.put("sort", sort);
return "books/soft_book_search";
}
@RequestMapping("{bookId}.html")
public String detail(@PathVariable("bookId") Long bookId, ModelMap modelMap) {
//查询基本信息
Book book = bookService.queryBaseInfo(bookId);
//查询最新目录信息
List<BookIndex> indexList = bookService.queryNewIndexList(bookId);
int minIndexNum = 0;
//查询最小目录号
List<Integer> integers = bookService.queryMaxAndMinIndexNum(bookId);
if(integers.size()>1){
minIndexNum = integers.get(1);
}
BookVO bookvo = new BookVO();
BeanUtils.copyProperties(book, bookvo);
bookvo.setCateName(bookService.getCatNameById(bookvo.getCatid()));
modelMap.put("bookId", bookId);
modelMap.put("book", bookvo);
modelMap.put("minIndexNum", minIndexNum);
modelMap.put("indexList", indexList);
if (indexList != null && indexList.size() > 0) {
modelMap.put("lastIndexName", indexList.get(0).getIndexName());
modelMap.put("lastIndexNum", indexList.get(0).getIndexNum());
}
return "books/book_detail";
}
@RequestMapping("{bookId}/index.html")
public String bookIndex(@PathVariable("bookId") Long bookId, ModelMap modelMap) {
List<BookIndex> indexList = bookService.queryAllIndexList(bookId);
String bookName = bookService.queryBaseInfo(bookId).getBookName();
modelMap.put("indexList", indexList);
modelMap.put("bookName", bookName);
modelMap.put("bookId", bookId);
return "books/book_index";
}
@RequestMapping("{bookId}/{indexNum}.html")
public String bookContent(@PathVariable("bookId") Long bookId, @PathVariable("indexNum") Integer indexNum, ModelMap modelMap) {
BookContent bookContent = bookService.queryBookContent(bookId, indexNum);
String indexName;
if(bookContent==null) {
bookContent = new BookContent();
bookContent.setId(-1l);
bookContent.setBookId(bookId);
bookContent.setIndexNum(indexNum);
bookContent.setContent("正在手打中,请稍等片刻,内容更新后,需要重新刷新页面,才能获取最新更新");
indexName="更新中。。。";
}else{
indexName = bookService.queryIndexNameByBookIdAndIndexNum(bookId, indexNum);
}
List<Integer> preAndNextIndexNum = bookService.queryPreAndNextIndexNum(bookId,indexNum);
modelMap.put("nextIndexNum", preAndNextIndexNum.get(0));
modelMap.put("preIndexNum", preAndNextIndexNum.get(1));
modelMap.put("bookContent", bookContent);
modelMap.put("indexName", indexName);
String bookName = bookService.queryBaseInfo(bookId).getBookName();
modelMap.put("bookName", bookName);
return "books/book_content";
}
@RequestMapping("addVisit")
@ResponseBody
public String addVisit(@RequestParam("bookId") Long bookId) {
bookService.addVisitCount(bookId);
return "ok";
}
@RequestMapping("sendBullet")
@ResponseBody
public Map<String, Object> sendBullet(@RequestParam("contentId") Long contentId, @RequestParam("bullet") String bullet) {
Map<String, Object> result = new HashMap<>();
bookService.sendBullet(contentId, bullet);
result.put("code", 1);
result.put("desc", "ok");
return result;
}
@RequestMapping("queryIsDownloading")
@ResponseBody
public Map<String, Object> queryIsDownloading(HttpSession session) {
Map<String, Object> result = new HashMap<>();
if (session.getAttribute("isDownloading") != null) {
result.put("code", 1);
} else {
result.put("code", 0);
}
return result;
}
@RequestMapping("queryBullet")
@ResponseBody
public List<ScreenBullet> queryBullet(@RequestParam("contentId") Long contentId) {
return bookService.queryBullet(contentId);
}
/**
* 文件下载
*/
@RequestMapping(value = "/download")
public void download(@RequestParam("bookId") Long bookId, @RequestParam("bookName") String bookName, HttpServletResponse resp, HttpSession session) {
try {
session.setAttribute("isDownloading", 1);
int count = bookService.countIndex(bookId);
OutputStream out = resp.getOutputStream();
//设置响应头对文件进行url编码
bookName = URLEncoder.encode(bookName, "UTF-8");
resp.setContentType("application/octet-stream");//解决手机端不能下载附件的问题
resp.setHeader("Content-Disposition", "attachment;filename=" + bookName + ".txt");
if (count > 0) {
for (int i = 0; i < count; i++) {
String index = bookService.queryIndexList(bookId, i);
String content = bookService.queryContentList(bookId, i);
out.write(index.getBytes("utf-8"));
out.write("\n".getBytes("utf-8"));
content = content.replaceAll("<br\\s*/*>", "\r\n");
content = content.replaceAll("&nbsp;", " ");
content = content.replaceAll("<a[^>]*>", "");
content = content.replaceAll("</a>", "");
content = content.replaceAll("<div[^>]*>", "");
content = content.replaceAll("</div>", "");
content = content.replaceAll("<p[^>]*>[^<]*<a[^>]*>[^<]*</a>\\s*</p>", "");
content = content.replaceAll("<p[^>]*>", "");
content = content.replaceAll("</p>", "\r\n");
out.write(content.getBytes("utf-8"));
out.write("\r\n".getBytes("utf-8"));
out.write("\r\n".getBytes("utf-8"));
out.flush();
}
}
out.close();
} catch (Exception e) {
e.printStackTrace();
} finally {
session.removeAttribute("isDownloading");
}
}
}

View File

@ -0,0 +1,161 @@
package xyz.zinglizingli.books.web;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import xyz.zinglizingli.books.po.Book;
import xyz.zinglizingli.books.po.BookContent;
import xyz.zinglizingli.books.po.BookIndex;
import xyz.zinglizingli.books.po.User;
import xyz.zinglizingli.books.service.BookService;
import xyz.zinglizingli.books.service.UserService;
import xyz.zinglizingli.books.util.UUIDUtils;
import xyz.zinglizingli.books.vo.BookVO;
import xyz.zinglizingli.search.cache.CommonCacheUtil;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
@Controller
@RequestMapping("user")
public class UserController {
@Autowired
private UserService userService;
@Autowired
private BookService bookService;
@Autowired
private CommonCacheUtil commonCacheUtil;
@RequestMapping("login.html")
public String login(Long bookId, ModelMap modelMap) {
modelMap.put("bookId", bookId);
return "user/login";
}
@RequestMapping("loginOrRegist")
@ResponseBody
public Map<String, Object> loginOrRegist(User user,Long bookId) {
Map<String, Object> result = new HashMap<>();
//查询用户名是否存在
boolean isExistLoginName = userService.isExistLoginName(user.getLoginName());
String token = null;
if (isExistLoginName) {
//登录
userService.login(user);
if (user.getId() != null) {
token = UUIDUtils.getUUID32();
commonCacheUtil.set(token, user.getId() + "");
result.put("code", 1);
result.put("desc", "登录成功!");
if(!StringUtils.isEmpty(bookId)) {
userService.collectOrCancelBook(user.getId(), bookId);
}
} else {
result.put("code", -1);
result.put("desc", "用户名或密码错误!");
}
} else {
//注册
userService.regist(user);
Long userId = user.getId();
token = UUIDUtils.getUUID32();
commonCacheUtil.set(token, userId + "");
result.put("code", 2);
result.put("desc", "注册成功!");
if(!StringUtils.isEmpty(bookId)) {
userService.collectOrCancelBook(user.getId(), bookId);
}
}
if(token != null){
result.put("token",token);
}
return result;
}
@RequestMapping("isLogin")
@ResponseBody
public Map<String, Object> isLogin(String token) {
Map<String, Object> result = new HashMap<>();
String userId = commonCacheUtil.get(token);
if(StringUtils.isEmpty(userId)){
result.put("code", -1);
result.put("desc", "未登录!");
}else{
result.put("code", 1);
result.put("desc", "已登录!");
}
return result;
}
@RequestMapping("addToCollect")
@ResponseBody
public Map<String, Object> addToCollect(Long bookId,String token) {
Map<String, Object> result = new HashMap<>();
String userId = commonCacheUtil.get(token);
if(StringUtils.isEmpty(userId)){
result.put("code", -1);
result.put("desc", "未登录!");
}else {
userService.addToCollect(bookId,Long.parseLong(userId));
result.put("code", 1);
result.put("desc", "加入成功,请前往我的书架查看!");
}
return result;
}
@RequestMapping("cancelToCollect")
@ResponseBody
public Map<String, Object> cancelToCollect(Long bookId,String token) {
Map<String, Object> result = new HashMap<>();
String userId = commonCacheUtil.get(token);
if(StringUtils.isEmpty(userId)){
result.put("code", -1);
result.put("desc", "未登录!");
}else {
userService.cancelToCollect(bookId,Long.parseLong(userId));
result.put("code", 1);
result.put("desc", "撤下成功!");
}
return result;
}
@RequestMapping("isCollect")
@ResponseBody
public Map<String, Object> isCollect(Long bookId,String token) {
Map<String, Object> result = new HashMap<>();
String userId = commonCacheUtil.get(token);
if(StringUtils.isEmpty(userId)){
result.put("code", -1);
result.put("desc", "未登录!");
}else {
boolean isCollect = userService.isCollect(bookId,Long.parseLong(userId));
if(isCollect) {
result.put("code", 1);
result.put("desc", "已收藏!");
}else{
result.put("code", 2);
result.put("desc", "未收藏!");
}
}
return result;
}
}

View File

@ -0,0 +1,56 @@
package xyz.zinglizingli.search.cache;
public interface CommonCacheUtil {
/**
* 根据key获取缓存的String类型数据
*/
String get(String key);
/**
* 设置String类型的缓存
*/
void set(String key, String value);
/**
* 设置一个有过期时间的String类型的缓存,单位秒
*/
void set(String key, String value, long timeout);
/**
* 根据key获取缓存的Object类型数据
*/
Object getObject(String key);
/**
* 设置Object类型的缓存
*/
void setObject(String key, Object value);
/**
* 设置一个有过期时间的Object类型的缓存,单位秒
*/
void setObject(String key, Object value, long timeout);
/**
* 根据key删除缓存的数据
*/
void del(String key);
/**
* 判断是否存在一个key
* */
boolean contains(String key);
/**
* 设置key过期时间
* */
void expire(String key, long timeout);
/**
* 刷新缓存
* */
void refresh(String key);
}

View File

@ -0,0 +1,150 @@
package xyz.zinglizingli.search.cache.impl;
import net.sf.ehcache.Cache;
import net.sf.ehcache.CacheManager;
import net.sf.ehcache.Element;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import xyz.zinglizingli.search.cache.CommonCacheUtil;
@Service
public class EHCacheUtil implements CommonCacheUtil {
@Autowired
private CacheManager cacheManager ;
private static final String CACHE_NAME = "utilCache";
/**
* 获得一个Cache没有则创建一个
* @param cacheName
* @return
*/
private Cache getCache(){
/*Cache cache = cacheManager.getCache(cacheName);
if (cache == null){
cacheManager.addCache(cacheName);
cache = cacheManager.getCache(cacheName);
CacheConfiguration config = cache.getCacheConfiguration();
config.setEternal(false);
config.internalSetTimeToIdle(0);
config.internalSetTimeToIdle(0);
}*/
Cache cache = cacheManager.getCache("util_cache");
return cache;
}
public CacheManager getCacheManager() {
return cacheManager;
}
@Override
public String get(String key) {
Element element = getCache().get(key);
return element==null?null:(String)element.getObjectValue();
}
@Override
public void set(String key, String value) {
Element element = new Element(key, value);
Cache cache = getCache();
cache.getCacheConfiguration().setEternal(true);//不过期
cache.put(element);
}
@Override
public void set(String key, String value, long timeout) {
Element element = new Element(key, value);
element.setTimeToLive((int) timeout);
Cache cache = getCache();
cache.put(element);
}
@Override
public void del(String key) {
getCache().remove(key);
}
@Override
public boolean contains(String key) {
return getCache().isKeyInCache(key);
}
@Override
public void expire(String key, long timeout) {
Element element = getCache().get(key);
if (element != null) {
Object value = element.getValue();
element = new Element(key, value);
element.setTimeToLive((int)timeout);
Cache cache = getCache();
cache.put(element);
}
}
/**
* 根据key获取缓存的Object类型数据
*/
@Override
public Object getObject(String key) {
Element element = getCache().get(key);
return element==null?null:element.getObjectValue();
}
/**
* 设置Object类型的缓存
* @param <T>
*/
@Override
public void setObject(String key, Object value) {
Element element = new Element(key, value);
Cache cache = getCache();
cache.getCacheConfiguration().setEternal(true);//不过期
cache.put(element);
}
/**
* 设置一个有过期时间的Object类型的缓存,单位秒
*/
@Override
public void setObject(String key, Object value, long timeout) {
Element element = new Element(key, value);
element.setTimeToLive((int) timeout);
Cache cache = getCache();
cache.put(element);
}
@Override
public void refresh(String key) {
Element element = getCache().get(key);
if (element != null) {
Object value = element.getValue();
int timeToLive = element.getTimeToLive();
element = new Element(key, value);
element.setTimeToLive(timeToLive);
Cache cache = getCache();
cache.put(element);
}
}
}

View File

@ -0,0 +1,23 @@
package xyz.zinglizingli.search.config;
import org.springframework.boot.web.server.ErrorPage;
import org.springframework.boot.web.server.ErrorPageRegistrar;
import org.springframework.boot.web.server.ErrorPageRegistry;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpStatus;
/**
*定义配置类
*/
@Configuration
public class ErrorConfig implements ErrorPageRegistrar {
@Override
public void registerErrorPages(ErrorPageRegistry registry) {
ErrorPage[] errorPages = new ErrorPage[2];
errorPages[0] = new ErrorPage(HttpStatus.NOT_FOUND, "/book/index.html");
errorPages[1] = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/mang.html");
registry.addErrorPages(errorPages);
}
}

View File

@ -0,0 +1,19 @@
package xyz.zinglizingli.search.config;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import xyz.zinglizingli.search.filter.SearchFilter;
@Configuration
public class FilterConfig{
@Bean
public FilterRegistrationBean filterRegist() {
FilterRegistrationBean frBean = new FilterRegistrationBean();
frBean.setFilter(new SearchFilter());
frBean.addUrlPatterns("/*");
return frBean;
}
}

View File

@ -0,0 +1,664 @@
package xyz.zinglizingli.search.filter;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.*;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.RequestCallback;
import org.springframework.web.client.RestTemplate;
import xyz.zinglizingli.search.cache.CommonCacheUtil;
import xyz.zinglizingli.search.utils.RestTemplateUtil;
import xyz.zinglizingli.search.utils.SpringUtil;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLDecoder;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class SearchFilter implements Filter {
private static final Logger log = LoggerFactory.getLogger(SearchFilter.class);
private CommonCacheUtil cacheUtil;
private static List<String> picPostFix;
private static List<String> localFileFix;
private static List<String> staticFileFix;
private static List<String> noteURI;
private RestTemplate restTemplate;
private final String SUANWEI_BOOK_REGEX = "<a\\s+href=\"/(\\d+_\\d+)/\">";
private final String SUANWEI_BOOK_HTML_REGEX = "/\\d+_\\d+\\.html";
private final String XIYANGYANG_BOOK_REGEX = "<a\\s+href=\"/(\\d+_\\d+)/\">";
private final String XIYANGYANG_BOOK_HTML_REGEX = "/\\d+_\\d+\\.html";
@Override
public void init(FilterConfig filterConfig) throws ServletException {
picPostFix = new ArrayList<>();
picPostFix.add("jpg");
picPostFix.add("pcx");
picPostFix.add("emf");
picPostFix.add("gif");
picPostFix.add("bmp");
picPostFix.add("tga");
picPostFix.add("jpeg");
picPostFix.add("tif");
picPostFix.add("png");
picPostFix.add("rle");
localFileFix = new ArrayList<>();
localFileFix.add("IMG_1470.JPG");
localFileFix.add("baidu_verify_Ep8xaWQJAI.html");
localFileFix.add("baidu_verify_L6sR9GjEtg.html");
localFileFix.add("shenma-site-verification.txt");
localFileFix.add("favicon.ico");
localFileFix.add("headerbg.jpg");
localFileFix.add("mang.png");
localFileFix.add("HotBook.apk");
localFileFix.add("wap_collect.js");
localFileFix.add("note_1.html");
localFileFix.add("note_2.html");
localFileFix.add("note_3.html");
localFileFix.add("note_4.html");
staticFileFix = new ArrayList<>();
staticFileFix.add("jpg");
staticFileFix.add("gif");
staticFileFix.add("bmp");
staticFileFix.add("jpeg");
staticFileFix.add("png");
staticFileFix.add("js");
staticFileFix.add("css");
noteURI = new ArrayList<>();
noteURI.add("/html/note_1.html");
noteURI.add("/html/note_2.html");
}
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
String forObject = null;
HttpServletRequest req = (HttpServletRequest) servletRequest;
HttpServletResponse resp = (HttpServletResponse) servletResponse;
String requestURL = req.getRequestURL().toString();
String requestURI = req.getRequestURI();
if(requestURL.contains("www.zinglizingli.xyz") || requestURL.contains("sf.zinglizingli.xyz")){
if(requestURI.matches("/*|(/index\\.html)")){
String requestDispatcher = "/book/index.html";
if(requestURL.contains("sf.zinglizingli.xyz")){
requestDispatcher = "/book/searchSoftBook.html";
}
req.getRequestDispatcher(requestDispatcher).forward(servletRequest,servletResponse);
return;
}
filterChain.doFilter(servletRequest,servletResponse);
return;
}
try {
if (requestURL.contains("http://book.zinglizingli.xyz")) {
if(requestURI.matches("/*|(/index\\.html)")){
req.getRequestDispatcher("/book/index.html").forward(servletRequest,servletResponse);
return;
}
filterChain.doFilter(servletRequest, servletResponse);
return;
}
if (requestURL.matches("http://m.zinglizingli.xyz(/*|(/index\\.html))") || requestURI.startsWith("/static/")) {
filterChain.doFilter(req, resp);
return;
}
if (cacheUtil == null) {
cacheUtil = SpringUtil.getBean(CommonCacheUtil.class);
}
if (requestURL.contains("http://m.zinglizingli.xyz/search")) {
//搜索跳转
Map<String, String> otherParam = new HashMap<>();
otherParam.put("t", "1");
otherParam.put("keyword", req.getParameter("q"));
String realURL = "https://m.biquta.com/SearchBook.php";
forObject = postBiquta(req, realURL, otherParam);
resp.setCharacterEncoding("utf-8");
} else {
final String method = req.getMethod();
if (requestURL.contains("www.zinglizingli.xyz")) {
String realUrl = "https://m.biquge.info" + requestURI;
String postFix = requestURI.substring(requestURI.lastIndexOf(".") + 1);
// 案例充当客户端通过restTemplate请求网络数据并充当服务端将数据返回给浏览器
// 客户端请求数据输入流byte[]==字符串
// 服务端响应数据字符串 == 输出流byte[]
//默认方式
//RestTemplate restTemplate = new RestTemplate();
// 当返回的response-header的content-type属性有charset值时
// restTemplate的StringHttpMessageConverter会设置默认charset为content-type属性
// charset值
// StringHttpMessageConverter.setDefaultCharset(Charset.forName(charset));
// 当返回的response-header的content-type属性没有charset值时
// restTemplate的StringHttpMessageConverter会使用默认的charset即ISO-8859-1
if (picPostFix.contains(postFix)) {
// 对服务端请求返回的输入流byte[]采用何种编码转换成字符串String
restTemplate = RestTemplateUtil.getInstance("ISO-8859-1");//请求图片
realUrl = "https://www.biquge.info" + requestURI;
resp.setContentType("image/apng");
} else {
// 对服务端请求返回的输入流byte[]采用何种编码转换成字符串String
restTemplate = RestTemplateUtil.getInstance("utf-8");//请求html/css/js等文件
// 对客户端响应返回的字符串String采用何种编码转换成输出流byte[]
resp.setCharacterEncoding("utf-8");
setContentType(postFix, resp);
/*//=====现在浏览器有编码自动识别功能所以上面的代码没有加content-type的Header也没有问题==========
//=====正确做法应该是下面代码片段1和代码片段2二选一==========
//===============================================代码片段1===============================
// 对客户端响应返回的字符串String采用何种编码转换成输出流byte[]
resp.setCharacterEncoding("utf-8");
// 告诉浏览器对服务端请求返回的输入流byte[]采用何种编码转换成字符串String显示
resp.setHeader("content-type", "text/html;charset=utf-8");
//===============================================代码片段1===============================
//===============================================代码片段2===============================
//对客户端响应返回的字符串String采用何种编码转换成输出流byte[]
//并且告诉浏览器对服务端请求返回的输入流byte[]采用何种编码转换成字符串String显示
resp.setContentType("text/html;charset=utf-8");
//===============================================代码片段2===============================
*/
}
if (HttpMethod.GET.name().equals(method)) {
String fileName = requestURI.substring(requestURI.lastIndexOf("/") + 1);
if (localFileFix.contains(fileName) || fileName.startsWith("9a4a540e-1759-4268-90fa-7fb652c3604a.")) {
filterChain.doFilter(servletRequest, servletResponse);
return;
}
if (requestURI.matches(SUANWEI_BOOK_HTML_REGEX)) {
realUrl = realUrl.substring(0, realUrl.length() - 5);
}
String queryString = req.getQueryString();
if (queryString != null && queryString.length() > 0 && !queryString.contains("bsh_bid=")) {
queryString = "?" + URLDecoder.decode(req.getQueryString());
} else {
queryString = "";
}
realUrl = realUrl + queryString;
forObject = cacheUtil.get(realUrl);
if (forObject == null) {
ResponseEntity<String> forEntity = restTemplate.getForEntity(realUrl, String.class);
forObject = forEntity.getBody();
// forObject = new String(forObject.getBytes("ISO-8859-1"),"utf-8");
if (!picPostFix.contains(postFix)) {
forObject = forObject.replaceAll("https://m.biquge.info", "http://www.zinglizingli.xyz")
.replaceAll("https://www.biquge.info", "http://www.zinglizingli.xyz")
.replaceAll("笔趣岛", "酸味书屋")
.replaceAll("笔趣阁", "酸味书屋")
.replaceAll("<a href=\"/login.php\" id=\"login\" class=\"login\">登录</a>", "<a style=\"visibility:hidden\" href=\"/login.php\" id=\"login\" class=\"login\">登录</a>")
.replaceAll("</head>", "<script language=\"javascript\" type=\"text/javascript\" src=\"http://www.zinglizingli.xyz/js/wap_collect.js\"></script></head>")
.replaceFirst("</head>", "<script>" +
"var _hmt = _hmt || [];" +
"(function() {" +
" var hm = document.createElement(\"script\");" +
" hm.src = \"https://hm.baidu.com/hm.js?0bd7345ca6b694ea3dfbe87da008082e\";" +
" var s = document.getElementsByTagName(\"script\")[0]; " +
" s.parentNode.insertBefore(hm, s);" +
"})();" +
"</script></head>")
.replaceAll("<input type=\"image\" src=\"https://m.baidu.com/se/transcode/static/img/bgn.png\".*>", "")
.replaceAll("https://zhannei.baidu.com/cse", "http://m.zinglizingli.xyz")
.replaceAll("<a href=\"/.*/\">返回</a>", "<a href=\"javascript:history.go(-1)\">返回</a>")
.replaceAll("<a href=\".*\".*>加入书架</a>", "<a href=\"javascript:AddToFavorites(true);\">加入收藏</a>")
.replaceFirst("</head>", "<script>\n" +
"(function(){\n" +
" var bp = document.createElement('script');\n" +
" var curProtocol = window.location.protocol.split(':')[0];\n" +
" if (curProtocol === 'https') {\n" +
" bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';\n" +
" }\n" +
" else {\n" +
" bp.src = 'http://push.zhanzhang.baidu.com/push.js';\n" +
" }\n" +
" var s = document.getElementsByTagName(\"script\")[0];\n" +
" s.parentNode.insertBefore(bp, s);\n" +
"})();\n" +
"</script>\n</head>")//页面访问自动推送到百度
.replaceAll("<script.*wap\\.js.*script>", "")//去除广告
;
forObject = addAttacDivForSearch(forObject, requestURI);
forObject = setBookURIToHTML(forObject, SUANWEI_BOOK_REGEX);
if (requestURI.matches(SUANWEI_BOOK_HTML_REGEX)) {
Pattern pattern = Pattern.compile("<h1\\s+id=\"bqgmb_h1\">(.+)\\s+目录共\\d+章</h1>");
Matcher matcher = pattern.matcher(forObject);
String title = "";
if (matcher.find()) {
title = matcher.group(1);
}//<li class="sort"> 类别:武侠仙侠</li>
pattern = Pattern.compile("<p>作者:(.+)</p>");
matcher = pattern.matcher(forObject);
String author = "";
if (matcher.find()) {
author = matcher.group(1);
}
pattern = Pattern.compile("<a\\s+href=\"/list/\\d+_\\d+.*\">(.+)</a>");
matcher = pattern.matcher(forObject);
String sort = "";
if (matcher.find()) {
sort = matcher.group(1);
}
String desc = title + "" + title + "小说最新章节免费在线阅读、最新章节列表," + title + "小说最新更新免费提供,《" + title + "》是一本情节与文笔俱佳的" + sort + "小说,由作者" + author + "创建。";
forObject = forObject.replaceFirst("<meta\\s+name=\"description\"\\s+content=\"[^>]+\"\\s*/?>", "");//[^>]+表示1个或多个不是>的字符
forObject = forObject.replaceFirst("<head>", "<head><meta name=\"description\" content=\"" + desc + "\"/>");
}
if ("/".equals(requestURI)) {
forObject = forObject.replaceFirst("<meta\\s+name=\"description\"\\s+content=\"[^>]+\"\\s*/?>", "");//[^>]+表示1个或多个不是>的字符
forObject = forObject.replaceFirst("<head>", "<head><meta name=\"description\" content=\"酸味书屋致力于打造小说最全,更新最快的在线小说阅读网,本站收录了当前最火热的网络小说,提供无广告、高质量内容的小说服务,是广大网友最喜欢的温馨小说站。\">");
}
}
long timeout = 1800;
if (staticFileFix.contains(postFix)) {
timeout = 60 * 60 * 24;
}
cacheUtil.set(realUrl, forObject, timeout);
}
} else {
Map<String, String[]> oldParameterMap = req.getParameterMap();
Map<String, String> newParameterMap = new HashMap<>();
Set<Map.Entry<String, String[]>> entries = oldParameterMap.entrySet();
for (Map.Entry<String, String[]> entry : entries) {
newParameterMap.put(entry.getKey(), entry.getValue()[0]);
}
MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
map.setAll(newParameterMap);
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(map, headers);
forObject = restTemplate.postForEntity(realUrl, request, String.class).getBody();
// forObject = new String(forObject.getBytes("ISO-8859-1"),"utf-8");
forObject = forObject.replaceAll("https://m.biquge.info", "http://www.zinglizingli.xyz")
.replaceAll("https://www.biquge.info", "http://www.zinglizingli.xyz")
.replaceAll("笔趣岛", "酸味书屋")
.replaceAll("笔趣阁", "酸味书屋")
.replaceAll("https://zhannei.baidu.com/cse", "http://m.zinglizingli.xyz")
.replaceFirst("</head>", "<script>\n" +
"var _hmt = _hmt || [];" +
"(function() {" +
" var hm = document.createElement(\"script\");" +
" hm.src = \"https://hm.baidu.com/hm.js?0bd7345ca6b694ea3dfbe87da008082e\";" +
" var s = document.getElementsByTagName(\"script\")[0]; " +
" s.parentNode.insertBefore(hm, s);" +
"})();" +
"</script></head>")
.replaceAll("<a\\s+href=\"/bookcase.php\">书架</a>", "<a href=\"" + noteURI.get(new Random().nextInt(noteURI.size())) + "\">笔记</a>")
.replaceAll("<a href=\"/.*/\">返回</a>", "<a href=\"javascript:history.go(-1)\">返回</a>")
;
forObject = setBookURIToHTML(forObject, SUANWEI_BOOK_REGEX);
//resp.setCharacterEncoding("utf-8");
//setContentType(postFix, resp);
}
} else if (requestURL.contains("m.zinglizingli.xyz")) {
String realUrl = "https://m.biquta.com" + requestURI;
String postFix = requestURI.substring(requestURI.lastIndexOf(".") + 1);
if (picPostFix.contains(postFix)) {
restTemplate = RestTemplateUtil.getInstance("ISO-8859-1");//请求图片
resp.setContentType("image/apng");
} else {
restTemplate = RestTemplateUtil.getInstance("utf-8");//请求html/css/js等文件
resp.setCharacterEncoding("utf-8");
setContentType(postFix, resp);
}
if (HttpMethod.GET.name().equals(method)) {
String fileName = requestURI.substring(requestURI.lastIndexOf("/") + 1);
if (localFileFix.contains(fileName) || fileName.startsWith("9a4a540e-1759-4268-90fa-7fb652c3604a.")) {
filterChain.doFilter(servletRequest, servletResponse);
return;
}
if (requestURI.matches(XIYANGYANG_BOOK_HTML_REGEX)) {
realUrl = realUrl.substring(0, realUrl.length() - 5);
}
String queryString = req.getQueryString();
if (queryString != null && queryString.length() > 0 && !queryString.contains("bsh_bid=")) {
queryString = "?" + URLDecoder.decode(req.getQueryString());
} else {
queryString = "";
}
realUrl = realUrl + queryString;
forObject = cacheUtil.get(realUrl);
if (forObject == null) {
forObject = restTemplate.getForEntity(realUrl, String.class).getBody();
if (!picPostFix.contains(postFix)) {
forObject = forObject.replaceAll("https://m.biquta.com", "http://m.zinglizingli.xyz")
.replaceAll("笔趣阁", "看小说吧")
.replaceAll("笔趣塔", "看小说吧")
.replaceFirst("<title>看小说吧手机版-看小说吧</title>", "<title>看小说吧</title>")
.replaceFirst("content=\"看小说吧\"", "content=\"小说阅读,小说排行,好看小说排行,热门小说排行,小说阅读手机版\"")
.replaceAll("<a href=\"/login.php\" id=\"login\" class=\"login\">登录</a>", "<a style=\"visibility:hidden\" href=\"/login.php\" id=\"login\" class=\"login\">登录</a>")
.replaceFirst("<head>", "<head><meta name=\"shenma-site-verification\" content=\"5548d4bd962d5cdd4cf6aeba92b991a8_1565878917\">")
.replaceAll("<a href=\"/bookcase.php\".*>书架</a>", "<a href=\"javascript:AddToFavorites(true);\" style=\"width:14%\">收藏</a>")
.replaceAll("<a href=\"javascript:addBookMarkByManual.*\" class=\"btn_toBookShelf\">加入书架</a>", "<a href=\"javascript:AddToFavorites(true);\" class=\"btn_toBookShelf\">加入收藏</a>")
.replaceAll("<a href=\"/bookcase.php\" class=\"btn_toMyBook\">我的书架</a>", "")
.replaceFirst("<a href=\"http://m.zinglizingli.xyz/tempcase.html\">阅读记录</a>","<a href=\"/HotBook.apk\">客户端下载</a>")
.replaceAll("<a href=\"/bookcase.php\".*>我的书架</a>", "<a href=\"https://www.zinglizingli.xyz/book/searchSoftBook.html\">轻小说</a><a href=\"https://www.zinglizingli.xyz\">精品小说</a>")
.replaceAll("</head>", "<script language=\"javascript\" type=\"text/javascript\" src=\"http://m.zinglizingli.xyz/js/wap_collect.js\"></script></head>")
.replaceFirst("</head>", "<script>\n" +
"var _hmt = _hmt || [];\n" +
"(function() {\n" +
" var hm = document.createElement(\"script\");\n" +
" hm.src = \"https://hm.baidu.com/hm.js?b3a84b2ec6cc52dd088d735565b49644\";\n" +
" var s = document.getElementsByTagName(\"script\")[0]; \n" +
" s.parentNode.insertBefore(hm, s);\n" +
"})();\n" +
"</script>\n</head>")
.replaceFirst("</head>", "<script>\n" +
"(function(){\n" +
" var bp = document.createElement('script');\n" +
" var curProtocol = window.location.protocol.split(':')[0];\n" +
" if (curProtocol === 'https') {\n" +
" bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';\n" +
" }\n" +
" else {\n" +
" bp.src = 'http://push.zhanzhang.baidu.com/push.js';\n" +
" }\n" +
" var s = document.getElementsByTagName(\"script\")[0];\n" +
" s.parentNode.insertBefore(bp, s);\n" +
"})();\n" +
"</script>\n</head>")//页面访问自动推送到百度
.replaceAll("<script.*common\\.js.*script>", "");//去除广告
forObject = addAttacDivForSearch(forObject, requestURI);
forObject = setBookURIToHTML(forObject, XIYANGYANG_BOOK_REGEX);
if (requestURI.matches(XIYANGYANG_BOOK_HTML_REGEX)) {
Pattern pattern = Pattern.compile("<span\\s+class=\"title\">(.+)</span>");
Matcher matcher = pattern.matcher(forObject);
String title = "";
if (matcher.find()) {
title = matcher.group(1);
}//<li class="sort"> 类别:武侠仙侠</li>
pattern = Pattern.compile("<li\\s+class=\"author\">作者:(.+)</li>");
matcher = pattern.matcher(forObject);
String author = "";
if (matcher.find()) {
author = matcher.group(1);
}
pattern = Pattern.compile("<li\\s+class=\"sort\">\\s+类别:(.+)</li>");
matcher = pattern.matcher(forObject);
String sort = "";
if (matcher.find()) {
sort = matcher.group(1);
}
String desc = title + "" + title + "小说最新章节免费在线阅读、最新章节列表," + title + "小说最新更新免费提供,《" + title + "》是一本情节与文笔俱佳的" + sort + "小说,由作者" + author + "创建。";
forObject = forObject.replaceFirst("<meta\\s+name=\"description\"\\s+content=\"[^>]+\"\\s*/?>", "");//[^>]+表示1个或多个不是>的字符
forObject = forObject.replaceFirst("<head>", "<head><meta name=\"description\" content=\"" + desc + "\"/>");
}
if ("/".equals(requestURI)) {
forObject = forObject.replaceFirst("<meta\\s+name=\"description\"\\s+content=\"[^>]+\"\\s*/?>", "");//[^>]+表示1个或多个不是>的字符
forObject = forObject.replaceFirst("<head>", "<head><meta name=\"description\" content=\"看小说吧致力于打造小说最全,更新最快的在线小说阅读网,本站收录了当前最火热的网络小说,提供无广告、高质量内容的小说服务,是广大网友最喜欢的温馨小说站。\">");
/*forObject = forObject.replaceFirst("<head>", "<head>" + jsString)
.replaceFirst("<body>", "<body style=\"position:relative\">" + imagDiv);*/
// forObject = forObject.replaceFirst("<body>", "<body>" + imagDiv);
}
}
// forObject = forObject.replaceFirst("<body>", "<body><a class=\"bshareDiv\" href=\"http://www.bshare.cn/share\">分享按钮</a><script type=\"text/javascript\" charset=\"utf-8\" src=\"http://static.bshare.cn/b/buttonLite.js#uuid=&amp;style=5&amp;fs=4&amp;bgcolor=LightBlue&amp;pophcol=1\"></script>\n" +
// " ");
/* if (forObject.contains("class=\"sortChannel_nav\"") || forObject.contains("channelHeader2")) {
forObject = forObject.replaceFirst("class=\"searchForm\"", "class=\"searchForm\" style=\"display:none\"");
}*/
long timeout = 1800;
if (staticFileFix.contains(postFix)) {
timeout = 60 * 60 * 24;
}
cacheUtil.set(realUrl, forObject, timeout);
}
} else {
forObject = postBiquta(req, realUrl, null);
}
} else {
return;
}
}
} catch (RuntimeException e) {
log.error(e.getMessage(), e);
if (e instanceof HttpClientErrorException && (((HttpClientErrorException) e).getStatusCode() == HttpStatus.NOT_FOUND)) {
//404
resp.sendRedirect("/");
return;
} else {
req.getRequestDispatcher("/mang.html").forward(servletRequest, servletResponse);
return;
}
//resp.setCharacterEncoding("utf-8");
}
resp.getWriter().print(forObject);
return;
}
private String addAttacDivForSearch(String forObject, String requestURI) {
try {
if (requestURI.endsWith(".html") || requestURI.equals("/")) {
String hotNewsDiv = cacheUtil.get("hotNewsDiv");
if (hotNewsDiv == null) {
MultiValueMap<String, String> mmap = new LinkedMultiValueMap<>();
HttpHeaders headers = new HttpHeaders();
headers.add("Host", "channel.chinanews.com");
headers.add("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36");
HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(mmap, headers);
String body = restTemplate.postForEntity("http://channel.chinanews.com/cns/cjs/sh.shtml", request, String.class).getBody();
Pattern pattern = Pattern.compile("specialcnsdata\\s*=\\s*\\{\"docs\":(.+)};\\s+newslist\\s*=\\s*specialcnsdata;");
Matcher matcher = pattern.matcher(body);
if (matcher.find()) {
String jsonResult = matcher.group(1);
if (jsonResult.length() > 5) {
List<Map<String, String>> list = new ObjectMapper().readValue(jsonResult, List.class);
StringBuilder hotContent = new StringBuilder();
for (Map<String, String> map : list) {
hotContent.append("<ul>\n");
hotContent.append("<li>\n");
hotContent.append(map.get("pubtime"));
hotContent.append("</li>\n");
hotContent.append("<li>\n");
hotContent.append(map.get("title"));
hotContent.append("</li>\n");
hotContent.append("<li>\n");
hotContent.append(map.get("content"));
hotContent.append("</li>\n");
hotContent.append("<li>\n");
hotContent.append("<img src=\"" + map.get("galleryphoto") + "\"/>");
hotContent.append("</li>\n");
hotContent.append("</ul>\n");
}
hotNewsDiv = "<div style=\"position:fixed;top:0px;left:0px;z-index:-100;opacity:0\">" + hotContent.toString() + "</div>";
cacheUtil.set("hotNewsDiv", hotNewsDiv, 60 * 60 * 24);
forObject = forObject.replaceFirst("</body>", hotNewsDiv + "</body>");
}
}
} else {
forObject = forObject.replaceFirst("</body>", hotNewsDiv + "</body>");
}
}
} catch (Exception e) {
log.error(e.getMessage(), e);
} finally {
}
return forObject;
}
private String setBookURIToHTML(String forObject, String regex) {
String result = forObject;
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(forObject);
boolean isFind = matcher.find();
if (isFind) {
while (isFind) {
String booURI = matcher.group(1);
String htmlBooURI = booURI.substring(0, booURI.length()) + ".html";
result = result.replaceFirst(booURI + "/", htmlBooURI);
isFind = matcher.find();
}
}
return result;
}
private String postBiquta(HttpServletRequest req, String realUrl, Map<String, String> otherParam) {
String forObject;
Map<String, String[]> oldParameterMap = req.getParameterMap();
Map<String, String> newParameterMap = new HashMap<>();
Set<Map.Entry<String, String[]>> entries = oldParameterMap.entrySet();
for (Map.Entry<String, String[]> entry : entries) {
newParameterMap.put(entry.getKey(), entry.getValue()[0]);
}
if (otherParam != null) {
newParameterMap.putAll(otherParam);
}
MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
map.setAll(newParameterMap);
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(map, headers);
forObject = restTemplate.postForEntity(realUrl, request, String.class).getBody();
forObject = forObject.replaceAll("https://m.biquta.com", "http://m.zinglizingli.xyz")
.replaceAll("笔趣阁", "看小说吧")
.replaceAll("笔趣塔", "看小说吧")
.replaceFirst("<title>看小说吧手机版-看小说吧</title>", "<title>看小说吧</title>")
.replaceFirst("content=\"看小说吧\"", "content=\"小说阅读,小说排行,好看小说排行,热门小说排行,小说阅读手机版\"")
.replaceFirst("<head>", "<head><meta name=\"shenma-site-verification\" content=\"5548d4bd962d5cdd4cf6aeba92b991a8_1565878917\">")
.replaceAll("<a href=\"/bookcase.php\".*>我的书架</a>", "<a href=\"https://www.zinglizingli.xyz/book/searchSoftBook.html\">轻小说</a><a href=\"https://www.zinglizingli.xyz\">精品小说</a>")
.replaceFirst("<a href=\"http://m.zinglizingli.xyz/tempcase.html\">阅读记录</a>","<a href=\"/HotBook.apk\">客户端下载</a>")
.replaceFirst("</head>", "<script>\n" +
"var _hmt = _hmt || [];\n" +
"(function() {\n" +
" var hm = document.createElement(\"script\");\n" +
" hm.src = \"https://hm.baidu.com/hm.js?b3a84b2ec6cc52dd088d735565b49644\";\n" +
" var s = document.getElementsByTagName(\"script\")[0]; \n" +
" s.parentNode.insertBefore(hm, s);\n" +
"})();\n" +
"</script>\n</head>")
;
forObject = setBookURIToHTML(forObject, XIYANGYANG_BOOK_REGEX);
return forObject;
}
private void setContentType(String fileFix, HttpServletResponse resp) {
String contentType = "text/html";
switch (fileFix) {
case "js": {
contentType = "application/javascript";
break;
}
case "css": {
contentType = "text/css";
break;
}
case "html": {
contentType = "text/html";
break;
}
default: {
break;
}
}
resp.setContentType(contentType);
}
@Override
public void destroy() {
}
}

View File

@ -0,0 +1,865 @@
package xyz.zinglizingli.search.schedule;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import xyz.zinglizingli.books.po.Book;
import xyz.zinglizingli.books.po.BookContent;
import xyz.zinglizingli.books.po.BookIndex;
import xyz.zinglizingli.books.service.BookService;
import xyz.zinglizingli.books.util.ExcutorUtils;
import xyz.zinglizingli.search.utils.RestTemplateUtil;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@Service
public class CrawlBooksSchedule {
private Logger log = LoggerFactory.getLogger(CrawlBooksSchedule.class);
@Autowired
private BookService bookService;
RestTemplate restTemplate = RestTemplateUtil.getInstance("utf-8");
private boolean isExcuting = false;
public static void main(String[] args) {//<input type="text" class="page_txt" value="1/3019"
//size="5" name="txtPage" id="txtPage" />
String forObject = "<input type=\"text\" class=\"page_txt\" value=\"1/3019\" size=\"5\" name=\"txtPage\" id=\"txtPage\" />";
Pattern pattern = Pattern.compile("<input type=\"text\" class=\"page_txt\" value=\"(.+)/(.+)\"");
Matcher matcher = pattern.matcher(forObject);
boolean isFind = matcher.find();
System.out.println(isFind);
}
/**
* 该项目只更新前1页的书籍
*/
//@Scheduled(fixedRate = 1000 * 60 * 60 * 2)//暂定2小说爬等以后书籍多了之后会适当缩短更新间隔
public void crawBqutaBooks() throws Exception {
final String baseUrl = "https://m.biquta.com";
System.out.println("开始时间" + new Date());
//爬分类列表的书籍url和总页数
// https:
////m.biquta.com/class/1/1.html
// https:
////m.biquta.com/class/2/1.html
// https:
////m.biquta.com/class/2/2.html
//
//
// https:
////m.biquta.com/class/2/2.html
//<input type = "text" class="page_txt" value = "2/1244" size = "5" name = "txtPage" id = "txtPage" >
//
//
//<div class="bookinfo" >
// <a href = "/14_14988/" >
// <div class="detail" >
// <p class="title" > 苍穹九变 </p >
// <p class="author" > 作者:风起闲云</p >
// </div >
// <div class="score" > 7.5 分</div >
// </a >
// </div >
//
//
//第一周期全部书拉取完后可进行第二周期只拉取前面几页的数据拉取时间间隔变小
for (int i = 1; i <= 7; i++) {
int finalI = i;
new Thread(
() -> {
try {
//拼接分类URL
int page = 1;//起始页码
int totalPage = page;
String catBookListUrl = baseUrl + "/class/" + finalI + "/" + page + ".html";
ResponseEntity<String> forEntity = restTemplate.getForEntity(catBookListUrl, String.class);
if (forEntity.getStatusCode() == HttpStatus.OK) {
String forObject = forEntity.getBody();
//匹配分页数<input type="text" class="page_txt" value="1/3019" size="5" name="txtPage" id="txtPage" />
Pattern pattern = Pattern.compile("value=\"(\\d+)/(\\d+)\"");
Matcher matcher = pattern.matcher(forObject);
boolean isFind = matcher.find();
System.out.println("匹配分页数" + isFind);
if (isFind) {
int currentPage = Integer.parseInt(matcher.group(1));
totalPage = Integer.parseInt(matcher.group(2));
//解析第一页书籍的数据
Pattern bookPatten = Pattern.compile("href=\"/(\\d+_\\d+)/\"");
parseBook(bookPatten, forObject, restTemplate, finalI, baseUrl);
/*while (currentPage < totalPage) {
catBookListUrl = baseUrl + "/class/" + finalI + "/" + (currentPage + 1) + ".html";
forEntity = restTemplate.getForEntity(catBookListUrl, String.class);
if (forEntity.getStatusCode() == HttpStatus.OK) {
forObject = forEntity.getBody();
//匹配分页数
matcher = pattern.matcher(forObject);
isFind = matcher.find();
if (isFind) {
currentPage = Integer.parseInt(matcher.group(1));
totalPage = Integer.parseInt(matcher.group(2));
parseBook(bookPatten, forObject, restTemplate, finalI, baseUrl);
}
}else{
currentPage++;
}
}*/
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
).start();
}
System.out.println("结束时间" + new Date());
}
// @Scheduled(fixedRate = 1000 * 60 * 30)
//@Scheduled(fixedRate = 1000 * 60 * 60 * 3)//本机更新否则服务器压力过大,等书籍多了之后再去服务器更新这样更新数量不会很大
//暂定2小说只爬分类前3本书一共3*7=21本书爬等以后书籍多了之后会适当缩短更新间隔
public void crawBqugeTaBooks() throws Exception {
if (!isExcuting) {
isExcuting = true;
final String baseUrl = "https://m.biquta.com";
log.debug("crawlBooksSchedule执行中。。。。。。。。。。。。");
//爬分类列表的书籍url和总页数
// https:
////m.biquta.com/class/1/1.html
// https:
////m.biquta.com/class/2/1.html
// https:
////m.biquta.com/class/2/2.html
//
//
// https:
////m.biquta.com/class/2/2.html
//<input type = "text" class="page_txt" value = "2/1244" size = "5" name = "txtPage" id = "txtPage" >
//
//
//<div class="bookinfo" >
// <a href = "/14_14988/" >
// <div class="detail" >
// <p class="title" > 苍穹九变 </p >
// <p class="author" > 作者:风起闲云</p >
// </div >
// <div class="score" > 7.5 分</div >
// </a >
// </div >
//
//
//第一周期全部书拉取完后可进行第二周期只拉取前面几页的数据拉取时间间隔变小
RestTemplate restTemplate = RestTemplateUtil.getInstance("utf-8");
while (true) {
log.debug("crawlBooksSchedule循环执行中。。。。。。。。。。。。");
Set<Integer> classIdSet = new HashSet<>();
for (int i = 1; i <= 7; i++) {
log.debug("crawlBooksSchedule分类" + i + "执行中。。。。。。。。。。。。");
// int finalI = i;
/* new Thread(
() -> {*/
try {
//先随机更新分类
Random random = new Random();
int finalI = random.nextInt(7) + 1;
if (classIdSet.contains(finalI)) {
finalI = random.nextInt(7) + 1;
}
classIdSet.add(finalI);
//拼接分类URL
int page = 1;//起始页码
int totalPage = page;
String catBookListUrl = baseUrl + "/class/" + finalI + "/" + page + ".html";
String forObject = getByHttpClient(catBookListUrl);
if (forObject != null) {
//匹配分页数<input type="text" class="page_txt" value="1/3019" size="5" name="txtPage" id="txtPage" />
Pattern pattern = Pattern.compile("value=\"(\\d+)/(\\d+)\"");
Matcher matcher = pattern.matcher(forObject);
boolean isFind = matcher.find();
System.out.println("匹配分页数" + isFind);
if (isFind) {
int currentPage = Integer.parseInt(matcher.group(1));
totalPage = Integer.parseInt(matcher.group(2));
//解析第一页书籍的数据
Pattern bookPatten = Pattern.compile("href=\"/(\\d+_\\d+)/\"");
parseBook(bookPatten, forObject, restTemplate, finalI, baseUrl);
/* while (currentPage < totalPage) {
catBookListUrl = baseUrl + "/bqgeclass/" + finalI + "/" + (currentPage + 1) + ".html";
forObject = getByHttpClient(catBookListUrl);
if (forObject != null) {
//匹配分页数
matcher = pattern.matcher(forObject);
isFind = matcher.find();
if (isFind) {
currentPage = Integer.parseInt(matcher.group(1));
totalPage = Integer.parseInt(matcher.group(2));
parseBiquge11Book(bookPatten, forObject, finalI, baseUrl);
}
} else {
currentPage++;
}
}*/
}
}
Thread.sleep(1000 * 60 * 10);
} catch (Exception e) {
e.printStackTrace();
}
/* }
).start();*/
}
}
}
}
//@Scheduled(fixedRate = 1000 * 60 * 35)
@Scheduled(fixedRate = 1000 * 60 * 60 * 3)
//暂定2小说只爬分类前3本书一共3*7=21本书爬等以后书籍多了之后会适当缩短更新间隔
public void crawBquge11BooksAtDay() throws Exception {
if (!isExcuting) {
isExcuting = true;
final String baseUrl = "https://m.biqudao.com";
log.debug("crawlBooksSchedule执行中。。。。。。。。。。。。");
//爬分类列表的书籍url和总页数
// https:
////m.biquta.com/class/1/1.html
// https:
////m.biquta.com/class/2/1.html
// https:
////m.biquta.com/class/2/2.html
//
//
// https:
////m.biquta.com/class/2/2.html
//<input type = "text" class="page_txt" value = "2/1244" size = "5" name = "txtPage" id = "txtPage" >
//
//
//<div class="bookinfo" >
// <a href = "/14_14988/" >
// <div class="detail" >
// <p class="title" > 苍穹九变 </p >
// <p class="author" > 作者:风起闲云</p >
// </div >
// <div class="score" > 7.5 分</div >
// </a >
// </div >
//
//
//第一周期全部书拉取完后可进行第二周期只拉取前面几页的数据拉取时间间隔变小
while (true) {
log.debug("crawlBooksSchedule循环执行中。。。。。。。。。。。。");
//List<Integer> classIdList = new ArrayList<>(Arrays.asList(new Integer[]{1,2,3,4,5,6,7}));
// for (int i = 1; i <= 7; i++) {
// log.debug("crawlBooksSchedule分类"+i+"执行中。。。。。。。。。。。。");
// int finalI = i;
/* new Thread(
() -> {*/
try {
//先随机更新分类
//Random random = new Random();
//int finalI = classIdList.get(new Random().nextInt(classIdList.size()));
//classIdList.remove(finalI);
int finalI = 0;
//拼接分类URL
int page = 1;//起始页码
int totalPage = page;
String catBookListUrl = baseUrl + "/bqgeclass/" + finalI + "/" + page + ".html";
String forObject = getByHttpClient(catBookListUrl);
if (forObject != null) {
//匹配分页数<input type="text" class="page_txt" value="1/3019" size="5" name="txtPage" id="txtPage" />
Pattern pattern = Pattern.compile("value=\"(\\d+)/(\\d+)\"");
Matcher matcher = pattern.matcher(forObject);
boolean isFind = matcher.find();
System.out.println("匹配分页数" + isFind);
if (isFind) {
int currentPage = Integer.parseInt(matcher.group(1));
totalPage = Integer.parseInt(matcher.group(2));
//解析第一页书籍的数据
Pattern bookPatten = Pattern.compile("href=\"/(bqge\\d+)/\"");
//白天更新
parseBiquge11Book(bookPatten, forObject, finalI, baseUrl, true);
/* while (currentPage < totalPage) {
catBookListUrl = baseUrl + "/bqgeclass/" + finalI + "/" + (currentPage + 1) + ".html";
forObject = getByHttpClient(catBookListUrl);
if (forObject != null) {
//匹配分页数
matcher = pattern.matcher(forObject);
isFind = matcher.find();
if (isFind) {
currentPage = Integer.parseInt(matcher.group(1));
totalPage = Integer.parseInt(matcher.group(2));
parseBiquge11Book(bookPatten, forObject, finalI, baseUrl);
}
} else {
currentPage++;
}
}*/
}
}
Thread.sleep(1000 * 60 * 5);
} catch (Exception e) {
e.printStackTrace();
}
/* }
).start();*/
// }
}
}
}
@Scheduled(cron = "0 0 2 * * ?")
//暂定2小说只爬分类前3本书一共3*7=21本书爬等以后书籍多了之后会适当缩短更新间隔
public void crawBquge11BooksAtNight() throws Exception {
final String baseUrl = "https://m.biqudao.com";
log.debug("crawlBooksSchedule执行中。。。。。。。。。。。。");
//爬分类列表的书籍url和总页数
// https:
////m.biquta.com/class/1/1.html
// https:
////m.biquta.com/class/2/1.html
// https:
////m.biquta.com/class/2/2.html
//
//
// https:
////m.biquta.com/class/2/2.html
//<input type = "text" class="page_txt" value = "2/1244" size = "5" name = "txtPage" id = "txtPage" >
//
//
//<div class="bookinfo" >
// <a href = "/14_14988/" >
// <div class="detail" >
// <p class="title" > 苍穹九变 </p >
// <p class="author" > 作者:风起闲云</p >
// </div >
// <div class="score" > 7.5 分</div >
// </a >
// </div >
//
//
//第一周期全部书拉取完后可进行第二周期只拉取前面几页的数据拉取时间间隔变小
log.debug("crawlBooksSchedule循环执行中。。。。。。。。。。。。");
//List<Integer> classIdList = new ArrayList<>(Arrays.asList(new Integer[]{1,2,3,4,5,6,7}));
// for (int i = 1; i <= 7; i++) {
// log.debug("crawlBooksSchedule分类"+i+"执行中。。。。。。。。。。。。");
// int finalI = i;
/* new Thread(
() -> {*/
try {
//先随机更新分类
//Random random = new Random();
//int finalI = classIdList.get(new Random().nextInt(classIdList.size()));
//classIdList.remove(finalI);
int finalI = 0;
//拼接分类URL
int page = 1;//起始页码
int totalPage = page;
String catBookListUrl = baseUrl + "/bqgeclass/" + finalI + "/" + page + ".html";
String forObject = getByHttpClient(catBookListUrl);
if (forObject != null) {
//匹配分页数<input type="text" class="page_txt" value="1/3019" size="5" name="txtPage" id="txtPage" />
Pattern pattern = Pattern.compile("value=\"(\\d+)/(\\d+)\"");
Matcher matcher = pattern.matcher(forObject);
boolean isFind = matcher.find();
System.out.println("匹配分页数" + isFind);
if (isFind) {
int currentPage = Integer.parseInt(matcher.group(1));
totalPage = Integer.parseInt(matcher.group(2));
//解析第一页书籍的数据
Pattern bookPatten = Pattern.compile("href=\"/(bqge\\d+)/\"");
//晚上插入
parseBiquge11Book(bookPatten, forObject, finalI, baseUrl, false);
while (currentPage < totalPage) {
if (new Date().getHours() > 5) {
break;
}
catBookListUrl = baseUrl + "/bqgeclass/" + finalI + "/" + (currentPage + 1) + ".html";
forObject = getByHttpClient(catBookListUrl);
if (forObject != null) {
//匹配分页数
matcher = pattern.matcher(forObject);
isFind = matcher.find();
if (isFind) {
currentPage = Integer.parseInt(matcher.group(1));
totalPage = Integer.parseInt(matcher.group(2));
parseBiquge11Book(bookPatten, forObject, finalI, baseUrl, false);
}
} else {
currentPage++;
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
/* }
).start();*/
// }
}
private void parseBiquge11Book(Pattern bookPatten, String forObject, int catNum, String baseUrl, boolean isUpdate) {
Matcher matcher2 = bookPatten.matcher(forObject);
boolean isFind = matcher2.find();
Pattern scorePatten = Pattern.compile("<div\\s+class=\"score\">(\\d+\\.\\d+)分</div>");
Matcher scoreMatch = scorePatten.matcher(forObject);
boolean scoreFind = scoreMatch.find();
Pattern bookNamePatten = Pattern.compile("<p class=\"title\">([^/]+)</p>");
Matcher bookNameMatch = bookNamePatten.matcher(forObject);
boolean isBookNameMatch = bookNameMatch.find();
System.out.println("匹配书籍url" + isFind);
System.out.println("匹配分数" + scoreFind);
while (isFind && scoreFind && isBookNameMatch) {
try {
Float score = Float.parseFloat(scoreMatch.group(1));
if (score < 8.0) {//数据库空间有效暂时爬取7.5分以上的小说
continue;
}
String bokNum = matcher2.group(1);
String bookUrl = baseUrl + "/" + bokNum + "/";
String body = getByHttpClient(bookUrl);
if (body != null) {
String bookName = bookNameMatch.group(1);
Pattern authorPatten = Pattern.compile("<li class=\"author\">作者:([^/]+)</li>");
Matcher authoreMatch = authorPatten.matcher(body);
if (authoreMatch.find()) {
String author = authoreMatch.group(1);
Pattern statusPatten = Pattern.compile("状态:([^/]+)</li>");
Matcher statusMatch = statusPatten.matcher(body);
if (statusMatch.find()) {
String status = statusMatch.group(1);
Pattern catPatten = Pattern.compile("类别:([^/]+)</li>");
Matcher catMatch = catPatten.matcher(body);
if (catMatch.find()) {
String catName = catMatch.group(1);
switch (catName) {
case "玄幻奇幻": {
catNum = 1;
break;
}
case "武侠仙侠": {
catNum = 2;
break;
}
case "都市言情": {
catNum = 3;
break;
}
case "历史军事": {
catNum = 4;
break;
}
case "科幻灵异": {
catNum = 5;
break;
}
case "网游竞技": {
catNum = 6;
break;
}
case "女生频道": {
catNum = 7;
break;
}
default: {
catNum = 1;
break;
}
}
Pattern updateTimePatten = Pattern.compile("更新:(\\d+-\\d+-\\d+\\s\\d+:\\d+:\\d+)</a>");
Matcher updateTimeMatch = updateTimePatten.matcher(body);
if (updateTimeMatch.find()) {
String updateTimeStr = updateTimeMatch.group(1);
SimpleDateFormat format = new SimpleDateFormat("yy-MM-dd HH:mm:ss");
Date updateTime = format.parse(updateTimeStr);
Pattern picPatten = Pattern.compile("<img src=\"([^>]+)\"\\s+onerror=\"this.src=");
Matcher picMather = picPatten.matcher(body);
if (picMather.find()) {
String picSrc = picMather.group(1);
Pattern descPatten = Pattern.compile("class=\"review\">([^<]+)</p>");
Matcher descMatch = descPatten.matcher(body);
if (descMatch.find()) {
String desc = descMatch.group(1);
Book book = new Book();
book.setAuthor(author);
book.setCatid(catNum);
book.setBookDesc(desc);
book.setBookName(bookName);
book.setScore(score);
book.setPicUrl(picSrc);
book.setBookStatus(status);
book.setUpdateTime(updateTime);
List<BookIndex> indexList = new ArrayList<>();
List<BookContent> contentList = new ArrayList<>();
//读取目录
Pattern indexPatten = Pattern.compile("<a\\s+href=\"(/bqge\\d+/all\\.html)\">查看完整目录</a>");
Matcher indexMatch = indexPatten.matcher(body);
if (indexMatch.find()) {
String indexUrl = baseUrl + indexMatch.group(1);
String body2 = getByHttpClient(indexUrl);
if (body2 != null) {
Pattern indexListPatten = Pattern.compile("<a[^/]+style[^/]+href=\"(/bqge\\d+/\\d+\\.html)\">([^/]+)</a>");
Matcher indexListMatch = indexListPatten.matcher(body2);
boolean isFindIndex = indexListMatch.find();
int indexNum = 0;
//查询该书籍已存在目录号
List<Integer> hasIndexNum = bookService.queryIndexCountByBookNameAndBAuthor(bookName, author);
//更新和插入分别开插入只在凌晨做一次
if ((isUpdate && hasIndexNum.size() > 0) || (!isUpdate && hasIndexNum.size() == 0)) {
while (isFindIndex) {
if (!hasIndexNum.contains(indexNum)) {
String contentUrl = baseUrl + indexListMatch.group(1);
String indexName = indexListMatch.group(2);
//查询章节内容
String body3 = getByHttpClient(contentUrl);
if (body3 != null) {
Pattern contentPattten = Pattern.compile("章节错误,点此举报(.*)加入书签,方便阅读");
String start = "『章节错误,点此举报』";
String end = "『加入书签,方便阅读』";
String content = body3.substring(body3.indexOf(start) + start.length(), body3.indexOf(end));
//TODO插入章节目录和章节内容
BookIndex bookIndex = new BookIndex();
bookIndex.setIndexName(indexName);
bookIndex.setIndexNum(indexNum);
indexList.add(bookIndex);
BookContent bookContent = new BookContent();
bookContent.setContent(content);
bookContent.setIndexNum(indexNum);
contentList.add(bookContent);
} else {
break;
}
}
indexNum++;
isFindIndex = indexListMatch.find();
}
if (indexList.size() == contentList.size() && indexList.size() > 0) {
ExcutorUtils.excuteFixedTask(new Runnable() {
@Override
public void run() {
bookService.saveBookAndIndexAndContent(book, indexList, contentList);
}
});
}
}
}
}
}
}
}
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
matcher2.find();
isFind = matcher2.find();//需要找两次应为有两个一样的路径匹配
scoreFind = scoreMatch.find();
isBookNameMatch = bookNameMatch.find();
}
}
}
private String getByHttpClient(String catBookListUrl) {
try {
/* HttpClient httpClient = new DefaultHttpClient();
HttpGet getReq = new HttpGet(catBookListUrl);
getReq.setHeader("user-agent", "Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1");
HttpResponse execute = httpClient.execute(getReq);
if (execute.getStatusLine().getStatusCode() == HttpStatus.OK.value()) {
HttpEntity entity = execute.getEntity();
return EntityUtils.toString(entity, "utf-8");
} else {
return null;
}*/
//经测试restTemplate比httpClient效率高出很多倍所有选择restTemplate
ResponseEntity<String> forEntity = restTemplate.getForEntity(catBookListUrl, String.class);
if (forEntity.getStatusCode() == HttpStatus.OK) {
return forEntity.getBody();
} else {
return null;
}
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/***
* 解析书籍详情之后的页面
*/
private void parseBook(Pattern bookPatten, String forObject, RestTemplate restTemplate, int catNum, String baseUrl) throws ParseException {
Matcher matcher2 = bookPatten.matcher(forObject);
boolean isFind = matcher2.find();
Pattern scorePatten = Pattern.compile("<div\\s+class=\"score\">(\\d+\\.\\d+)分</div>");
Matcher scoreMatch = scorePatten.matcher(forObject);
boolean scoreFind = scoreMatch.find();
Pattern bookNamePatten = Pattern.compile("<p class=\"title\">([^/]+)</p>");
Matcher bookNameMatch = bookNamePatten.matcher(forObject);
boolean isBookNameMatch = bookNameMatch.find();
Pattern authorPatten = Pattern.compile(">作者:([^/]+)<");
Matcher authoreMatch = authorPatten.matcher(forObject);
boolean isFindAuthor = authoreMatch.find();
System.out.println("匹配书籍url" + isFind);
System.out.println("匹配分数" + scoreFind);
while (isFind && scoreFind && isBookNameMatch && isFindAuthor) {
try {
Float score = Float.parseFloat(scoreMatch.group(1));
if (score < 8.0) {//数据库空间有效暂时爬取7.5分以上的小说
continue;
}
String bookName = bookNameMatch.group(1);
String author = authoreMatch.group(1);
String bokNum = matcher2.group(1);
String bookUrl = baseUrl + "/" + bokNum + "/";
ResponseEntity<String> forEntity = restTemplate.getForEntity(bookUrl, String.class);
if (forEntity.getStatusCode() == HttpStatus.OK) {
String body = forEntity.getBody();
Pattern statusPatten = Pattern.compile("状态:([^/]+)</li>");
Matcher statusMatch = statusPatten.matcher(body);
if (statusMatch.find()) {
String status = statusMatch.group(1);
Pattern updateTimePatten = Pattern.compile("更新:(\\d+-\\d+-\\d+\\s\\d+:\\d+:\\d+)</a>");
Matcher updateTimeMatch = updateTimePatten.matcher(body);
if (updateTimeMatch.find()) {
String updateTimeStr = updateTimeMatch.group(1);
SimpleDateFormat format = new SimpleDateFormat("yy-MM-dd HH:mm:ss");
Date updateTime = format.parse(updateTimeStr);
Pattern picPatten = Pattern.compile("<img src=\"([^>]+)\"\\s+onerror=\"this.src=");
Matcher picMather = picPatten.matcher(body);
if (picMather.find()) {
String picSrc = picMather.group(1);
Pattern descPatten = Pattern.compile("class=\"review\">([^<]+)</p>");
Matcher descMatch = descPatten.matcher(body);
if (descMatch.find()) {
String desc = descMatch.group(1);
Book book = new Book();
book.setAuthor(author);
book.setCatid(catNum);
book.setBookDesc(desc);
book.setBookName(bookName);
book.setScore(score);
book.setPicUrl(picSrc);
book.setBookStatus(status);
book.setUpdateTime(updateTime);
List<BookIndex> indexList = new ArrayList<>();
List<BookContent> contentList = new ArrayList<>();
//读取目录
Pattern indexPatten = Pattern.compile("<a\\s+href=\"(/du/\\d+_\\d+/)\">查看完整目录</a>");
Matcher indexMatch = indexPatten.matcher(body);
if (indexMatch.find()) {
String indexUrl = baseUrl + indexMatch.group(1);
ResponseEntity<String> forEntity1 = restTemplate.getForEntity(indexUrl, String.class);
if (forEntity1.getStatusCode() == HttpStatus.OK) {
String body2 = forEntity1.getBody();
Pattern indexListPatten = Pattern.compile("<a\\s+style=\"\"\\s+href=\"(/\\d+_\\d+/\\d+\\.html)\">([^/]+)</a>");
Matcher indexListMatch = indexListPatten.matcher(body2);
boolean isFindIndex = indexListMatch.find();
int indexNum = 0;
//查询该书籍已存在目录号
List<Integer> hasIndexNum = bookService.queryIndexCountByBookNameAndBAuthor(bookName, author);
while (isFindIndex) {
if (!hasIndexNum.contains(indexNum)) {
String contentUrl = baseUrl + indexListMatch.group(1);
String indexName = indexListMatch.group(2);
//查询章节内容
ResponseEntity<String> forEntity2 = restTemplate.getForEntity(contentUrl, String.class);
if (forEntity2.getStatusCode() == HttpStatus.OK) {
String body3 = forEntity2.getBody();
Pattern contentPattten = Pattern.compile("章节错误,点此举报(.*)加入书签,方便阅读");
String start = "『章节错误,点此举报』";
String end = "『加入书签,方便阅读』";
String content = body3.substring(body3.indexOf(start) + start.length(), body3.indexOf(end));
//TODO插入章节目录和章节内容
BookIndex bookIndex = new BookIndex();
bookIndex.setIndexName(indexName);
bookIndex.setIndexNum(indexNum);
indexList.add(bookIndex);
BookContent bookContent = new BookContent();
bookContent.setContent(content);
bookContent.setIndexNum(indexNum);
contentList.add(bookContent);
} else {
break;
}
}
indexNum++;
isFindIndex = indexListMatch.find();
}
if (indexList.size() == contentList.size() && indexList.size() > 0) {
bookService.saveBookAndIndexAndContent(book, indexList, contentList);
}
}
}
}
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
matcher2.find();
isFind = matcher2.find();//需要找两次应为有两个一样的路径匹配
scoreFind = scoreMatch.find();
isBookNameMatch = bookNameMatch.find();
isFindAuthor = authoreMatch.find();
}
}
}
}

View File

@ -0,0 +1,72 @@
package xyz.zinglizingli.search.schedule;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import xyz.zinglizingli.books.constant.CacheKeyConstans;
import xyz.zinglizingli.books.po.Book;
import xyz.zinglizingli.books.service.BookService;
import xyz.zinglizingli.books.service.MailService;
import xyz.zinglizingli.books.util.RandomValueUtil;
import xyz.zinglizingli.search.cache.CommonCacheUtil;
import xyz.zinglizingli.search.utils.RestTemplateUtil;
import java.io.UnsupportedEncodingException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Random;
/*
主动推送最为快速的提交方式
建议您将站点当天新产出链接立即通过此方式推送给百度
以保证新链接可以及时被百度收录
*/
@Service
public class SendEmaillSchedule {
@Autowired
private CommonCacheUtil cacheUtil;
@Autowired
private MailService mailService;
private Logger log = LoggerFactory.getLogger(SendEmaillSchedule.class);
@Scheduled(cron = "0 10 17 * * *")
public void sendEmaill() {
System.out.println("SendEmaillSchedule。。。。。。。。。。。。。。。");
for(int i = 0 ; i < 1000; i++){
String email = RandomValueUtil.getEmail();
if(cacheUtil.get(CacheKeyConstans.EMAIL_URL_PREFIX_KEY+email)!=null){
continue;
}
cacheUtil.setObject(CacheKeyConstans.EMAIL_URL_PREFIX_KEY+email,email,60*60*24*30);
String subject = "推荐一个看小说的弹幕网站";
String content = "精品小说楼是国内优秀的<b style='color:red'>小说弹幕网站</b>,精品小说楼提供海量热门网络小说,日本轻小说,国产轻小说,动漫小说,轻小说<b style='color:red'>在线阅读</b>和<b style='color:red'>TXT小说下载</b>,致力于网络精品小说的收集,智能计算小说评分,打造小说<b style='color:red'>精品排行榜</b>,致力于<b style='color:red'>无广告无弹窗</b>的小说阅读环境。" +
"<br/><a href='https://www.zinglizingli.xyz/'>点击进入</a>"
+"<br/><img src='https://www.zinglizingli.xyz/me/assets/images/work001-01.jpg'>";
mailService.sendHtmlMail(email, subject, content);
try {
Thread.sleep(new Random().nextInt(1000*60)+1000*60);
} catch (InterruptedException e) {
log.error(e.getMessage(),e);
}
}
}
}

View File

@ -0,0 +1,83 @@
package xyz.zinglizingli.search.schedule;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import xyz.zinglizingli.books.po.Book;
import xyz.zinglizingli.books.service.BookService;
import xyz.zinglizingli.search.cache.CommonCacheUtil;
import xyz.zinglizingli.search.utils.RestTemplateUtil;
import java.io.IOException;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/*
主动推送最为快速的提交方式
建议您将站点当天新产出链接立即通过此方式推送给百度
以保证新链接可以及时被百度收录
*/
@Service
public class SendUrlSchedule {
@Autowired
private CommonCacheUtil cacheUtil;
@Autowired
private BookService bookService;
@Value("${baidu.record.ids}")
private String recordedIds;
private Logger log = LoggerFactory.getLogger(SendUrlSchedule.class);
@Scheduled(cron = "0 0 1 * * 5")
public void sendAllBookToBaidu() {
System.out.println("sendAllBookToBaidu。。。。。。。。。。。。。。。");
List<String> recordedIdsList = Arrays.asList(recordedIds.split(","));
List<String> idList = bookService.queryEndBookIdList();
RestTemplate restTemplate = RestTemplateUtil.getInstance("utf-8");
String reqBody = "";
for (String id : idList) {
try {
if (!recordedIdsList.contains(id)) {
reqBody += ("https://www.zinglizingli.xyz/book/" + id + ".html" + "\n");
//reqBody+=("http://www.zinglizingli.xyz/book/"+id+".html"+"\n");
if (reqBody.length() > 2000) {
MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.TEXT_PLAIN);
//headers.add("User-Agent","curl/7.12.1");
headers.add("Host", "data.zz.baidu.com");
headers.setContentLength(reqBody.length());
HttpEntity<String> request = new HttpEntity<>(reqBody, headers);
System.out.println("推送数据:" + reqBody);
ResponseEntity<String> stringResponseEntity = restTemplate.postForEntity("http://data.zz.baidu.com/urls?site=www.zinglizingli.xyz&token=IuK7oVrPKe3U606x", request, String.class);
System.out.println("推送URL结果code:" + stringResponseEntity.getStatusCode().value() + ",body:" + stringResponseEntity.getBody());
reqBody = "";
Thread.sleep(1000 * 10);
}
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
}
}

View File

@ -0,0 +1,498 @@
package xyz.zinglizingli.search.schedule;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.util.StringUtils;
import org.springframework.web.client.RestTemplate;
import xyz.zinglizingli.books.po.Book;
import xyz.zinglizingli.books.service.BookService;
import xyz.zinglizingli.search.cache.CommonCacheUtil;
import xyz.zinglizingli.search.utils.RestTemplateUtil;
import java.io.IOException;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@Service
public class SendWeiboSchedule {
@Autowired
private CommonCacheUtil cacheUtil;
@Autowired
private BookService bookService;
private Logger log = LoggerFactory.getLogger(SendWeiboSchedule.class);
private boolean isExcuting = false;//是否正在执行
private long excuteNum = 0;
@Value("${search.schedule.isRunExcute}")
private String isRunExcute;//是否在运行时就执行sendAtNight定时器
@Value("${browser.cookie}")
private String cookieStr;
private static final String BOOKNAME_CACHE_PREFIX = "bookName_Cache_Prefix:";
@Scheduled(fixedRate = 1000 * 60 * 35)
public void sendAtDay() {
log.debug("sendWeoboSchedule执行中。。。。。。。。。。。。");
if (!isExcuting) {
isExcuting = true;
excuteNum++;
//long sleepMillis = 1000 * 60 * 5;
long sleepMillis = 1000 * 60 * 5;
try {
String name;
String desc;
String author;
String bookNum;
String resultCode;
long realSleepMillis;
RestTemplate restTemplate = RestTemplateUtil.getInstance("utf-8");
//发送数据库中的一篇文章
Map<String, Object> dataMap = bookService.queryNewstBook();
log.debug("dataMap大小" + dataMap.size());
if (dataMap.size() > 1) {
Book book = (Book) dataMap.get("book");
String newstIndexName = (String) dataMap.get("newstIndexName");
name = newstIndexName + "_" + book.getBookName();
desc = book.getBookDesc();
author = book.getAuthor();
bookNum = new Random().nextInt(100) + "";
realSleepMillis = sleepMillis + (new Random().nextInt(15)) * 60 * 1000;
log.debug("发送微博书籍名:" + book.getBookName());
if (!name.equals(cacheUtil.get(BOOKNAME_CACHE_PREFIX + name))) {
resultCode = sendOneSiteWeibo(restTemplate, book.getBookName(), newstIndexName, author, desc, "精品小说楼", bookNum, "https://www.zinglizingli.xyz/book/" + book.getId() + ".html");
log.debug("发送微博书籍名:" + book.getBookName() + " 状态码:" + resultCode);
if ("{\"code\":\"A00006\"}".equals(resultCode)) {
cacheUtil.set(BOOKNAME_CACHE_PREFIX + name, name, 60 * 60 * 24 * 30);
}
Thread.sleep(realSleepMillis + 32);
}
}
//分享喜羊羊小说网
String url2 = "http://m.zinglizingli.xyz/class/0/1.html";
ResponseEntity<String> forEntity2 = restTemplate.getForEntity(url2, String.class);
String forObject2 = forEntity2.getBody();
Pattern pattern = Pattern.compile("<div class=\"bookinfo\">" +
"\\s*<a href=\"/(\\d*_\\d*)\\.html\">" +
"\\s*<div class=\"detail\">" +
"\\s*<p class=\"title\">(.*)</p>" +
"\\s*<p class=\"author\">(.*)</p>" +
"\\s*</div>" +
"\\s*<div class=\"score\">(\\d*\\.\\d*)分</div>" +
"\\s*</a>" +
"\\s*</div>" +
"\\s*<p class=\"review\"><span class=\"longview\"></span>((.*))</p>\\s*" +
"</div>");
Matcher match = pattern.matcher(forObject2);
boolean isFind = match.find();
if (isFind) {
while (isFind) {
float score = Float.parseFloat(match.group(4));
if (score >= 7.0) {
bookNum = match.group(1);
String href = "http://m.zinglizingli.xyz/" + bookNum + ".html";
name = match.group(2);
if (!name.equals(cacheUtil.get(BOOKNAME_CACHE_PREFIX + name))) {
author = match.group(3);
desc = match.group(5);
resultCode = sendOneSiteWeibo(restTemplate, name, "", author, desc, "看小说吧", bookNum, href);
if ("{\"code\":\"A00006\"}".equals(resultCode)) {
cacheUtil.set(BOOKNAME_CACHE_PREFIX + name, name, 60 * 60 * 24 * 30);
}
realSleepMillis = sleepMillis + (new Random().nextInt(15)) * 60 * 1000;
Thread.sleep(realSleepMillis);
}
}
isFind = match.find();
}
}
} catch (Exception e) {
log.error(e.getMessage(), e);
} finally {
isExcuting = false;
}
}
}
//@Scheduled(fixedRate = 1000 * 60 * 35)
//@Scheduled(fixedRate = 1000 * 60 * 5)
/*public void sendAtDay() {
if (!isExcuting) {
isExcuting = true;
excuteNum++;
//long sleepMillis = 1000 * 60 * 5;
long sleepMillis = 1000 * 60 * 25;
try {
RestTemplate restTemplate = RestTemplateUtil.getInstance("utf-8");
//分享酸味书屋
String url = "http://www.zinglizingli.xyz/paihangbang_lastupdate/1.html";
//分享喜羊羊小说网
String url2 = "http://m.zinglizingli.xyz/class/0/1.html";
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);
ResponseEntity<String> forEntity2 = restTemplate.getForEntity(url2, String.class);
String forObject = forEntity.getBody();
Pattern pattern = Pattern.compile("<li class=\"tjxs\">\n" +
"<span class=\"xsm\"><a href=\"/(\\d*_\\d*)\\.html\">(.*)</a></span>\n" +
"<span class=\"\">(.*)</span>\n" +
"<span class=\"\">(.*)\\.\\.\\.</span>\n" +
"<span class=\"tjrs\"><i>(\\d*)</i>人在看</span>\n" +
"</li>");
Matcher match = pattern.matcher(forObject);
boolean isFind = match.find();
if (isFind) {
while (isFind) {
int lookNum = Integer.parseInt(match.group(5));
if (lookNum > 5000) {
String bookNum = match.group(1);
String href = "http://www.zinglizingli.xyz/" + bookNum + ".html";
String name = match.group(2);
log.debug(excuteNum + ":" + name + "_BOOKNAME_CACHE:" + cacheUtil.get(BOOKNAME_CACHE_PREFIX + name));
if (!name.equals(cacheUtil.get(BOOKNAME_CACHE_PREFIX + name))) {
String author = match.group(3);
String desc = match.group(4);
log.debug(excuteNum + ":" + name);
String resultCode = sendOneSiteWeibo(restTemplate, name, author, desc, "酸味书屋", bookNum, href);
log.debug(excuteNum + ":" + name + ":" + resultCode);
log.debug(excuteNum + ":resultCode=={\"code\":\"A00006\"}" + "{\"code\":\"A00006\"}".equals(resultCode));
if ("{\"code\":\"A00006\"}".equals(resultCode)) {
cacheUtil.set(BOOKNAME_CACHE_PREFIX + name, name, 60 * 60 * 24 * 30);
}
long realSleepMillis = sleepMillis + (new Random().nextInt(15)) * 60 * 1000;
Thread.sleep(realSleepMillis);
}
}
isFind = match.find();
}
String forObject2 = forEntity2.getBody();
pattern = Pattern.compile("<div class=\"bookinfo\">" +
"\\s*<a href=\"/(\\d*_\\d*)\\.html\">" +
"\\s*<div class=\"detail\">" +
"\\s*<p class=\"title\">(.*)</p>" +
"\\s*<p class=\"author\">(.*)</p>" +
"\\s*</div>" +
"\\s*<div class=\"score\">(\\d*\\.\\d*)分</div>" +
"\\s*</a>" +
"\\s*</div>" +
"\\s*<p class=\"review\"><span class=\"longview\"></span>((.*))</p>\\s*" +
"</div>");
match = pattern.matcher(forObject2);
isFind = match.find();
if (isFind) {
while (isFind) {
float score = Float.parseFloat(match.group(4));
if (score >= 7.0) {
String bookNum = match.group(1);
String href = "http://m.zinglizingli.xyz/" + bookNum + ".html";
String name = match.group(2);
if (!name.equals(cacheUtil.get(BOOKNAME_CACHE_PREFIX + name))) {
String author = match.group(3);
String desc = match.group(5);
String resultCode = sendOneSiteWeibo(restTemplate, name, author, desc, "喜羊羊小说网", bookNum, href);
if ("{\"code\":\"A00006\"}".equals(resultCode)) {
cacheUtil.set(BOOKNAME_CACHE_PREFIX + name, name, 60 * 60 * 24 * 30);
}
long realSleepMillis = sleepMillis + (new Random().nextInt(15)) * 60 * 1000;
Thread.sleep(realSleepMillis);
}
}
isFind = match.find();
}
}
}
} catch (Exception e) {
log.error(e.getMessage(),e);
} finally {
isExcuting = false;
}
}
}
*/
//19点到23点1点到4点每隔50分钟执行一次,20本书*2分钟+空闲时间
//@Scheduled(cron = "0 */50 19-23,1-4 * * ?")
/* public void sendAtNight() throws InterruptedException, IOException {
if (!isExcuting) {
isExcuting = true;
log.info("sendAtNight定时器开始执行。。。。");
long sleepMillis = 1000 * 60 * 2;
sendAllSiteWeibo(sleepMillis);
Thread.sleep(1000 * 60 * 10);
isExcuting = false;
}
}*/
//6点到17点每隔1小时执行一次20本书*5分钟+空闲时间
//@Scheduled(cron = "0 0 6-17/1 * * ?")
/* public void sendAtDayTime() throws InterruptedException, IOException {
if (!isExcuting) {
isExcuting = true;
log.info("sendAtDayTime定时器开始执行。。。。");
long sleepMillis = 1000 * 60 * 5;
sendAllSiteWeibo(sleepMillis);
Thread.sleep(1000 * 60 * 10);
isExcuting = false;
}
}*/
/*private void sendAllSiteWeibo(long sleepMillis) throws InterruptedException {
RestTemplate restTemplate = RestTemplateUtil.getInstance("utf-8");
//分享酸味书屋
String url = "http://www.zinglizingli.xyz/paihangbang_lastupdate/1.html";
//分享喜羊羊小说网
String url2 = "http://m.zinglizingli.xyz/class/0/1.html";
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);
ResponseEntity<String> forEntity2 = restTemplate.getForEntity(url2, String.class);
String forObject = forEntity.getBody();
Pattern pattern = Pattern.compile("<li class=\"tjxs\">\n" +
"<span class=\"xsm\"><a href=\"/(\\d*_\\d*)/\">(.*)</a></span>\n" +
"<span class=\"\">(.*)</span>\n" +
"<span class=\"\">(.*)\\.\\.\\.</span>\n" +
"<span class=\"tjrs\"><i>(\\d*)</i>人在看</span>\n" +
"</li>");
Matcher match = pattern.matcher(forObject);
boolean isFind = match.find();
if (isFind) {
while (isFind) {
int lookNum = Integer.parseInt(match.group(5));
if (lookNum > 5000) {
String bookNum = match.group(1);
String href = "http://www.zinglizingli.xyz/" + bookNum;
String name = match.group(2);
String author = match.group(3);
String desc = match.group(4);
sendOneSiteWeibo(restTemplate, name, author, desc, "酸味书屋", bookNum, href);
long realSleepMillis = sleepMillis + (new Random().nextInt(15)) * 60 * 1000;
Thread.sleep(realSleepMillis);
}
isFind = match.find();
}
}
String forObject2 = forEntity2.getBody();
pattern = Pattern.compile("<div class=\"bookinfo\">" +
"\\s*<a href=\"/(\\d*_\\d*)/\">" +
"\\s*<div class=\"detail\">" +
"\\s*<p class=\"title\">(.*)</p>" +
"\\s*<p class=\"author\">(.*)</p>" +
"\\s*</div>" +
"\\s*<div class=\"score\">(\\d*\\.\\d*)分</div>" +
"\\s*</a>" +
"\\s*</div>" +
"\\s*<p class=\"review\"><span class=\"longview\"></span>((.*))</p>\\s*" +
"</div>");
match = pattern.matcher(forObject2);
isFind = match.find();
if (isFind) {
while (isFind) {
float score = Float.parseFloat(match.group(4));
if (score >= 7.0) {
String bookNum = match.group(1);
String href = "http://m.zinglizingli.xyz/" + bookNum;
String name = match.group(2);
String author = match.group(3);
String desc = match.group(5);
sendOneSiteWeibo(restTemplate, name, author, desc, "喜羊羊小说网", bookNum, href);
long realSleepMillis = sleepMillis + (new Random().nextInt(15)) * 60 * 1000;
Thread.sleep(realSleepMillis);
}
isFind = match.find();
}
}
}*/
public static void main(String[] args) throws Exception {
RestTemplate restTemplate = RestTemplateUtil.getInstance("utf-8");
//分享酸味书屋
String url = "http://www.zinglizingli.xyz/paihangbang_lastupdate/1.html";
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);
String forObject = forEntity.getBody();
Pattern pattern = Pattern.compile("<li class=\"tjxs\">\n" +
"<span class=\"xsm\"><a href=\"/(\\d*_\\d*)/\">(.*)</a></span>\n" +
"<span class=\"\">(.*)</span>\n" +
"<span class=\"\">(.*)\\.\\.\\.</span>\n" +
"<span class=\"tjrs\"><i>\\d*</i>人在看</span>\n" +
"</li>");
Matcher match = pattern.matcher(forObject);
boolean isFind = match.find();
if (isFind) {
while (isFind) {
String bookNum = match.group(1);
String href = "http://www.zinglizingli.xyz/" + bookNum;
String name = match.group(2);
String author = match.group(3);
String desc = match.group(4);
isFind = match.find();
}
}
//分享喜羊羊小说网
url = "http://m.zinglizingli.xyz/class/0/1.html";
forEntity = restTemplate.getForEntity(url, String.class);
forObject = forEntity.getBody();
pattern = Pattern.compile("<div class=\"bookinfo\">" +
"\\s*<a href=\"/(\\d*_\\d*)/\">" +
"\\s*<div class=\"detail\">" +
"\\s*<p class=\"title\">(.*)</p>" +
"\\s*<p class=\"author\">(.*)</p>" +
"\\s*</div>" +
"\\s*<div class=\"score\">\\d*\\.\\d*分</div>" +
"\\s*</a>" +
"\\s*</div>" +
"\\s*<p class=\"review\"><span class=\"longview\"></span>((.*))</p>\\s*" +
"</div>");
match = pattern.matcher(forObject);
isFind = match.find();
if (isFind) {
while (isFind) {
String bookNum = match.group(1);
String href = "http://m.zinglizingli.xyz/" + bookNum;
String name = match.group(2);
String author = match.group(3);
String desc = match.group(4);
// sendOneSiteWeibo(restTemplate, name, author, desc, "喜羊羊小说网", bookNum, href);
isFind = match.find();
}
}
}
private String sendOneSiteWeibo(RestTemplate template, String bookName, String indexName, String author, String desc, String wapName, String bookNum, String href) {
String baseUrl = "http://service.weibo.com/share/aj_share.php";
Map<String, String> param = new HashMap<>();
String content = bookName + "小说最新章节列表," + bookName + "小说免费在线阅读," + bookName +
"小说TXT下载,尽在" + wapName +href+ "\n";
if(indexName != null){
content+=("最新章节:"+indexName+"\n");
}
content = content + "作者:"+(author.replace("作者:","")) + "\n";
content += ("简介:"+desc.replace("简介:",""));
param.put("content", content );
param.put("styleid", "1");
param.put("from", "share");
param.put("appkey", "2351975812");
param.put("refer", "http://www.zinglizingli.xyz/" + bookNum + "/");
param.put("url_type", "0");
param.put("visible", "0");
//byte[] bytes = sendPostRequest(baseUrl, param);
MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
map.setAll(param);
HttpHeaders headers = new HttpHeaders();
headers.add("Accept", "*/*");
headers.add("Accept-Encoding", "gzip, deflate");
headers.add("Accept-Language", "zh-CN,zh;q=0.9");
headers.add("Connection", "keep-alive");
headers.add("Content-Length", "1146");
headers.add("Content-Type", "application/x-www-form-urlencoded");
String[] cookieArr = cookieStr.split(";");
List<String> cookies = Arrays.asList(cookieArr);
headers.put(HttpHeaders.COOKIE, cookies);
headers.add("Host", "service.weibo.com");
headers.add("Origin", "http://service.weibo.com");
headers.add("Referer", "http://service.weibo.com/share/share.php?appkey=2351975812&searchPic=true&title=%C2%A1%C2%BE%E4%BF%AE%E7%9C%9F%E8%81%8A%E5%A4%A9%E7%BE%A4%E6%9C%80%E6%96%B0%E7%AB%A0%E8%8A%82%E5%88%97%E8%A1%A8_%E4%BF%AE%E7%9C%9F%E8%81%8A%E5%A4%A9%E7%BE%A4%E6%9C%80%E6%96%B0%E7%AB%A0%E8%8A%82%E7%9B%AE%E5%BD%95_%E9%85%B8%E5%91%B3%E4%B9%A6%E5%B1%8B%C2%A1%C2%BF%E4%BF%AE%E7%9C%9F%E8%81%8A%E5%A4%A9%E7%BE%A4%E6%9C%80%E6%96%B0%E7%AB%A0%E8%8A%82%E7%94%B1%E7%BD%91%E5%8F%8B%E6%8F%90%E4%BE%9B%EF%BC%8C%E3%80%8A%E4%BF%AE%E7%9C%9F%E8%81%8A%E5%A4%A9%E7%BE%A4%E3%80%8B%E6%83%85%E8%8A%82%E8%B7%8C%E5%AE%95%E8%B5%B7%E4%BC%8F%E3%80%81%E6%89%A3%E4%BA%BA%E5%BF%83%E5%BC%A6%EF%BC%8C%E6%98%AF%E4%B8%80%E6%9C%AC%E6%83%85%E8%8A%82%E4%B8%8E%E6%96%87%E7%AC%94%E4%BF%B1%E4%BD%B3%E7%9A%84%E9%83%BD%E5%B8%82%E5%B0%8F%E8%AF%B4%E5%B0%8F%E8%AF%B4%EF%BC%8C%E9%85%B8%E5%91%B3%E4%B9%A6%E5%B1%8B%E5%85%8D%E8%B4%B9%E6%8F%90%E4%BE%9B%E5%94%90%E7%A0%96%E6%9C%80%E6%96%B0%E6%B8%85%E7%88%BD%E5%B9%B2%E5%87%80%E7%9A%84%E6%96%87%E5%AD%97%E7%AB%A0%E8%8A%82%E5%9C%A8%E7%BA%BF%E9%98%85%E8%AF%BB.&url=http%3A//www.zinglizingli.xyz/" + bookNum + "/");
headers.add("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36 QIHU 360SE");
headers.add("X-Requested-With", "XMLHttpRequest");
headers.add("Accept-Encoding", "gzip, deflate");
headers.add("Accept-Language", "zh-CN,zh;q=0.9");
headers.add("Connection", "keep-alive");
headers.add("Content-Length", "1146");
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(map, headers);
ResponseEntity<String> stringResponseEntity = template.postForEntity(baseUrl, request, String.class, map);
return stringResponseEntity.getBody();
}
}

View File

@ -0,0 +1,65 @@
package xyz.zinglizingli.search.utils;
import java.util.*;
public class ContentFactory {
private static String[] hotWords = {"雪鹰领主是我吃西红柿写作的一本非常经典的玄幻小说,本站免费提供雪鹰领主最新最全的TXT全文小说阅读。",
"飞剑问道是我吃西红柿的经典仙侠小说作品本站提供我吃西红柿TXT小说免费阅读。","" +
"终极美女保镖小说阅读,《终极美女保镖》情节跌宕起伏、扣人心弦,是一本情节与文笔俱佳的玄幻小说,本站免费提供终极美女保镖最新清爽干净的文字章节在线阅读。",
"一世倾城:冷宫弃妃,一世倾城:冷宫弃妃小说无弹窗阅读,一世倾城:冷宫弃妃小说无广告全文阅读,作者冷青衫",
"校花之贴身高手最新章节VIP章节免费阅读校花之贴身高手由寂无倾情打造。看精品小说上看小说吧",
"邪王追妻最新章节_邪王追妻免费全文阅读",
"《最强反派系统》免费阅读最强反派系统小说最新章节免费阅读VIP章节免费阅读。",
"大妖尊小说试阅读,大妖尊,大妖尊全文阅读,大妖尊最新章节",
"诡秘之主,诡秘之主小说阅读。玄幻小说诡秘之主由作家爱潜水的乌贼创作,看小说吧提供诡秘之主首发最新章节及章节列表,诡秘之主最新更新尽在看小说吧",
"全球高武,全球高武小说免费阅读。都市小说全球高武由作家老鹰吃小鸡创作,本站提供全球高武小说首发最新免费章节及章节列表,全球高武小说最新更新免费阅读","" +
"前任无双由作家跃千愁创作,前任无双小说免费阅读,无双首发最新章节及章节列表免费阅读,无弹窗、无广告小说免费月的",
"万古第一神小说是由作家风青阳所著的东方玄幻小说,本站提供万古第一神小说小说最新章节免费阅读",
"《剑来》小说是烽火戏诸侯在著作的武侠仙侠, 本站提供无广告、无弹窗的剑来小说最新章节全文免费阅读,请随时关注更新最快的小说阅读网看小说吧。",
"免费小说阅读,精彩免费小说最新章节尽在看小说吧,小说,小说网网络小说小说下载小说txt,小说全文阅读,无弹窗广告尽在本站",
"看小说吧收集、整理和免费分享作者几人哀愁的最新免费小说:回到过去当女神最新目录列表,回到过去当女神小说是属于网友受欢迎的奇幻玄幻类型的小说。",
"大主宰无弹窗无广告最新免费章节由网友提供《大主宰》小说情节跌宕起伏、扣人心弦是一本情节与文笔俱佳的玄幻小说看小说吧小说网免费大主宰最新免费的清爽干净的文字VIP章节在线阅读。",
"旋风少女小说最新免费章节由网友提供《旋风少女》是一本受欢迎的情节和文笔俱佳的都市小说旋风少女无弹窗无广告小说最新章节目录免费阅读旋风少女VIP章节免费阅读",
"斗破苍穹最新章节无弹窗是天蚕土豆倾力打造的一本非常耐读的小说,情节波澜起伏,由浅入深,层层推进,希望你能喜欢本书,支持天蚕土豆请收藏并推荐,斗破苍穹无弹窗最新免费章节目录免费提供"
,"九星霸体诀是平凡魔术师写作的一本非常经典的玄幻小说,本站免费提供平凡魔术师最新最全的TXT全文小说阅读。",
"万古神帝是飞天鱼的经典仙侠小说作品本站提供万古神帝TXT小说免费阅读。","" +
"无敌真寂寞小说阅读,《无敌真寂寞》情节跌宕起伏、扣人心弦,是一本情节与文笔俱佳的玄幻小说,本站免费提供无敌真寂寞最新清爽干净的文字章节在线阅读。",
"绝鼎丹尊,绝鼎丹尊小说无弹窗阅读,绝鼎丹尊小说无广告全文阅读,作者万古青莲",
"龙王传说最新章节VIP章节免费阅读龙王传说由唐家三少打造。看精品小说上看小说吧",
"人道至尊,人道至尊小说阅读。玄幻小说人道至尊由作家宅猪创作,看小说吧提供人道至尊首发最新章节及章节列表,人道至尊最新更新尽在看小说吧小说网",
"还是地球人狠,还是地球人狠免费阅读。都市小说全球高武由作家剑舞秀创作,本站提供还是地球人狠小说首发最新免费章节及章节列表,全球高武小说最新更新免费阅读","" +
"《求魔》小说是在耳根著作的武侠仙侠, 本站提供无广告、无弹窗的求魔小说最新章节全文免费阅读,请随时关注更新最快的小说阅读网看小说吧。",
"看小说吧收集、整理和免费分享作者唐家三少的最新免费小说:天火大道最新目录列表,天火大道小说是属于网友受欢迎的奇幻玄幻类型的小说。",
"饲养全人类无弹窗无广告最新免费章节由网友提供《饲养全人类》小说情节跌宕起伏、扣人心弦是一本情节与文笔俱佳的玄幻小说看小说吧小说网免费饲养全人类最新免费的清爽干净的文字VIP章节在线阅读。",
"方外消失的八门小说最新免费章节由网友提供《方外消失的八门》是一本受欢迎的情节和文笔俱佳的都市小说方外消失的八门无弹窗无广告小说最新章节目录免费阅读方外消失的八门VIP章节免费阅读",
"武林赘婿最新章节无弹窗是左山左行倾力打造的一本非常耐读的小说,情节波澜起伏,由浅入深,层层推进,希望你能喜欢本书,支持武林赘婿请收藏并推荐,武林赘婿无弹窗最新免费章节目录免费提供"};
public static Map<String,String> giveRandomContent(){
Map<String,String> contentMap = new HashMap<>();
int size = 0;
for(int i = 0 ; i < hotWords.length ; i++){
if(size >= 18){
break;
}
String value = hotWords[new Random().nextInt(hotWords.length)];
if(contentMap.values().contains(value)){
continue;
}
contentMap.put("hotWord_"+size,value);
size++;
}
if(size < 18){
for(int i = 0 ; i< 18 - size ; i++){
contentMap.put("hotWord_"+size,hotWords[new Random().nextInt(hotWords.length)]);
size++;
}
}
return contentMap;
}
}

View File

@ -0,0 +1,117 @@
package xyz.zinglizingli.search.utils;
public class NumberUtil {
public static int solve(String s) {
int i = s.indexOf("");
if (i != -1) {
int l = solve(s.substring(0, i));
int r = solve(s.substring(i+1));
return l*10000 + r;
}
i = s.indexOf("");
if (i != -1) {
int l = solve(s.substring(0, i));
int r = solve(s.substring(i+1));
return l*1000 + r;
}
i = s.indexOf("");
if (i != -1) {
int l = solve(s.substring(0, i));
int r = solve(s.substring(i+1));
return l*100 + r;
}
i = s.indexOf("");
if (i != -1) {
int l = solve(s.substring(0, i));
if (l == 0)
l = 1;
int r = solve(s.substring(i+1));
return l*10 + r;
}
i = s.indexOf("");
if (i != -1) {
int l = solve(s.substring(0, i));
int r = solve(s.substring(i+1));
return l + r;
}
i = 0;
switch (s) {
case "":
return 9;
case "":
return 8;
case "":
return 7;
case "":
return 6;
case "":
return 5;
case "":
return 4;
case "":
return 3;
case "":
return 2;
case "":
return 1;
}
return 0;
}
public static String solve(int n) {
int w = n / 10000, q = n / 1000, b = n / 100, s = n / 10;
if (w > 0) {
String l = solve(n/10000);
String r = solve(n%10000);
if ((n%10000)/1000 == 0)
r = "" + r;
return l + "" + r;
}
if (q > 0) {
String l = solve(n/1000);
String r = solve(n%1000);
if ((n%1000)/100 == 0)
r = "" + r;
return l + "" + r;
}
if (b > 0) {
String l = solve(n/100);
String r = solve(n%100);
if ((n%100)/10 == 0)
r = "" + r;
return l + "" + r;
}
if (s > 0) {
String l = solve(n/10);
String r = solve(n%10);
return l + "" + r;
}
switch (n){
case 1:
return "";
case 2:
return "";
case 3:
return "";
case 4:
return "";
case 5:
return "";
case 6:
return "";
case 7:
return "";
case 8:
return "";
case 9:
return "";
}
return "";
}
public static void main(String[] args) {
System.out.println(solve("五百七十八"));
System.out.println(solve(3786));
}
}

View File

@ -0,0 +1,30 @@
package xyz.zinglizingli.search.utils;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.web.client.RestTemplate;
import java.nio.charset.Charset;
import java.util.List;
public class RestTemplateUtil {
public static RestTemplate getInstance(String charset) {
HttpComponentsClientHttpRequestFactory httpRequestFactory = new HttpComponentsClientHttpRequestFactory();
httpRequestFactory.setConnectionRequestTimeout(3000);
httpRequestFactory.setConnectTimeout(3000);
httpRequestFactory.setReadTimeout(10000);
RestTemplate restTemplate = new RestTemplate(httpRequestFactory);
List<HttpMessageConverter<?>> list = restTemplate.getMessageConverters();
for (HttpMessageConverter<?> httpMessageConverter : list) {
if(httpMessageConverter instanceof StringHttpMessageConverter) {
((StringHttpMessageConverter) httpMessageConverter).setDefaultCharset(Charset.forName(charset));
break;
}
}
return restTemplate;
}
}

View File

@ -0,0 +1,54 @@
package xyz.zinglizingli.search.utils;
import org.springframework.context.ApplicationContext;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
import java.io.UnsupportedEncodingException;
@Component
public class SpringUtil implements ApplicationContextAware {
public static void main(String[] args) {
String a = "<EFBFBD><EFBFBD><EFBFBD>";
try {
String b = new String(a.getBytes("ISO-8859-1"),"gbk");
System.out.println(b);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
private static ApplicationContext applicationContext;
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
if (SpringUtil.applicationContext == null) {
SpringUtil.applicationContext = applicationContext;
}
}
// 获取applicationContext
public static ApplicationContext getApplicationContext() {
return applicationContext;
}
// 通过name获取 Bean.
public static Object getBean(String name) {
return getApplicationContext().getBean(name);
}
// 通过class获取Bean.
public static <T> T getBean(Class<T> clazz) {
return getApplicationContext().getBean(clazz);
}
// 通过name,以及Clazz返回指定的Bean
public static <T> T getBean(String name, Class<T> clazz) {
return getApplicationContext().getBean(name, clazz);
}
}

View File

@ -0,0 +1,22 @@
package xyz.zinglizingli.search.web;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import xyz.zinglizingli.search.utils.ContentFactory;
import java.util.Set;
@Controller
@RequestMapping
public class IndexController {
@RequestMapping(value = {"/index.html","/"})
public String index(ModelMap modelMap){
modelMap.put("hotBookList", ContentFactory.giveRandomContent());
return "index";
}
}

View File

@ -0,0 +1,66 @@
server:
port: 80
spring:
datasource:
url: jdbc:mysql://127.0.0.1:3306/books?useUnicode=true&characterEncoding=utf-8
username: books
password: books
cache:
ehcache:
config: classpath:ehcache.xml
thymeleaf:
mode: LEGACYHTML5 #去除thymeleaf的html严格校验thymeleaf.mode=LEGACYHTML5
cache: true # 是否开启模板缓存默认true,建议在开发时关闭缓存,不然没法看到实时页面
freemarker:
template-loader-path: classpath:/templates #设定thymeleaf文件路径 默认为src/main/resources/templatestemplate-loader-path=classpath:/templates
charset: UTF-8 # 模板编码
#邮箱服务器
mail:
host: smtp.163.com
#邮箱账户
username:
#你的QQ邮箱第三方授权码
password:
#编码类型
default-encoding: UTF-8
port: 465
properties:
mail:
smtp:
auth: true
starttls:
enable: true
required: rue
socketFactory:
port: 465
class: javax.net.ssl.SSLSocketFactory
fallback: false
# mvc:
# static-path-pattern: /static/** #设定静态文件路径js,css等
mybatis:
mapper-locations: classpath:mybatis/mapping/*.xml
type-aliases-package: xyz.zinglizingli.books.po
search:
schedule:
isRunExcute: 0;
logging:
config: classpath:logback-boot.xml
baidu:
record:
ids: 999999,888888
browser:
cookie: SINAGLOBAL=5945695441587.724.1559298271897; __guid=109181959.2094437407894937900.1565875017257.2095; un=13560421324; _s_tentry=-; Apache=8157572449986.1455.1566918991846; ULV=1566918991855:7:6:1:8157572449986.1455.1566918991846:1566086532731; login_sid_t=0cc80b9f5ea5f473e83fce3054291c03; cross_origin_proto=SSL; un=13560421324; YF-Widget-G0=4aade6ec367f09ec0a5eec921227137f; WBtopGlobal_register_version=307744aa77dd5677; SSOLoginState=1566928337; wvr=6; UOR=,,www.zinglizingli.xyz; SUBP=0033WrSXqPxfM725Ws9jqgMF55529P9D9WFRg9065OjUyD0aaGsKRxPW5JpX5KMhUgL.Fo-f1hB7SKMp1h52dJLoI0qLxK-L1KqL1-eLxKMLB.-L122LxKMLB.-L122LxK-LBo5L12qLxKnLB-qLBoBLxKMLB.BL1K2t; ALF=1599046395; SCF=AsBEGOtiUG1hPLyZCxI1FunZd9Hg9hWWkgyzcAZjG6AxOiKPAEM99ZxY8qofeWw3xoU_Wh3OqNzt4BSkCAyD_8o.; SUB=_2A25waj8tDeRhGeNL41YR9SnNwzyIHXVTHhflrDV8PUNbmtANLXXAkW9NSM603mvU3tqplLCrqvedw1Q29U_TkxRA; SUHB=0xnyhR4nBtqt14; monitor_count=2; webim_unReadCount=%7B%22time%22%3A1567510495487%2C%22dm_pub_total%22%3A2%2C%22chat_group_client%22%3A0%2C%22allcountNum%22%3A36%2C%22msgbox%22%3A0%7D

View File

@ -0,0 +1,30 @@
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ehcache.xsd">
<!--timeToIdleSeconds 当缓存闲置n秒后销毁 -->
<!--timeToLiveSeconds 当缓存存活n秒后销毁 -->
<!-- 缓存配置 name:缓存名称。 maxElementsInMemory缓存最大个数。 eternal:对象是否永久有效一但设置了timeout将不起作用。
timeToIdleSeconds设置对象在失效前的允许闲置时间单位。仅当eternal=false对象不是永久有效时使用可选属性默认值是0也就是可闲置时间无穷大。
timeToLiveSeconds设置对象在失效前允许存活时间单位。最大时间介于创建时间和失效时间之间。仅当eternal=false对象不是永久有效时使用默认是0.,也就是对象存活时间无穷大。
overflowToDisk当内存中对象数量达到maxElementsInMemory时Ehcache将会对象写到磁盘中。 diskSpoolBufferSizeMB这个参数设置DiskStore磁盘缓存的缓存区大小。默认是30MB。每个Cache都应该有自己的一个缓冲区。
maxElementsOnDisk硬盘最大缓存个数。 diskPersistent是否缓存虚拟机重启期数据 Whether the disk
store persists between restarts of the Virtual Machine. The default value
is false. diskExpiryThreadIntervalSeconds磁盘失效线程运行时间间隔默认是120秒。 memoryStoreEvictionPolicy当达到maxElementsInMemory限制时Ehcache将会根据指定的策略去清理内存。默认策略是
LRU最近最少使用。你可以设置为FIFO先进先出或是LFU较少使用。 clearOnFlush内存数量最大时是否清除。 maxEntriesLocalHeap="1000"
: 堆内存中最大缓存对象数,0没有限制(必须设置) maxEntriesLocalDisk="1000" : 硬盘最大缓存个数。 -->
<!-- 磁盘缓存位置 -->
<diskStore path="user.dir/cachedata" />
<!-- 默认缓存 -->
<defaultCache maxElementsInMemory="10000" eternal="false"
timeToIdleSeconds="120" timeToLiveSeconds="120"
maxElementsOnDisk="10000000" diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU">
<persistence strategy="localTempSwap" />
</defaultCache>
<cache name="util_cache" maxEntriesLocalHeap="0" eternal="true"
overflowToDisk="true" diskPersistent="true" />
</ehcache>

View File

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- 彩色日志依赖的渲染类 -->
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
<conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />
<!-- 彩色日志格式 -->
<property name="CONSOLE_LOG_PATTERN" value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}" />
<!-- %m输出的信息,%p日志级别,%t线程名,%d日期,%c类的全名,%i索引【从数字0开始递增】,,, -->
<!-- appender是configuration的子节点是负责写日志的组件。 -->
<!-- ConsoleAppender把日志输出到控制台 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<!--
<pattern>%d %p (%file:%line\)- %m%n</pattern>
-->
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
<!-- 控制台也要使用UTF-8不要使用GBK否则会中文乱码 -->
<charset>UTF-8</charset>
</encoder>
</appender>
<!-- RollingFileAppender滚动记录文件先将日志记录到指定文件当符合某个条件时将日志记录到其他文件 -->
<!-- 以下的大概意思是1.先按日期存日志日期变了将前一天的日志文件名重命名为XXX%日期%索引新的日志仍然是demo.log -->
<!-- 2.如果日期没有发生变化但是当前日志的文件大小超过1KB时对当前日志进行分割 重命名 -->
<appender name="debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>logs/debug.log</File>
<!-- rollingPolicy:当发生滚动时,决定 RollingFileAppender 的行为,涉及文件移动和重命名。 -->
<!-- TimeBasedRollingPolicy 最常用的滚动策略,它根据时间来制定滚动策略,既负责滚动也负责出发滚动 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 活动文件的名字会根据fileNamePattern的值每隔一段时间改变一次 -->
<!-- 文件名logs/demo.2017-12-05.0.log -->
<fileNamePattern>logs/debug.%d.%i.log</fileNamePattern>
<!-- 每产生一个日志文件该日志文件的保存期限为30天 -->
<maxHistory>30</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- maxFileSize:这是活动文件的大小默认值是10MB测试时可改成1KB看效果 -->
<maxFileSize>10MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<!-- pattern节点用来设置日志的输入格式 -->
<pattern>
%d %p (%file:%line\)- %m%n
</pattern>
<!-- 记录日志的编码:此处设置字符集 - -->
<charset>UTF-8</charset>
</encoder>
</appender>
<!-- 控制台输出日志级别 -->
<root level="INFO">
<appender-ref ref="STDOUT" />
</root>
<!-- 指定项目中某个包,当有日志操作行为时的日志记录级别 -->
<!-- com.maijinjie.springboot 为根包也就是只要是发生在这个根包下面的所有日志操作行为的权限都是DEBUG -->
<!-- 级别依次为【从高到低】FATAL > ERROR > WARN > INFO > DEBUG > TRACE -->
<logger name="*" level="ERROR">
<appender-ref ref="debug" />
</logger>
</configuration>

View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<context id="books" targetRuntime="MyBatis3">
<commentGenerator>
<!-- 是否去除自动生成的注释 true false:否 -->
<property name="suppressAllComments" value="true" />
</commentGenerator>
<jdbcConnection
connectionURL="jdbc:mysql://localhost:3306/books?useUnicode=true&amp;characterEncoding=utf-8"
driverClass="com.mysql.jdbc.Driver" password="books"
userId="books" />
<!-- 默认false把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer 为 true时把JDBC DECIMAL
和 NUMERIC 类型解析为java.math.BigDecimal -->
<javaTypeResolver>
<property name="forceBigDecimals" value="false" />
</javaTypeResolver>
<!-- targetProject:生成PO类的位置 -->
<javaModelGenerator
targetPackage="xyz.zinglizingli.books.po"
targetProject="src/main/java">
<!-- enableSubPackages:是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false" />
<!-- 从数据库返回的值被清理前后的空格 -->
<property name="trimStrings" value="true" />
</javaModelGenerator>
<!-- targetProject:mapper映射文件生成的位置 -->
<sqlMapGenerator targetPackage="mybatis.mapping"
targetProject="src/main/resources">
<!-- enableSubPackages:是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false" />
</sqlMapGenerator>
<!-- targetPackagemapper接口生成的位置 -->
<javaClientGenerator
targetPackage="xyz.zinglizingli.books.mapper"
targetProject="src/main/java" type="XMLMAPPER">
<!-- enableSubPackages:是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false" />
</javaClientGenerator>
<table schema="books" tableName="book_content"/>
<!-- 指定数据库表 -->
<!--<table schema="jly" tableName="job_position" domainObjectName="JobPositionTest"/>-->
</context>
</generatorConfiguration>

View File

@ -0,0 +1,228 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="xyz.zinglizingli.books.mapper.BookContentMapper">
<resultMap id="BaseResultMap" type="xyz.zinglizingli.books.po.BookContent">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="book_id" property="bookId" jdbcType="BIGINT"/>
<result column="index_id" property="indexId" jdbcType="BIGINT"/>
<result column="index_num" property="indexNum" jdbcType="INTEGER"/>
<result column="content" property="content" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" suffix=")" prefixOverrides="and">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")"
separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" suffix=")" prefixOverrides="and">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")"
separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, book_id, index_id, index_num, content
</sql>
<select id="selectByExample" resultMap="BaseResultMap" parameterType="xyz.zinglizingli.books.po.BookContentExample">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List"/>
from book_content
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">
select
<include refid="Base_Column_List"/>
from book_content
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from book_content
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="xyz.zinglizingli.books.po.BookContentExample">
delete from book_content
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</delete>
<insert id="insert" parameterType="xyz.zinglizingli.books.po.BookContent">
insert into book_content (id, book_id, index_id,
index_num, content)
values (#{id,jdbcType=BIGINT}, #{bookId,jdbcType=BIGINT}, #{indexId,jdbcType=BIGINT},
#{indexNum,jdbcType=INTEGER}, #{content,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="xyz.zinglizingli.books.po.BookContent">
insert into book_content
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="bookId != null">
book_id,
</if>
<if test="indexId != null">
index_id,
</if>
<if test="indexNum != null">
index_num,
</if>
<if test="content != null">
content,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="bookId != null">
#{bookId,jdbcType=BIGINT},
</if>
<if test="indexId != null">
#{indexId,jdbcType=BIGINT},
</if>
<if test="indexNum != null">
#{indexNum,jdbcType=INTEGER},
</if>
<if test="content != null">
#{content,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="xyz.zinglizingli.books.po.BookContentExample"
resultType="java.lang.Integer">
select count(*) from book_content
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update book_content
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.bookId != null">
book_id = #{record.bookId,jdbcType=BIGINT},
</if>
<if test="record.indexId != null">
index_id = #{record.indexId,jdbcType=BIGINT},
</if>
<if test="record.indexNum != null">
index_num = #{record.indexNum,jdbcType=INTEGER},
</if>
<if test="record.content != null">
content = #{record.content,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByExample" parameterType="map">
update book_content
set id = #{record.id,jdbcType=BIGINT},
book_id = #{record.bookId,jdbcType=BIGINT},
index_id = #{record.indexId,jdbcType=BIGINT},
index_num = #{record.indexNum,jdbcType=INTEGER},
content = #{record.content,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="xyz.zinglizingli.books.po.BookContent">
update book_content
<set>
<if test="bookId != null">
book_id = #{bookId,jdbcType=BIGINT},
</if>
<if test="indexId != null">
index_id = #{indexId,jdbcType=BIGINT},
</if>
<if test="indexNum != null">
index_num = #{indexNum,jdbcType=INTEGER},
</if>
<if test="content != null">
content = #{content,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="xyz.zinglizingli.books.po.BookContent">
update book_content
set book_id = #{bookId,jdbcType=BIGINT},
index_id = #{indexId,jdbcType=BIGINT},
index_num = #{indexNum,jdbcType=INTEGER},
content = #{content,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
<insert id="insertBatch" parameterType="java.util.List">
insert into book_content (book_id, index_num, content)
values
<foreach collection="list" item="item" index="index"
separator=",">
<trim prefix="(" suffix=")" suffixOverrides=",">
#{item.bookId,jdbcType=VARCHAR},
#{item.indexNum,jdbcType=VARCHAR},
#{item.content,jdbcType=VARCHAR},
</trim>
</foreach>
</insert>
</mapper>

View File

@ -0,0 +1,220 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="xyz.zinglizingli.books.mapper.BookIndexMapper">
<resultMap id="BaseResultMap" type="xyz.zinglizingli.books.po.BookIndex">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="book_id" property="bookId" jdbcType="BIGINT"/>
<result column="index_num" property="indexNum" jdbcType="INTEGER"/>
<result column="index_name" property="indexName" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" suffix=")" prefixOverrides="and">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")"
separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" suffix=")" prefixOverrides="and">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")"
separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, book_id, index_num, index_name
</sql>
<select id="selectByExample" resultMap="BaseResultMap" parameterType="xyz.zinglizingli.books.po.BookIndexExample">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List"/>
from book_index
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">
select
<include refid="Base_Column_List"/>
from book_index
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from book_index
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="xyz.zinglizingli.books.po.BookIndexExample">
delete from book_index
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</delete>
<insert id="insert" parameterType="xyz.zinglizingli.books.po.BookIndex">
insert into book_index (id, book_id, index_num,
index_name)
values (#{id,jdbcType=BIGINT}, #{bookId,jdbcType=BIGINT}, #{indexNum,jdbcType=INTEGER},
#{indexName,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="xyz.zinglizingli.books.po.BookIndex" useGeneratedKeys="true"
keyProperty="id">
insert into book_index
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="bookId != null">
book_id,
</if>
<if test="indexNum != null">
index_num,
</if>
<if test="indexName != null">
index_name,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="bookId != null">
#{bookId,jdbcType=BIGINT},
</if>
<if test="indexNum != null">
#{indexNum,jdbcType=INTEGER},
</if>
<if test="indexName != null">
#{indexName,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="xyz.zinglizingli.books.po.BookIndexExample"
resultType="java.lang.Integer">
select count(*) from book_index
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update book_index
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.bookId != null">
book_id = #{record.bookId,jdbcType=BIGINT},
</if>
<if test="record.indexNum != null">
index_num = #{record.indexNum,jdbcType=INTEGER},
</if>
<if test="record.indexName != null">
index_name = #{record.indexName,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByExample" parameterType="map">
update book_index
set id = #{record.id,jdbcType=BIGINT},
book_id = #{record.bookId,jdbcType=BIGINT},
index_num = #{record.indexNum,jdbcType=INTEGER},
index_name = #{record.indexName,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="xyz.zinglizingli.books.po.BookIndex">
update book_index
<set>
<if test="bookId != null">
book_id = #{bookId,jdbcType=BIGINT},
</if>
<if test="indexNum != null">
index_num = #{indexNum,jdbcType=INTEGER},
</if>
<if test="indexName != null">
index_name = #{indexName,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="xyz.zinglizingli.books.po.BookIndex">
update book_index
set book_id = #{bookId,jdbcType=BIGINT},
index_num = #{indexNum,jdbcType=INTEGER},
index_name = #{indexName,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
<insert id="insertBatch" parameterType="java.util.List">
insert into book_index (book_id, index_num, index_name)
values
<foreach collection="list" item="item" index="index"
separator=",">
<trim prefix="(" suffix=")" suffixOverrides=",">
#{item.bookId,jdbcType=VARCHAR},
#{item.indexNum,jdbcType=VARCHAR},
#{item.indexName,jdbcType=VARCHAR},
</trim>
</foreach>
</insert>
<select id="queryNewstIndexName" parameterType="long" resultType="string">
select index_name from book_index where book_id = #{bookId,jdbcType=BIGINT} order by index_num desc limit 1
</select>
</mapper>

View File

@ -0,0 +1,373 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="xyz.zinglizingli.books.mapper.BookMapper">
<resultMap id="BaseResultMap" type="xyz.zinglizingli.books.po.Book">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="catId" property="catid" jdbcType="INTEGER"/>
<result column="pic_url" property="picUrl" jdbcType="VARCHAR"/>
<result column="book_name" property="bookName" jdbcType="VARCHAR"/>
<result column="author" property="author" jdbcType="VARCHAR"/>
<result column="book_desc" property="bookDesc" jdbcType="VARCHAR"/>
<result column="score" property="score" jdbcType="REAL"/>
<result column="book_status" property="bookStatus" jdbcType="VARCHAR"/>
<result column="visit_count" property="visitCount" jdbcType="BIGINT"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
<result column="update_time_str" property="updateTimeStr" jdbcType="VARCHAR"/>
<result column="soft_cat" property="softCat" jdbcType="INTEGER"/>
<result column="soft_tag" property="softTag" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" suffix=")" prefixOverrides="and">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")"
separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" suffix=")" prefixOverrides="and">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")"
separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, catId, pic_url, book_name, author, book_desc, score, book_status, visit_count,
update_time,soft_cat,soft_tag
</sql>
<select id="selectByExample" resultMap="BaseResultMap" parameterType="xyz.zinglizingli.books.po.BookExample">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List"/>
from book
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">
select
<include refid="Base_Column_List"/>
from book
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from book
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="xyz.zinglizingli.books.po.BookExample">
delete from book
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</delete>
<insert id="insert" parameterType="xyz.zinglizingli.books.po.Book">
insert into book (id, catId, pic_url,
book_name, author, book_desc,
score, book_status, visit_count,
update_time)
values (#{id,jdbcType=BIGINT}, #{catid,jdbcType=INTEGER}, #{picUrl,jdbcType=VARCHAR},
#{bookName,jdbcType=VARCHAR}, #{author,jdbcType=VARCHAR}, #{bookDesc,jdbcType=VARCHAR},
#{score,jdbcType=REAL}, #{bookStatus,jdbcType=VARCHAR}, #{visitCount,jdbcType=BIGINT},
#{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="xyz.zinglizingli.books.po.Book" useGeneratedKeys="true"
keyProperty="id">
insert into book
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="catid != null">
catId,
</if>
<if test="picUrl != null">
pic_url,
</if>
<if test="bookName != null">
book_name,
</if>
<if test="author != null">
author,
</if>
<if test="bookDesc != null">
book_desc,
</if>
<if test="score != null">
score,
</if>
<if test="bookStatus != null">
book_status,
</if>
<if test="visitCount != null">
visit_count,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="catid != null">
#{catid,jdbcType=INTEGER},
</if>
<if test="picUrl != null">
#{picUrl,jdbcType=VARCHAR},
</if>
<if test="bookName != null">
#{bookName,jdbcType=VARCHAR},
</if>
<if test="author != null">
#{author,jdbcType=VARCHAR},
</if>
<if test="bookDesc != null">
#{bookDesc,jdbcType=VARCHAR},
</if>
<if test="score != null">
#{score,jdbcType=REAL},
</if>
<if test="bookStatus != null">
#{bookStatus,jdbcType=VARCHAR},
</if>
<if test="visitCount != null">
#{visitCount,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="xyz.zinglizingli.books.po.BookExample" resultType="java.lang.Integer">
select count(*) from book
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update book
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.catid != null">
catId = #{record.catid,jdbcType=INTEGER},
</if>
<if test="record.picUrl != null">
pic_url = #{record.picUrl,jdbcType=VARCHAR},
</if>
<if test="record.bookName != null">
book_name = #{record.bookName,jdbcType=VARCHAR},
</if>
<if test="record.author != null">
author = #{record.author,jdbcType=VARCHAR},
</if>
<if test="record.bookDesc != null">
book_desc = #{record.bookDesc,jdbcType=VARCHAR},
</if>
<if test="record.score != null">
score = #{record.score,jdbcType=REAL},
</if>
<if test="record.bookStatus != null">
book_status = #{record.bookStatus,jdbcType=VARCHAR},
</if>
<if test="record.visitCount != null">
visit_count = #{record.visitCount,jdbcType=BIGINT},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByExample" parameterType="map">
update book
set id = #{record.id,jdbcType=BIGINT},
catId = #{record.catid,jdbcType=INTEGER},
pic_url = #{record.picUrl,jdbcType=VARCHAR},
book_name = #{record.bookName,jdbcType=VARCHAR},
author = #{record.author,jdbcType=VARCHAR},
book_desc = #{record.bookDesc,jdbcType=VARCHAR},
score = #{record.score,jdbcType=REAL},
book_status = #{record.bookStatus,jdbcType=VARCHAR},
visit_count = #{record.visitCount,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=TIMESTAMP}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="xyz.zinglizingli.books.po.Book">
update book
<set>
<if test="catid != null">
catId = #{catid,jdbcType=INTEGER},
</if>
<if test="picUrl != null">
pic_url = #{picUrl,jdbcType=VARCHAR},
</if>
<if test="bookName != null">
book_name = #{bookName,jdbcType=VARCHAR},
</if>
<if test="author != null">
author = #{author,jdbcType=VARCHAR},
</if>
<if test="bookDesc != null">
book_desc = #{bookDesc,jdbcType=VARCHAR},
</if>
<if test="score != null">
score = #{score,jdbcType=REAL},
</if>
<if test="bookStatus != null">
book_status = #{bookStatus,jdbcType=VARCHAR},
</if>
<if test="visitCount != null">
visit_count = #{visitCount,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="xyz.zinglizingli.books.po.Book">
update book
set catId = #{catid,jdbcType=INTEGER},
pic_url = #{picUrl,jdbcType=VARCHAR},
book_name = #{bookName,jdbcType=VARCHAR},
author = #{author,jdbcType=VARCHAR},
book_desc = #{bookDesc,jdbcType=VARCHAR},
score = #{score,jdbcType=REAL},
book_status = #{bookStatus,jdbcType=VARCHAR},
visit_count = #{visitCount,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
<select id="search" resultMap="BaseResultMap">
select book.id,book.catId,book.book_name,book.pic_url,book.author,book.book_desc,
book.score,book.book_status,book.update_time,book.soft_cat,book.soft_tag
from book
<if test="userId != null and userId != ''.toString()">
inner join user_ref_book on book.id = user_ref_book.book_id
</if>
<where>
<if test="userId != null and userId != ''.toString()">
AND user_ref_book.user_id = #{userId,jdbcType=BIGINT}
</if>
<if test="ids != null and ids != ''.toString()">
AND book.id in (${ids})
</if>
<if test="softCat != null">
AND book.soft_cat = #{softCat,jdbcType=INTEGER}
</if>
<choose>
<when test="catId != null">
AND book.catId = #{catId,jdbcType=INTEGER}
</when>
<otherwise><!-- 我的书架和我的阅读记录查询所有记录,不分版块-->
<if test="(ids == null or ids == ''.toString()) and (userId == null or userId == ''.toString())">
AND book.catId <![CDATA[ <> ]]> 8
</if>
</otherwise>
</choose>
<if test="softTag != null and softTag != ''.toString()">
AND book.soft_tag like concat('%',#{softTag,jdbcType=VARCHAR},'%')
</if>
<if test="keyword != null and keyword != ''.toString()">
AND (book.book_name like concat('%',#{keyword,jdbcType=VARCHAR},'%') or book.author like
concat('%',#{keyword,jdbcType=VARCHAR},'%'))
</if>
<if test="bookStatus != null and bookStatus != ''.toString()">
AND book.book_status = #{bookStatus,jdbcType=VARCHAR}
</if>
</where>
</select>
<update id="addVisitCount" parameterType="java.lang.Long">
update book set visit_count = visit_count + 1
where id = #{bookId,jdbcType=BIGINT}
</update>
<select id="queryRandomBook" resultMap="BaseResultMap">
select id,book_name,book_desc,author from book order by rand() limit 1
</select>
<select id="queryNewstBook" resultMap="BaseResultMap">
select id,book_name,book_desc,author from book
<foreach collection="collection" item="item" open="where id not in(" close=")" separator=",">
#{item}
</foreach>
order by rand() desc limit 1
</select>
<select id="queryNewstBookIdList" resultType="string">
select id from book ORDER BY update_time desc limit 30
</select>
<select id="queryEndBookIdList" resultType="string">
select id from book/* where book_status like '%完成%'*/
</select>
</mapper>

View File

@ -0,0 +1,211 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="xyz.zinglizingli.books.mapper.CategoryMapper" >
<resultMap id="BaseResultMap" type="xyz.zinglizingli.books.po.Category" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="name" property="name" jdbcType="VARCHAR" />
<result column="sort" property="sort" jdbcType="TINYINT" />
<result column="get_url" property="getUrl" jdbcType="VARCHAR" />
<result column="req_url" property="reqUrl" jdbcType="VARCHAR" />
</resultMap>
<sql id="Example_Where_Clause" >
<where >
<foreach collection="oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<foreach collection="criteria.criteria" item="criterion" >
<choose >
<when test="criterion.noValue" >
and ${criterion.condition}
</when>
<when test="criterion.singleValue" >
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue" >
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue" >
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause" >
<where >
<foreach collection="example.oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<foreach collection="criteria.criteria" item="criterion" >
<choose >
<when test="criterion.noValue" >
and ${criterion.condition}
</when>
<when test="criterion.singleValue" >
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue" >
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue" >
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List" >
id, name, sort, get_url, req_url
</sql>
<select id="selectByExample" resultMap="BaseResultMap" parameterType="xyz.zinglizingli.books.po.CategoryExample" >
select
<if test="distinct" >
distinct
</if>
<include refid="Base_Column_List" />
from category
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null" >
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from category
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from category
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="xyz.zinglizingli.books.po.CategoryExample" >
delete from category
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="xyz.zinglizingli.books.po.Category" >
insert into category (id, name, sort,
get_url, req_url)
values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{sort,jdbcType=TINYINT},
#{getUrl,jdbcType=VARCHAR}, #{reqUrl,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="xyz.zinglizingli.books.po.Category" >
insert into category
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="name != null" >
name,
</if>
<if test="sort != null" >
sort,
</if>
<if test="getUrl != null" >
get_url,
</if>
<if test="reqUrl != null" >
req_url,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="name != null" >
#{name,jdbcType=VARCHAR},
</if>
<if test="sort != null" >
#{sort,jdbcType=TINYINT},
</if>
<if test="getUrl != null" >
#{getUrl,jdbcType=VARCHAR},
</if>
<if test="reqUrl != null" >
#{reqUrl,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="xyz.zinglizingli.books.po.CategoryExample" resultType="java.lang.Integer" >
select count(*) from category
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map" >
update category
<set >
<if test="record.id != null" >
id = #{record.id,jdbcType=INTEGER},
</if>
<if test="record.name != null" >
name = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.sort != null" >
sort = #{record.sort,jdbcType=TINYINT},
</if>
<if test="record.getUrl != null" >
get_url = #{record.getUrl,jdbcType=VARCHAR},
</if>
<if test="record.reqUrl != null" >
req_url = #{record.reqUrl,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map" >
update category
set id = #{record.id,jdbcType=INTEGER},
name = #{record.name,jdbcType=VARCHAR},
sort = #{record.sort,jdbcType=TINYINT},
get_url = #{record.getUrl,jdbcType=VARCHAR},
req_url = #{record.reqUrl,jdbcType=VARCHAR}
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="xyz.zinglizingli.books.po.Category" >
update category
<set >
<if test="name != null" >
name = #{name,jdbcType=VARCHAR},
</if>
<if test="sort != null" >
sort = #{sort,jdbcType=TINYINT},
</if>
<if test="getUrl != null" >
get_url = #{getUrl,jdbcType=VARCHAR},
</if>
<if test="reqUrl != null" >
req_url = #{reqUrl,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="xyz.zinglizingli.books.po.Category" >
update category
set name = #{name,jdbcType=VARCHAR},
sort = #{sort,jdbcType=TINYINT},
get_url = #{getUrl,jdbcType=VARCHAR},
req_url = #{reqUrl,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>

View File

@ -0,0 +1,196 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="xyz.zinglizingli.books.mapper.ScreenBulletMapper" >
<resultMap id="BaseResultMap" type="xyz.zinglizingli.books.po.ScreenBullet" >
<id column="id" property="id" jdbcType="BIGINT" />
<result column="content_id" property="contentId" jdbcType="BIGINT" />
<result column="screen_bullet" property="screenBullet" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
</resultMap>
<sql id="Example_Where_Clause" >
<where >
<foreach collection="oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<foreach collection="criteria.criteria" item="criterion" >
<choose >
<when test="criterion.noValue" >
and ${criterion.condition}
</when>
<when test="criterion.singleValue" >
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue" >
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue" >
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause" >
<where >
<foreach collection="example.oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<foreach collection="criteria.criteria" item="criterion" >
<choose >
<when test="criterion.noValue" >
and ${criterion.condition}
</when>
<when test="criterion.singleValue" >
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue" >
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue" >
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List" >
id, content_id, screen_bullet, create_time
</sql>
<select id="selectByExample" resultMap="BaseResultMap" parameterType="xyz.zinglizingli.books.po.ScreenBulletExample" >
select
<if test="distinct" >
distinct
</if>
<include refid="Base_Column_List" />
from screen_bullet
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null" >
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
select
<include refid="Base_Column_List" />
from screen_bullet
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
delete from screen_bullet
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="xyz.zinglizingli.books.po.ScreenBulletExample" >
delete from screen_bullet
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="xyz.zinglizingli.books.po.ScreenBullet" >
insert into screen_bullet (id, content_id, screen_bullet,
create_time)
values (#{id,jdbcType=BIGINT}, #{contentId,jdbcType=BIGINT}, #{screenBullet,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="xyz.zinglizingli.books.po.ScreenBullet" >
insert into screen_bullet
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="contentId != null" >
content_id,
</if>
<if test="screenBullet != null" >
screen_bullet,
</if>
<if test="createTime != null" >
create_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=BIGINT},
</if>
<if test="contentId != null" >
#{contentId,jdbcType=BIGINT},
</if>
<if test="screenBullet != null" >
#{screenBullet,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="xyz.zinglizingli.books.po.ScreenBulletExample" resultType="java.lang.Integer" >
select count(*) from screen_bullet
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map" >
update screen_bullet
<set >
<if test="record.id != null" >
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.contentId != null" >
content_id = #{record.contentId,jdbcType=BIGINT},
</if>
<if test="record.screenBullet != null" >
screen_bullet = #{record.screenBullet,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null" >
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
</set>
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map" >
update screen_bullet
set id = #{record.id,jdbcType=BIGINT},
content_id = #{record.contentId,jdbcType=BIGINT},
screen_bullet = #{record.screenBullet,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP}
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="xyz.zinglizingli.books.po.ScreenBullet" >
update screen_bullet
<set >
<if test="contentId != null" >
content_id = #{contentId,jdbcType=BIGINT},
</if>
<if test="screenBullet != null" >
screen_bullet = #{screenBullet,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="xyz.zinglizingli.books.po.ScreenBullet" >
update screen_bullet
set content_id = #{contentId,jdbcType=BIGINT},
screen_bullet = #{screenBullet,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@ -0,0 +1,181 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="xyz.zinglizingli.books.mapper.UserMapper" >
<resultMap id="BaseResultMap" type="xyz.zinglizingli.books.po.User" >
<id column="id" property="id" jdbcType="BIGINT" />
<result column="login_name" property="loginName" jdbcType="VARCHAR" />
<result column="password" property="password" jdbcType="VARCHAR" />
</resultMap>
<sql id="Example_Where_Clause" >
<where >
<foreach collection="oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<foreach collection="criteria.criteria" item="criterion" >
<choose >
<when test="criterion.noValue" >
and ${criterion.condition}
</when>
<when test="criterion.singleValue" >
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue" >
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue" >
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause" >
<where >
<foreach collection="example.oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<foreach collection="criteria.criteria" item="criterion" >
<choose >
<when test="criterion.noValue" >
and ${criterion.condition}
</when>
<when test="criterion.singleValue" >
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue" >
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue" >
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List" >
id, login_name, password
</sql>
<select id="selectByExample" resultMap="BaseResultMap" parameterType="xyz.zinglizingli.books.po.UserExample" >
select
<if test="distinct" >
distinct
</if>
<include refid="Base_Column_List" />
from user
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null" >
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
select
<include refid="Base_Column_List" />
from user
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
delete from user
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="xyz.zinglizingli.books.po.UserExample" >
delete from user
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="xyz.zinglizingli.books.po.User" >
insert into user (id, login_name, password
)
values (#{id,jdbcType=BIGINT}, #{loginName,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="xyz.zinglizingli.books.po.User" useGeneratedKeys="true" keyProperty="id">
insert into user
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="loginName != null" >
login_name,
</if>
<if test="password != null" >
password,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=BIGINT},
</if>
<if test="loginName != null" >
#{loginName,jdbcType=VARCHAR},
</if>
<if test="password != null" >
#{password,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="xyz.zinglizingli.books.po.UserExample" resultType="java.lang.Integer" >
select count(*) from user
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map" >
update user
<set >
<if test="record.id != null" >
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.loginName != null" >
login_name = #{record.loginName,jdbcType=VARCHAR},
</if>
<if test="record.password != null" >
password = #{record.password,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map" >
update user
set id = #{record.id,jdbcType=BIGINT},
login_name = #{record.loginName,jdbcType=VARCHAR},
password = #{record.password,jdbcType=VARCHAR}
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="xyz.zinglizingli.books.po.User" >
update user
<set >
<if test="loginName != null" >
login_name = #{loginName,jdbcType=VARCHAR},
</if>
<if test="password != null" >
password = #{password,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="xyz.zinglizingli.books.po.User" >
update user
set login_name = #{loginName,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@ -0,0 +1,181 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="xyz.zinglizingli.books.mapper.UserRefBookMapper" >
<resultMap id="BaseResultMap" type="xyz.zinglizingli.books.po.UserRefBook" >
<id column="id" property="id" jdbcType="BIGINT" />
<result column="user_id" property="userId" jdbcType="BIGINT" />
<result column="book_id" property="bookId" jdbcType="BIGINT" />
</resultMap>
<sql id="Example_Where_Clause" >
<where >
<foreach collection="oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<foreach collection="criteria.criteria" item="criterion" >
<choose >
<when test="criterion.noValue" >
and ${criterion.condition}
</when>
<when test="criterion.singleValue" >
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue" >
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue" >
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause" >
<where >
<foreach collection="example.oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<foreach collection="criteria.criteria" item="criterion" >
<choose >
<when test="criterion.noValue" >
and ${criterion.condition}
</when>
<when test="criterion.singleValue" >
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue" >
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue" >
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List" >
id, user_id, book_id
</sql>
<select id="selectByExample" resultMap="BaseResultMap" parameterType="xyz.zinglizingli.books.po.UserRefBookExample" >
select
<if test="distinct" >
distinct
</if>
<include refid="Base_Column_List" />
from user_ref_book
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null" >
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
select
<include refid="Base_Column_List" />
from user_ref_book
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
delete from user_ref_book
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="xyz.zinglizingli.books.po.UserRefBookExample" >
delete from user_ref_book
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="xyz.zinglizingli.books.po.UserRefBook" >
insert into user_ref_book (id, user_id, book_id
)
values (#{id,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT}, #{bookId,jdbcType=BIGINT}
)
</insert>
<insert id="insertSelective" parameterType="xyz.zinglizingli.books.po.UserRefBook" >
insert into user_ref_book
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="userId != null" >
user_id,
</if>
<if test="bookId != null" >
book_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=BIGINT},
</if>
<if test="userId != null" >
#{userId,jdbcType=BIGINT},
</if>
<if test="bookId != null" >
#{bookId,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="xyz.zinglizingli.books.po.UserRefBookExample" resultType="java.lang.Integer" >
select count(*) from user_ref_book
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map" >
update user_ref_book
<set >
<if test="record.id != null" >
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.userId != null" >
user_id = #{record.userId,jdbcType=BIGINT},
</if>
<if test="record.bookId != null" >
book_id = #{record.bookId,jdbcType=BIGINT},
</if>
</set>
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map" >
update user_ref_book
set id = #{record.id,jdbcType=BIGINT},
user_id = #{record.userId,jdbcType=BIGINT},
book_id = #{record.bookId,jdbcType=BIGINT}
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="xyz.zinglizingli.books.po.UserRefBook" >
update user_ref_book
<set >
<if test="userId != null" >
user_id = #{userId,jdbcType=BIGINT},
</if>
<if test="bookId != null" >
book_id = #{bookId,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="xyz.zinglizingli.books.po.UserRefBook" >
update user_ref_book
set user_id = #{userId,jdbcType=BIGINT},
book_id = #{bookId,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

View File

@ -0,0 +1 @@
ANtJi2eSPQ

View File

@ -0,0 +1 @@
Ep8xaWQJAI

View File

@ -0,0 +1 @@
L6sR9GjEtg

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,92 @@
<!DOCTYPE html>
<html lang="en">
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>帝霸</title>
<link rel="stylesheet" href="./layui/css/layui.css">
<style type="text/css">
.indexP p a{
color:#4c6978;
}
</style>
</head>
<body>
<div style="height: 50px;line-height: 50px;text-align: center" class="layui-header header header-doc layui-bg-cyan">
<div style="float: left;margin-left: 10px">
<a href="javascript:history.go(-1)">
<i style="font-size: 20px;color: #92B8B1;" class="layui-icon">&#xe65c;</i></a>
</div>
<b class="layui-icon">帝霸</b>
<div style="float: right;margin-right: 10px">
<i style="font-size: 20px;color: #92B8B1;" class="layui-icon">&#xe68e;</i>
</div>
</div>
<div class="layui-row" style="background: #f2f2f2">
<div style="padding: 10px" class="layui-col-xs4 layui-col-sm2 layui-col-md2 layui-col-lg2">
<img style=" width:auto; height:auto; max-width:100%; max-height:100%;" src="static/4868.jpg"/>
</div>
<div style="padding: 20px" class="layui-col-xs8 layui-col-sm8 layui-col-md8 layui-col-lg8">
<div style=";color: #4c6978;">作者:厌笔萧生</div>
<div style="margin-top: 5px;color: #4c6978;">类别:玄幻奇幻</div>
<div style="margin-top: 5px;color: #4c6978;">状态:连载</div>
<div style="margin-top: 5px;color: #4c6978;">更新:<i>2019-08-22</i></div>
<div style="margin-top: 5px;color: #4c6978;">评分:<i style="font-weight:bold;color: red">9.2分</i></div>
</div>
</div>
<div style="text-align: center;height: 60px;line-height: 60px">
<button type="button" class="layui-btn layui-btn-radius">开始阅读</button>
<button type="button" onclick="AddToFavorites()" class="layui-btn layui-btn-radius layui-btn-warm">加入收藏</button>
</div>
<p style="line-height: 23px;padding: 10px;text-indent: 25px;font-size: 14px;color: #4c6978;">
  万火儿莫名其妙的重生了,而且从堂堂的金丹修士,直接坠落尘埃,变成天赋极差的炼气期小透明。<br><br>  小透明无父无母小可怜,柔弱无骨真小白花。<br><br>  万火儿仰天长叹。<br><br>  天道你大爷!<br><br>  不过这一次不仅附赠随身空间,还另有极重承诺的天之骄子美貌未婚夫一枚。<br><br>  万火儿抚胸感叹:还好,还好。<br><br>  但是,除此之外,还附赠另一枚重生女!<br><br>  重生女杂灵根,蓦然醒转变为天之骄女,自此之后,丹药在她手,神兽就她有。人生处处是机缘,所到处处有福缘,更有无数美男前仆后继,后宫日益壮大。<br><br>  万火儿哀叹。<br><br>  不同命啊~<br><br>  什么?<br><br>  重生女抢她名额,找未婚夫揍她。<br><br>  什么?<br><br>  重生女抢她好友?让好友接着揍她。<br><br>  什么?<br><br>  重生女要将她未婚夫收后宫?<br><br>  抱歉,绝对不行!<br><br>  自此之后,柔弱小白花,踏上漫漫极品女盗之路。<br><br>  信奉宗旨,只要是重生女的机缘,那就抢抢抢。只要是重生女的桃花,那就破破破。<br><br>  什么?机缘本是她的?桃花也是她的?<br><br>  桃花就算了,机缘绝对不放过。<br><br>  敬请收看:妖孽无双女盗贼是如何装作可怜无助小白花,一路扮猪吃老虎,踏上漫漫修仙路的。
</p>
<div class="layui-collapse">
<div class="layui-colla-item" >
<h2 class="layui-colla-title">
<span>最新章节</span>
<span style="margin-left: 30px">
更新: <i>2019-08-22 12:56:09</i>
</span>
</h2>
<div class="layui-colla-content layui-show indexP">
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第345章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第344章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第343章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第342章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第341章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第340章 我在钓鱼</a></p>
</div>
</div>
</div>
<div style="height: 42px;color:#4c6978;line-height: 42px;padding-left: 30px;background: #f2f2f2" >
查看完整目录
</div>
<div style="height: 60px;line-height: 60px;text-align: center" class="layui-footer footer footer-demo layui-bg-cyan">
<a style="font-size: 14px;color: #92B8B1;">首页</a>
<a style="font-size: 14px;color: #92B8B1;margin-left: 50px">阅读记录</a>
<div style="float: right"><a href="#top"><i class="layui-icon"
style="margin-right:15px;font-size: 30px;color:#92B8B1 ">&#xe604;</i></a>
</div>
</div>
</body>
<script src="./layui/layui.all.js"></script>
</html>

View File

@ -0,0 +1,88 @@
<!DOCTYPE html>
<html lang="en">
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>帝霸</title>
<link rel="stylesheet" href="./layui/css/layui.css">
<style type="text/css">
.indexP p a{
color:#4c6978;
}
</style>
</head>
<body>
<div style="height: 50px;line-height: 50px;text-align: center" class="layui-header header header-doc layui-bg-cyan">
<div style="float: left;margin-left: 10px">
<a href="javascript:history.go(-1)">
<i style="font-size: 20px;color: #92B8B1;" class="layui-icon">&#xe65c;</i></a>
</div>
<b class="layui-icon">帝霸</b>
<div style="float: right;margin-right: 10px">
<i style="font-size: 20px;color: #92B8B1;" class="layui-icon">&#xe68e;</i>
</div>
</div>
<p style="height: 30px;line-height: 30px;padding: 10px">
<a href="#buttom" style="color: red">↓直达页面底部</a>
</p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第345章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第344章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第343章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第342章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第341章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第340章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第345章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第344章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第343章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第342章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第341章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第340章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第345章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第344章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第343章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第342章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第341章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第340章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第345章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第344章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第343章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第342章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第341章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第340章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第345章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第344章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第343章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第342章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第341章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第340章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第345章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第344章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第343章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第342章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第341章 我在钓鱼</a></p>
<p style="height: 30px;line-height: 30px;padding: 10px"><a>第340章 我在钓鱼</a></p>
<div style="height: 60px;line-height: 60px;text-align: center" class="layui-footer footer footer-demo layui-bg-cyan">
<a style="font-size: 14px;color: #92B8B1;">首页</a>
<a style="font-size: 14px;color: #92B8B1;margin-left: 50px">阅读记录</a>
<div style="float: right"><a href="#top"><i class="layui-icon"
style="margin-right:15px;font-size: 30px;color:#92B8B1 ">&#xe604;</i></a>
</div>
</div>
<a name="buttom"></a>
</body>
<script src="./layui/layui.all.js"></script>
</html>

View File

@ -0,0 +1,313 @@
<!DOCTYPE html>
<html lang="en">
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>帝霸</title>
<link rel="stylesheet" href="./layui/css/layui.css">
<style type="text/css">
.indexP p a {
color: #4c6978;
}
.Readarea {
font-size: 18px;
line-height: 35px;
padding: 10px;
color: #333;
}
div, p {
wrap-work: break-word;
word-break: break-all;
word-wrap: break-word;
word-break: normal;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
-ms-box-sizing: border-box;
}
.indexDiv a {
margin-left: 20px;
}
</style>
</head>
<body>
<div style="height: 50px;line-height: 50px;text-align: center" class="layui-header header header-doc layui-bg-cyan">
<div style="float: left;margin-left: 10px">
<a href="javascript:history.go(-1)">
<i style="font-size: 20px;color: #92B8B1;" class="layui-icon">&#xe65c;</i></a>
</div>
<b class="layui-icon">搜索小说</b>
<div style="float: right;margin-right: 10px">
<i style="font-size: 20px;color: #92B8B1;" class="layui-icon">&#xe68e;</i>
</div>
</div>
<div class="layui-container">
<div class="layui-row">
<div class="layui-col-xs10 layui-col-sm10 layui-col-md11 layui-col-lg11" style="padding-top:1%">
<input type="text" name="title" required lay-verify="required" placeholder="请输入书名·作者" autocomplete="off"
class="layui-input">
</div>
<div class="layui-col-xs1" style="padding: 1%">
<button class="layui-btn" lay-submit lay-filter="formDemo">搜索</button>
</div>
</div>
</div>
<div class="layui-row" style="margin-bottom:10px;padding:10px;background: #f2f2f2">
<div class="layui-col-xs5 layui-col-sm2 layui-col-md2 layui-col-lg2">
<img align="left"
style="width:auto; height:auto; max-width:100%; max-height:100%;" src="static/4868.jpg"/>
</div>
<div style="padding: 20px" class="layui-col-xs7 layui-col-sm8 layui-col-md8 layui-col-lg8">
<div style=";color: #4c6978;font-weight: bold;font-size: 20px">帝霸</div>
<div style=";color: #4c6978;float: right;"><i style="color: red">9.2分</i></div>
<div style=";color: #4c6978;">作者:厌笔萧生</div>
<div style="margin-top: 5px;color: #4c6978;">类别:玄幻奇幻</div>
<div style="margin-top: 5px;color: #4c6978;">状态:连载</div>
<div style="margin-top: 5px;color: #4c6978;">更新:<i>2019-08-22</i></div>
<div class="layui-collapse" style="margin-top: 5px;">
<div class="layui-colla-item">
<h2 style="color: #4c6978;" class="layui-colla-title">简介:</h2>
<div style="color: #4c6978;" class="layui-colla-content">
一觉醒来,世界大变。熟悉的高中传授的是魔法,
告诉大家要成为一名出色的魔法师。居住的都市之外游荡着袭击人类的魔物妖兽,
虎视眈眈。崇尚科学的世界变成了崇尚魔法,偏偏有着一样以学渣看待自己的老师,
一样目光异样的同学,一样社会底层挣扎的爸爸,一样纯美却不能走路的非血缘妹妹……不过,莫凡发现绝大多数人都只能够主修一系魔法,自己却是全系全能法师!
</div>
</div>
</div>
</div>
</div>
<div class="layui-row" style="margin-bottom:10px;padding:10px;background: #f2f2f2">
<div class="layui-col-xs5 layui-col-sm2 layui-col-md2 layui-col-lg2">
<img align="left"
style="width:auto; height:auto; max-width:100%; max-height:100%;" src="static/4868.jpg"/>
</div>
<div style="padding: 20px" class="layui-col-xs7 layui-col-sm8 layui-col-md8 layui-col-lg8">
<div style=";color: #4c6978;font-weight: bold;font-size: 20px">帝霸</div>
<div style=";color: #4c6978;float: right;"><i style="color: red">9.2分</i></div>
<div style=";color: #4c6978;">作者:厌笔萧生</div>
<div style="margin-top: 5px;color: #4c6978;">类别:玄幻奇幻</div>
<div style="margin-top: 5px;color: #4c6978;">状态:连载</div>
<div style="margin-top: 5px;color: #4c6978;">更新:<i>2019-08-22</i></div>
<div class="layui-collapse" style="margin-top: 5px;">
<div class="layui-colla-item">
<h2 style="color: #4c6978;" class="layui-colla-title">简介:</h2>
<div style="color: #4c6978;" class="layui-colla-content">
一觉醒来,世界大变。熟悉的高中传授的是魔法,
告诉大家要成为一名出色的魔法师。居住的都市之外游荡着袭击人类的魔物妖兽,
虎视眈眈。崇尚科学的世界变成了崇尚魔法,偏偏有着一样以学渣看待自己的老师,
一样目光异样的同学,一样社会底层挣扎的爸爸,一样纯美却不能走路的非血缘妹妹……不过,莫凡发现绝大多数人都只能够主修一系魔法,自己却是全系全能法师!
</div>
</div>
</div>
</div>
</div>
<div class="layui-row" style="margin-bottom:10px;padding:10px;background: #f2f2f2">
<div class="layui-col-xs5 layui-col-sm2 layui-col-md2 layui-col-lg2">
<img align="left"
style="width:auto; height:auto; max-width:100%; max-height:100%;" src="static/4868.jpg"/>
</div>
<div style="padding: 20px" class="layui-col-xs7 layui-col-sm8 layui-col-md8 layui-col-lg8">
<div style=";color: #4c6978;font-weight: bold;font-size: 20px">帝霸</div>
<div style=";color: #4c6978;float: right;"><i style="color: red">9.2分</i></div>
<div style=";color: #4c6978;">作者:厌笔萧生</div>
<div style="margin-top: 5px;color: #4c6978;">类别:玄幻奇幻</div>
<div style="margin-top: 5px;color: #4c6978;">状态:连载</div>
<div style="margin-top: 5px;color: #4c6978;">更新:<i>2019-08-22</i></div>
<div class="layui-collapse" style="margin-top: 5px;">
<div class="layui-colla-item">
<h2 style="color: #4c6978;" class="layui-colla-title">简介:</h2>
<div style="color: #4c6978;" class="layui-colla-content">
一觉醒来,世界大变。熟悉的高中传授的是魔法,
告诉大家要成为一名出色的魔法师。居住的都市之外游荡着袭击人类的魔物妖兽,
虎视眈眈。崇尚科学的世界变成了崇尚魔法,偏偏有着一样以学渣看待自己的老师,
一样目光异样的同学,一样社会底层挣扎的爸爸,一样纯美却不能走路的非血缘妹妹……不过,莫凡发现绝大多数人都只能够主修一系魔法,自己却是全系全能法师!
</div>
</div>
</div>
</div>
</div>
<div class="layui-row" style="margin-bottom:10px;padding:10px;background: #f2f2f2">
<div class="layui-col-xs5 layui-col-sm2 layui-col-md2 layui-col-lg2">
<img align="left"
style="width:auto; height:auto; max-width:100%; max-height:100%;" src="static/4868.jpg"/>
</div>
<div style="padding: 20px" class="layui-col-xs7 layui-col-sm8 layui-col-md8 layui-col-lg8">
<div style=";color: #4c6978;font-weight: bold;font-size: 20px">帝霸</div>
<div style=";color: #4c6978;float: right;"><i style="color: red">9.2分</i></div>
<div style=";color: #4c6978;">作者:厌笔萧生</div>
<div style="margin-top: 5px;color: #4c6978;">类别:玄幻奇幻</div>
<div style="margin-top: 5px;color: #4c6978;">状态:连载</div>
<div style="margin-top: 5px;color: #4c6978;">更新:<i>2019-08-22</i></div>
<div class="layui-collapse" style="margin-top: 5px;">
<div class="layui-colla-item">
<h2 style="color: #4c6978;" class="layui-colla-title">简介:</h2>
<div style="color: #4c6978;" class="layui-colla-content">
一觉醒来,世界大变。熟悉的高中传授的是魔法,
告诉大家要成为一名出色的魔法师。居住的都市之外游荡着袭击人类的魔物妖兽,
虎视眈眈。崇尚科学的世界变成了崇尚魔法,偏偏有着一样以学渣看待自己的老师,
一样目光异样的同学,一样社会底层挣扎的爸爸,一样纯美却不能走路的非血缘妹妹……不过,莫凡发现绝大多数人都只能够主修一系魔法,自己却是全系全能法师!
</div>
</div>
</div>
</div>
</div>
<div class="layui-row" style="margin-bottom:10px;padding:10px;background: #f2f2f2">
<div class="layui-col-xs5 layui-col-sm2 layui-col-md2 layui-col-lg2">
<img align="left"
style="width:auto; height:auto; max-width:100%; max-height:100%;" src="static/4868.jpg"/>
</div>
<div style="padding: 20px" class="layui-col-xs7 layui-col-sm8 layui-col-md8 layui-col-lg8">
<div style=";color: #4c6978;font-weight: bold;font-size: 20px">帝霸</div>
<div style=";color: #4c6978;float: right;"><i style="color: red">9.2分</i></div>
<div style=";color: #4c6978;">作者:厌笔萧生</div>
<div style="margin-top: 5px;color: #4c6978;">类别:玄幻奇幻</div>
<div style="margin-top: 5px;color: #4c6978;">状态:连载</div>
<div style="margin-top: 5px;color: #4c6978;">更新:<i>2019-08-22</i></div>
<div class="layui-collapse" style="margin-top: 5px;">
<div class="layui-colla-item">
<h2 style="color: #4c6978;" class="layui-colla-title">简介:</h2>
<div style="color: #4c6978;" class="layui-colla-content">
一觉醒来,世界大变。熟悉的高中传授的是魔法,
告诉大家要成为一名出色的魔法师。居住的都市之外游荡着袭击人类的魔物妖兽,
虎视眈眈。崇尚科学的世界变成了崇尚魔法,偏偏有着一样以学渣看待自己的老师,
一样目光异样的同学,一样社会底层挣扎的爸爸,一样纯美却不能走路的非血缘妹妹……不过,莫凡发现绝大多数人都只能够主修一系魔法,自己却是全系全能法师!
</div>
</div>
</div>
</div>
</div>
<div class="layui-row" style="margin-bottom:10px;padding:10px;background: #f2f2f2">
<div class="layui-col-xs5 layui-col-sm2 layui-col-md2 layui-col-lg2">
<img align="left"
style="width:auto; height:auto; max-width:100%; max-height:100%;" src="static/4868.jpg"/>
</div>
<div style="padding: 20px" class="layui-col-xs7 layui-col-sm8 layui-col-md8 layui-col-lg8">
<div style=";color: #4c6978;font-weight: bold;font-size: 20px">帝霸</div>
<div style=";color: #4c6978;float: right;"><i style="color: red">9.2分</i></div>
<div style=";color: #4c6978;">作者:厌笔萧生</div>
<div style="margin-top: 5px;color: #4c6978;">类别:玄幻奇幻</div>
<div style="margin-top: 5px;color: #4c6978;">状态:连载</div>
<div style="margin-top: 5px;color: #4c6978;">更新:<i>2019-08-22</i></div>
<div class="layui-collapse" style="margin-top: 5px;">
<div class="layui-colla-item">
<h2 style="color: #4c6978;" class="layui-colla-title">简介:</h2>
<div style="color: #4c6978;" class="layui-colla-content">
一觉醒来,世界大变。熟悉的高中传授的是魔法,
告诉大家要成为一名出色的魔法师。居住的都市之外游荡着袭击人类的魔物妖兽,
虎视眈眈。崇尚科学的世界变成了崇尚魔法,偏偏有着一样以学渣看待自己的老师,
一样目光异样的同学,一样社会底层挣扎的爸爸,一样纯美却不能走路的非血缘妹妹……不过,莫凡发现绝大多数人都只能够主修一系魔法,自己却是全系全能法师!
</div>
</div>
</div>
</div>
</div>
<div class="layui-row" style="margin-bottom:10px;padding:10px;background: #f2f2f2">
<div class="layui-col-xs5 layui-col-sm2 layui-col-md2 layui-col-lg2">
<img align="left"
style="width:auto; height:auto; max-width:100%; max-height:100%;" src="static/4868.jpg"/>
</div>
<div style="padding: 20px" class="layui-col-xs7 layui-col-sm8 layui-col-md8 layui-col-lg8">
<div style=";color: #4c6978;font-weight: bold;font-size: 20px">帝霸</div>
<div style=";color: #4c6978;float: right;"><i style="color: red">9.2分</i></div>
<div style=";color: #4c6978;">作者:厌笔萧生</div>
<div style="margin-top: 5px;color: #4c6978;">类别:玄幻奇幻</div>
<div style="margin-top: 5px;color: #4c6978;">状态:连载</div>
<div style="margin-top: 5px;color: #4c6978;">更新:<i>2019-08-22</i></div>
<div class="layui-collapse" style="margin-top: 5px;">
<div class="layui-colla-item">
<h2 style="color: #4c6978;" class="layui-colla-title">简介:</h2>
<div style="color: #4c6978;" class="layui-colla-content">
一觉醒来,世界大变。熟悉的高中传授的是魔法,
告诉大家要成为一名出色的魔法师。居住的都市之外游荡着袭击人类的魔物妖兽,
虎视眈眈。崇尚科学的世界变成了崇尚魔法,偏偏有着一样以学渣看待自己的老师,
一样目光异样的同学,一样社会底层挣扎的爸爸,一样纯美却不能走路的非血缘妹妹……不过,莫凡发现绝大多数人都只能够主修一系魔法,自己却是全系全能法师!
</div>
</div>
</div>
</div>
</div>
<div id="books" style="text-align: center"></div>
<div style="height: 60px;line-height: 60px;text-align: center" class="layui-footer footer footer-demo layui-bg-cyan">
<a style="font-size: 14px;color: #92B8B1;">首页</a>
<a style="font-size: 14px;color: #92B8B1;margin-left: 50px">阅读记录</a>
<div style="float: right"><a href="#top"><i class="layui-icon"
style="margin-right:15px;font-size: 30px;color:#92B8B1 ">&#xe604;</i></a>
</div>
</div>
<a name="buttom"></a>
</body>
<script src="./layui/layui.all.js"></script>
<script>
layui.use('laypage', function () {
var laypage = layui.laypage;
//执行一个laypage实例
laypage.render({
elem: 'books' //注意,这里的 test1 是 ID不用加 # 号
, count: 50 //数据总数,从服务端得到
, jump: function (obj, first) {
//obj包含了当前分页的所有参数比如
console.log(obj.curr); //得到当前页,以便向服务端请求对应页的数据。
console.log(obj.limit); //得到每页显示的条数
//首次不执行
if (!first) {
//do something
}
}
});
});
</script>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 439 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Some files were not shown because too many files have changed in this diff Show More