1
mirror of https://github.com/CarmJos/EasySQL.git synced 2026-06-14 03:15:55 +08:00

Compare commits

..

22 Commits

Author SHA1 Message Date
carm 50b36d8430 [v0.2.5] 打包时不再对slf4j-api进行relocation 2022-01-06 14:39:28 +08:00
carm cd60bf256e 添加依赖地址 2022-01-05 05:09:49 +08:00
carm ebe68befee 添加依赖地址 2022-01-05 04:59:02 +08:00
carm 594413e13b 添加依赖地址 2022-01-05 04:56:57 +08:00
carm df94272c73 [v0.2.4] 依赖relocation并添加Optional标签 2022-01-05 02:32:09 +08:00
carm ab986e9526 [v0.2.3] 添加默认的终止manager方法,并支持强制关闭活动链接。 2021-12-23 15:17:12 +08:00
carm 3f3b7bf4a5 添加代码折叠 2021-12-20 19:09:57 +08:00
carm c69695c16d Merge remote-tracking branch 'origin/master' 2021-12-20 19:08:28 +08:00
carm 02aad28715 添加代码折叠 2021-12-20 19:07:04 +08:00
carm b423000fe5 [U] 使用SonarCloud分析 2021-12-20 18:41:25 +08:00
carm cf356f2492 [U] 使用 SonarCloud 分析。 2021-12-20 18:40:29 +08:00
carm 4775c335d5 [v0.2.2] 版本优化
- `[F]` 修复部分类的使用异常问题
- `[F]` 修复 SQLUpdateBatchAction 中 getSQLContent 方法返回内容不正确导致的其他方法一并出现异常的问题。
- `[U]` 修改 SQLUpdateBatchAction 的默认异常处理器。
- `[F]` 修复 PreparedSQLBatchUpdateActionImpl 异常继承导致的无法使用的问题。
2021-12-19 23:53:35 +08:00
carm 84c35eb481 [v0.2.2] 版本优化
- `[F]` 修复部分类的使用异常问题
- `[F]` 修复 SQLUpdateBatchAction 中 getSQLContent 方法返回内容不正确导致的其他方法一并出现异常的问题。
- `[U]` 修改 SQLUpdateBatchAction 的默认异常处理器。
- `[F]` 修复 PreparedSQLBatchUpdateActionImpl 异常继承导致的无法使用的问题。
2021-12-19 23:47:48 +08:00
carm d30b6b9ab2 添加gpg配置 2021-12-15 20:11:57 +08:00
carm f70f73daf2 Merge remote-tracking branch 'origin/master' 2021-12-15 20:08:33 +08:00
carm 4a7c11ef13 添加SCM配置 2021-12-15 20:08:16 +08:00
carm 427aca95ca Create codacy-analysis.yml 2021-12-15 17:07:49 +08:00
carm 2b86d9234a [v0.2.1-fix] 修改javadoc为中文版本 2021-12-14 20:33:24 +08:00
carm 139d213160 [v0.2.1-fix] 补全缺失的javadoc 2021-12-14 20:23:51 +08:00
carm ebc96e5176 [v0.2.1-fix] 补全缺失的javadoc 2021-12-14 20:19:04 +08:00
carm 7621c86495 [v0.2.1-fix] 修改Javadoc 2021-12-14 20:08:54 +08:00
carm 95182748ef [v0.2.1-fix] 修改Java版本 2021-12-14 20:03:47 +08:00
36 changed files with 521 additions and 142 deletions
+54
View File
@@ -0,0 +1,54 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow checks out code, performs a Codacy security scan
# and integrates the results with the
# GitHub Advanced Security code scanning feature. For more information on
# the Codacy security scan action usage and parameters, see
# https://github.com/codacy/codacy-analysis-cli-action.
# For more information on Codacy Analysis CLI in general, see
# https://github.com/codacy/codacy-analysis-cli.
name: Codacy Security Scan
on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '27 16 * * 5'
jobs:
codacy-security-scan:
name: Codacy Security Scan
runs-on: ubuntu-latest
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout code
uses: actions/checkout@v2
# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
- name: Run Codacy Analysis CLI
uses: codacy/codacy-analysis-cli-action@d840f886c4bd4edc059706d09c6a1586111c540b
with:
# Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository
# You can also omit the token and run the tools that support default configurations
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
verbose: true
output: results.sarif
format: sarif
# Adjust severity of non-security issues
gh-code-scanning-compat: true
# Force 0 exit code to allow SARIF file generation
# This will handover control about PR rejection to the GitHub side
max-allowed-issues: 2147483647
# Upload the SARIF file generated in the previous step
- name: Upload SARIF results file
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: results.sarif
+1 -1
View File
@@ -24,7 +24,7 @@ jobs:
distribution: 'adopt' distribution: 'adopt'
- name: Generate docs - name: Generate docs
run: mvn clean package run: mvn clean package -DskipTests
- name: Copy to Location - name: Copy to Location
run: | run: |
+1 -1
View File
@@ -21,7 +21,7 @@ jobs:
java-version: '11' java-version: '11'
distribution: 'adopt' distribution: 'adopt'
- name: "Package" - name: "Package"
run: mvn -B package --file pom.xml run: mvn -B package --file pom.xml -Dmaven.javadoc.skip=true
- name: "Target Stage" - name: "Target Stage"
run: mkdir staging && cp */target/*.jar staging run: mkdir staging && cp */target/*.jar staging
- name: "Upload artifact" - name: "Upload artifact"
+36
View File
@@ -0,0 +1,36 @@
name: Build
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=CarmJos_EasySQL
+97 -16
View File
@@ -26,10 +26,6 @@
- 基于JDBC开发,可自选连接池、JDBC驱动。 - 基于JDBC开发,可自选连接池、JDBC驱动。
- 简单便捷的增删改查接口,无需手写SQL语句。 - 简单便捷的增删改查接口,无需手写SQL语句。
- 额外提供部分常用情况的SQL操作 - 额外提供部分常用情况的SQL操作
- 存在则更新,不存在则插入
- 创建表
- 修改表
- ...
- 自动关闭数据流 - 自动关闭数据流
- 支持同步操作与异步操作 - 支持同步操作与异步操作
@@ -41,18 +37,43 @@
您可以 [点击这里](easysql-demo/src/main/java/EasySQLDemo.java) 查看部分代码演示,更多演示详见 [开发介绍](.documentation/README.md) 。 您可以 [点击这里](easysql-demo/src/main/java/EasySQLDemo.java) 查看部分代码演示,更多演示详见 [开发介绍](.documentation/README.md) 。
### 依赖方式 (Maven) ### 依赖方式
#### Maven 依赖
<details>
<summary>远程库配置</summary>
```xml ```xml
<project> <project>
<repositories> <repositories>
<repository> <repository>
<id>github</id> <!--采用github依赖库,安全稳定,但需要配置 (推荐)-->
<id>EasySQL</id>
<name>GitHub Packages</name> <name>GitHub Packages</name>
<url>https://maven.pkg.github.com/CarmJos/EasySQL</url> <url>https://maven.pkg.github.com/CarmJos/EasySQL</url>
</repository> </repository>
<repository>
<!--采用我的私人依赖库,简单方便,但可能因为变故而无法使用-->
<id>carm-repo</id>
<name>Carm's Repo</name>
<url>https://repo.carm.cc/repository/maven-public/</url>
</repository>
</repositories> </repositories>
</project>
```
</details>
<details>
<summary>原生依赖</summary>
```xml
<project>
<dependencies> <dependencies>
<!--对于需要提供公共接口的项目,可以仅打包API部分,方便他人调用--> <!--对于需要提供公共接口的项目,可以仅打包API部分,方便他人调用-->
<dependency> <dependency>
@@ -70,14 +91,19 @@
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<!--如需自定义连接池,则可以仅打包实现部分,自行创建SQLManager--> </dependencies>
<dependency> </project>
<groupId>cc.carm.lib</groupId> ```
<artifactId>easysql-beecp</artifactId>
<version>[LATEST RELEASE]</version>
<scope>compile</scope>
</dependency>
</details>
<details>
<summary>含连接池版本</summary>
```xml
<project>
<dependencies>
<!--也可直接选择打包了连接池的版本--> <!--也可直接选择打包了连接池的版本-->
<dependency> <dependency>
<groupId>cc.carm.lib</groupId> <groupId>cc.carm.lib</groupId>
@@ -91,12 +117,64 @@
<version>[LATEST VERSION]</version> <version>[LATEST VERSION]</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>
``` ```
</details>
#### Gradle 依赖
<details>
<summary>远程库配置</summary>
```groovy
repositories {
// 采用github依赖库,安全稳定,但需要配置 (推荐)
maven { url 'https://maven.pkg.github.com/CarmJos/EasySQL' }
// 采用我的私人依赖库,简单方便,但可能因为变故而无法使用
maven { url 'https://repo.carm.cc/repository/maven-public/' }
}
```
</details>
<details>
<summary>原生依赖</summary>
```groovy
dependencies {
//对于需要提供公共接口的项目,可以仅打包API部分,方便他人调用
api "cc.carm.lib:easysql-api:[LATEST RELEASE]"
//如需自定义连接池,则可以仅打包实现部分,自行创建SQLManager
api "cc.carm.lib:easysql-impl:[LATEST RELEASE]"
}
```
</details>
<details>
<summary>含连接池版本</summary>
```groovy
dependencies {
//也可直接选择打包了连接池的版本
api "cc.carm.lib:easysql-beecp:[LATEST RELEASE]"
api "cc.carm.lib:easysql-hikaricp:[LATEST RELEASE]"
}
```
</details>
## 支持与捐赠 ## 支持与捐赠
若您觉得本插件做的不错,您可以通过捐赠支持我! 若您觉得本插件做的不错,您可以通过捐赠支持我!
@@ -108,7 +186,9 @@
## 开源协议 ## 开源协议
本项目源码采用 [GNU General Public License v3.0](https://opensource.org/licenses/GPL-3.0) 开源协议。 本项目源码采用 [GNU General Public License v3.0](https://opensource.org/licenses/GPL-3.0) 开源协议。
> ### 关于 GPL 协议 <details>
<summary>关于 GPL 协议</summary>
> GNU General Public Licence (GPL) 有可能是开源界最常用的许可模式。GPL 保证了所有开发者的权利,同时为使用者提供了足够的复制,分发,修改的权利: > GNU General Public Licence (GPL) 有可能是开源界最常用的许可模式。GPL 保证了所有开发者的权利,同时为使用者提供了足够的复制,分发,修改的权利:
> >
> #### 可自由复制 > #### 可自由复制
@@ -123,3 +203,4 @@
> 需要注意的是,分发的时候,需要明确提供源代码和二进制文件,另外,用于某些程序的某些协议有一些问题和限制,你可以看一下 @PierreJoye 写的 Practical Guide to GPL Compliance 一文。使用 GPL 协议,你必须在源代码代码中包含相应信息,以及协议本身。 > 需要注意的是,分发的时候,需要明确提供源代码和二进制文件,另外,用于某些程序的某些协议有一些问题和限制,你可以看一下 @PierreJoye 写的 Practical Guide to GPL Compliance 一文。使用 GPL 协议,你必须在源代码代码中包含相应信息,以及协议本身。
> >
> *以上文字来自 [五种开源协议GPL,LGPL,BSD,MIT,Apache](https://www.oschina.net/question/54100_9455) 。* > *以上文字来自 [五种开源协议GPL,LGPL,BSD,MIT,Apache](https://www.oschina.net/question/54100_9455) 。*
</details>
+3 -3
View File
@@ -5,7 +5,7 @@
<parent> <parent>
<groupId>cc.carm.lib</groupId> <groupId>cc.carm.lib</groupId>
<artifactId>easysql-parent</artifactId> <artifactId>easysql-parent</artifactId>
<version>0.2.1</version> <version>0.2.5</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@@ -46,8 +46,8 @@
</ciManagement> </ciManagement>
<properties> <properties>
<maven.compiler.source>8</maven.compiler.source> <maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target> <maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.encoding>UTF-8</maven.compiler.encoding> <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
</properties> </properties>
@@ -13,17 +13,17 @@ import java.util.function.Function;
* SQLAction 是用于承载SQL语句并进行处理、返回的基本类。 * SQLAction 是用于承载SQL语句并进行处理、返回的基本类。
* *
* <ul> * <ul>
* <li>同步执行 {@link #execute()}, {@link #execute(Function, BiConsumer)}</li> * <li>同步执行 {@link #execute()}, {@link #execute(Function, BiConsumer)}
* <br>同步执行方法中有会抛出异常的方法与不抛出异常的方法, * <br>同步执行方法中有会抛出异常的方法与不抛出异常的方法,
* <br> 若选择不抛出异常,则返回值可能为空,需要特殊处理。 * <br>若选择不抛出异常,则返回值可能为空,需要特殊处理。</li>
* *
* <li>异步执行 {@link #executeAsync(Consumer, BiConsumer)}</li> * <li>异步执行 {@link #executeAsync(Consumer, BiConsumer)}
* <br>异步执行时将提供成功与异常两种处理方式 * <br>异步执行时将提供成功与异常两种处理方式
* <br>可自行选择是否对数据或异常进行处理 * <br>可自行选择是否对数据或异常进行处理
* <br> 默认的异常处理器为 {@link #defaultExceptionHandler()} * <br>默认的异常处理器为 {@link #defaultExceptionHandler()}</li>
* </ul> * </ul>
* *
* <b>注意:</b> 无论是否异步,都不需要自行关闭ResultSet,本API已自动关闭 * <b>注意: 无论是否异步,都不需要自行关闭ResultSet,本API已自动关闭</b>
* *
* @param <T> 需要返回的类型 * @param <T> 需要返回的类型
* @author CarmJos * @author CarmJos
@@ -138,6 +138,7 @@ public interface SQLAction<T> {
return (exception, action) -> { return (exception, action) -> {
getManager().getLogger().severe("Error when execute [" + action.getSQLContent() + "]"); getManager().getLogger().severe("Error when execute [" + action.getSQLContent() + "]");
getManager().getLogger().severe(exception.getLocalizedMessage()); getManager().getLogger().severe(exception.getLocalizedMessage());
exception.printStackTrace();
}; };
} }
@@ -2,6 +2,8 @@ package cc.carm.lib.easysql.api;
import cc.carm.lib.easysql.api.action.PreparedSQLUpdateAction; import cc.carm.lib.easysql.api.action.PreparedSQLUpdateAction;
import cc.carm.lib.easysql.api.action.PreparedSQLUpdateBatchAction; import cc.carm.lib.easysql.api.action.PreparedSQLUpdateBatchAction;
import cc.carm.lib.easysql.api.action.SQLUpdateAction;
import cc.carm.lib.easysql.api.action.SQLUpdateBatchAction;
import cc.carm.lib.easysql.api.action.query.SQLQuery; import cc.carm.lib.easysql.api.action.query.SQLQuery;
import cc.carm.lib.easysql.api.builder.*; import cc.carm.lib.easysql.api.builder.*;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -34,6 +36,7 @@ public interface SQLManager {
* 得到一个数据库连接实例 * 得到一个数据库连接实例
* *
* @return Connection * @return Connection
* @throws SQLException 见 {@link DataSource#getConnection()}
*/ */
@NotNull Connection getConnection() throws SQLException; @NotNull Connection getConnection() throws SQLException;
@@ -49,14 +52,17 @@ public interface SQLManager {
* *
* @param sql SQL语句内容 * @param sql SQL语句内容
* @return 更新的行数 * @return 更新的行数
* @see SQLUpdateAction
*/ */
@Nullable Integer executeSQL(String sql); @Nullable Integer executeSQL(String sql);
/** /**
* 执行一条不需要返回结果的SQL更改(UPDATE、REPLACE、DELETE) * 执行一条不需要返回结果的预处理SQL更改(UPDATE、REPLACE、DELETE)
* *
* @param sql SQL语句内容 * @param sql SQL语句内容
* @param params SQL语句中 ? 的对应参数
* @return 更新的行数 * @return 更新的行数
* @see PreparedSQLUpdateAction
*/ */
@Nullable Integer executeSQL(String sql, Object[] params); @Nullable Integer executeSQL(String sql, Object[] params);
@@ -64,7 +70,9 @@ public interface SQLManager {
* 执行多条不需要返回结果的SQL更改(UPDATE、REPLACE、DELETE) * 执行多条不需要返回结果的SQL更改(UPDATE、REPLACE、DELETE)
* *
* @param sql SQL语句内容 * @param sql SQL语句内容
* @param paramsBatch SQL语句中对应?的参数组
* @return 对应参数返回的行数 * @return 对应参数返回的行数
* @see PreparedSQLUpdateBatchAction
*/ */
@Nullable List<Integer> executeSQLBatch(String sql, Iterable<Object[]> paramsBatch); @Nullable List<Integer> executeSQLBatch(String sql, Iterable<Object[]> paramsBatch);
@@ -73,7 +81,9 @@ public interface SQLManager {
* 执行多条不需要返回结果的SQL。 * 执行多条不需要返回结果的SQL。
* *
* @param sql SQL语句内容 * @param sql SQL语句内容
* @param moreSQL 更多SQL语句内容
* @return 对应参数返回的行数 * @return 对应参数返回的行数
* @see SQLUpdateBatchAction
*/ */
@Nullable List<Integer> executeSQLBatch(@NotNull String sql, String... moreSQL); @Nullable List<Integer> executeSQLBatch(@NotNull String sql, String... moreSQL);
@@ -85,20 +95,67 @@ public interface SQLManager {
*/ */
@Nullable List<Integer> executeSQLBatch(@NotNull Iterable<String> sqlBatch); @Nullable List<Integer> executeSQLBatch(@NotNull Iterable<String> sqlBatch);
/**
* 在库中创建一个表
*
* @param tableName 表名
* @return {@link TableCreateBuilder}
*/
TableCreateBuilder createTable(@NotNull String tableName); TableCreateBuilder createTable(@NotNull String tableName);
/**
* 新建一个查询
*
* @return {@link QueryBuilder}
*/
QueryBuilder createQuery(); QueryBuilder createQuery();
InsertBuilder<PreparedSQLUpdateBatchAction> createInsertBatch(@NotNull String tableName); /**
* 创建一条插入操作
*
* @param tableName 目标表名
* @return {@link InsertBuilder}
*/
InsertBuilder<PreparedSQLUpdateAction> createInsert(@NotNull String tableName); InsertBuilder<PreparedSQLUpdateAction> createInsert(@NotNull String tableName);
ReplaceBuilder<PreparedSQLUpdateBatchAction> createReplaceBatch(@NotNull String tableName); /**
* 创建支持多组数据的插入操作
*
* @param tableName 目标表名
* @return {@link InsertBuilder}
*/
InsertBuilder<PreparedSQLUpdateBatchAction> createInsertBatch(@NotNull String tableName);
/**
* 创建一条替换操作
*
* @param tableName 目标表名
* @return {@link ReplaceBuilder}
*/
ReplaceBuilder<PreparedSQLUpdateAction> createReplace(@NotNull String tableName); ReplaceBuilder<PreparedSQLUpdateAction> createReplace(@NotNull String tableName);
/**
* 创建支持多组数据的替换操作
*
* @param tableName 目标表名
* @return {@link ReplaceBuilder}
*/
ReplaceBuilder<PreparedSQLUpdateBatchAction> createReplaceBatch(@NotNull String tableName);
/**
* 创建更新操作
*
* @param tableName 目标表名
* @return {@link UpdateBuilder}
*/
UpdateBuilder createUpdate(@NotNull String tableName); UpdateBuilder createUpdate(@NotNull String tableName);
/**
* 创建删除操作
*
* @param tableName 目标表名
* @return {@link DeleteBuilder}
*/
DeleteBuilder createDelete(@NotNull String tableName); DeleteBuilder createDelete(@NotNull String tableName);
} }
@@ -26,8 +26,8 @@ public interface PreparedSQLUpdateBatchAction extends SQLAction<List<Integer>> {
* 设定自增主键的序列 * 设定自增主键的序列
* *
* @param keyColumnIndex 自增主键的序列 * @param keyColumnIndex 自增主键的序列
* 若该值 > 0,则 {@link #execute()} 返回自增主键数值 * <br>若该值 0,则 {@link #execute()} 返回自增主键数值
* 若该值 ≤ 0,则 {@link #execute()} 返回变更的行数 * <br>若该值 ≤ 0,则 {@link #execute()} 返回变更的行数
* @return {@link PreparedSQLUpdateBatchAction} * @return {@link PreparedSQLUpdateBatchAction}
*/ */
PreparedSQLUpdateBatchAction setKeyIndex(int keyColumnIndex); PreparedSQLUpdateBatchAction setKeyIndex(int keyColumnIndex);
@@ -2,14 +2,18 @@ package cc.carm.lib.easysql.api.action;
import cc.carm.lib.easysql.api.SQLAction; import cc.carm.lib.easysql.api.SQLAction;
import java.sql.SQLException;
import java.util.List;
import java.util.function.BiConsumer;
public interface SQLUpdateAction extends SQLAction<Integer> { public interface SQLUpdateAction extends SQLAction<Integer> {
/** /**
* 设定自增主键的序列 * 设定自增主键的序列
* *
* @param keyColumnIndex 自增主键的序列 * @param keyColumnIndex 自增主键的序列
* 若该值 > 0,则 {@link #execute()} 返回自增主键数值 * <br>若该值 0,则 {@link #execute()} 返回自增主键数值
* 若该值 ≤ 0,则 {@link #execute()} 返回变更的行数 * <br>若该值 ≤ 0,则 {@link #execute()} 返回变更的行数
* @return {@link SQLUpdateAction} * @return {@link SQLUpdateAction}
*/ */
SQLUpdateAction setKeyIndex(int keyColumnIndex); SQLUpdateAction setKeyIndex(int keyColumnIndex);
@@ -23,4 +27,6 @@ public interface SQLUpdateAction extends SQLAction<Integer> {
return setKeyIndex(-1); // will return changed lines number return setKeyIndex(-1); // will return changed lines number
} }
} }
@@ -3,7 +3,9 @@ package cc.carm.lib.easysql.api.action;
import cc.carm.lib.easysql.api.SQLAction; import cc.carm.lib.easysql.api.SQLAction;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.sql.SQLException;
import java.util.List; import java.util.List;
import java.util.function.BiConsumer;
public interface SQLUpdateBatchAction extends SQLAction<List<Integer>> { public interface SQLUpdateBatchAction extends SQLAction<List<Integer>> {
@@ -15,4 +17,20 @@ public interface SQLUpdateBatchAction extends SQLAction<List<Integer>> {
*/ */
SQLUpdateBatchAction addBatch(@NotNull String sql); SQLUpdateBatchAction addBatch(@NotNull String sql);
List<String> getSQLContents();
@Override
default BiConsumer<SQLException, SQLAction<List<Integer>>> defaultExceptionHandler() {
return (exception, action) -> {
getManager().getLogger().severe("Error when execute SQLs : ");
int i = 1;
for (String content : getSQLContents()) {
getManager().getLogger().severe("#" + i + " [" + content + "]");
i++;
}
getManager().getLogger().severe(exception.getLocalizedMessage());
exception.printStackTrace();
};
}
} }
@@ -7,8 +7,6 @@ public interface InsertBuilder<T> {
String getTableName(); String getTableName();
InsertBuilder<T> setTableName(String tableName);
T setColumnNames(List<String> columnNames); T setColumnNames(List<String> columnNames);
default T setColumnNames(String... columnNames) { default T setColumnNames(String... columnNames) {
@@ -7,8 +7,6 @@ public interface ReplaceBuilder<T> {
String getTableName(); String getTableName();
ReplaceBuilder<T> setTableName(String tableName);
T setColumnNames(List<String> columnNames); T setColumnNames(List<String> columnNames);
default T setColumnNames(String... columnNames) { default T setColumnNames(String... columnNames) {
@@ -8,8 +8,6 @@ public interface TableCreateBuilder extends SQLBuilder {
@NotNull String getTableName(); @NotNull String getTableName();
TableCreateBuilder setTableName(@NotNull String tableName);
@NotNull String getTableSettings(); @NotNull String getTableSettings();
TableCreateBuilder setTableSettings(@NotNull String settings); TableCreateBuilder setTableSettings(@NotNull String settings);
@@ -9,4 +9,13 @@ public interface TableQueryBuilder extends ConditionalBuilder<PreparedQueryActio
TableQueryBuilder selectColumns(@NotNull String... columnNames); TableQueryBuilder selectColumns(@NotNull String... columnNames);
/**
* 对结果进行排序
*
* @param columnName 排序使用的列名
* @param asc 是否为正序排序 (为false则倒序排序)
* @return {@link TableQueryBuilder}
*/
TableQueryBuilder orderBy(@NotNull String columnName, boolean asc);
} }
@@ -1,4 +1,9 @@
package cc.carm.lib.easysql.api.builder; package cc.carm.lib.easysql.api.builder;
public interface UpsertBuilder { public interface UpsertBuilder {
String getTableName();
UpsertBuilder setColumnNames(String[] columnNames, String updateColumn);
} }
+30 -3
View File
@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>easysql-parent</artifactId> <artifactId>easysql-parent</artifactId>
<groupId>cc.carm.lib</groupId> <groupId>cc.carm.lib</groupId>
<version>0.2.1</version> <version>0.2.5</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@@ -46,8 +46,8 @@
</ciManagement> </ciManagement>
<properties> <properties>
<maven.compiler.source>8</maven.compiler.source> <maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target> <maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.encoding>UTF-8</maven.compiler.encoding> <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
<maven.javadoc.skip>true</maven.javadoc.skip> <maven.javadoc.skip>true</maven.javadoc.skip>
@@ -67,6 +67,7 @@
<groupId>com.github.chris2018998</groupId> <groupId>com.github.chris2018998</groupId>
<artifactId>beecp</artifactId> <artifactId>beecp</artifactId>
<version>3.3.0</version> <version>3.3.0</version>
<optional>true</optional>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
@@ -89,6 +90,32 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
<version>3.2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
<configuration>
<relocations>
<relocation>
<pattern>cn.beecp</pattern>
<shadedPattern>cc.carm.lib.easysql.beecp</shadedPattern>
</relocation>
</relocations>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/MANIFEST.MF</exclude>
<exclude>META-INF/*.txt</exclude>
</excludes>
</filter>
</filters>
</configuration>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
@@ -1,5 +1,8 @@
package cc.carm.lib.easysql; package cc.carm.lib.easysql;
import cc.carm.lib.easysql.api.SQLManager;
import cc.carm.lib.easysql.api.action.query.SQLQuery;
import cc.carm.lib.easysql.api.util.TimeDateUtils;
import cc.carm.lib.easysql.manager.SQLManagerImpl; import cc.carm.lib.easysql.manager.SQLManagerImpl;
import cn.beecp.BeeDataSource; import cn.beecp.BeeDataSource;
import cn.beecp.BeeDataSourceConfig; import cn.beecp.BeeDataSourceConfig;
@@ -18,4 +21,26 @@ public class EasySQL {
return new SQLManagerImpl(new BeeDataSource(config)); return new SQLManagerImpl(new BeeDataSource(config));
} }
public static void shutdownManager(SQLManager manager, boolean forceClose, boolean outputActiveQuery) {
if (!manager.getActiveQuery().isEmpty()) {
manager.getLogger().severe("There are " + manager.getActiveQuery().size() + " connections still running");
for (SQLQuery value : manager.getActiveQuery().values()) {
if (outputActiveQuery) {
manager.getLogger().severe("#" + value.getAction().getShortID() + " -> " + value.getSQLContent());
manager.getLogger().severe("- execute at " + TimeDateUtils.getTimeString(value.getExecuteTime()));
}
if (forceClose) value.close();
}
}
if (manager.getDataSource() instanceof BeeDataSource) {
//Close bee connection pool
((BeeDataSource) manager.getDataSource()).close();
}
}
public static void shutdownManager(SQLManager manager) {
shutdownManager(manager, true, manager.isDebugMode());
}
} }
+3 -3
View File
@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>easysql-parent</artifactId> <artifactId>easysql-parent</artifactId>
<groupId>cc.carm.lib</groupId> <groupId>cc.carm.lib</groupId>
<version>0.2.1</version> <version>0.2.5</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@@ -46,8 +46,8 @@
</ciManagement> </ciManagement>
<properties> <properties>
<maven.compiler.source>8</maven.compiler.source> <maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target> <maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.encoding>UTF-8</maven.compiler.encoding> <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
<maven.javadoc.skip>true</maven.javadoc.skip> <maven.javadoc.skip>true</maven.javadoc.skip>
+30 -3
View File
@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>easysql-parent</artifactId> <artifactId>easysql-parent</artifactId>
<groupId>cc.carm.lib</groupId> <groupId>cc.carm.lib</groupId>
<version>0.2.1</version> <version>0.2.5</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@@ -45,8 +45,8 @@
</ciManagement> </ciManagement>
<properties> <properties>
<maven.compiler.source>8</maven.compiler.source> <maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target> <maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.encoding>UTF-8</maven.compiler.encoding> <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
<maven.javadoc.skip>true</maven.javadoc.skip> <maven.javadoc.skip>true</maven.javadoc.skip>
@@ -66,6 +66,7 @@
<groupId>com.zaxxer</groupId> <groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId> <artifactId>HikariCP</artifactId>
<version>4.0.3</version> <version>4.0.3</version>
<optional>true</optional>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
@@ -88,6 +89,32 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
<version>3.2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
<configuration>
<relocations>
<relocation>
<pattern>com.zaxxer.hikari</pattern>
<shadedPattern>cc.carm.lib.easysql.hikari</shadedPattern>
</relocation>
</relocations>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/MANIFEST.MF</exclude>
<exclude>META-INF/*.txt</exclude>
</excludes>
</filter>
</filters>
</configuration>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
@@ -0,0 +1,56 @@
package cc.carm.lib.easysql;
import cc.carm.lib.easysql.api.SQLManager;
import cc.carm.lib.easysql.api.action.query.SQLQuery;
import cc.carm.lib.easysql.api.util.TimeDateUtils;
import cc.carm.lib.easysql.manager.SQLManagerImpl;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Properties;
public class EasySQL {
public static SQLManagerImpl createManager(
@NotNull String driver, @NotNull String url,
@NotNull String username, @Nullable String password) {
HikariConfig config = new HikariConfig();
config.setDriverClassName(driver);
config.setJdbcUrl(url);
config.setUsername(username);
config.setPassword(password);
return createManager(config);
}
public static SQLManagerImpl createManager(@NotNull Properties properties) {
return createManager(new HikariConfig(properties));
}
public static SQLManagerImpl createManager(@NotNull HikariConfig config) {
return new SQLManagerImpl(new HikariDataSource(config));
}
public static void shutdownManager(SQLManager manager, boolean forceClose, boolean outputActiveQuery) {
if (!manager.getActiveQuery().isEmpty()) {
manager.getLogger().severe("There are " + manager.getActiveQuery().size() + " connections still running");
for (SQLQuery value : manager.getActiveQuery().values()) {
if (outputActiveQuery) {
manager.getLogger().severe("#" + value.getAction().getShortID() + " -> " + value.getSQLContent());
manager.getLogger().severe("- execute at " + TimeDateUtils.getTimeString(value.getExecuteTime()));
}
if (forceClose) value.close();
}
}
if (manager.getDataSource() instanceof HikariDataSource) {
//Close hikari pool
((HikariDataSource) manager.getDataSource()).close();
}
}
public static void shutdownManager(SQLManager manager) {
shutdownManager(manager, true, manager.isDebugMode());
}
}
@@ -1,32 +0,0 @@
package easysql;
import cc.carm.lib.easysql.manager.SQLManagerImpl;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Properties;
public class EasySQL {
public static SQLManagerImpl createManager(
@NotNull String driver, @NotNull String url,
@NotNull String username, @Nullable String password) {
HikariConfig config = new HikariConfig();
config.setDriverClassName(driver);
config.setJdbcUrl(url);
config.setUsername(username);
config.setPassword(password);
return createManager(config);
}
public static SQLManagerImpl createManager(@NotNull Properties properties) {
return createManager(new HikariConfig(properties));
}
public static SQLManagerImpl createManager(@NotNull HikariConfig config) {
return new SQLManagerImpl(new HikariDataSource(config));
}
}
+3 -3
View File
@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>easysql-parent</artifactId> <artifactId>easysql-parent</artifactId>
<groupId>cc.carm.lib</groupId> <groupId>cc.carm.lib</groupId>
<version>0.2.1</version> <version>0.2.5</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@@ -46,8 +46,8 @@
</ciManagement> </ciManagement>
<properties> <properties>
<maven.compiler.source>8</maven.compiler.source> <maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target> <maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.encoding>UTF-8</maven.compiler.encoding> <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
<maven.javadoc.skip>true</maven.javadoc.skip> <maven.javadoc.skip>true</maven.javadoc.skip>
@@ -12,10 +12,9 @@ import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.function.Consumer;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class PreparedSQLBatchUpdateActionImpl extends SQLUpdateBatchActionImpl implements PreparedSQLUpdateBatchAction { public class PreparedSQLBatchUpdateActionImpl extends AbstractSQLAction<List<Integer>> implements PreparedSQLUpdateBatchAction {
int keyIndex = -1; int keyIndex = -1;
List<Object[]> allParams; List<Object[]> allParams;
@@ -54,6 +53,7 @@ public class PreparedSQLBatchUpdateActionImpl extends SQLUpdateBatchActionImpl i
); );
outputDebugMessage(); outputDebugMessage();
if (keyIndex > 0) { if (keyIndex > 0) {
statement.executeBatch();
List<Integer> generatedKeys = new ArrayList<>(); List<Integer> generatedKeys = new ArrayList<>();
ResultSet resultSet = statement.getGeneratedKeys(); ResultSet resultSet = statement.getGeneratedKeys();
if (resultSet != null) { if (resultSet != null) {
@@ -59,13 +59,14 @@ public class PreparedSQLUpdateActionImpl extends SQLUpdateActionImpl implements
); );
outputDebugMessage(); outputDebugMessage();
if (keyIndex > 0) { if (keyIndex > 0) {
statement.executeUpdate();
ResultSet resultSet = statement.getGeneratedKeys(); ResultSet resultSet = statement.getGeneratedKeys();
if (resultSet != null) { if (resultSet != null) {
if (resultSet.next()) value = resultSet.getInt(keyIndex); if (resultSet.next()) value = resultSet.getInt(keyIndex);
resultSet.close(); resultSet.close();
} }
} else { } else {
value = statement.executeUpdate(getSQLContent()); value = statement.executeUpdate();
} }
statement.close(); statement.close();
@@ -8,7 +8,6 @@ import java.sql.Connection;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Statement; import java.sql.Statement;
import java.util.function.Consumer;
public class SQLUpdateActionImpl extends AbstractSQLAction<Integer> implements SQLUpdateAction { public class SQLUpdateActionImpl extends AbstractSQLAction<Integer> implements SQLUpdateAction {
@@ -23,9 +23,12 @@ public class SQLUpdateBatchActionImpl extends AbstractSQLAction<List<Integer>> i
@Override @Override
public @NotNull String getSQLContent() { public @NotNull String getSQLContent() {
return this.sqlContents.stream() return this.sqlContents.get(0);
.map(content -> "[" + content + "]" + " ") }
.collect(Collectors.joining());
@Override
public @NotNull List<String> getSQLContents() {
return this.sqlContents;
} }
@Override @Override
@@ -50,5 +53,4 @@ public class SQLUpdateBatchActionImpl extends AbstractSQLAction<List<Integer>> i
return returnedValues; return returnedValues;
} }
} }
@@ -43,9 +43,4 @@ public abstract class InsertBuilderImpl<T> extends AbstractSQLBuilder implements
public String getTableName() { public String getTableName() {
return tableName; return tableName;
} }
public InsertBuilderImpl<T> setTableName(String tableName) {
this.tableName = tableName;
return this;
}
} }
@@ -43,9 +43,4 @@ public abstract class ReplaceBuilderImpl<T> extends AbstractSQLBuilder implement
public String getTableName() { public String getTableName() {
return tableName; return tableName;
} }
public ReplaceBuilderImpl<T> setTableName(String tableName) {
this.tableName = tableName;
return this;
}
} }
@@ -50,12 +50,6 @@ public class TableCreateBuilderImpl extends AbstractSQLBuilder implements TableC
return new SQLUpdateActionImpl(getManager(), createSQL.toString()); return new SQLUpdateActionImpl(getManager(), createSQL.toString());
} }
@Override
public TableCreateBuilder setTableName(@NotNull String tableName) {
this.tableName = tableName;
return this;
}
@Override @Override
public TableCreateBuilder addColumn(@NotNull String column) { public TableCreateBuilder addColumn(@NotNull String column) {
this.columns.add(column); this.columns.add(column);
@@ -5,6 +5,7 @@ import cc.carm.lib.easysql.api.action.query.PreparedQueryAction;
import cc.carm.lib.easysql.api.builder.TableQueryBuilder; import cc.carm.lib.easysql.api.builder.TableQueryBuilder;
import cc.carm.lib.easysql.manager.SQLManagerImpl; import cc.carm.lib.easysql.manager.SQLManagerImpl;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
@@ -14,9 +15,10 @@ public class TableQueryBuilderImpl
@NotNull String tableName; @NotNull String tableName;
ArrayList<Object> params = new ArrayList<>();
String[] columns; String[] columns;
@Nullable String orderBy;
public TableQueryBuilderImpl(@NotNull SQLManagerImpl manager, @NotNull String tableName) { public TableQueryBuilderImpl(@NotNull SQLManagerImpl manager, @NotNull String tableName) {
super(manager); super(manager);
this.tableName = tableName; this.tableName = tableName;
@@ -43,9 +45,10 @@ public class TableQueryBuilderImpl
if (hasConditions()) sqlBuilder.append(" ").append(buildConditionSQL()); if (hasConditions()) sqlBuilder.append(" ").append(buildConditionSQL());
if (limit > 0) sqlBuilder.append(" ").append(buildLimitSQL()); if (limit > 0) sqlBuilder.append(" ").append(buildLimitSQL());
if (orderBy != null) sqlBuilder.append(orderBy);
return new PreparedQueryActionImpl(getManager(), sqlBuilder.toString()) return new PreparedQueryActionImpl(getManager(), sqlBuilder.toString())
.setParams(hasConditionParams() ? params : null); .setParams(hasConditionParams() ? getConditionParams() : null);
} }
@Override @Override
@@ -59,4 +62,10 @@ public class TableQueryBuilderImpl
return this; return this;
} }
@Override
public TableQueryBuilder orderBy(@NotNull String columnName, boolean asc) {
this.orderBy = "ORDER BY `" + columnName + "` " + (asc ? "ASC" : "DESC");
return this;
}
} }
@@ -5,10 +5,10 @@ import cc.carm.lib.easysql.action.PreparedSQLUpdateActionImpl;
import cc.carm.lib.easysql.action.SQLUpdateActionImpl; import cc.carm.lib.easysql.action.SQLUpdateActionImpl;
import cc.carm.lib.easysql.action.SQLUpdateBatchActionImpl; import cc.carm.lib.easysql.action.SQLUpdateBatchActionImpl;
import cc.carm.lib.easysql.api.SQLManager; import cc.carm.lib.easysql.api.SQLManager;
import cc.carm.lib.easysql.api.action.query.SQLQuery;
import cc.carm.lib.easysql.api.action.PreparedSQLUpdateAction; import cc.carm.lib.easysql.api.action.PreparedSQLUpdateAction;
import cc.carm.lib.easysql.api.action.PreparedSQLUpdateBatchAction; import cc.carm.lib.easysql.api.action.PreparedSQLUpdateBatchAction;
import cc.carm.lib.easysql.api.action.SQLUpdateBatchAction; import cc.carm.lib.easysql.api.action.SQLUpdateBatchAction;
import cc.carm.lib.easysql.api.action.query.SQLQuery;
import cc.carm.lib.easysql.api.builder.*; import cc.carm.lib.easysql.api.builder.*;
import cc.carm.lib.easysql.builder.impl.*; import cc.carm.lib.easysql.builder.impl.*;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -1,7 +1,5 @@
package cc.carm.lib.easysql.util; package cc.carm.lib.easysql.util;
import cc.carm.lib.easysql.api.SQLAction;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.BigInteger; import java.math.BigInteger;
import java.sql.*; import java.sql.*;
@@ -40,10 +38,9 @@ public class StatementUtil {
) throws SQLException { ) throws SQLException {
sql = sql.trim(); sql = sql.trim();
PreparedStatement statement = connection.prepareStatement(sql, returnGeneratedKey ? Statement.RETURN_GENERATED_KEYS : Statement.NO_GENERATED_KEYS); PreparedStatement statement = connection.prepareStatement(sql, returnGeneratedKey ? Statement.RETURN_GENERATED_KEYS : Statement.NO_GENERATED_KEYS);
final Map<Integer, Integer> nullTypeMap = new HashMap<>(); Map<Integer, Integer> nullTypeMap = new HashMap<>();
if (params != null) { if (params != null) fillParams(statement, Arrays.asList(params), nullTypeMap);
fillParams(statement, Arrays.asList(params), nullTypeMap); statement.addBatch();
}
return statement; return statement;
} }
@@ -76,7 +73,7 @@ public class StatementUtil {
sql = sql.trim(); sql = sql.trim();
PreparedStatement statement = connection.prepareStatement(sql, returnGeneratedKey ? Statement.RETURN_GENERATED_KEYS : Statement.NO_GENERATED_KEYS); PreparedStatement statement = connection.prepareStatement(sql, returnGeneratedKey ? Statement.RETURN_GENERATED_KEYS : Statement.NO_GENERATED_KEYS);
final Map<Integer, Integer> nullTypeMap = new HashMap<>(); Map<Integer, Integer> nullTypeMap = new HashMap<>();
for (Object[] params : paramsBatch) { for (Object[] params : paramsBatch) {
fillParams(statement, Arrays.asList(params), nullTypeMap); fillParams(statement, Arrays.asList(params), nullTypeMap);
statement.addBatch(); statement.addBatch();
+36 -13
View File
@@ -4,10 +4,19 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
<sonar.organization>carmjos</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
</properties>
<groupId>cc.carm.lib</groupId> <groupId>cc.carm.lib</groupId>
<artifactId>easysql-parent</artifactId> <artifactId>easysql-parent</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>0.2.1</version> <version>0.2.5</version>
<modules> <modules>
<module>easysql-api</module> <module>easysql-api</module>
@@ -21,7 +30,7 @@
<name>EasySQL</name> <name>EasySQL</name>
<description>简单便捷的数据库操作工具,可自选连接池。</description> <description>简单便捷的数据库操作工具,可自选连接池。</description>
<url>https://github.com/CarmJos/${name}</url> <url>https://github.com/CarmJos/${project.name}</url>
<developers> <developers>
<developer> <developer>
@@ -29,12 +38,15 @@
<name>Carm Jos</name> <name>Carm Jos</name>
<email>carm@carm.cc</email> <email>carm@carm.cc</email>
<url>https://www.carm.cc</url> <url>https://www.carm.cc</url>
<roles>
<role>Main Developer</role>
</roles>
</developer> </developer>
</developers> </developers>
<scm>
<connection>scm:git:git@github.com:CarmJos/EasySQL.git</connection>
<developerConnection>scm:git:git@github.com:CarmJos/EasySQL.git</developerConnection>
<url>https://github.com/CarmJos/EasySQL</url>
</scm>
<licenses> <licenses>
<license> <license>
<name>GNU General Public License v3.0</name> <name>GNU General Public License v3.0</name>
@@ -52,13 +64,6 @@
<url>${project.url}/actions/workflows/maven.yml</url> <url>${project.url}/actions/workflows/maven.yml</url>
</ciManagement> </ciManagement>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
</properties>
<repositories> <repositories>
<repository> <repository>
@@ -123,6 +128,20 @@
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
</plugin> </plugin>
<!-- <plugin>-->
<!-- <groupId>org.apache.maven.plugins</groupId>-->
<!-- <artifactId>maven-gpg-plugin</artifactId>-->
<!-- <version>1.5</version>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <id>sign-artifacts</id>-->
<!-- <phase>verify</phase>-->
<!-- <goals>-->
<!-- <goal>sign</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
</plugins> </plugins>
<pluginManagement> <pluginManagement>
@@ -137,7 +156,11 @@
<links> <links>
<link>https://javadoc.io/doc/org.jetbrains/annotations/</link> <link>https://javadoc.io/doc/org.jetbrains/annotations/</link>
</links> </links>
<detectJavaApiLink>true</detectJavaApiLink> <detectJavaApiLink>false</detectJavaApiLink>
<encoding>UTF-8</encoding>
<charset>UTF-8</charset>
<docencoding>UTF-8</docencoding>
<locale>zh_CN</locale>
</configuration> </configuration>
<executions> <executions>
<execution> <execution>