Compare commits

...

75 Commits

Author SHA1 Message Date
dependabot[bot]
30d9a29b7b build(deps): bump h2 from 2.0.206 to 2.1.214
Bumps [h2](https://github.com/h2database/h2database) from 2.0.206 to 2.1.214.
- [Release notes](https://github.com/h2database/h2database/releases)
- [Commits](https://github.com/h2database/h2database/compare/version-2.0.206...version-2.1.214)

---
updated-dependencies:
- dependency-name: com.h2database:h2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-02 12:43:54 +00:00
禾几海
c8e93c45c7 Merge pull request #74 from xiaohai2271/dependabot/maven/com.alibaba-druid-1.2.6
build(deps): bump druid from 1.2.5 to 1.2.6
2021-06-02 10:57:25 +08:00
禾几海
32de31a21e Merge pull request #75 from xiaohai2271/dependabot/maven/org.mybatis.spring.boot-mybatis-spring-boot-starter-2.2.0
build(deps): bump mybatis-spring-boot-starter from 2.1.4 to 2.2.0
2021-06-02 10:57:04 +08:00
禾几海
cc20df91e6 Merge pull request #63 from xiaohai2271/dependabot/maven/org.projectlombok-lombok-1.18.20
build(deps): bump lombok from 1.18.18 to 1.18.20
2021-06-01 23:30:23 +08:00
dependabot[bot]
71d79ed008 build(deps): bump mybatis-spring-boot-starter from 2.1.4 to 2.2.0
Bumps [mybatis-spring-boot-starter](https://github.com/mybatis/spring-boot-starter) from 2.1.4 to 2.2.0.
- [Release notes](https://github.com/mybatis/spring-boot-starter/releases)
- [Commits](https://github.com/mybatis/spring-boot-starter/compare/mybatis-spring-boot-2.1.4...mybatis-spring-boot-2.2.0)

---
updated-dependencies:
- dependency-name: org.mybatis.spring.boot:mybatis-spring-boot-starter
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-01 15:30:00 +00:00
dependabot[bot]
f7ff494ea4 build(deps): bump druid from 1.2.5 to 1.2.6
Bumps [druid](https://github.com/alibaba/druid) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/alibaba/druid/releases)
- [Commits](https://github.com/alibaba/druid/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: com.alibaba:druid
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-01 15:29:55 +00:00
禾几海
971f48c5f9 Merge pull request #72 from xiaohai2271/dependabot/maven/org.jetbrains.kotlin-kotlin-maven-plugin-1.5.10
build(deps): bump kotlin-maven-plugin from 1.4.10 to 1.5.10
2021-06-01 23:29:54 +08:00
禾几海
e1522a8cc1 Merge pull request #73 from xiaohai2271/dependabot/maven/net.minidev-json-smart-2.4.7
build(deps): bump json-smart from 2.3 to 2.4.7
2021-06-01 23:29:32 +08:00
dependabot[bot]
3cc4989960 build(deps): bump json-smart from 2.3 to 2.4.7
Bumps [json-smart](https://github.com/netplex/json-smart-v2) from 2.3 to 2.4.7.
- [Release notes](https://github.com/netplex/json-smart-v2/releases)
- [Commits](https://github.com/netplex/json-smart-v2/commits)

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-01 05:22:45 +00:00
dependabot[bot]
8c751e6e76 build(deps): bump kotlin-maven-plugin from 1.4.10 to 1.5.10
Bumps kotlin-maven-plugin from 1.4.10 to 1.5.10.

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-01 05:22:39 +00:00
dependabot[bot]
af47631126 build(deps): bump lombok from 1.18.18 to 1.18.20
Bumps [lombok](https://github.com/rzwitserloot/lombok) from 1.18.18 to 1.18.20.
- [Release notes](https://github.com/rzwitserloot/lombok/releases)
- [Changelog](https://github.com/projectlombok/lombok/blob/master/doc/changelog.markdown)
- [Commits](https://github.com/rzwitserloot/lombok/compare/v1.18.18...v1.18.20)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-01 05:24:17 +00:00
禾几海
2107a1c100 Merge pull request #49 from xiaohai2271/dependabot/maven/com.squareup.okhttp3-okhttp-4.9.1
build(deps): bump okhttp from 4.9.0 to 4.9.1
2021-04-01 14:14:35 +08:00
禾几海
2eac16dbe4 Merge pull request #52 from xiaohai2271/dependabot/maven/com.alibaba-druid-1.2.5
build(deps): bump druid from 1.2.3 to 1.2.5
2021-04-01 14:12:39 +08:00
禾几海
d248e15cea fix: 规范请求头的token
规范为` Authorization: Bearer $token`
2021-03-16 20:09:06 +08:00
禾几海
91a818d293 fix: sql条件错误 2021-03-16 15:54:26 +08:00
禾几海
65c31e96b4 test: 补增单元测试 2021-03-16 15:45:49 +08:00
禾几海
81b4851e42 refactor: 分页查询
通过数据库进行分页查询而非查询全部然后分页
2021-03-16 15:38:49 +08:00
禾几海
9c580cf6d9 fix: 文章不可见
当open字段为false时文章应当不被感知
而之前的版本并没有做强制要求
2021-03-16 15:30:05 +08:00
禾几海
9eea5b3db9 ci: Sync repository to gitee 2021-03-15 22:12:49 +08:00
禾几海
eacb2e29f3 fix: 修复数据异常 2021-03-15 18:51:53 +08:00
禾几海
fafee4f918 fix: 分页数据异常 2021-03-15 17:31:37 +08:00
dependabot[bot]
30a4c11366 build(deps): bump druid from 1.2.3 to 1.2.5
Bumps [druid](https://github.com/alibaba/druid) from 1.2.3 to 1.2.5.
- [Release notes](https://github.com/alibaba/druid/releases)
- [Commits](https://github.com/alibaba/druid/compare/1.2.3...1.2.5)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-01 05:31:55 +00:00
禾几海
5632d47674 Merge pull request #48 from xiaohai2271/dependabot/maven/org.projectlombok-lombok-1.18.18
build(deps): bump lombok from 1.18.16 to 1.18.18
2021-02-28 22:24:55 +08:00
dependabot[bot]
15b5d89554 build(deps): bump okhttp from 4.9.0 to 4.9.1
Bumps [okhttp](https://github.com/square/okhttp) from 4.9.0 to 4.9.1.
- [Release notes](https://github.com/square/okhttp/releases)
- [Changelog](https://github.com/square/okhttp/blob/master/CHANGELOG.md)
- [Commits](https://github.com/square/okhttp/compare/parent-4.9.0...parent-4.9.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-02-01 05:28:43 +00:00
dependabot[bot]
79426dbe24 build(deps): bump lombok from 1.18.16 to 1.18.18
Bumps [lombok](https://github.com/rzwitserloot/lombok) from 1.18.16 to 1.18.18.
- [Release notes](https://github.com/rzwitserloot/lombok/releases)
- [Changelog](https://github.com/rzwitserloot/lombok/blob/master/doc/changelog.markdown)
- [Commits](https://github.com/rzwitserloot/lombok/compare/v1.18.16...v1.18.18)

Signed-off-by: dependabot[bot] <support@github.com>
2021-02-01 05:28:40 +00:00
禾几海
b3b19dbc45 Merge pull request #38 from xiaohai2271/dependabot/maven/net.sourceforge.htmlunit-htmlunit-2.45.0
build(deps): bump htmlunit from 2.44.0 to 2.45.0
2020-12-02 11:00:34 +08:00
禾几海
87ec6d24ca Merge pull request #37 from xiaohai2271/dependabot/maven/org.mybatis.spring.boot-mybatis-spring-boot-starter-2.1.4
build(deps): bump mybatis-spring-boot-starter from 2.1.3 to 2.1.4
2020-12-01 14:08:15 +08:00
禾几海
0148c5e3f5 Merge pull request #39 from xiaohai2271/dependabot/maven/com.alibaba-druid-1.2.3
build(deps): bump druid from 1.2.1 to 1.2.3
2020-12-01 14:04:58 +08:00
禾几海
7cff3b9c08 Merge pull request #40 from xiaohai2271/dependabot/maven/com.sun.xml.bind-jaxb-impl-3.0.0
build(deps): bump jaxb-impl from 2.3.3 to 3.0.0
2020-12-01 14:02:35 +08:00
禾几海
a354f48edf Merge pull request #41 from xiaohai2271/dependabot/maven/org.jetbrains.kotlin-kotlin-stdlib-1.4.20
build(deps): bump kotlin-stdlib from 1.4.10 to 1.4.20
2020-12-01 14:02:02 +08:00
dependabot[bot]
2cd2dc93d7 build(deps): bump kotlin-stdlib from 1.4.10 to 1.4.20
Bumps [kotlin-stdlib](https://github.com/JetBrains/kotlin) from 1.4.10 to 1.4.20.
- [Release notes](https://github.com/JetBrains/kotlin/releases)
- [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md)
- [Commits](https://github.com/JetBrains/kotlin/compare/v1.4.10...v1.4.20)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-01 05:39:35 +00:00
dependabot[bot]
d5fbc0fbf1 build(deps): bump jaxb-impl from 2.3.3 to 3.0.0
Bumps jaxb-impl from 2.3.3 to 3.0.0.

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-01 05:39:09 +00:00
dependabot[bot]
b29362eb8c build(deps): bump druid from 1.2.1 to 1.2.3
Bumps [druid](https://github.com/alibaba/druid) from 1.2.1 to 1.2.3.
- [Release notes](https://github.com/alibaba/druid/releases)
- [Commits](https://github.com/alibaba/druid/compare/1.2.1...1.2.3)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-01 05:39:07 +00:00
dependabot[bot]
d7c6cca683 build(deps): bump htmlunit from 2.44.0 to 2.45.0
Bumps [htmlunit](https://github.com/HtmlUnit/htmlunit) from 2.44.0 to 2.45.0.
- [Release notes](https://github.com/HtmlUnit/htmlunit/releases)
- [Commits](https://github.com/HtmlUnit/htmlunit/compare/2.44.0...2.45.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-01 05:39:03 +00:00
dependabot[bot]
8020eaeff3 build(deps): bump mybatis-spring-boot-starter from 2.1.3 to 2.1.4
Bumps [mybatis-spring-boot-starter](https://github.com/mybatis/spring-boot-starter) from 2.1.3 to 2.1.4.
- [Release notes](https://github.com/mybatis/spring-boot-starter/releases)
- [Commits](https://github.com/mybatis/spring-boot-starter/compare/mybatis-spring-boot-2.1.3...mybatis-spring-boot-2.1.4)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-01 05:39:02 +00:00
禾几海
aedcaf207b ci: skip ci action situation
[skip ci]
2020-11-14 21:38:58 +08:00
禾几海
af9bf9ef46 ci: skip ci action situation 2020-11-14 21:27:44 +08:00
禾几海
b38ce4c8ce Update dependabot.yml 2020-11-02 15:04:20 +08:00
禾几海
3d3548b984 Merge pull request #27 from xiaohai2271/dependabot/maven/com.youbenzi-MDTool-1.2.4
build(deps): bump MDTool from 1.2.3 to 1.2.4
2020-11-01 19:12:55 +08:00
禾几海
4be9eda566 Merge pull request #28 from xiaohai2271/dependabot/maven/com.dyuproject.protostuff-protostuff-runtime-1.1.6
build(deps): bump protostuff-runtime from 1.0.8 to 1.1.6
2020-11-01 19:12:14 +08:00
禾几海
e5711746fb Merge pull request #29 from xiaohai2271/dependabot/maven/org.mybatis.spring.boot-mybatis-spring-boot-starter-2.1.3
build(deps): bump mybatis-spring-boot-starter from 2.0.1 to 2.1.3
2020-11-01 19:11:36 +08:00
禾几海
cc9cf8b1e8 Merge pull request #31 from xiaohai2271/dependabot/maven/com.alibaba-druid-1.2.1
build(deps): bump druid from 1.1.14 to 1.2.1
2020-10-27 13:22:10 +08:00
禾几海
ff076f8366 Merge pull request #32 from xiaohai2271/dependabot/maven/com.squareup.okhttp3-okhttp-4.9.0
build(deps): bump okhttp from 4.8.0 to 4.9.0
2020-10-27 13:17:27 +08:00
禾几海
dd9ae0b3f9 Merge pull request #30 from xiaohai2271/dependabot/maven/eu.bitwalker-UserAgentUtils-1.21
build(deps): bump UserAgentUtils from 1.20 to 1.21
2020-10-22 22:37:46 +08:00
dependabot[bot]
0e7d5f2d23 build(deps): bump okhttp from 4.8.0 to 4.9.0
Bumps [okhttp](https://github.com/square/okhttp) from 4.8.0 to 4.9.0.
- [Release notes](https://github.com/square/okhttp/releases)
- [Changelog](https://github.com/square/okhttp/blob/master/CHANGELOG.md)
- [Commits](https://github.com/square/okhttp/compare/parent-4.8.0...parent-4.9.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-20 16:17:29 +00:00
dependabot[bot]
1de1af2a54 build(deps): bump druid from 1.1.14 to 1.2.1
Bumps [druid](https://github.com/alibaba/druid) from 1.1.14 to 1.2.1.
- [Release notes](https://github.com/alibaba/druid/releases)
- [Commits](https://github.com/alibaba/druid/compare/1.1.14...1.2.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-20 16:17:25 +00:00
dependabot[bot]
857a3d9473 build(deps): bump UserAgentUtils from 1.20 to 1.21
Bumps [UserAgentUtils](https://github.com/HaraldWalker/user-agent-utils) from 1.20 to 1.21.
- [Release notes](https://github.com/HaraldWalker/user-agent-utils/releases)
- [Commits](https://github.com/HaraldWalker/user-agent-utils/compare/1.20...1.21)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-20 16:17:24 +00:00
dependabot[bot]
78efa62476 build(deps): bump protostuff-runtime from 1.0.8 to 1.1.6
Bumps protostuff-runtime from 1.0.8 to 1.1.6.

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-20 16:17:22 +00:00
dependabot[bot]
674812c5c6 build(deps): bump mybatis-spring-boot-starter from 2.0.1 to 2.1.3
Bumps [mybatis-spring-boot-starter](https://github.com/mybatis/spring-boot-starter) from 2.0.1 to 2.1.3.
- [Release notes](https://github.com/mybatis/spring-boot-starter/releases)
- [Commits](https://github.com/mybatis/spring-boot-starter/compare/mybatis-spring-boot-2.0.1...mybatis-spring-boot-2.1.3)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-20 16:17:22 +00:00
dependabot[bot]
14ce46c312 build(deps): bump MDTool from 1.2.3 to 1.2.4
Bumps [MDTool](https://github.com/cevin15/MDTool) from 1.2.3 to 1.2.4.
- [Release notes](https://github.com/cevin15/MDTool/releases)
- [Commits](https://github.com/cevin15/MDTool/commits)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-20 16:17:21 +00:00
禾几海
5f5fbadfd8 Merge pull request #15 from xiaohai2271/dependabot/maven/com.sun.xml.bind-jaxb-core-2.3.0.1
build(deps): bump jaxb-core from 2.3.0 to 2.3.0.1
2020-10-21 00:11:48 +08:00
禾几海
c153d9a0e3 Merge pull request #16 from xiaohai2271/dependabot/maven/org.jetbrains.kotlin-kotlin-maven-plugin-1.4.10
build(deps): bump kotlin-maven-plugin from 1.3.72 to 1.4.10
2020-10-21 00:11:25 +08:00
禾几海
18d35809f5 Merge pull request #17 from xiaohai2271/dependabot/maven/com.sun.xml.bind-jaxb-impl-2.3.3
build(deps): bump jaxb-impl from 2.3.0 to 2.3.3
2020-10-21 00:11:00 +08:00
禾几海
75e2424f75 Merge pull request #22 from xiaohai2271/dependabot/maven/javax.xml.bind-jaxb-api-2.3.1
build(deps): bump jaxb-api from 2.3.0 to 2.3.1
2020-10-21 00:10:24 +08:00
禾几海
b6c4251198 Merge pull request #21 from xiaohai2271/dependabot/maven/com.github.pagehelper-pagehelper-spring-boot-starter-1.3.0
build(deps): bump pagehelper-spring-boot-starter from 1.2.12 to 1.3.0
2020-10-21 00:08:04 +08:00
禾几海
fc1bfa0e4f Merge pull request #19 from xiaohai2271/dependabot/maven/org.jetbrains.kotlin-kotlin-stdlib-1.4.10
build(deps): bump kotlin-stdlib from 1.3.72 to 1.4.10
2020-10-21 00:07:25 +08:00
禾几海
e37de0e177 Merge pull request #20 from xiaohai2271/dependabot/maven/com.dyuproject.protostuff-protostuff-core-1.1.6
build(deps): bump protostuff-core from 1.0.8 to 1.1.6
2020-10-21 00:06:58 +08:00
dependabot[bot]
082662af66 build(deps): bump protostuff-core from 1.0.8 to 1.1.6
Bumps protostuff-core from 1.0.8 to 1.1.6.

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-20 15:11:14 +00:00
dependabot[bot]
0c0e2404d0 Merge pull request #26 from xiaohai2271/dependabot/maven/org.projectlombok-lombok-1.18.16 2020-10-20 14:59:05 +00:00
dependabot[bot]
71f82bfe32 build(deps): bump lombok from 1.18.6 to 1.18.16
Bumps [lombok](https://github.com/rzwitserloot/lombok) from 1.18.6 to 1.18.16.
- [Release notes](https://github.com/rzwitserloot/lombok/releases)
- [Changelog](https://github.com/rzwitserloot/lombok/blob/master/doc/changelog.markdown)
- [Commits](https://github.com/rzwitserloot/lombok/compare/v1.18.6...v1.18.16)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-20 07:06:17 +00:00
禾几海
61ce2fddad Merge pull request #24 from xiaohai2271/dependabot/maven/net.sourceforge.htmlunit-htmlunit-2.44.0
build(deps): bump htmlunit from 2.42.0 to 2.44.0
2020-10-20 13:03:25 +08:00
禾几海
a245f259f7 revert: "Update test.yml"
This reverts commit 2c85c3ea
2020-10-17 23:28:58 +08:00
禾几海
aa22369b13 Merge pull request #25 from kingzhongking/master
style(pom):  delete some comment
2020-10-17 22:51:00 +08:00
kingzhongking
8c3866afe6 style(pom): delete some comment 2020-10-17 14:44:29 +00:00
禾几海
2c85c3eaac Update test.yml 2020-10-16 19:32:36 +08:00
dependabot[bot]
2559937e02 build(deps): bump htmlunit from 2.42.0 to 2.44.0
Bumps [htmlunit](https://github.com/HtmlUnit/htmlunit) from 2.42.0 to 2.44.0.
- [Release notes](https://github.com/HtmlUnit/htmlunit/releases)
- [Commits](https://github.com/HtmlUnit/htmlunit/compare/2.42.0...2.44.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-16 11:21:27 +00:00
dependabot[bot]
8de4be602e build(deps): bump jaxb-api from 2.3.0 to 2.3.1
Bumps [jaxb-api](https://github.com/javaee/jaxb-spec) from 2.3.0 to 2.3.1.
- [Release notes](https://github.com/javaee/jaxb-spec/releases)
- [Commits](https://github.com/javaee/jaxb-spec/compare/2.3.0...2.3.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-16 11:21:23 +00:00
dependabot[bot]
1f88995884 build(deps): bump pagehelper-spring-boot-starter from 1.2.12 to 1.3.0
Bumps pagehelper-spring-boot-starter from 1.2.12 to 1.3.0.

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-16 11:21:23 +00:00
禾几海
c879fbff5f Update dependabot.yml 2020-10-16 19:21:00 +08:00
dependabot[bot]
f6020bf8d0 build(deps): bump kotlin-stdlib from 1.3.72 to 1.4.10
Bumps [kotlin-stdlib](https://github.com/JetBrains/kotlin) from 1.3.72 to 1.4.10.
- [Release notes](https://github.com/JetBrains/kotlin/releases)
- [Changelog](https://github.com/JetBrains/kotlin/blob/v1.4.10/ChangeLog.md)
- [Commits](https://github.com/JetBrains/kotlin/compare/v1.3.72...v1.4.10)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-16 11:09:51 +00:00
dependabot[bot]
418b1d78e5 build(deps): bump jaxb-impl from 2.3.0 to 2.3.3
Bumps jaxb-impl from 2.3.0 to 2.3.3.

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-16 11:09:20 +00:00
dependabot[bot]
98ed489bb1 build(deps): bump kotlin-maven-plugin from 1.3.72 to 1.4.10
Bumps kotlin-maven-plugin from 1.3.72 to 1.4.10.

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-16 11:09:19 +00:00
dependabot[bot]
cfdd818829 build(deps): bump jaxb-core from 2.3.0 to 2.3.0.1
Bumps jaxb-core from 2.3.0 to 2.3.0.1.

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-16 11:09:18 +00:00
禾几海
3afbef009f Create dependabot.yml 2020-10-16 19:08:56 +08:00
禾几海
8f4d1cd6c8 Update issue templates 2020-10-15 16:46:31 +08:00
13 changed files with 369 additions and 218 deletions

View File

@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

12
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "maven" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "monthly"
open-pull-requests-limit: 10

View File

@@ -10,7 +10,7 @@ on:
jobs: jobs:
build: build:
if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '.md')" # 如果 commit 信息包含以下关键字则跳过该任务
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
KEY: ${{ secrets.WEB_HOOK_ACCESS_KEY }} KEY: ${{ secrets.WEB_HOOK_ACCESS_KEY }}
@@ -22,5 +22,16 @@ jobs:
with: with:
java-version: 1.8 java-version: 1.8
- name: Sync repository
uses: x-dr/sync-repo-to-gitee@v1.0
env:
# 在 Settings->Secrets 配置 GITEE_KEY
SSH_KEY: ${{ secrets.GITEE_KEY }}
with:
# GitHub存储库的SSH URL.
github-repo: git@github.com:xiaohai2271/blog-backEnd.git
# Gitee存储库的SSH URL.
gitee-repo: git@gitee.com:xiaohai2271/blog-backEnd.git
- name: Deploy - name: Deploy
run: mvn -B test --file pom.xml && curl http://bt.celess.cn:2271/hook?access_key=$KEY run: mvn -B test --file pom.xml && curl http://bt.celess.cn:2271/hook?access_key=$KEY

View File

@@ -10,7 +10,7 @@ on:
jobs: jobs:
build: build:
if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '.md')" # 如果 commit 信息包含以下关键字则跳过该任务
runs-on: ubuntu-latest runs-on: ubuntu-latest
# env: # env:
# APPLICATION_PROPERTIES_TEST: ${{ secrets.APPLICATION_PROPERTIES_TEST }} # APPLICATION_PROPERTIES_TEST: ${{ secrets.APPLICATION_PROPERTIES_TEST }}

36
pom.xml
View File

@@ -6,7 +6,7 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.3.RELEASE</version> <version>2.1.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository --> <relativePath/>
</parent> </parent>
<groupId>cn.celess</groupId> <groupId>cn.celess</groupId>
<artifactId>blog</artifactId> <artifactId>blog</artifactId>
@@ -40,14 +40,14 @@
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
<artifactId>druid</artifactId> <artifactId>druid</artifactId>
<version>1.1.14</version> <version>1.2.6</version>
</dependency> </dependency>
<!-- lombok --> <!-- lombok -->
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
<version>1.18.6</version> <version>1.18.20</version>
</dependency> </dependency>
@@ -67,12 +67,12 @@
<dependency> <dependency>
<groupId>com.youbenzi</groupId> <groupId>com.youbenzi</groupId>
<artifactId>MDTool</artifactId> <artifactId>MDTool</artifactId>
<version>1.2.3</version> <version>1.2.4</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.minidev</groupId> <groupId>net.minidev</groupId>
<artifactId>json-smart</artifactId> <artifactId>json-smart</artifactId>
<version>2.3</version> <version>2.4.7</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
@@ -99,33 +99,33 @@
<dependency> <dependency>
<groupId>org.mybatis.spring.boot</groupId> <groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId> <artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.0.1</version> <version>2.2.0</version>
</dependency> </dependency>
<!-- pageHelper --> <!-- pageHelper -->
<dependency> <dependency>
<groupId>com.github.pagehelper</groupId> <groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId> <artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.12</version> <version>1.3.0</version>
</dependency> </dependency>
<!-- protostuff序列化依赖 --> <!-- protostuff序列化依赖 -->
<dependency> <dependency>
<groupId>com.dyuproject.protostuff</groupId> <groupId>com.dyuproject.protostuff</groupId>
<artifactId>protostuff-core</artifactId> <artifactId>protostuff-core</artifactId>
<version>1.0.8</version> <version>1.1.6</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.dyuproject.protostuff</groupId> <groupId>com.dyuproject.protostuff</groupId>
<artifactId>protostuff-runtime</artifactId> <artifactId>protostuff-runtime</artifactId>
<version>1.0.8</version> <version>1.1.6</version>
</dependency> </dependency>
<!-- Ua解析--> <!-- Ua解析-->
<dependency> <dependency>
<groupId>eu.bitwalker</groupId> <groupId>eu.bitwalker</groupId>
<artifactId>UserAgentUtils</artifactId> <artifactId>UserAgentUtils</artifactId>
<version>1.20</version> <version>1.21</version>
</dependency> </dependency>
<dependency> <dependency>
@@ -145,12 +145,12 @@
<dependency> <dependency>
<groupId>com.squareup.okhttp3</groupId> <groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId> <artifactId>okhttp</artifactId>
<version>4.8.0</version> <version>4.9.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.jetbrains.kotlin</groupId> <groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId> <artifactId>kotlin-stdlib</artifactId>
<version>1.3.72</version> <version>1.4.20</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
@@ -158,14 +158,14 @@
<dependency> <dependency>
<groupId>net.sourceforge.htmlunit</groupId> <groupId>net.sourceforge.htmlunit</groupId>
<artifactId>htmlunit</artifactId> <artifactId>htmlunit</artifactId>
<version>2.42.0</version> <version>2.45.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.h2database</groupId> <groupId>com.h2database</groupId>
<artifactId>h2</artifactId> <artifactId>h2</artifactId>
<version>1.4.200</version> <version>2.1.214</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.github.kstyrc</groupId> <groupId>com.github.kstyrc</groupId>
@@ -178,17 +178,17 @@
<dependency> <dependency>
<groupId>javax.xml.bind</groupId> <groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId> <artifactId>jaxb-api</artifactId>
<version>2.3.0</version> <version>2.3.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.sun.xml.bind</groupId> <groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId> <artifactId>jaxb-impl</artifactId>
<version>2.3.0</version> <version>3.0.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.sun.xml.bind</groupId> <groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId> <artifactId>jaxb-core</artifactId>
<version>2.3.0</version> <version>2.3.0.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax.activation</groupId> <groupId>javax.activation</groupId>
@@ -214,7 +214,7 @@
<plugin> <plugin>
<groupId>org.jetbrains.kotlin</groupId> <groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId> <artifactId>kotlin-maven-plugin</artifactId>
<version>1.3.72</version> <version>1.5.10</version>
<executions> <executions>
<execution> <execution>
<id>compile</id> <id>compile</id>

View File

@@ -1,6 +1,7 @@
package cn.celess.blog.mapper; package cn.celess.blog.mapper;
import cn.celess.blog.entity.ArticleTag; import cn.celess.blog.entity.ArticleTag;
import cn.celess.blog.entity.Tag;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@@ -27,6 +28,8 @@ public interface ArticleTagMapper {
List<ArticleTag> findAllByArticleId(Long articleId); List<ArticleTag> findAllByArticleId(Long articleId);
List<Tag> findTagByArticleId(Long articleId);
int deleteMultiById(List<ArticleTag> articleTags); int deleteMultiById(List<ArticleTag> articleTags);
List<ArticleTag> findArticleByTag(Long tagId); List<ArticleTag> findArticleByTag(Long tagId);

View File

@@ -279,21 +279,20 @@ public class ArticleServiceImpl implements ArticleService {
*/ */
@Override @Override
public PageData<ArticleModel> adminArticles(int count, int page, Boolean deleted) { public PageData<ArticleModel> adminArticles(int count, int page, Boolean deleted) {
PageHelper.startPage(page, count);
List<Article> articleList = articleMapper.findAll(); List<Article> articleList = articleMapper.findAll();
PageData<ArticleModel> pageData = new PageData<>(null, 0, count, page); PageData<ArticleModel> pageData = new PageData<>(new PageInfo<>(articleList));
List<Article> collect; List<Article> collect;
if (deleted != null) { if (deleted != null) {
collect = articleList.stream().filter(article -> article.isDeleted() == deleted).collect(Collectors.toList()); collect = articleList.stream().filter(article -> article.isDeleted() == deleted).collect(Collectors.toList());
} else { } else {
collect = articleList; collect = articleList;
} }
pageData.setTotal(collect.size());
List<ArticleModel> articleModels = collect.stream() List<ArticleModel> articleModels = collect.stream()
.peek(article -> article.setMdContent(null)) .peek(article -> article.setMdContent(null))
.map(ModalTrans::article) .map(ModalTrans::article)
.skip((page - 1) * count)
.limit(count)
.collect(Collectors.toList()); .collect(Collectors.toList());
pageData.setList(articleModels); pageData.setList(articleModels);

View File

@@ -30,6 +30,8 @@ public class JwtUtil {
*/ */
public static final long EXPIRATION_SHORT_TIME = 7200000; public static final long EXPIRATION_SHORT_TIME = 7200000;
private static final String CLAIM_KEY_USERNAME = "sub"; private static final String CLAIM_KEY_USERNAME = "sub";
private static final String BEARER_PREFIX_UPPER = "Bearer";
private static final String BEARER_PREFIX_LOWER = "bearer";
/** /**
* JWT 秘钥需自行设置不可泄露 * JWT 秘钥需自行设置不可泄露
*/ */
@@ -48,7 +50,7 @@ public class JwtUtil {
} }
public String updateTokenDate(String token) { public String updateTokenDate(String token) {
Claims claims = Jwts.parser().setSigningKey(SECRET).parseClaimsJws(token).getBody(); Claims claims = Jwts.parser().setSigningKey(SECRET).parseClaimsJws(getJwtString(token)).getBody();
return Jwts.builder() return Jwts.builder()
.setClaims(claims) .setClaims(claims)
.setExpiration(new Date(claims.getExpiration().getTime() + EXPIRATION_SHORT_TIME)) .setExpiration(new Date(claims.getExpiration().getTime() + EXPIRATION_SHORT_TIME))
@@ -60,7 +62,7 @@ public class JwtUtil {
* 获取token是否过期 * 获取token是否过期
*/ */
public Boolean isTokenExpired(String token) { public Boolean isTokenExpired(String token) {
Date expiration = getExpirationDateFromToken(token); Date expiration = getExpirationDateFromToken(getJwtString(token));
return expiration == null || expiration.before(new Date()); return expiration == null || expiration.before(new Date());
} }
@@ -68,7 +70,7 @@ public class JwtUtil {
* 根据token获取username * 根据token获取username
*/ */
public String getUsernameFromToken(String token) { public String getUsernameFromToken(String token) {
Claims claims = getClaimsFromToken(token); Claims claims = getClaimsFromToken(getJwtString(token));
return claims == null ? null : claims.getSubject(); return claims == null ? null : claims.getSubject();
} }
@@ -76,7 +78,7 @@ public class JwtUtil {
* 获取token的过期时间 * 获取token的过期时间
*/ */
public Date getExpirationDateFromToken(String token) { public Date getExpirationDateFromToken(String token) {
Claims claims = getClaimsFromToken(token); Claims claims = getClaimsFromToken(getJwtString(token));
return claims == null ? null : claims.getExpiration(); return claims == null ? null : claims.getExpiration();
} }
@@ -88,7 +90,7 @@ public class JwtUtil {
try { try {
claims = Jwts.parser() claims = Jwts.parser()
.setSigningKey(SECRET) .setSigningKey(SECRET)
.parseClaimsJws(token) .parseClaimsJws(getJwtString(token))
.getBody(); .getBody();
} catch (ExpiredJwtException e) { } catch (ExpiredJwtException e) {
log.info("JWT令牌过期"); log.info("JWT令牌过期");
@@ -107,4 +109,9 @@ public class JwtUtil {
return claims; return claims;
} }
private String getJwtString(String token) {
if (token == null) return token;
return token.replaceFirst(BEARER_PREFIX_UPPER, "").replace(BEARER_PREFIX_LOWER, "");
}
} }

View File

@@ -64,6 +64,14 @@
and article_tag.t_id = tag_category.t_id and article_tag.t_id = tag_category.t_id
</select> </select>
<select id="findTagByArticleId" resultMap="cn.celess.blog.mapper.TagMapper.tagResultMap">
select tag_category.*
from article_tag,
tag_category
where a_id = #{articleId}
and article_tag.t_id = tag_category.t_id
</select>
<select id="findOneById" resultMap="articleTagResultMap"> <select id="findOneById" resultMap="articleTagResultMap">
select * select *
from article_tag, from article_tag,
@@ -98,4 +106,4 @@
and article_tag.a_id = article.a_id and article_tag.a_id = article.a_id
</select> </select>
</mapper> </mapper>

View File

@@ -1,185 +1,242 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cn.celess.blog.mapper.ArticleMapper"> <mapper namespace="cn.celess.blog.mapper.ArticleMapper">
<resultMap id="articleResultMap" type="cn.celess.blog.entity.Article"> <resultMap id="articleResultMap" type="cn.celess.blog.entity.Article">
<id column="a_id" property="id"/> <id column="a_id" property="id"/>
<result column="a_title" property="title"/> <result column="a_title" property="title"/>
<result column="a_summary" property="summary"/> <result column="a_summary" property="summary"/>
<result column="a_md_content" property="mdContent"/> <result column="a_md_content" property="mdContent"/>
<result column="a_url" property="url"/> <result column="a_url" property="url"/>
<result column="a_author_id" property="user.id"/> <result column="a_author_id" property="user.id"/>
<result column="a_is_open" property="open"/> <result column="a_is_open" property="open"/>
<result column="a_is_original" property="type"/> <result column="a_is_original" property="type"/>
<!-- <result column="next_a_id" property="nextArticleId"/>--> <!-- <result column="next_a_id" property="nextArticleId"/>-->
<!-- <result column="pre_a_id" property="preArticleId"/>--> <!-- <result column="pre_a_id" property="preArticleId"/>-->
<result column="a_reading_number" property="readingNumber"/> <result column="a_reading_number" property="readingNumber"/>
<result column="a_publish_date" property="publishDate"/> <result column="a_publish_date" property="publishDate"/>
<result column="a_update_date" property="updateDate"/> <result column="a_update_date" property="updateDate"/>
<result column="is_delete" property="deleted"/> <result column="is_delete" property="deleted"/>
<association property="category" column="a_category_id" javaType="cn.celess.blog.entity.TagCategory" <association property="category" column="a_category_id" javaType="cn.celess.blog.entity.TagCategory"
resultMap="cn.celess.blog.mapper.CategoryMapper.categoryResultMap"> resultMap="cn.celess.blog.mapper.CategoryMapper.categoryResultMap">
</association> </association>
<collection property="tags" ofType="cn.celess.blog.entity.TagCategory" <collection property="tags" ofType="cn.celess.blog.entity.Tag"
resultMap="cn.celess.blog.mapper.CategoryMapper.categoryResultMap"> select="cn.celess.blog.mapper.ArticleTagMapper.findTagByArticleId" column="a_id">
</collection> <id column="tagId" property="id"/>
</resultMap> <result column="tagName" property="name"/>
</collection>
</resultMap>
<resultMap id="articleViewResultMap" type="cn.celess.blog.entity.Article">
<id column="articleId" property="id"/>
<result column="title" property="title"/> <resultMap id="articleViewResultMap" type="cn.celess.blog.entity.Article">
<result column="summary" property="summary"/> <id column="articleId" property="id"/>
<result column="mdContent" property="mdContent"/> <result column="title" property="title"/>
<result column="url" property="url"/> <result column="summary" property="summary"/>
<result column="isOpen" property="open"/> <result column="mdContent" property="mdContent"/>
<result column="isOriginal" property="type"/> <result column="url" property="url"/>
<result column="likeCount" property="likeCount"/> <result column="isOpen" property="open"/>
<result column="dislikeCount" property="dislikeCount"/> <result column="isOriginal" property="type"/>
<result column="readingCount" property="readingNumber"/> <result column="likeCount" property="likeCount"/>
<result column="publishDate" property="publishDate"/> <result column="dislikeCount" property="dislikeCount"/>
<result column="updateDate" property="updateDate"/> <result column="readingCount" property="readingNumber"/>
<result column="isDelete" property="deleted"/> <result column="publishDate" property="publishDate"/>
<association property="category" column="categoryId" javaType="cn.celess.blog.entity.Category"> <result column="updateDate" property="updateDate"/>
<id column="categoryId" property="id"/> <result column="isDelete" property="deleted"/>
<result column="categoryName" property="name"/> <association property="category" column="categoryId" javaType="cn.celess.blog.entity.Category">
</association> <id column="categoryId" property="id"/>
<association property="user" column="authorId" javaType="cn.celess.blog.entity.User"> <result column="categoryName" property="name"/>
<id column="authorId" property="id"/> </association>
<result column="userEmail" property="email"/> <association property="user" column="authorId" javaType="cn.celess.blog.entity.User">
<result column="userAvatar" property="avatarImgUrl"/> <id column="authorId" property="id"/>
<result column="userDisplayName" property="displayName"/> <result column="userEmail" property="email"/>
</association> <result column="userAvatar" property="avatarImgUrl"/>
<collection property="tags" ofType="cn.celess.blog.entity.Tag"> <result column="userDisplayName" property="displayName"/>
<id column="tagId" property="id"/> </association>
<result column="tagName" property="name"/> <collection property="tags" ofType="cn.celess.blog.entity.Tag"
</collection> select="cn.celess.blog.mapper.ArticleTagMapper.findTagByArticleId" column="{articleId=articleId}">
<id column="tagId" property="id"/>
</resultMap> <result column="tagName" property="name"/>
</collection>
<insert id="insert" useGeneratedKeys="true" keyProperty="id" parameterType="cn.celess.blog.entity.Article">
insert into article (a_author_id, a_category_id, a_md_content, a_is_original, </resultMap>
a_summary, a_title, a_url)
values (#{user.id}, #{category.id}, #{mdContent}, #{type}, #{summary}, #{title}, #{url}) <insert id="insert" useGeneratedKeys="true" keyProperty="id" parameterType="cn.celess.blog.entity.Article">
</insert> insert into article (a_author_id, a_category_id, a_md_content, a_is_original,
<update id="delete"> a_summary, a_title, a_url)
update article values (#{user.id}, #{category.id}, #{mdContent}, #{type}, #{summary}, #{title}, #{url})
set is_delete = true </insert>
where a_id = #{id} <update id="delete">
</update> update article
set is_delete = true
<update id="update"> where a_id = #{id}
update article </update>
set a_update_date=now(),
<if test="title!=null">a_title=#{title},</if> <update id="update">
<if test="mdContent!=null">a_md_content=#{mdContent},</if> update article
<if test="summary!=null">a_summary=#{summary},</if> set a_update_date=now(),
<if test="type!=null">a_is_original=#{type},</if> <if test="title!=null">a_title=#{title},</if>
<if test="url!=null">a_url=#{url},</if> <if test="mdContent!=null">a_md_content=#{mdContent},</if>
<if test="category!=null">a_category_id=#{category.id},</if> <if test="summary!=null">a_summary=#{summary},</if>
<if test="open!=null">a_is_open=#{open}</if> <if test="type!=null">a_is_original=#{type},</if>
where a_id = #{id} <if test="url!=null">a_url=#{url},</if>
</update> <if test="category!=null">a_category_id=#{category.id},</if>
<if test="open!=null">a_is_open=#{open}</if>
<update id="updateReadingNumber"> where a_id = #{id}
update article </update>
set a_reading_number=a_reading_number + 1
where a_id = #{id} <update id="updateReadingNumber">
</update> update article
set a_reading_number=a_reading_number + 1
<select id="getLastestArticle" resultMap="articleViewResultMap" resultType="cn.celess.blog.entity.Article"> where a_id = #{id}
select * </update>
from articleView
order by articleId desc <select id="getLastestArticle" resultMap="articleViewResultMap" resultType="cn.celess.blog.entity.Article">
limit 1 select *
</select> from articleView
order by articleId desc
limit 1
<select id="findArticleById" resultMap="articleViewResultMap"> </select>
select *
from articleView
where articleId = #{id} <select id="findArticleById" resultMap="articleViewResultMap">
</select> select *
from articleView
<select id="existsByTitle" resultType="boolean"> where articleId = #{id}
SELECT EXISTS(SELECT * FROM article WHERE a_title = #{title}) </select>
</select>
<select id="existsByTitle" resultType="boolean">
<select id="isDeletedById" resultType="boolean"> SELECT EXISTS(SELECT * FROM article WHERE a_title = #{title})
select is_delete </select>
from article
WHERE a_id = #{id} <select id="isDeletedById" resultType="boolean">
</select> select is_delete
from article
<select id="findAllByAuthorId" resultMap="articleViewResultMap"> WHERE a_id = #{id}
select * </select>
from articleView
where authorId = #{authorId} <select id="findAllByAuthorId" resultMap="articleViewResultMap">
and isDelete = false select *
order by articleId desc from articleView
</select> where authorId = #{authorId}
and isDelete = false
<select id="findAllByOpen" resultMap="articleViewResultMap"> order by articleId desc
select * </select>
from articleView
where isOpen = #{isOpen} <select id="findAllByOpen" resultMap="articleViewResultMap">
and isDelete = false select article.a_id as articleId,
order by articleId desc article.a_title as title,
</select> article.a_summary as summary,
article.a_md_content as mdContent,
article.a_url as url,
<select id="getTitleById" resultType="string"> article.a_is_original as isOriginal,
SELECT title article.a_reading_number as readingCount,
from articleView article.a_like as likeCount,
where articleId = #{id} article.a_dislike as dislikeCount,
</select> article.a_publish_date as publishDate,
article.a_update_date as updateDate,
<select id="findAllByCategoryId" resultMap="articleViewResultMap"> article.a_is_open as isOpen,
select * category.t_id as categoryId,
from articleView category.t_name as categoryName,
where categoryId = #{id} user.u_id as authorId,
and isDelete = false user.u_email as userEmail,
order by articleId desc user.u_avatar as userAvatar,
</select> user.u_display_name as userDisplayName,
article.is_delete as isDelete
<select id="findAllByCategoryIdAndOpen" resultMap="articleViewResultMap"> from article,
select * tag_category as category,
from articleView article_tag,
where categoryId = #{id} user
and isDelete = false where article.a_is_open = #{isOpen}
and isOpen = true and article.is_delete = false
order by articleId desc and article.a_id = article_tag.a_id
</select> and article.a_category_id = category.t_id
and category.is_category = true
and article.a_author_id = user.u_id
<select id="findAll" resultMap="articleViewResultMap"> group by article.a_id
select * order by article.a_id desc
from articleView </select>
order by articleId desc
</select>
<select id="getTitleById" resultType="string">
SELECT title
<select id="count" resultType="long"> from articleView
select count(*) where articleId = #{id}
from article </select>
where is_delete = false;
</select> <select id="findAllByCategoryId" resultMap="articleViewResultMap">
select *
<select id="getPreArticle" resultMap="articleViewResultMap"> from articleView
select * where categoryId = #{id}
from articleView and isDelete = false
where articleId = (select max(articleId) order by articleId desc
from articleView </select>
where articleId &lt; #{id}
) <select id="findAllByCategoryIdAndOpen" resultMap="articleViewResultMap">
</select> select *
<select id="getNextArticle" resultMap="articleViewResultMap"> from articleView
select * where categoryId = #{id}
from articleView and isDelete = false
where articleId = (select min(articleId) and isOpen = true
from articleView order by articleId desc
where articleId &gt; #{id} </select>
)
</select>
<select id="findAll" resultMap="articleViewResultMap">
select article.a_id as articleId,
</mapper> article.a_title as title,
article.a_summary as summary,
article.a_md_content as mdContent,
article.a_url as url,
article.a_is_original as isOriginal,
article.a_reading_number as readingCount,
article.a_like as likeCount,
article.a_dislike as dislikeCount,
article.a_publish_date as publishDate,
article.a_update_date as updateDate,
article.a_is_open as isOpen,
category.t_id as categoryId,
category.t_name as categoryName,
user.u_id as authorId,
user.u_email as userEmail,
user.u_avatar as userAvatar,
user.u_display_name as userDisplayName,
article.is_delete as isDelete
from article,
tag_category as category,
article_tag,
user
where article.a_id = article_tag.a_id
and article.a_category_id = category.t_id
and category.is_category = true
and article.a_author_id = user.u_id
group by article.a_id
order by article.a_id desc
</select>
<select id="count" resultType="long">
select count(*)
from article
where is_delete = false;
</select>
<select id="getPreArticle" resultMap="articleViewResultMap">
select *
from articleView
where articleId = (select max(articleId)
from articleView
where isOpen = true
and articleId &lt; #{id}
)
</select>
<select id="getNextArticle" resultMap="articleViewResultMap">
select *
from articleView
where articleId = (select min(articleId)
from articleView
where isOpen = true
and articleId &gt; #{id}
)
</select>
</mapper>

View File

@@ -219,7 +219,7 @@ public class BaseTest {
protected ResultActions getMockData(MockHttpServletRequestBuilder builder, String token, Object content) throws Exception { protected ResultActions getMockData(MockHttpServletRequestBuilder builder, String token, Object content) throws Exception {
// MockHttpServletRequestBuilder mockHttpServletRequestBuilder = get(url); // MockHttpServletRequestBuilder mockHttpServletRequestBuilder = get(url);
if (token != null) { if (token != null) {
builder.header("Authorization", token); builder.header("Authorization", "Bearer "+token);
} }
if (content != null) { if (content != null) {
builder.content(mapper.writeValueAsString(content)).contentType(MediaType.APPLICATION_JSON); builder.content(mapper.writeValueAsString(content)).contentType(MediaType.APPLICATION_JSON);

View File

@@ -134,4 +134,13 @@ public class ArticleTagMapperTest extends BaseTest {
return articleTag; return articleTag;
} }
}
@Test
public void findTagByArticleId() {
Article article = articleMapper.findAll().get(0);
assertNotNull(article);
List<Tag> tagByArticleId = articleTagMapper.findTagByArticleId(article.getId());
assertNotEquals(0, tagByArticleId.size());
}
}

View File

@@ -3,6 +3,8 @@ package cn.celess.blog.service;
import cn.celess.blog.BaseTest; import cn.celess.blog.BaseTest;
import cn.celess.blog.entity.model.ArticleModel; import cn.celess.blog.entity.model.ArticleModel;
import cn.celess.blog.entity.model.PageData; import cn.celess.blog.entity.model.PageData;
import cn.celess.blog.mapper.ArticleMapper;
import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -12,6 +14,8 @@ public class ArticleServiceTest extends BaseTest {
@Autowired @Autowired
ArticleService articleService; ArticleService articleService;
@Autowired
ArticleMapper articleMapper;
@Test @Test
public void adminArticles() { public void adminArticles() {
@@ -24,4 +28,25 @@ public class ArticleServiceTest extends BaseTest {
assertTrue(pageData.getList().stream().anyMatch(ArticleModel::isDeleted)); assertTrue(pageData.getList().stream().anyMatch(ArticleModel::isDeleted));
assertTrue(pageData.getList().stream().anyMatch(articleModel -> !articleModel.isDeleted())); assertTrue(pageData.getList().stream().anyMatch(articleModel -> !articleModel.isDeleted()));
} }
}
@Test
public void retrievePageForOpen() {
PageData<ArticleModel> articleModelPageData = articleService.retrievePageForOpen(10, 1);
assertEquals(10, articleModelPageData.getPageSize());
assertEquals(1, articleModelPageData.getPageNum());
assertEquals(10, articleModelPageData.getList().size());
articleModelPageData.getList().forEach(Assert::assertNotNull);
// 测试open字段
articleModelPageData.getList().forEach(articleModel -> {
// 当前文章
assertTrue(articleMapper.findArticleById(articleModel.getId()).getOpen());
if (articleModel.getPreArticle() != null) {
assertTrue(articleMapper.findArticleById(articleModel.getPreArticle().getId()).getOpen());
}
if (articleModel.getNextArticle() != null) {
assertTrue(articleMapper.findArticleById(articleModel.getNextArticle().getId()).getOpen());
}
});
}
}