上传代码

This commit is contained in:
xxy 2020-05-02 15:05:21 +08:00
parent c8c80fa719
commit ed34c67d08
733 changed files with 61899 additions and 0 deletions

12
.gitignore vendored Normal file
View File

@ -0,0 +1,12 @@
/.idea
/cachedata
/logs
/novel-common/target
/novel-front/target
/novel-front/*.iml
/novel-common/*.iml
/novel-mobile/target
/novel-mobile/*.iml
/novel-front/novel-front.iml
/novel-crawl/novel-crawl.iml
/novel-crawl/target

147
README.md Normal file
View File

@ -0,0 +1,147 @@
[![index](./assets/热门云产品1040.100.jpg)](https://cloud.tencent.com/act/cps/redirect?redirect=1052&cps_key=736e609d66e0ac4e57813316cec6fd0b&from=console)
# 小说精品屋-plus
#### 前言
小说精品屋-plus致力于打造一个完整的商用小说门户平台。
#### 项目介绍
小说精品屋是一个多平台web、安卓app、微信小程序、功能完善的小说弹幕网站包含精品小说专区、轻小说专区和漫画专区。包括小说/漫画分类、小说/漫画搜索、小说/漫画排行、完本小说/漫画、小说/漫画评分、小说/漫画在线阅读、小说/漫画书架、小说/漫画阅读记录、小说下载、小说弹幕、小说/漫画自动爬取、小说内容自动分享到微博、邮件自动推广、链接自动推送到百度搜索引擎等功能。包含电脑端、移动端、微信小程序等多个平台现已开源web端、安卓端、小程序端源码。
小说精品屋-plus是在小说精品屋的基础上重新进行了数据库设计、代码重构和功能增强提升了程序整体的可读性和性能增加了很多商用特性。主要升级如下
- [x] 数据库重新设计,结构调整。
- [x] 服务端代码重构MyBatis3升级为MyBatis3DynamicSql。
- [x] 移动站与PC站站点分离浏览器自动识别跳转。
- [x] PC站UI更新。
- [x] 新闻模块。
- [x] 排行榜。
- [x] 小说评论模块。
- [x] 阅读主题模块。
- [ ] 作家专区。
- [ ] 充值。
- [ ] 后台管理系统。
- [x] 爬虫管理系统。
#### 项目结构
```
novel-plus -- 父工程
├── novel-common -- 通用模块
├── novel-front -- 前台门户系统
├── novel-crawl -- 爬虫管理系统
└── novel-admin -- 后台管理系统
```
#### 技术选型
Springboot+Mybatis+Mysql+Ehcache+Thymeleaf+Layui
#### PC站截图
1. 首页
![index](./assets/pc_index.png)
2.列表页
![index](./assets/pc_all.png)
3.排行页
![index](./assets/pc_rank.png)
4.详情页
![index](./assets/pc_detail.png)
5.目录页
![index](./assets/pc_catalog.png)
6.内容页
![index](./assets/pc_content1.png)
![index](./assets/pc_content2.png)
#### 手机站截图
1. 首页
![index](./assets/QQ%E5%9B%BE%E7%89%8720191018162208.jpg)
2. 小说详情页
![微信图片_20190904181558](./assets/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20190904181558.png)
3. 目录页
![QQ图片20191018161901](./assets/QQ%E5%9B%BE%E7%89%8720191108022250.png)
4. 小说阅读页
![QQ图片20191018161901](./assets/QQ%E5%9B%BE%E7%89%8720191018161901.png)
#### 爬虫管理系统截图
![QQ图片20191018161901](./assets/crawl_index.png)
**喜欢此项目的可以给我的GitHub和Gitee加个Star支持一下 。**
#### 演示地址
[点击前往](http://www.java2nb.com)(前台门户)
#### 代码仓库
Gitee仓库地址 https://gitee.com/xiongxyang/novel-plus
GitHub仓库地址 https://github.com/201206030/fiction_house
#### QQ交流群
![mini-code](./assets/qq_group.png)
#### 捐赠支持
开源项目不易,若此项目能得到你的青睐,可以捐赠支持作者持续开发与维护。
![mini-code](./assets/jk.png)
##### 捐赠名单
| 捐赠者 | 金额 | 时间 |
| :----- | :------- | :-------------------------- |
| **阳 | ¥10.00 | 2020年03月06日 下午14点10分 |
| *梦 | ¥66.00 | 2019年12月27日 下午21点39分 |
| *金名 | ¥50.00 | 2019年12月27日 下午19点29分 |
| *天气 | ¥300.00 | 2019年12月27日 上午10点13分 |
| *强 | ¥10.00 | 2019年12月25日 下午21点29分 |
| *生 | ¥50.00 | 2019年12月25日 下午18点36分 |
| *江云 | ¥100.00 | 2019年12月20日 下午19点57分 |
| *磊 | ¥3.00 | 2019年12月17日 下午18点09分 |
| *勇 | ¥20.00 | 2019年11月30日 下午16点13分 |
| *伟 | ¥10.00 | 2019年11月14日 上午11点02分 |
| *式 | ¥8.88 | 2019年11月12日 下午23点54分 |
| *星 | ¥20.00 | 2019年11月12日 下午20点11分 |
| *😊 | ¥100.00 | 2019年11月12日 下午15点32分 |
| *东 | ¥10.00 | 2019年11月11日 下午21点23分 |
| *海 | ¥15.00 | 2019年11月11日 上午7点45分 |
| *飞 | ¥5.00 | 2019年11月11日 上午0点14分 |
| *沐 | ¥10.00 | 2019年11月10日 上午12点09分 |
#### 备注
精品小说屋所有相关项目均已在开源中国公开,感兴趣的可进入[开源中国](https://www.oschina.net/p/fiction_house)按关键字`精品小说屋`搜索。
[![index](./assets/120060.jpg)](https://www.aliyun.com/minisite/goods?userCode=uf4nasee )

BIN
assets/120060.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

BIN
assets/1573592459699.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 411 KiB

BIN
assets/640x100.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

BIN
assets/IMG_1736.JPG Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

BIN
assets/IMG_1737.JPG Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
assets/android_index.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 KiB

BIN
assets/baijiahao.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

BIN
assets/chapter_manager.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

BIN
assets/chapter_pub.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

BIN
assets/charset_config.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

BIN
assets/craw_config.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

BIN
assets/crawl_config.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
assets/crawl_index.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
assets/crawl_pic.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

BIN
assets/database_config.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

BIN
assets/index_config.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
assets/jk.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

BIN
assets/jk_ali.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
assets/jk_wc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

BIN
assets/login.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

BIN
assets/manhua_content.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 KiB

BIN
assets/mh_content.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

BIN
assets/mh_index.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 KiB

BIN
assets/mini-code.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

BIN
assets/mini4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
assets/novel_list.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

BIN
assets/novel_pub.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

BIN
assets/oschina_tp.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
assets/pc_all.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 KiB

BIN
assets/pc_catalog.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

BIN
assets/pc_content1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 KiB

BIN
assets/pc_content2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 KiB

BIN
assets/pc_detail.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 307 KiB

BIN
assets/pc_index.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 929 KiB

BIN
assets/pc_rank.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 KiB

BIN
assets/pic_save_type.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

BIN
assets/qq_group.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
assets/score_config.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
assets/springcloud.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

BIN
assets/upload_config.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

BIN
assets/精品小说楼.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 764 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

106
novel-common/pom.xml Normal file
View File

@ -0,0 +1,106 @@
<?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">
<parent>
<artifactId>novel</artifactId>
<groupId>com.java2nb</groupId>
<version>3.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>novel-common</artifactId>
<packaging>jar</packaging>
<name>novel-common</name>
<description>小说精品屋 通用模块</description>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
<!--mysql驱动-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>${mybatis.version}</version>
</dependency>
<!--分页助手启动器-->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>${pagehelper.version}</version>
</dependency>
<dependency>
<groupId>com.cuisongliu</groupId>
<artifactId>orderbyhelper-spring-boot-starter</artifactId>
<version>${orderbyhelper.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<!--httpclient-->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.2</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.dynamic-sql</groupId>
<artifactId>mybatis-dynamic-sql</artifactId>
<version>${mybatis-dynamic-sql.version}</version>
</dependency>
<!-- MyBatis 生成器 -->
<dependency>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-core</artifactId>
<version>${mybatis-generator.version}</version>
<optional>true</optional>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,37 @@
package com.java2nb.novel.core.advice;
import com.java2nb.novel.core.bean.ResultBean;
import com.java2nb.novel.core.exception.BusinessException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* 通用的异常处理器
*
* @author 11797*/
@Slf4j
@ControllerAdvice
@ResponseBody
public class CommonExceptionHandler {
/**
* 处理业务异常
* */
@ExceptionHandler(BusinessException.class)
public ResultBean handlerBusinessException(BusinessException e){
log.error(e.getMessage(),e);
return ResultBean.fail(e.getResStatus());
}
/**
* 处理系统异常
* */
@ExceptionHandler(Exception.class)
public ResultBean handlerException(Exception e){
log.error(e.getMessage(),e);
return ResultBean.error();
}
}

View File

@ -0,0 +1,73 @@
package com.java2nb.novel.core.bean;
import com.java2nb.novel.core.enums.ResponseStatus;
import lombok.Data;
import java.io.Serializable;
/**
* 自定义响应结构
* @author 11797
* @param <T>
*/
@Data
public class ResultBean<T> implements Serializable {
private static final long serialVersionUID = 1L;
private int code = ResponseStatus.OK.getCode();
/**
* 响应消息
* */
private String msg = ResponseStatus.OK.getMsg();
/**
* 响应中的数据
* */
private T data;
private ResultBean() {
}
private ResultBean(ResponseStatus ResponseStatus) {
this.code = ResponseStatus.getCode();;
this.msg = ResponseStatus.getMsg();
}
private ResultBean(T data) {
this.data = data;
}
/**
* 业务处理成功,无数据返回
* */
public static ResultBean ok() {
return new ResultBean();
}
/**
* 业务处理成功有数据返回
* */
public static <T> ResultBean ok(T data) {
return new ResultBean(data);
}
/**
* 业务处理失败
* */
public static ResultBean fail(ResponseStatus ResponseStatus) {
return new ResultBean(ResponseStatus);
}
/**
* 系统错误
* */
public static ResultBean error() {
return new ResultBean(ResponseStatus.ERROR);
}
}

View File

@ -0,0 +1,53 @@
package com.java2nb.novel.core.cache;
/**
* @author 11797
*/
public interface CacheKey {
/**
* 首页小说设置
* */
String INDEX_BOOK_SETTINGS_KEY = "indexBookSettingsKey";
/**
* 首页新闻
* */
String INDEX_NEWS_KEY = "indexNewsKey";
/**
* 首页点击榜单
* */
String INDEX_CLICK_BANK_BOOK_KEY = "indexClickBankBookKey";
/**
* 首页友情链接
* */
String INDEX_LINK_KEY = "indexLinkKey";
/**
* 首页新书榜单
* */
String INDEX_NEW_BOOK_KEY = "indexNewBookKey";
/**
* 首页更新榜单
* */
String INDEX_UPDATE_BOOK_KEY = "indexUpdateBookKey";
/**
* 模板目录保存key
* */
String TEMPLATE_DIR_KEY = "templateDirKey";;
/**
* 正在运行的爬虫线程存储KEY前缀
* */
String RUNNING_CRAWL_THREAD_KEY_PREFIX = "runningCrawlTreadDataKeyPrefix";
/**
* 标记小说是否正在入库
* */
String NEW_BOOK_IN_SAVE = "newBookInSave";
}

View File

@ -0,0 +1,59 @@
package com.java2nb.novel.core.cache;
/**
* @author 11797
*/
public interface CacheService {
/**
* 根据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,144 @@
package com.java2nb.novel.core.cache.impl;
import com.java2nb.novel.core.cache.CacheService;
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;
/**
* @author xxy
*/
@Service
public class EhCacheServiceImpl implements CacheService {
@Autowired
private CacheManager cacheManager ;
private static final String CACHE_NAME = "utilCache";
/**
* 获得一个Cache没有则创建一个
* @return
*/
private Cache getCache(){
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类型的缓存
*/
@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,240 @@
package com.java2nb.novel.core.crawl;
import com.java2nb.novel.core.utils.HttpUtil;
import com.java2nb.novel.core.utils.IdWorker;
import com.java2nb.novel.core.utils.RandomBookInfoUtil;
import com.java2nb.novel.entity.Book;
import com.java2nb.novel.entity.BookContent;
import com.java2nb.novel.entity.BookIndex;
import lombok.SneakyThrows;
import org.apache.commons.lang3.StringUtils;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static java.util.regex.Pattern.compile;
/**
* 爬虫解析器
*
* @author Administrator
*/
public class CrawlParser {
public static final Integer BOOK_INDEX_LIST_KEY = 1;
public static final Integer BOOK_CONTENT_LIST_KEY = 2;
private static final Integer BOOK_KEY = 3;
@SneakyThrows
public static Book parseBook(RuleBean ruleBean, String bookId) {
Book book = new Book();
String bookDetailUrl = ruleBean.getBookDetailUrl().replace("{bookId}", bookId);
String bookDetailHtml = HttpUtil.getByHttpClient(bookDetailUrl);
if (bookDetailHtml != null) {
Pattern bookNamePatten = compile(ruleBean.getBookNamePatten());
Matcher bookNameMatch = bookNamePatten.matcher(bookDetailHtml);
boolean isFindBookName = bookNameMatch.find();
if (isFindBookName) {
String bookName = bookNameMatch.group(1);
//设置小说名
book.setBookName(bookName);
Pattern authorNamePatten = compile(ruleBean.getAuthorNamePatten());
Matcher authorNameMatch = authorNamePatten.matcher(bookDetailHtml);
boolean isFindAuthorName = authorNameMatch.find();
if (isFindAuthorName) {
String authorName = authorNameMatch.group(1);
//设置作者名
book.setAuthorName(authorName);
if (StringUtils.isNotBlank(ruleBean.getPicUrlPatten())) {
Pattern picUrlPatten = compile(ruleBean.getPicUrlPatten());
Matcher picUrlMatch = picUrlPatten.matcher(bookDetailHtml);
boolean isFindPicUrl = picUrlMatch.find();
if (isFindPicUrl) {
String picUrl = picUrlMatch.group(1);
//设置封面图片路径
book.setPicUrl(picUrl);
}
}
if (StringUtils.isNotBlank(ruleBean.getScorePatten())) {
Pattern scorePatten = compile(ruleBean.getScorePatten());
Matcher scoreMatch = scorePatten.matcher(bookDetailHtml);
boolean isFindScore = scoreMatch.find();
if (isFindScore) {
String score = scoreMatch.group(1);
//设置评分
book.setScore(Float.parseFloat(score));
}
}
if (StringUtils.isNotBlank(ruleBean.getVisitCountPatten())) {
Pattern visitCountPatten = compile(ruleBean.getVisitCountPatten());
Matcher visitCountMatch = visitCountPatten.matcher(bookDetailHtml);
boolean isFindVisitCount = visitCountMatch.find();
if (isFindVisitCount) {
String visitCount = visitCountMatch.group(1);
//设置访问次数
book.setVisitCount(Long.parseLong(visitCount));
}
}
String desc = bookDetailHtml.substring(bookDetailHtml.indexOf(ruleBean.getDescStart()) + ruleBean.getDescStart().length());
desc = desc.substring(0, desc.indexOf(ruleBean.getDescEnd()));
//设置书籍简介
book.setBookDesc(desc);
if (StringUtils.isNotBlank(ruleBean.getStatusPatten())) {
Pattern bookStatusPatten = compile(ruleBean.getStatusPatten());
Matcher bookStatusMatch = bookStatusPatten.matcher(bookDetailHtml);
boolean isFindBookStatus = bookStatusMatch.find();
if (isFindBookStatus) {
String bookStatus = bookStatusMatch.group(1);
if (ruleBean.getBookStatusRule().get(bookStatus) != null) {
//设置更新状态
book.setBookStatus(ruleBean.getBookStatusRule().get(bookStatus));
}
}
}
if (StringUtils.isNotBlank(ruleBean.getUpadateTimePatten()) && StringUtils.isNotBlank(ruleBean.getUpadateTimeFormatPatten())) {
Pattern updateTimePatten = compile(ruleBean.getUpadateTimePatten());
Matcher updateTimeMatch = updateTimePatten.matcher(bookDetailHtml);
boolean isFindUpdateTime = updateTimeMatch.find();
if (isFindUpdateTime) {
String updateTime = updateTimeMatch.group(1);
//设置更新时间
book.setLastIndexUpdateTime(new SimpleDateFormat(ruleBean.getUpadateTimeFormatPatten()).parse(updateTime));
}
}
}
if (book.getVisitCount() == null && book.getScore() != null) {
//随机根据评分生成访问次数
book.setVisitCount(RandomBookInfoUtil.getVisitCountByScore(book.getScore()));
} else if (book.getVisitCount() != null && book.getScore() == null) {
//随机根据访问次数生成评分
book.setScore(RandomBookInfoUtil.getScoreByVisitCount(book.getVisitCount()));
} else if (book.getVisitCount() == null && book.getScore() == null) {
//都没有设置成固定值
book.setVisitCount(100L);
book.setScore(6.5f);
}
}
}
return book;
}
public static Map<Integer, List> parseBookIndexAndContent(String sourceBookId, Book book, RuleBean ruleBean, Map<Integer, BookIndex> hasIndexs) {
Map<Integer,List> result = new HashMap<>(2);
result.put(BOOK_INDEX_LIST_KEY,new ArrayList(0));
result.put(BOOK_CONTENT_LIST_KEY,new ArrayList(0));
Date currentDate = new Date();
List<BookIndex> indexList = new ArrayList<>();
List<BookContent> contentList = new ArrayList<>();
//读取目录
String indexListUrl = ruleBean.getBookIndexUrl().replace("{bookId}", sourceBookId);
String indexListHtml = HttpUtil.getByHttpClient(indexListUrl);
if (indexListHtml != null) {
Pattern indexIdPatten = compile(ruleBean.getIndexIdPatten());
Matcher indexIdMatch = indexIdPatten.matcher(indexListHtml);
Pattern indexNamePatten = compile(ruleBean.getIndexNamePatten());
Matcher indexNameMatch = indexNamePatten.matcher(indexListHtml);
boolean isFindIndex = indexIdMatch.find() & indexNameMatch.find();
int indexNum = 0;
//总字数
Integer totalWordCount = 0;
//最新目录
Long lastIndexId = null;
String lastIndexName = null;
while (isFindIndex) {
BookIndex hasIndex = hasIndexs.get(indexNum);
String indexName = indexNameMatch.group(1);
if (hasIndex == null || !StringUtils.deleteWhitespace(hasIndex.getIndexName()).equals(StringUtils.deleteWhitespace(indexName))) {
String contentUrl = ruleBean.getBookContentUrl().replace("{bookId}", sourceBookId).replace("{indexId}", indexIdMatch.group(1));
//查询章节内容
String contentHtml = HttpUtil.getByHttpClient(contentUrl);
if (contentHtml != null) {
String content = contentHtml.substring(contentHtml.indexOf(ruleBean.getContentStart()) + ruleBean.getContentStart().length());
content = content.substring(0, content.indexOf(ruleBean.getContentEnd()));
//TODO插入章节目录和章节内容
BookIndex bookIndex = new BookIndex();
bookIndex.setIndexName(indexName);
bookIndex.setIndexNum(indexNum);
indexList.add(bookIndex);
BookContent bookContent = new BookContent();
bookContent.setContent(content);
contentList.add(bookContent);
//判断是新增还是更新
if(hasIndexs.size() == 0){
//新书入库
//设置目录和章节内容
Long indexId = new IdWorker().nextId();
lastIndexId = indexId;
lastIndexName = indexName;
bookIndex.setId(indexId);
bookIndex.setBookId(book.getId());
Integer wordCount = bookContent.getContent().length();
totalWordCount += wordCount;
bookIndex.setWordCount(wordCount);
bookIndex.setCreateTime(currentDate);
bookIndex.setUpdateTime(currentDate);
bookContent.setIndexId(indexId);
//设置小说基础信息
book.setWordCount(totalWordCount);
book.setLastIndexId(lastIndexId);
book.setLastIndexName(lastIndexName);
book.setLastIndexUpdateTime(currentDate);
book.setCreateTime(currentDate);
book.setUpdateTime(currentDate);
}else{
//老书更新
}
if(hasIndex != null){
bookIndex.setId(hasIndex.getId());
bookContent.setIndexId(hasIndex.getId());
}
} else {
break;
}
}
indexNum++;
isFindIndex = indexIdMatch.find() & indexNameMatch.find();
}
if (indexList.size() == contentList.size() && indexList.size() > 0) {
result.put(BOOK_INDEX_LIST_KEY,indexList);
result.put(BOOK_CONTENT_LIST_KEY,contentList);
}
}
return result;
}
}

View File

@ -0,0 +1,42 @@
package com.java2nb.novel.core.crawl;
import lombok.Data;
import java.util.Map;
/**
* 爬虫解析规则bean
* @author Administrator
*/
@Data
public class RuleBean {
private String bookListUrl;
private Map<String,String> catIdRule;
private Map<String,Byte> bookStatusRule;
private String bookIdPatten;
private String pagePatten;
private String totalPagePatten;
private String bookDetailUrl;
private String bookNamePatten;
private String authorNamePatten;
private String picUrlPatten;
private String statusPatten;
private String scorePatten;
private String visitCountPatten;
private String descStart;;
private String descEnd;
private String upadateTimePatten;
private String upadateTimeFormatPatten;
private String bookIndexUrl;
private String indexIdPatten;
private String indexNamePatten;
private String bookContentUrl;
private String contentStart;
private String contentEnd;
}

View File

@ -0,0 +1,62 @@
package com.java2nb.novel.core.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
/**
* @author 11797
*/
@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum ResponseStatus {
/**
* 请求成功
* */
OK(200,"SUCCESS"),
/**
* 服务器异常
* */
ERROR(500,"未知异常,请联系管理员!"),
/**
* 参数错误
* */
PARAM_ERROR(400,"非法参数!"),
/**
* 拒绝访问
* */
FORBIDDEN(403,"拒绝访问!"),
/**
* 用户相关错误
* */
NO_LOGIN(1001, "未登录或登陆失效!"),
VEL_CODE_ERROR(1002, "验证码错误!"),
USERNAME_EXIST(1003,"该手机号已注册!"),
USERNAME_PASS_ERROR(1004,"手机号或密码错误!"),
TWO_PASSWORD_DIFF(1005, "两次输入的新密码不匹配!"),
OLD_PASSWORD_ERROR(1006, "旧密码不匹配!"),
/**
* 评论相关错误
* */
HAS_COMMENTS(3001, "已评价过该书籍!"),
/**
* 其他通用错误
* */
PASSWORD_ERROR(88001,"密码错误!");
private int code;
private String msg;
}

View File

@ -0,0 +1,22 @@
package com.java2nb.novel.core.exception;
import com.java2nb.novel.core.enums.ResponseStatus;
import lombok.Data;
/**
* 自定义业务异常用于处理用户请求时业务错误时抛出
*/
@Data
public class BusinessException extends RuntimeException {
private ResponseStatus resStatus;
public BusinessException(ResponseStatus resStatus) {
//不调用父类Throwable的fillInStackTrace()方法生成栈追踪信息提高应用性能
//构造器之间的调用必须在第一行
super(resStatus.getMsg(), null, false, false);
this.resStatus = resStatus;
}
}

View File

@ -0,0 +1,33 @@
package com.java2nb.novel.core.utils;
import lombok.SneakyThrows;
import org.springframework.beans.BeanUtils;
import java.util.ArrayList;
import java.util.List;
/**
* Bean操作工具类
* @author Administrator
*/
public class BeanUtil {
/**
* 复制集合对象属性值生成新类型集合
* @param source 源集合
* @param targetClass 目标集合类型
* @return 新集合
* */
@SneakyThrows
public static <T> List<T> copyList(List source,Class<T> targetClass){
List<T> target = new ArrayList<>(source.size());
for( int i = 0 ; i < source.size() ; i++){
Object sourceItem = source.get(i);
T targetItem = targetClass.newInstance();
BeanUtils.copyProperties(sourceItem,targetItem);
target.add(targetItem);
}
return target;
}
}

View File

@ -0,0 +1,53 @@
package com.java2nb.novel.core.utils;
import lombok.SneakyThrows;
import org.apache.commons.codec.Charsets;
import org.apache.http.client.utils.DateUtils;
import org.springframework.core.io.Resource;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import java.io.*;
import java.util.Date;
import java.util.Objects;
/**
* 文件操作工具类
* @author 11797
*/
public class FileUtil {
/**
* 网络图片转本地
* */
@SneakyThrows
public static String network2Local(String picSrc,String picSavePath,String visitPrefix) {
//本地图片保存
HttpHeaders headers = new HttpHeaders();
HttpEntity<String> requestEntity = new HttpEntity<>(null, headers);
ResponseEntity<Resource> resEntity = RestTemplateUtil.getInstance(Charsets.ISO_8859_1.name()).exchange(picSrc, HttpMethod.GET, requestEntity, Resource.class);
InputStream input = Objects.requireNonNull(resEntity.getBody()).getInputStream();
Date currentDate = new Date();
picSrc = visitPrefix + DateUtils.formatDate(currentDate, "yyyy") + "/" + DateUtils.formatDate(currentDate, "MM") + "/" + DateUtils.formatDate(currentDate, "dd") + "/"
+ UUIDUtil.getUUID32()
+ picSrc.substring(picSrc.lastIndexOf("."));
File picFile = new File(picSavePath + picSrc);
File parentFile = picFile.getParentFile();
if (!parentFile.exists()) {
parentFile.mkdirs();
}
OutputStream out = new FileOutputStream(picFile);
byte[] b = new byte[4096];
for (int n; (n = input.read(b)) != -1; ) {
out.write(b, 0, n);
}
out.close();
input.close();
return picSrc;
}
}

View File

@ -0,0 +1,40 @@
package com.java2nb.novel.core.utils;
import lombok.SneakyThrows;
import org.mybatis.generator.api.MyBatisGenerator;
import org.mybatis.generator.config.Configuration;
import org.mybatis.generator.config.xml.ConfigurationParser;
import org.mybatis.generator.internal.DefaultShellCallback;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
/**
* 代码生成器
*
* @author 11797
*/
public class Generator {
@SneakyThrows
public static void main(String[] args) {
//MBG 执行过程中的警告信息
List<String> warnings = new ArrayList<>();
//读取我们的 MBG 配置文件
InputStream is = Generator.class.getResourceAsStream("/mybatis/generatorConfig.xml");
ConfigurationParser cp = new ConfigurationParser(warnings);
Configuration config = cp.parseConfiguration(is);
is.close();
//当生成的代码重复时不要覆盖原代码
DefaultShellCallback callback = new DefaultShellCallback(false);
//创建 MBG
MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings);
//执行生成代码
myBatisGenerator.generate(null);
//输出警告信息
for (String warning : warnings) {
System.out.println(warning);
}
}
}

View File

@ -0,0 +1,31 @@
package com.java2nb.novel.core.utils;
import org.apache.http.client.HttpClient;
import org.apache.http.impl.client.DefaultHttpClient;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;
/**
* @author Administrator
*/
public class HttpUtil {
private static RestTemplate restTemplate = RestTemplateUtil.getInstance("utf-8");
public static String getByHttpClient(String url) {
try {
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);
if (forEntity.getStatusCode() == HttpStatus.OK) {
return forEntity.getBody();
} else {
return null;
}
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}

View File

@ -0,0 +1,163 @@
package com.java2nb.novel.core.utils;
import java.lang.management.ManagementFactory;
import java.net.InetAddress;
import java.net.NetworkInterface;
/**
* <p>名称IdWorker.java</p>
* <p>描述分布式自增长ID</p>
* <pre>
* Twitter的 Snowflake JAVA实现方案
* </pre>
* 核心代码为其IdWorker这个类实现其原理结构如下我分别用一个0表示一位分割开部分的作用
* 1||0---0000000000 0000000000 0000000000 0000000000 0 --- 00000 ---00000 ---000000000000
* 在上面的字符串中第一位为未使用实际上也可作为long的符号位接下来的41位为毫秒级时间
* 然后5位datacenter标识位5位机器ID并不算标识符实际是为线程标识
* 然后12位该毫秒内的当前毫秒内的计数加起来刚好64位为一个Long型
* 这样的好处是整体上按照时间自增排序并且整个分布式系统内不会产生ID碰撞由datacenter和机器ID作区分
* 并且效率较高经测试snowflake每秒能够产生26万ID左右完全满足需要
* <p>
* 64位ID (42(毫秒)+5(机器ID)+5(业务编码)+12(重复累加))
*
*/
public class IdWorker {
// 时间起始标记点作为基准一般取系统的最近时间一旦确定不能变动
private final static long twepoch = 1288834974657L;
// 机器标识位数
private final static long workerIdBits = 5L;
// 数据中心标识位数
private final static long datacenterIdBits = 5L;
// 机器ID最大值
private final static long maxWorkerId = -1L ^ (-1L << workerIdBits);
// 数据中心ID最大值
private final static long maxDatacenterId = -1L ^ (-1L << datacenterIdBits);
// 毫秒内自增位
private final static long sequenceBits = 12L;
// 机器ID偏左移12位
private final static long workerIdShift = sequenceBits;
// 数据中心ID左移17位
private final static long datacenterIdShift = sequenceBits + workerIdBits;
// 时间毫秒左移22位
private final static long timestampLeftShift = sequenceBits + workerIdBits + datacenterIdBits;
private final static long sequenceMask = -1L ^ (-1L << sequenceBits);
/* 上次生产id时间戳 */
private static long lastTimestamp = -1L;
// 0并发控制
private long sequence = 0L;
private final long workerId;
// 数据标识id部分
private final long datacenterId;
public IdWorker(){
this.datacenterId = getDatacenterId(maxDatacenterId);
this.workerId = getMaxWorkerId(datacenterId, maxWorkerId);
}
/**
* @param workerId
* 工作机器ID
* @param datacenterId
* 序列号
*/
public IdWorker(long workerId, long datacenterId) {
if (workerId > maxWorkerId || workerId < 0) {
throw new IllegalArgumentException(String.format("worker Id can't be greater than %d or less than 0", maxWorkerId));
}
if (datacenterId > maxDatacenterId || datacenterId < 0) {
throw new IllegalArgumentException(String.format("datacenter Id can't be greater than %d or less than 0", maxDatacenterId));
}
this.workerId = workerId;
this.datacenterId = datacenterId;
}
/**
* 获取下一个ID
*
* @return
*/
public synchronized long nextId() {
long timestamp = timeGen();
if (timestamp < lastTimestamp) {
throw new RuntimeException(String.format("Clock moved backwards. Refusing to generate id for %d milliseconds", lastTimestamp - timestamp));
}
if (lastTimestamp == timestamp) {
// 当前毫秒内+1
sequence = (sequence + 1) & sequenceMask;
if (sequence == 0) {
// 当前毫秒内计数满了则等待下一秒
timestamp = tilNextMillis(lastTimestamp);
}
} else {
sequence = 0L;
}
lastTimestamp = timestamp;
// ID偏移组合生成最终的ID并返回ID
long nextId = ((timestamp - twepoch) << timestampLeftShift)
| (datacenterId << datacenterIdShift)
| (workerId << workerIdShift) | sequence;
return nextId;
}
private long tilNextMillis(final long lastTimestamp) {
long timestamp = this.timeGen();
while (timestamp <= lastTimestamp) {
timestamp = this.timeGen();
}
return timestamp;
}
private long timeGen() {
return System.currentTimeMillis();
}
/**
* <p>
* 获取 maxWorkerId
* </p>
*/
protected static long getMaxWorkerId(long datacenterId, long maxWorkerId) {
StringBuffer mpid = new StringBuffer();
mpid.append(datacenterId);
String name = ManagementFactory.getRuntimeMXBean().getName();
if (!name.isEmpty()) {
/*
* GET jvmPid
*/
mpid.append(name.split("@")[0]);
}
/*
* MAC + PID hashcode 获取16个低位
*/
return (mpid.toString().hashCode() & 0xffff) % (maxWorkerId + 1);
}
/**
* <p>
* 数据标识id部分
* </p>
*/
protected static long getDatacenterId(long maxDatacenterId) {
long id = 0L;
try {
InetAddress ip = InetAddress.getLocalHost();
NetworkInterface network = NetworkInterface.getByInetAddress(ip);
if (network == null) {
id = 1L;
} else {
byte[] mac = network.getHardwareAddress();
id = ((0x000000FF & (long) mac[mac.length - 1])
| (0x0000FF00 & (((long) mac[mac.length - 2]) << 8))) >> 6;
id = id % (maxDatacenterId + 1);
}
} catch (Exception e) {
System.out.println(" getDatacenterId: " + e.getMessage());
}
return id;
}
}

View File

@ -0,0 +1,34 @@
package com.java2nb.novel.core.utils;
import javax.servlet.http.HttpServletRequest;
public class IpUtil {
/**
* 获取真实IP
* @param request 请求体
* @return 真实IP
*/
public static String getRealIp(HttpServletRequest request) {
// 这个一般是Nginx反向代理设置的参数
String ip = request.getHeader("X-Real-IP");
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("X-Forwarded-For");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("WL-Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
}
// 处理多IP的情况只取第一个IP
if (ip != null && ip.contains(",")) {
String[] ipArray = ip.split(",");
ip = ipArray[0];
}
return ip;
}
}

View File

@ -0,0 +1,61 @@
package com.java2nb.novel.core.utils;
import lombok.SneakyThrows;
import sun.misc.BASE64Encoder;
import java.security.MessageDigest;
/**
* @author 11797
*/
public class MD5Util {
private static final String DEFAUL_CHARSET = "utf-8" ;
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 HEX_DIGITS[d1] + HEX_DIGITS[d2];
}
@SneakyThrows
public static String MD5Encode(String origin,String charsetname) {
MessageDigest md = MessageDigest.getInstance("MD5");
if (charsetname == null || "".equals(charsetname)) {
return byteArrayToHexString(md.digest(origin
.getBytes()));
} else {
return byteArrayToHexString(md.digest(origin
.getBytes(charsetname)));
}
}
@SneakyThrows
public static String MD5New(String str) {
//首先利用MD5算法将密码加密变成等长字节
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] b1 = md.digest(str.getBytes());
//将等长字节利用Base64算法转换成字符串
BASE64Encoder encoder = new BASE64Encoder();
return encoder.encode(b1);
}
private static final String[] HEX_DIGITS = {"0", "1", "2", "3", "4", "5",
"6", "7", "8", "9", "a", "b", "c", "d", "e", "f"};
}

View File

@ -0,0 +1,103 @@
package com.java2nb.novel.core.utils;
import java.util.Random;
/**
* 随机生成小说信息工具类
* @author Administrator
*/
public class RandomBookInfoUtil {
/**
* 根据评分获取访问人数
* */
public static Long getVisitCountByScore(Float score){
Long visitCount ;
if(score > 9){
visitCount = 100000 + new Random(100000).nextLong();
}else if(score > 8){
visitCount = 10000 + new Random(10000).nextLong();
}else if(score > 7){
visitCount = 1000 + new Random(1000).nextLong();
}else if(score > 6){
visitCount = 100 + new Random(100).nextLong();
}else{
visitCount = new Random(100).nextLong();
}
return visitCount;
}
/**
* 根据访问人数获取评分
* */
public static Float getScoreByVisitCount(Long visitCount){
Float score;
if(visitCount>100000) {
score = 8.9f;
}else if(visitCount>10000){
score = 8.0f+(visitCount/10000)*0.1f;
}else if(visitCount>1000){
score = 7.0f+(visitCount/1000)*0.1f;
}else if(visitCount>100){
score = 6.0f+(visitCount/100)*0.1f;
}else{
score = 6.0f;
}
return score;
}
/**
* 获取分类名
* */
public static 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;
}
case 9: {
catName = "漫画";
break;
}
default: {
break;
}
}
return catName;
}
}

View File

@ -0,0 +1,138 @@
package com.java2nb.novel.core.utils;
import com.java2nb.novel.core.cache.CacheService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletResponse;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.util.Random;
/**
* @author xiongxy
*/
public class RandomValidateCodeUtil {
/**
* 放到session中的key
* */
public static final String RANDOM_CODE_KEY = "randomValidateCodeKey";
/**
* 随机产生只有数字的字符串 private String
* */
private String randString = "0123456789";
/**
* 图片宽
* */
private int width = 100;
/**
* 图片高
* */
private int height = 38;
/**
* 干扰线数量
* */
private int lineSize = 40;
/**
* 随机产生字符数量
* */
private int stringNum = 4;
private static final Logger logger = LoggerFactory.getLogger(RandomValidateCodeUtil.class);
private Random random = new Random();
/**
* 获得字体
*/
private Font getFont() {
return new Font("Fixedsys", Font.ROMAN_BASELINE, 23);
}
/**
* 获得颜色
*/
private Color getRandColor(int fc, int bc) {
if (fc > 255) {
fc = 255;
}
if (bc > 255) {
bc = 255;
}
int r = fc + random.nextInt(bc - fc - 16);
int g = fc + random.nextInt(bc - fc - 14);
int b = fc + random.nextInt(bc - fc - 18);
return new Color(r, g, b);
}
/**
* 生成随机图片
*/
public void getRandcode(CacheService cacheService, HttpServletResponse response) {
// BufferedImage类是具有缓冲区的Image类,Image类是用于描述图像信息的类
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_BGR);
// 产生Image对象的Graphics对象,改对象可以在图像上进行各种绘制操作
Graphics g = image.getGraphics();
//图片大小
g.fillRect(0, 0, width, height);
//字体大小
//字体颜色
g.setColor(new Color(204,204,204));
// 绘制干扰线
for (int i = 0; i <= lineSize; i++) {
drowLine(g);
}
// 绘制随机字符
String randomString = "";
for (int i = 1; i <= stringNum; i++) {
randomString = drowString(g, randomString, i);
}
logger.info(randomString);
//将生成的随机字符串保存到缓存中
cacheService.set(RANDOM_CODE_KEY,randomString,60*5);
g.dispose();
try {
// 将内存中的图片通过流动形式输出到客户端
ImageIO.write(image, "JPEG", response.getOutputStream());
} catch (Exception e) {
logger.error("将内存中的图片通过流动形式输出到客户端失败>>>> ", e);
}
}
/**
* 绘制字符串
*/
private String drowString(Graphics g, String randomString, int i) {
g.setFont(getFont());
g.setColor(new Color(random.nextInt(101), random.nextInt(111), random
.nextInt(121)));
String rand = String.valueOf(getRandomString(random.nextInt(randString
.length())));
randomString += rand;
g.translate(random.nextInt(3), random.nextInt(3));
g.drawString(rand, 13 * i, 23);
return randomString;
}
/**
* 绘制干扰线
*/
private void drowLine(Graphics g) {
int x = random.nextInt(width);
int y = random.nextInt(height);
int xl = random.nextInt(13);
int yl = random.nextInt(15);
g.drawLine(x, y, x + xl, y + yl);
}
/**
* 获取随机的字符
*/
public String getRandomString(int num) {
return String.valueOf(randString.charAt(num));
}
}

View File

@ -0,0 +1,72 @@
package com.java2nb.novel.core.utils;
import lombok.SneakyThrows;
import org.apache.http.config.Registry;
import org.apache.http.config.RegistryBuilder;
import org.apache.http.conn.socket.ConnectionSocketFactory;
import org.apache.http.conn.socket.PlainConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.conn.ssl.TrustStrategy;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
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 javax.net.ssl.SSLContext;
import java.nio.charset.Charset;
import java.security.cert.X509Certificate;
import java.util.List;
public class RestTemplateUtil {
@SneakyThrows
public static RestTemplate getInstance(String charset) {
TrustStrategy acceptingTrustStrategy = (X509Certificate[] chain, String authType) -> true;
//忽略证书
SSLContext sslContext = org.apache.http.ssl.SSLContexts.custom()
.loadTrustMaterial(null, acceptingTrustStrategy)
.build();
SSLConnectionSocketFactory csf = new SSLConnectionSocketFactory(sslContext);
Registry<ConnectionSocketFactory> registry = RegistryBuilder.<ConnectionSocketFactory>create()
.register("http", PlainConnectionSocketFactory.getSocketFactory())
.register("https", csf)
.build();
PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(registry);
//连接池的最大连接数0代表不限如果取0需要考虑连接泄露导致系统崩溃的后果
connectionManager.setMaxTotal(1000);
//每个路由的最大连接数,如果只调用一个地址,可以将其设置为最大连接数
connectionManager.setDefaultMaxPerRoute(300);
CloseableHttpClient httpClient = HttpClients.custom()
.setConnectionManager(connectionManager)
.build();
HttpComponentsClientHttpRequestFactory requestFactory =
new HttpComponentsClientHttpRequestFactory();
requestFactory.setHttpClient(httpClient);
requestFactory.setConnectionRequestTimeout(3000);
requestFactory.setConnectTimeout(3000);
requestFactory.setReadTimeout(10000);
RestTemplate restTemplate = new RestTemplate(requestFactory);
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,52 @@
package com.java2nb.novel.core.utils;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
/**
* @author Administrator
*/
@Component
public class SpringUtil implements ApplicationContextAware {
private static ApplicationContext applicationContext;
@Override
public void setApplicationContext(ApplicationContext applicationContext) {
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,26 @@
package com.java2nb.novel.core.utils;
/**
* 线程工具类
* @author Administrator
*/
public class ThreadUtil {
/**
* 根据线程ID获取线程
* */
public static Thread findThread(long threadId) {
ThreadGroup group = Thread.currentThread().getThreadGroup();
while(group != null) {
Thread[] threads = new Thread[(int)(group.activeCount() * 1.2)];
int count = group.enumerate(threads, true);
for(int i = 0; i < count; i++) {
if(threadId == threads[i].getId()) {
return threads[i];
}
}
group = group.getParent();
}
return null;
}
}

View File

@ -0,0 +1,96 @@
package com.java2nb.novel.core.utils;
import java.util.UUID;
/**
* @author Administrator
*/
public class UUIDUtil {
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,332 @@
package com.java2nb.novel.entity;
import java.io.Serializable;
import java.util.Date;
import javax.annotation.Generated;
public class Book implements Serializable{
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long id;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Byte workDirection;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Integer catId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String catName;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String picUrl;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String bookName;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long authorId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String authorName;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String bookDesc;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Float score;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Byte bookStatus;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long visitCount;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Integer wordCount;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Integer commentCount;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long lastIndexId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String lastIndexName;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Date lastIndexUpdateTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Byte isVip;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Byte status;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Date updateTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Date createTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Integer crawlSourceId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String crawlBookId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Date crawlLastTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Byte crawlIsStop;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getId() {
return id;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setId(Long id) {
this.id = id;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Byte getWorkDirection() {
return workDirection;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setWorkDirection(Byte workDirection) {
this.workDirection = workDirection;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Integer getCatId() {
return catId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setCatId(Integer catId) {
this.catId = catId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public String getCatName() {
return catName;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setCatName(String catName) {
this.catName = catName == null ? null : catName.trim();
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public String getPicUrl() {
return picUrl;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setPicUrl(String picUrl) {
this.picUrl = picUrl == null ? null : picUrl.trim();
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public String getBookName() {
return bookName;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setBookName(String bookName) {
this.bookName = bookName == null ? null : bookName.trim();
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getAuthorId() {
return authorId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setAuthorId(Long authorId) {
this.authorId = authorId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public String getAuthorName() {
return authorName;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setAuthorName(String authorName) {
this.authorName = authorName == null ? null : authorName.trim();
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public String getBookDesc() {
return bookDesc;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setBookDesc(String bookDesc) {
this.bookDesc = bookDesc == null ? null : bookDesc.trim();
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Float getScore() {
return score;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setScore(Float score) {
this.score = score;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Byte getBookStatus() {
return bookStatus;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setBookStatus(Byte bookStatus) {
this.bookStatus = bookStatus;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getVisitCount() {
return visitCount;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setVisitCount(Long visitCount) {
this.visitCount = visitCount;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Integer getWordCount() {
return wordCount;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setWordCount(Integer wordCount) {
this.wordCount = wordCount;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Integer getCommentCount() {
return commentCount;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setCommentCount(Integer commentCount) {
this.commentCount = commentCount;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getLastIndexId() {
return lastIndexId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setLastIndexId(Long lastIndexId) {
this.lastIndexId = lastIndexId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public String getLastIndexName() {
return lastIndexName;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setLastIndexName(String lastIndexName) {
this.lastIndexName = lastIndexName == null ? null : lastIndexName.trim();
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Date getLastIndexUpdateTime() {
return lastIndexUpdateTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setLastIndexUpdateTime(Date lastIndexUpdateTime) {
this.lastIndexUpdateTime = lastIndexUpdateTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Byte getIsVip() {
return isVip;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setIsVip(Byte isVip) {
this.isVip = isVip;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Byte getStatus() {
return status;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setStatus(Byte status) {
this.status = status;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Date getUpdateTime() {
return updateTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Date getCreateTime() {
return createTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Integer getCrawlSourceId() {
return crawlSourceId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setCrawlSourceId(Integer crawlSourceId) {
this.crawlSourceId = crawlSourceId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public String getCrawlBookId() {
return crawlBookId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setCrawlBookId(String crawlBookId) {
this.crawlBookId = crawlBookId == null ? null : crawlBookId.trim();
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Date getCrawlLastTime() {
return crawlLastTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setCrawlLastTime(Date crawlLastTime) {
this.crawlLastTime = crawlLastTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Byte getCrawlIsStop() {
return crawlIsStop;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setCrawlIsStop(Byte crawlIsStop) {
this.crawlIsStop = crawlIsStop;
}
}

View File

@ -0,0 +1,162 @@
package com.java2nb.novel.entity;
import javax.annotation.Generated;
import java.util.Date;
public class BookAuthor {
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long id;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String inviteCode;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String penName;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String telPhone;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String chatAccount;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String email;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Byte workDirection;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Byte status;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Date createTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long createUserId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Date updateTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long updateUserId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getId() {
return id;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setId(Long id) {
this.id = id;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public String getInviteCode() {
return inviteCode;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setInviteCode(String inviteCode) {
this.inviteCode = inviteCode == null ? null : inviteCode.trim();
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public String getPenName() {
return penName;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setPenName(String penName) {
this.penName = penName == null ? null : penName.trim();
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public String getTelPhone() {
return telPhone;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setTelPhone(String telPhone) {
this.telPhone = telPhone == null ? null : telPhone.trim();
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public String getChatAccount() {
return chatAccount;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setChatAccount(String chatAccount) {
this.chatAccount = chatAccount == null ? null : chatAccount.trim();
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public String getEmail() {
return email;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setEmail(String email) {
this.email = email == null ? null : email.trim();
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Byte getWorkDirection() {
return workDirection;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setWorkDirection(Byte workDirection) {
this.workDirection = workDirection;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Byte getStatus() {
return status;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setStatus(Byte status) {
this.status = status;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Date getCreateTime() {
return createTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getCreateUserId() {
return createUserId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setCreateUserId(Long createUserId) {
this.createUserId = createUserId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Date getUpdateTime() {
return updateTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getUpdateUserId() {
return updateUserId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setUpdateUserId(Long updateUserId) {
this.updateUserId = updateUserId;
}
}

View File

@ -0,0 +1,110 @@
package com.java2nb.novel.entity;
import javax.annotation.Generated;
import java.util.Date;
public class BookCategory {
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Integer id;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Byte workDirection;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String name;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Byte sort;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long createUserId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Date createTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long updateUserId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Date updateTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Integer getId() {
return id;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setId(Integer id) {
this.id = id;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Byte getWorkDirection() {
return workDirection;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setWorkDirection(Byte workDirection) {
this.workDirection = workDirection;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public String getName() {
return name;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Byte getSort() {
return sort;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setSort(Byte sort) {
this.sort = sort;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getCreateUserId() {
return createUserId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setCreateUserId(Long createUserId) {
this.createUserId = createUserId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Date getCreateTime() {
return createTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getUpdateUserId() {
return updateUserId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setUpdateUserId(Long updateUserId) {
this.updateUserId = updateUserId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Date getUpdateTime() {
return updateTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}

View File

@ -0,0 +1,98 @@
package com.java2nb.novel.entity;
import javax.annotation.Generated;
import java.util.Date;
public class BookComment {
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long id;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long bookId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String commentContent;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Integer replyCount;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Byte auditStatus;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Date createTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long createUserId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getId() {
return id;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setId(Long id) {
this.id = id;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getBookId() {
return bookId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setBookId(Long bookId) {
this.bookId = bookId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public String getCommentContent() {
return commentContent;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setCommentContent(String commentContent) {
this.commentContent = commentContent == null ? null : commentContent.trim();
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Integer getReplyCount() {
return replyCount;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setReplyCount(Integer replyCount) {
this.replyCount = replyCount;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Byte getAuditStatus() {
return auditStatus;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setAuditStatus(Byte auditStatus) {
this.auditStatus = auditStatus;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Date getCreateTime() {
return createTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getCreateUserId() {
return createUserId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setCreateUserId(Long createUserId) {
this.createUserId = createUserId;
}
}

View File

@ -0,0 +1,44 @@
package com.java2nb.novel.entity;
import javax.annotation.Generated;
public class BookContent {
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long id;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long indexId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String content;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getId() {
return id;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setId(Long id) {
this.id = id;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getIndexId() {
return indexId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setIndexId(Long indexId) {
this.indexId = indexId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public String getContent() {
return content;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setContent(String content) {
this.content = content == null ? null : content.trim();
}
}

View File

@ -0,0 +1,110 @@
package com.java2nb.novel.entity;
import javax.annotation.Generated;
import java.util.Date;
public class BookIndex {
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long id;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long bookId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Integer indexNum;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String indexName;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Integer wordCount;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Byte isVip;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Date createTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Date updateTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getId() {
return id;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setId(Long id) {
this.id = id;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getBookId() {
return bookId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setBookId(Long bookId) {
this.bookId = bookId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Integer getIndexNum() {
return indexNum;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setIndexNum(Integer indexNum) {
this.indexNum = indexNum;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public String getIndexName() {
return indexName;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setIndexName(String indexName) {
this.indexName = indexName == null ? null : indexName.trim();
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Integer getWordCount() {
return wordCount;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setWordCount(Integer wordCount) {
this.wordCount = wordCount;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Byte getIsVip() {
return isVip;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setIsVip(Byte isVip) {
this.isVip = isVip;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Date getCreateTime() {
return createTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Date getUpdateTime() {
return updateTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}

View File

@ -0,0 +1,110 @@
package com.java2nb.novel.entity;
import javax.annotation.Generated;
import java.util.Date;
public class BookSetting {
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long id;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long bookId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Byte sort;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Byte type;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Date createTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long createUserId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Date updateTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long updateUserId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getId() {
return id;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setId(Long id) {
this.id = id;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getBookId() {
return bookId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setBookId(Long bookId) {
this.bookId = bookId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Byte getSort() {
return sort;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setSort(Byte sort) {
this.sort = sort;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Byte getType() {
return type;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setType(Byte type) {
this.type = type;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Date getCreateTime() {
return createTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getCreateUserId() {
return createUserId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setCreateUserId(Long createUserId) {
this.createUserId = createUserId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Date getUpdateTime() {
return updateTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getUpdateUserId() {
return updateUserId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setUpdateUserId(Long updateUserId) {
this.updateUserId = updateUserId;
}
}

View File

@ -0,0 +1,97 @@
package com.java2nb.novel.entity;
import java.util.Date;
import javax.annotation.Generated;
public class CrawlBatchTask {
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long id;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Integer sourceId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Integer crawlCountSuccess;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Integer crawlCountTarget;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Byte taskStatus;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Date startTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Date endTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getId() {
return id;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setId(Long id) {
this.id = id;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Integer getSourceId() {
return sourceId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setSourceId(Integer sourceId) {
this.sourceId = sourceId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Integer getCrawlCountSuccess() {
return crawlCountSuccess;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setCrawlCountSuccess(Integer crawlCountSuccess) {
this.crawlCountSuccess = crawlCountSuccess;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Integer getCrawlCountTarget() {
return crawlCountTarget;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setCrawlCountTarget(Integer crawlCountTarget) {
this.crawlCountTarget = crawlCountTarget;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Byte getTaskStatus() {
return taskStatus;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setTaskStatus(Byte taskStatus) {
this.taskStatus = taskStatus;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Date getStartTime() {
return startTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Date getEndTime() {
return endTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
}

View File

@ -0,0 +1,84 @@
package com.java2nb.novel.entity;
import java.util.Date;
import javax.annotation.Generated;
public class CrawlSingleTask {
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long id;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Integer sourceId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String sourceBookId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Byte taskStatus;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Byte excCount;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Date createTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getId() {
return id;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setId(Long id) {
this.id = id;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Integer getSourceId() {
return sourceId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setSourceId(Integer sourceId) {
this.sourceId = sourceId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public String getSourceBookId() {
return sourceBookId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setSourceBookId(String sourceBookId) {
this.sourceBookId = sourceBookId == null ? null : sourceBookId.trim();
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Byte getTaskStatus() {
return taskStatus;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setTaskStatus(Byte taskStatus) {
this.taskStatus = taskStatus;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Byte getExcCount() {
return excCount;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setExcCount(Byte excCount) {
this.excCount = excCount;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Date getCreateTime() {
return createTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}

View File

@ -0,0 +1,84 @@
package com.java2nb.novel.entity;
import java.util.Date;
import javax.annotation.Generated;
public class CrawlSource {
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Integer id;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String sourceName;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String crawlRule;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Byte sourceStatus;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Date createTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Date updateTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Integer getId() {
return id;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setId(Integer id) {
this.id = id;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public String getSourceName() {
return sourceName;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setSourceName(String sourceName) {
this.sourceName = sourceName == null ? null : sourceName.trim();
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public String getCrawlRule() {
return crawlRule;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setCrawlRule(String crawlRule) {
this.crawlRule = crawlRule == null ? null : crawlRule.trim();
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Byte getSourceStatus() {
return sourceStatus;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setSourceStatus(Byte sourceStatus) {
this.sourceStatus = sourceStatus;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Date getCreateTime() {
return createTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Date getUpdateTime() {
return updateTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}

View File

@ -0,0 +1,124 @@
package com.java2nb.novel.entity;
import java.io.Serializable;
import java.util.Date;
import javax.annotation.Generated;
public class FriendLink implements Serializable{
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Integer id;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String linkName;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String linkUrl;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Byte sort;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Byte isOpen;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long createUserId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Date createTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long updateUserId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Date updateTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Integer getId() {
return id;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setId(Integer id) {
this.id = id;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public String getLinkName() {
return linkName;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setLinkName(String linkName) {
this.linkName = linkName == null ? null : linkName.trim();
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public String getLinkUrl() {
return linkUrl;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setLinkUrl(String linkUrl) {
this.linkUrl = linkUrl == null ? null : linkUrl.trim();
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Byte getSort() {
return sort;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setSort(Byte sort) {
this.sort = sort;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Byte getIsOpen() {
return isOpen;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setIsOpen(Byte isOpen) {
this.isOpen = isOpen;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getCreateUserId() {
return createUserId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setCreateUserId(Long createUserId) {
this.createUserId = createUserId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Date getCreateTime() {
return createTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getUpdateUserId() {
return updateUserId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setUpdateUserId(Long updateUserId) {
this.updateUserId = updateUserId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Date getUpdateTime() {
return updateTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}

View File

@ -0,0 +1,138 @@
package com.java2nb.novel.entity;
import javax.annotation.Generated;
import java.io.Serializable;
import java.util.Date;
public class News implements Serializable {
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long id;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Integer catId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String catName;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String sourceName;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String title;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Date createTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long createUserId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Date updateTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long updateUserId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String content;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getId() {
return id;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setId(Long id) {
this.id = id;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Integer getCatId() {
return catId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setCatId(Integer catId) {
this.catId = catId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public String getCatName() {
return catName;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setCatName(String catName) {
this.catName = catName == null ? null : catName.trim();
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public String getSourceName() {
return sourceName;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setSourceName(String sourceName) {
this.sourceName = sourceName == null ? null : sourceName.trim();
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public String getTitle() {
return title;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setTitle(String title) {
this.title = title == null ? null : title.trim();
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Date getCreateTime() {
return createTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getCreateUserId() {
return createUserId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setCreateUserId(Long createUserId) {
this.createUserId = createUserId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Date getUpdateTime() {
return updateTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getUpdateUserId() {
return updateUserId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setUpdateUserId(Long updateUserId) {
this.updateUserId = updateUserId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public String getContent() {
return content;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setContent(String content) {
this.content = content == null ? null : content.trim();
}
}

View File

@ -0,0 +1,136 @@
package com.java2nb.novel.entity;
import java.util.Date;
import javax.annotation.Generated;
public class User {
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long id;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String username;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String password;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String nickName;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String userPhoto;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Byte userSex;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long accountBalance;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Byte status;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Date createTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Date updateTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getId() {
return id;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setId(Long id) {
this.id = id;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public String getUsername() {
return username;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setUsername(String username) {
this.username = username == null ? null : username.trim();
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public String getPassword() {
return password;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setPassword(String password) {
this.password = password == null ? null : password.trim();
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public String getNickName() {
return nickName;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setNickName(String nickName) {
this.nickName = nickName == null ? null : nickName.trim();
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public String getUserPhoto() {
return userPhoto;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setUserPhoto(String userPhoto) {
this.userPhoto = userPhoto == null ? null : userPhoto.trim();
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Byte getUserSex() {
return userSex;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setUserSex(Byte userSex) {
this.userSex = userSex;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getAccountBalance() {
return accountBalance;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setAccountBalance(Long accountBalance) {
this.accountBalance = accountBalance;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Byte getStatus() {
return status;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setStatus(Byte status) {
this.status = status;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Date getCreateTime() {
return createTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Date getUpdateTime() {
return updateTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}

View File

@ -0,0 +1,84 @@
package com.java2nb.novel.entity;
import java.util.Date;
import javax.annotation.Generated;
public class UserBookshelf {
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long id;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long userId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long bookId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long preContentId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Date createTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Date updateTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getId() {
return id;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setId(Long id) {
this.id = id;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getUserId() {
return userId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setUserId(Long userId) {
this.userId = userId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getBookId() {
return bookId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setBookId(Long bookId) {
this.bookId = bookId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getPreContentId() {
return preContentId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setPreContentId(Long preContentId) {
this.preContentId = preContentId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Date getCreateTime() {
return createTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Date getUpdateTime() {
return updateTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}

View File

@ -0,0 +1,59 @@
package com.java2nb.novel.entity;
import java.util.Date;
import javax.annotation.Generated;
public class UserFeedback {
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long id;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long userId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String content;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Date createTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getId() {
return id;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setId(Long id) {
this.id = id;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getUserId() {
return userId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setUserId(Long userId) {
this.userId = userId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public String getContent() {
return content;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setContent(String content) {
this.content = content == null ? null : content.trim();
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Date getCreateTime() {
return createTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}

View File

@ -0,0 +1,84 @@
package com.java2nb.novel.entity;
import java.util.Date;
import javax.annotation.Generated;
public class UserReadHistory {
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long id;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long userId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long bookId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long preContentId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Date createTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Date updateTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getId() {
return id;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setId(Long id) {
this.id = id;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getUserId() {
return userId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setUserId(Long userId) {
this.userId = userId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getBookId() {
return bookId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setBookId(Long bookId) {
this.bookId = bookId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Long getPreContentId() {
return preContentId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setPreContentId(Long preContentId) {
this.preContentId = preContentId;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Date getCreateTime() {
return createTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public Date getUpdateTime() {
return updateTime;
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}

View File

@ -0,0 +1,79 @@
package com.java2nb.novel.mapper;
import java.sql.JDBCType;
import java.util.Date;
import javax.annotation.Generated;
import org.mybatis.dynamic.sql.SqlColumn;
import org.mybatis.dynamic.sql.SqlTable;
public final class BookAuthorDynamicSqlSupport {
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final BookAuthor bookAuthor = new BookAuthor();
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<Long> id = bookAuthor.id;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<String> inviteCode = bookAuthor.inviteCode;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<String> penName = bookAuthor.penName;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<String> telPhone = bookAuthor.telPhone;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<String> chatAccount = bookAuthor.chatAccount;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<String> email = bookAuthor.email;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<Byte> workDirection = bookAuthor.workDirection;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<Byte> status = bookAuthor.status;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<Date> createTime = bookAuthor.createTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<Long> createUserId = bookAuthor.createUserId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<Date> updateTime = bookAuthor.updateTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<Long> updateUserId = bookAuthor.updateUserId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final class BookAuthor extends SqlTable {
public final SqlColumn<Long> id = column("id", JDBCType.BIGINT);
public final SqlColumn<String> inviteCode = column("invite_code", JDBCType.VARCHAR);
public final SqlColumn<String> penName = column("pen_name", JDBCType.VARCHAR);
public final SqlColumn<String> telPhone = column("tel_phone", JDBCType.VARCHAR);
public final SqlColumn<String> chatAccount = column("chat_account", JDBCType.VARCHAR);
public final SqlColumn<String> email = column("email", JDBCType.VARCHAR);
public final SqlColumn<Byte> workDirection = column("work_direction", JDBCType.TINYINT);
public final SqlColumn<Byte> status = column("status", JDBCType.TINYINT);
public final SqlColumn<Date> createTime = column("create_time", JDBCType.TIMESTAMP);
public final SqlColumn<Long> createUserId = column("create_user_id", JDBCType.BIGINT);
public final SqlColumn<Date> updateTime = column("update_time", JDBCType.TIMESTAMP);
public final SqlColumn<Long> updateUserId = column("update_user_id", JDBCType.BIGINT);
public BookAuthor() {
super("book_author");
}
}
}

View File

@ -0,0 +1,248 @@
package com.java2nb.novel.mapper;
import static com.java2nb.novel.mapper.BookAuthorDynamicSqlSupport.*;
import static org.mybatis.dynamic.sql.SqlBuilder.*;
import com.java2nb.novel.entity.BookAuthor;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import javax.annotation.Generated;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.mybatis.dynamic.sql.BasicColumn;
import org.mybatis.dynamic.sql.delete.DeleteDSLCompleter;
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
import org.mybatis.dynamic.sql.insert.render.InsertStatementProvider;
import org.mybatis.dynamic.sql.insert.render.MultiRowInsertStatementProvider;
import org.mybatis.dynamic.sql.select.CountDSLCompleter;
import org.mybatis.dynamic.sql.select.SelectDSLCompleter;
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
import org.mybatis.dynamic.sql.update.UpdateDSL;
import org.mybatis.dynamic.sql.update.UpdateDSLCompleter;
import org.mybatis.dynamic.sql.update.UpdateModel;
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
import org.mybatis.dynamic.sql.util.mybatis3.MyBatis3Utils;
@Mapper
public interface BookAuthorMapper {
@Generated("org.mybatis.generator.api.MyBatisGenerator")
BasicColumn[] selectList = BasicColumn.columnList(id, inviteCode, penName, telPhone, chatAccount, email, workDirection, status, createTime, createUserId, updateTime, updateUserId);
@Generated("org.mybatis.generator.api.MyBatisGenerator")
@SelectProvider(type=SqlProviderAdapter.class, method="select")
long count(SelectStatementProvider selectStatement);
@Generated("org.mybatis.generator.api.MyBatisGenerator")
@DeleteProvider(type=SqlProviderAdapter.class, method="delete")
int delete(DeleteStatementProvider deleteStatement);
@Generated("org.mybatis.generator.api.MyBatisGenerator")
@InsertProvider(type=SqlProviderAdapter.class, method="insert")
int insert(InsertStatementProvider<BookAuthor> insertStatement);
@Generated("org.mybatis.generator.api.MyBatisGenerator")
@InsertProvider(type=SqlProviderAdapter.class, method="insertMultiple")
int insertMultiple(MultiRowInsertStatementProvider<BookAuthor> multipleInsertStatement);
@Generated("org.mybatis.generator.api.MyBatisGenerator")
@SelectProvider(type=SqlProviderAdapter.class, method="select")
@ResultMap("BookAuthorResult")
Optional<BookAuthor> selectOne(SelectStatementProvider selectStatement);
@Generated("org.mybatis.generator.api.MyBatisGenerator")
@SelectProvider(type=SqlProviderAdapter.class, method="select")
@Results(id="BookAuthorResult", value = {
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="invite_code", property="inviteCode", jdbcType=JdbcType.VARCHAR),
@Result(column="pen_name", property="penName", jdbcType=JdbcType.VARCHAR),
@Result(column="tel_phone", property="telPhone", jdbcType=JdbcType.VARCHAR),
@Result(column="chat_account", property="chatAccount", jdbcType=JdbcType.VARCHAR),
@Result(column="email", property="email", jdbcType=JdbcType.VARCHAR),
@Result(column="work_direction", property="workDirection", jdbcType=JdbcType.TINYINT),
@Result(column="status", property="status", jdbcType=JdbcType.TINYINT),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="create_user_id", property="createUserId", jdbcType=JdbcType.BIGINT),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_user_id", property="updateUserId", jdbcType=JdbcType.BIGINT)
})
List<BookAuthor> selectMany(SelectStatementProvider selectStatement);
@Generated("org.mybatis.generator.api.MyBatisGenerator")
@UpdateProvider(type=SqlProviderAdapter.class, method="update")
int update(UpdateStatementProvider updateStatement);
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default long count(CountDSLCompleter completer) {
return MyBatis3Utils.countFrom(this::count, bookAuthor, completer);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default int delete(DeleteDSLCompleter completer) {
return MyBatis3Utils.deleteFrom(this::delete, bookAuthor, completer);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default int deleteByPrimaryKey(Long id_) {
return delete(c ->
c.where(id, isEqualTo(id_))
);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default int insert(BookAuthor record) {
return MyBatis3Utils.insert(this::insert, record, bookAuthor, c ->
c.map(id).toProperty("id")
.map(inviteCode).toProperty("inviteCode")
.map(penName).toProperty("penName")
.map(telPhone).toProperty("telPhone")
.map(chatAccount).toProperty("chatAccount")
.map(email).toProperty("email")
.map(workDirection).toProperty("workDirection")
.map(status).toProperty("status")
.map(createTime).toProperty("createTime")
.map(createUserId).toProperty("createUserId")
.map(updateTime).toProperty("updateTime")
.map(updateUserId).toProperty("updateUserId")
);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default int insertMultiple(Collection<BookAuthor> records) {
return MyBatis3Utils.insertMultiple(this::insertMultiple, records, bookAuthor, c ->
c.map(id).toProperty("id")
.map(inviteCode).toProperty("inviteCode")
.map(penName).toProperty("penName")
.map(telPhone).toProperty("telPhone")
.map(chatAccount).toProperty("chatAccount")
.map(email).toProperty("email")
.map(workDirection).toProperty("workDirection")
.map(status).toProperty("status")
.map(createTime).toProperty("createTime")
.map(createUserId).toProperty("createUserId")
.map(updateTime).toProperty("updateTime")
.map(updateUserId).toProperty("updateUserId")
);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default int insertSelective(BookAuthor record) {
return MyBatis3Utils.insert(this::insert, record, bookAuthor, c ->
c.map(id).toPropertyWhenPresent("id", record::getId)
.map(inviteCode).toPropertyWhenPresent("inviteCode", record::getInviteCode)
.map(penName).toPropertyWhenPresent("penName", record::getPenName)
.map(telPhone).toPropertyWhenPresent("telPhone", record::getTelPhone)
.map(chatAccount).toPropertyWhenPresent("chatAccount", record::getChatAccount)
.map(email).toPropertyWhenPresent("email", record::getEmail)
.map(workDirection).toPropertyWhenPresent("workDirection", record::getWorkDirection)
.map(status).toPropertyWhenPresent("status", record::getStatus)
.map(createTime).toPropertyWhenPresent("createTime", record::getCreateTime)
.map(createUserId).toPropertyWhenPresent("createUserId", record::getCreateUserId)
.map(updateTime).toPropertyWhenPresent("updateTime", record::getUpdateTime)
.map(updateUserId).toPropertyWhenPresent("updateUserId", record::getUpdateUserId)
);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default Optional<BookAuthor> selectOne(SelectDSLCompleter completer) {
return MyBatis3Utils.selectOne(this::selectOne, selectList, bookAuthor, completer);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default List<BookAuthor> select(SelectDSLCompleter completer) {
return MyBatis3Utils.selectList(this::selectMany, selectList, bookAuthor, completer);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default List<BookAuthor> selectDistinct(SelectDSLCompleter completer) {
return MyBatis3Utils.selectDistinct(this::selectMany, selectList, bookAuthor, completer);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default Optional<BookAuthor> selectByPrimaryKey(Long id_) {
return selectOne(c ->
c.where(id, isEqualTo(id_))
);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default int update(UpdateDSLCompleter completer) {
return MyBatis3Utils.update(this::update, bookAuthor, completer);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
static UpdateDSL<UpdateModel> updateAllColumns(BookAuthor record, UpdateDSL<UpdateModel> dsl) {
return dsl.set(id).equalTo(record::getId)
.set(inviteCode).equalTo(record::getInviteCode)
.set(penName).equalTo(record::getPenName)
.set(telPhone).equalTo(record::getTelPhone)
.set(chatAccount).equalTo(record::getChatAccount)
.set(email).equalTo(record::getEmail)
.set(workDirection).equalTo(record::getWorkDirection)
.set(status).equalTo(record::getStatus)
.set(createTime).equalTo(record::getCreateTime)
.set(createUserId).equalTo(record::getCreateUserId)
.set(updateTime).equalTo(record::getUpdateTime)
.set(updateUserId).equalTo(record::getUpdateUserId);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
static UpdateDSL<UpdateModel> updateSelectiveColumns(BookAuthor record, UpdateDSL<UpdateModel> dsl) {
return dsl.set(id).equalToWhenPresent(record::getId)
.set(inviteCode).equalToWhenPresent(record::getInviteCode)
.set(penName).equalToWhenPresent(record::getPenName)
.set(telPhone).equalToWhenPresent(record::getTelPhone)
.set(chatAccount).equalToWhenPresent(record::getChatAccount)
.set(email).equalToWhenPresent(record::getEmail)
.set(workDirection).equalToWhenPresent(record::getWorkDirection)
.set(status).equalToWhenPresent(record::getStatus)
.set(createTime).equalToWhenPresent(record::getCreateTime)
.set(createUserId).equalToWhenPresent(record::getCreateUserId)
.set(updateTime).equalToWhenPresent(record::getUpdateTime)
.set(updateUserId).equalToWhenPresent(record::getUpdateUserId);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default int updateByPrimaryKey(BookAuthor record) {
return update(c ->
c.set(inviteCode).equalTo(record::getInviteCode)
.set(penName).equalTo(record::getPenName)
.set(telPhone).equalTo(record::getTelPhone)
.set(chatAccount).equalTo(record::getChatAccount)
.set(email).equalTo(record::getEmail)
.set(workDirection).equalTo(record::getWorkDirection)
.set(status).equalTo(record::getStatus)
.set(createTime).equalTo(record::getCreateTime)
.set(createUserId).equalTo(record::getCreateUserId)
.set(updateTime).equalTo(record::getUpdateTime)
.set(updateUserId).equalTo(record::getUpdateUserId)
.where(id, isEqualTo(record::getId))
);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default int updateByPrimaryKeySelective(BookAuthor record) {
return update(c ->
c.set(inviteCode).equalToWhenPresent(record::getInviteCode)
.set(penName).equalToWhenPresent(record::getPenName)
.set(telPhone).equalToWhenPresent(record::getTelPhone)
.set(chatAccount).equalToWhenPresent(record::getChatAccount)
.set(email).equalToWhenPresent(record::getEmail)
.set(workDirection).equalToWhenPresent(record::getWorkDirection)
.set(status).equalToWhenPresent(record::getStatus)
.set(createTime).equalToWhenPresent(record::getCreateTime)
.set(createUserId).equalToWhenPresent(record::getCreateUserId)
.set(updateTime).equalToWhenPresent(record::getUpdateTime)
.set(updateUserId).equalToWhenPresent(record::getUpdateUserId)
.where(id, isEqualTo(record::getId))
);
}
}

View File

@ -0,0 +1,59 @@
package com.java2nb.novel.mapper;
import java.sql.JDBCType;
import java.util.Date;
import javax.annotation.Generated;
import org.mybatis.dynamic.sql.SqlColumn;
import org.mybatis.dynamic.sql.SqlTable;
public final class BookCategoryDynamicSqlSupport {
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final BookCategory bookCategory = new BookCategory();
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<Integer> id = bookCategory.id;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<Byte> workDirection = bookCategory.workDirection;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<String> name = bookCategory.name;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<Byte> sort = bookCategory.sort;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<Long> createUserId = bookCategory.createUserId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<Date> createTime = bookCategory.createTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<Long> updateUserId = bookCategory.updateUserId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<Date> updateTime = bookCategory.updateTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final class BookCategory extends SqlTable {
public final SqlColumn<Integer> id = column("id", JDBCType.INTEGER);
public final SqlColumn<Byte> workDirection = column("work_direction", JDBCType.TINYINT);
public final SqlColumn<String> name = column("name", JDBCType.VARCHAR);
public final SqlColumn<Byte> sort = column("sort", JDBCType.TINYINT);
public final SqlColumn<Long> createUserId = column("create_user_id", JDBCType.BIGINT);
public final SqlColumn<Date> createTime = column("create_time", JDBCType.TIMESTAMP);
public final SqlColumn<Long> updateUserId = column("update_user_id", JDBCType.BIGINT);
public final SqlColumn<Date> updateTime = column("update_time", JDBCType.TIMESTAMP);
public BookCategory() {
super("book_category");
}
}
}

View File

@ -0,0 +1,216 @@
package com.java2nb.novel.mapper;
import static com.java2nb.novel.mapper.BookCategoryDynamicSqlSupport.*;
import static org.mybatis.dynamic.sql.SqlBuilder.*;
import com.java2nb.novel.entity.BookCategory;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import javax.annotation.Generated;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.mybatis.dynamic.sql.BasicColumn;
import org.mybatis.dynamic.sql.delete.DeleteDSLCompleter;
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
import org.mybatis.dynamic.sql.insert.render.InsertStatementProvider;
import org.mybatis.dynamic.sql.insert.render.MultiRowInsertStatementProvider;
import org.mybatis.dynamic.sql.select.CountDSLCompleter;
import org.mybatis.dynamic.sql.select.SelectDSLCompleter;
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
import org.mybatis.dynamic.sql.update.UpdateDSL;
import org.mybatis.dynamic.sql.update.UpdateDSLCompleter;
import org.mybatis.dynamic.sql.update.UpdateModel;
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
import org.mybatis.dynamic.sql.util.mybatis3.MyBatis3Utils;
@Mapper
public interface BookCategoryMapper {
@Generated("org.mybatis.generator.api.MyBatisGenerator")
BasicColumn[] selectList = BasicColumn.columnList(id, workDirection, name, sort, createUserId, createTime, updateUserId, updateTime);
@Generated("org.mybatis.generator.api.MyBatisGenerator")
@SelectProvider(type=SqlProviderAdapter.class, method="select")
long count(SelectStatementProvider selectStatement);
@Generated("org.mybatis.generator.api.MyBatisGenerator")
@DeleteProvider(type=SqlProviderAdapter.class, method="delete")
int delete(DeleteStatementProvider deleteStatement);
@Generated("org.mybatis.generator.api.MyBatisGenerator")
@InsertProvider(type=SqlProviderAdapter.class, method="insert")
int insert(InsertStatementProvider<BookCategory> insertStatement);
@Generated("org.mybatis.generator.api.MyBatisGenerator")
@InsertProvider(type=SqlProviderAdapter.class, method="insertMultiple")
int insertMultiple(MultiRowInsertStatementProvider<BookCategory> multipleInsertStatement);
@Generated("org.mybatis.generator.api.MyBatisGenerator")
@SelectProvider(type=SqlProviderAdapter.class, method="select")
@ResultMap("BookCategoryResult")
Optional<BookCategory> selectOne(SelectStatementProvider selectStatement);
@Generated("org.mybatis.generator.api.MyBatisGenerator")
@SelectProvider(type=SqlProviderAdapter.class, method="select")
@Results(id="BookCategoryResult", value = {
@Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
@Result(column="work_direction", property="workDirection", jdbcType=JdbcType.TINYINT),
@Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
@Result(column="sort", property="sort", jdbcType=JdbcType.TINYINT),
@Result(column="create_user_id", property="createUserId", jdbcType=JdbcType.BIGINT),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_user_id", property="updateUserId", jdbcType=JdbcType.BIGINT),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP)
})
List<BookCategory> selectMany(SelectStatementProvider selectStatement);
@Generated("org.mybatis.generator.api.MyBatisGenerator")
@UpdateProvider(type=SqlProviderAdapter.class, method="update")
int update(UpdateStatementProvider updateStatement);
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default long count(CountDSLCompleter completer) {
return MyBatis3Utils.countFrom(this::count, bookCategory, completer);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default int delete(DeleteDSLCompleter completer) {
return MyBatis3Utils.deleteFrom(this::delete, bookCategory, completer);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default int deleteByPrimaryKey(Integer id_) {
return delete(c ->
c.where(id, isEqualTo(id_))
);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default int insert(BookCategory record) {
return MyBatis3Utils.insert(this::insert, record, bookCategory, c ->
c.map(id).toProperty("id")
.map(workDirection).toProperty("workDirection")
.map(name).toProperty("name")
.map(sort).toProperty("sort")
.map(createUserId).toProperty("createUserId")
.map(createTime).toProperty("createTime")
.map(updateUserId).toProperty("updateUserId")
.map(updateTime).toProperty("updateTime")
);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default int insertMultiple(Collection<BookCategory> records) {
return MyBatis3Utils.insertMultiple(this::insertMultiple, records, bookCategory, c ->
c.map(id).toProperty("id")
.map(workDirection).toProperty("workDirection")
.map(name).toProperty("name")
.map(sort).toProperty("sort")
.map(createUserId).toProperty("createUserId")
.map(createTime).toProperty("createTime")
.map(updateUserId).toProperty("updateUserId")
.map(updateTime).toProperty("updateTime")
);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default int insertSelective(BookCategory record) {
return MyBatis3Utils.insert(this::insert, record, bookCategory, c ->
c.map(id).toPropertyWhenPresent("id", record::getId)
.map(workDirection).toPropertyWhenPresent("workDirection", record::getWorkDirection)
.map(name).toPropertyWhenPresent("name", record::getName)
.map(sort).toPropertyWhenPresent("sort", record::getSort)
.map(createUserId).toPropertyWhenPresent("createUserId", record::getCreateUserId)
.map(createTime).toPropertyWhenPresent("createTime", record::getCreateTime)
.map(updateUserId).toPropertyWhenPresent("updateUserId", record::getUpdateUserId)
.map(updateTime).toPropertyWhenPresent("updateTime", record::getUpdateTime)
);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default Optional<BookCategory> selectOne(SelectDSLCompleter completer) {
return MyBatis3Utils.selectOne(this::selectOne, selectList, bookCategory, completer);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default List<BookCategory> select(SelectDSLCompleter completer) {
return MyBatis3Utils.selectList(this::selectMany, selectList, bookCategory, completer);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default List<BookCategory> selectDistinct(SelectDSLCompleter completer) {
return MyBatis3Utils.selectDistinct(this::selectMany, selectList, bookCategory, completer);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default Optional<BookCategory> selectByPrimaryKey(Integer id_) {
return selectOne(c ->
c.where(id, isEqualTo(id_))
);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default int update(UpdateDSLCompleter completer) {
return MyBatis3Utils.update(this::update, bookCategory, completer);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
static UpdateDSL<UpdateModel> updateAllColumns(BookCategory record, UpdateDSL<UpdateModel> dsl) {
return dsl.set(id).equalTo(record::getId)
.set(workDirection).equalTo(record::getWorkDirection)
.set(name).equalTo(record::getName)
.set(sort).equalTo(record::getSort)
.set(createUserId).equalTo(record::getCreateUserId)
.set(createTime).equalTo(record::getCreateTime)
.set(updateUserId).equalTo(record::getUpdateUserId)
.set(updateTime).equalTo(record::getUpdateTime);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
static UpdateDSL<UpdateModel> updateSelectiveColumns(BookCategory record, UpdateDSL<UpdateModel> dsl) {
return dsl.set(id).equalToWhenPresent(record::getId)
.set(workDirection).equalToWhenPresent(record::getWorkDirection)
.set(name).equalToWhenPresent(record::getName)
.set(sort).equalToWhenPresent(record::getSort)
.set(createUserId).equalToWhenPresent(record::getCreateUserId)
.set(createTime).equalToWhenPresent(record::getCreateTime)
.set(updateUserId).equalToWhenPresent(record::getUpdateUserId)
.set(updateTime).equalToWhenPresent(record::getUpdateTime);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default int updateByPrimaryKey(BookCategory record) {
return update(c ->
c.set(workDirection).equalTo(record::getWorkDirection)
.set(name).equalTo(record::getName)
.set(sort).equalTo(record::getSort)
.set(createUserId).equalTo(record::getCreateUserId)
.set(createTime).equalTo(record::getCreateTime)
.set(updateUserId).equalTo(record::getUpdateUserId)
.set(updateTime).equalTo(record::getUpdateTime)
.where(id, isEqualTo(record::getId))
);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default int updateByPrimaryKeySelective(BookCategory record) {
return update(c ->
c.set(workDirection).equalToWhenPresent(record::getWorkDirection)
.set(name).equalToWhenPresent(record::getName)
.set(sort).equalToWhenPresent(record::getSort)
.set(createUserId).equalToWhenPresent(record::getCreateUserId)
.set(createTime).equalToWhenPresent(record::getCreateTime)
.set(updateUserId).equalToWhenPresent(record::getUpdateUserId)
.set(updateTime).equalToWhenPresent(record::getUpdateTime)
.where(id, isEqualTo(record::getId))
);
}
}

View File

@ -0,0 +1,54 @@
package com.java2nb.novel.mapper;
import java.sql.JDBCType;
import java.util.Date;
import javax.annotation.Generated;
import org.mybatis.dynamic.sql.SqlColumn;
import org.mybatis.dynamic.sql.SqlTable;
public final class BookCommentDynamicSqlSupport {
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final BookComment bookComment = new BookComment();
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<Long> id = bookComment.id;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<Long> bookId = bookComment.bookId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<String> commentContent = bookComment.commentContent;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<Integer> replyCount = bookComment.replyCount;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<Byte> auditStatus = bookComment.auditStatus;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<Date> createTime = bookComment.createTime;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<Long> createUserId = bookComment.createUserId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final class BookComment extends SqlTable {
public final SqlColumn<Long> id = column("id", JDBCType.BIGINT);
public final SqlColumn<Long> bookId = column("book_id", JDBCType.BIGINT);
public final SqlColumn<String> commentContent = column("comment_content", JDBCType.VARCHAR);
public final SqlColumn<Integer> replyCount = column("reply_count", JDBCType.INTEGER);
public final SqlColumn<Byte> auditStatus = column("audit_status", JDBCType.TINYINT);
public final SqlColumn<Date> createTime = column("create_time", JDBCType.TIMESTAMP);
public final SqlColumn<Long> createUserId = column("create_user_id", JDBCType.BIGINT);
public BookComment() {
super("book_comment");
}
}
}

View File

@ -0,0 +1,203 @@
package com.java2nb.novel.mapper;
import com.java2nb.novel.entity.BookComment;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;
import org.mybatis.dynamic.sql.BasicColumn;
import org.mybatis.dynamic.sql.delete.DeleteDSLCompleter;
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
import org.mybatis.dynamic.sql.insert.render.InsertStatementProvider;
import org.mybatis.dynamic.sql.insert.render.MultiRowInsertStatementProvider;
import org.mybatis.dynamic.sql.select.CountDSLCompleter;
import org.mybatis.dynamic.sql.select.SelectDSLCompleter;
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
import org.mybatis.dynamic.sql.update.UpdateDSL;
import org.mybatis.dynamic.sql.update.UpdateDSLCompleter;
import org.mybatis.dynamic.sql.update.UpdateModel;
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
import org.mybatis.dynamic.sql.util.mybatis3.MyBatis3Utils;
import javax.annotation.Generated;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import static com.java2nb.novel.mapper.BookCommentDynamicSqlSupport.*;
import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo;
@Mapper
public interface BookCommentMapper {
@Generated("org.mybatis.generator.api.MyBatisGenerator")
BasicColumn[] selectList = BasicColumn.columnList(id, bookId, commentContent, replyCount, auditStatus, createTime, createUserId);
@Generated("org.mybatis.generator.api.MyBatisGenerator")
@SelectProvider(type=SqlProviderAdapter.class, method="select")
long count(SelectStatementProvider selectStatement);
@Generated("org.mybatis.generator.api.MyBatisGenerator")
@DeleteProvider(type=SqlProviderAdapter.class, method="delete")
int delete(DeleteStatementProvider deleteStatement);
@Generated("org.mybatis.generator.api.MyBatisGenerator")
@InsertProvider(type=SqlProviderAdapter.class, method="insert")
int insert(InsertStatementProvider<BookComment> insertStatement);
@Generated("org.mybatis.generator.api.MyBatisGenerator")
@InsertProvider(type=SqlProviderAdapter.class, method="insertMultiple")
int insertMultiple(MultiRowInsertStatementProvider<BookComment> multipleInsertStatement);
@Generated("org.mybatis.generator.api.MyBatisGenerator")
@SelectProvider(type=SqlProviderAdapter.class, method="select")
@ResultMap("BookCommentResult")
Optional<BookComment> selectOne(SelectStatementProvider selectStatement);
@Generated("org.mybatis.generator.api.MyBatisGenerator")
@SelectProvider(type=SqlProviderAdapter.class, method="select")
@Results(id="BookCommentResult", value = {
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="book_id", property="bookId", jdbcType=JdbcType.BIGINT),
@Result(column="comment_content", property="commentContent", jdbcType=JdbcType.VARCHAR),
@Result(column="reply_count", property="replyCount", jdbcType=JdbcType.INTEGER),
@Result(column="audit_status", property="auditStatus", jdbcType=JdbcType.TINYINT),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="create_user_id", property="createUserId", jdbcType=JdbcType.BIGINT)
})
List<BookComment> selectMany(SelectStatementProvider selectStatement);
@Generated("org.mybatis.generator.api.MyBatisGenerator")
@UpdateProvider(type=SqlProviderAdapter.class, method="update")
int update(UpdateStatementProvider updateStatement);
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default long count(CountDSLCompleter completer) {
return MyBatis3Utils.countFrom(this::count, bookComment, completer);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default int delete(DeleteDSLCompleter completer) {
return MyBatis3Utils.deleteFrom(this::delete, bookComment, completer);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default int deleteByPrimaryKey(Long id_) {
return delete(c ->
c.where(id, isEqualTo(id_))
);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default int insert(BookComment record) {
return MyBatis3Utils.insert(this::insert, record, bookComment, c ->
c.map(id).toProperty("id")
.map(bookId).toProperty("bookId")
.map(commentContent).toProperty("commentContent")
.map(replyCount).toProperty("replyCount")
.map(auditStatus).toProperty("auditStatus")
.map(createTime).toProperty("createTime")
.map(createUserId).toProperty("createUserId")
);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default int insertMultiple(Collection<BookComment> records) {
return MyBatis3Utils.insertMultiple(this::insertMultiple, records, bookComment, c ->
c.map(id).toProperty("id")
.map(bookId).toProperty("bookId")
.map(commentContent).toProperty("commentContent")
.map(replyCount).toProperty("replyCount")
.map(auditStatus).toProperty("auditStatus")
.map(createTime).toProperty("createTime")
.map(createUserId).toProperty("createUserId")
);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default int insertSelective(BookComment record) {
return MyBatis3Utils.insert(this::insert, record, bookComment, c ->
c.map(id).toPropertyWhenPresent("id", record::getId)
.map(bookId).toPropertyWhenPresent("bookId", record::getBookId)
.map(commentContent).toPropertyWhenPresent("commentContent", record::getCommentContent)
.map(replyCount).toPropertyWhenPresent("replyCount", record::getReplyCount)
.map(auditStatus).toPropertyWhenPresent("auditStatus", record::getAuditStatus)
.map(createTime).toPropertyWhenPresent("createTime", record::getCreateTime)
.map(createUserId).toPropertyWhenPresent("createUserId", record::getCreateUserId)
);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default Optional<BookComment> selectOne(SelectDSLCompleter completer) {
return MyBatis3Utils.selectOne(this::selectOne, selectList, bookComment, completer);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default List<BookComment> select(SelectDSLCompleter completer) {
return MyBatis3Utils.selectList(this::selectMany, selectList, bookComment, completer);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default List<BookComment> selectDistinct(SelectDSLCompleter completer) {
return MyBatis3Utils.selectDistinct(this::selectMany, selectList, bookComment, completer);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default Optional<BookComment> selectByPrimaryKey(Long id_) {
return selectOne(c ->
c.where(id, isEqualTo(id_))
);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default int update(UpdateDSLCompleter completer) {
return MyBatis3Utils.update(this::update, bookComment, completer);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
static UpdateDSL<UpdateModel> updateAllColumns(BookComment record, UpdateDSL<UpdateModel> dsl) {
return dsl.set(id).equalTo(record::getId)
.set(bookId).equalTo(record::getBookId)
.set(commentContent).equalTo(record::getCommentContent)
.set(replyCount).equalTo(record::getReplyCount)
.set(auditStatus).equalTo(record::getAuditStatus)
.set(createTime).equalTo(record::getCreateTime)
.set(createUserId).equalTo(record::getCreateUserId);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
static UpdateDSL<UpdateModel> updateSelectiveColumns(BookComment record, UpdateDSL<UpdateModel> dsl) {
return dsl.set(id).equalToWhenPresent(record::getId)
.set(bookId).equalToWhenPresent(record::getBookId)
.set(commentContent).equalToWhenPresent(record::getCommentContent)
.set(replyCount).equalToWhenPresent(record::getReplyCount)
.set(auditStatus).equalToWhenPresent(record::getAuditStatus)
.set(createTime).equalToWhenPresent(record::getCreateTime)
.set(createUserId).equalToWhenPresent(record::getCreateUserId);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default int updateByPrimaryKey(BookComment record) {
return update(c ->
c.set(bookId).equalTo(record::getBookId)
.set(commentContent).equalTo(record::getCommentContent)
.set(replyCount).equalTo(record::getReplyCount)
.set(auditStatus).equalTo(record::getAuditStatus)
.set(createTime).equalTo(record::getCreateTime)
.set(createUserId).equalTo(record::getCreateUserId)
.where(id, isEqualTo(record::getId))
);
}
@Generated("org.mybatis.generator.api.MyBatisGenerator")
default int updateByPrimaryKeySelective(BookComment record) {
return update(c ->
c.set(bookId).equalToWhenPresent(record::getBookId)
.set(commentContent).equalToWhenPresent(record::getCommentContent)
.set(replyCount).equalToWhenPresent(record::getReplyCount)
.set(auditStatus).equalToWhenPresent(record::getAuditStatus)
.set(createTime).equalToWhenPresent(record::getCreateTime)
.set(createUserId).equalToWhenPresent(record::getCreateUserId)
.where(id, isEqualTo(record::getId))
);
}
}

View File

@ -0,0 +1,33 @@
package com.java2nb.novel.mapper;
import java.sql.JDBCType;
import javax.annotation.Generated;
import org.mybatis.dynamic.sql.SqlColumn;
import org.mybatis.dynamic.sql.SqlTable;
public final class BookContentDynamicSqlSupport {
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final BookContent bookContent = new BookContent();
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<Long> id = bookContent.id;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<Long> indexId = bookContent.indexId;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final SqlColumn<String> content = bookContent.content;
@Generated("org.mybatis.generator.api.MyBatisGenerator")
public static final class BookContent extends SqlTable {
public final SqlColumn<Long> id = column("id", JDBCType.BIGINT);
public final SqlColumn<Long> indexId = column("index_id", JDBCType.BIGINT);
public final SqlColumn<String> content = column("content", JDBCType.LONGVARCHAR);
public BookContent() {
super("book_content");
}
}
}

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