Skip to content

Commit

Permalink
Merge branch 'dev' into 5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
chenrenfei committed Nov 7, 2023
2 parents c3db69b + a3fb7d5 commit 63a67ee
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 12 deletions.
4 changes: 2 additions & 2 deletions trunk/sqltoy-orm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
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>
<groupId>com.sagframe</groupId>
<version>5.2.75</version>
<version>5.2.76</version>
<name>sagacity-sqltoy</name>
<description>sagacity-sqltoy</description>
<artifactId>sagacity-sqltoy</artifactId>
Expand All @@ -19,7 +19,7 @@
<httpclient-httpmime.version>4.5.14</httpclient-httpmime.version>
<httpclient-core.version>4.4.16</httpclient-core.version>
<elastic-rest-client.version>8.10.4</elastic-rest-client.version>
<fastjson.version>2.0.41</fastjson.version>
<fastjson.version>2.0.42</fastjson.version>
<mongo.version>3.12.14</mongo.version>
<junit-jupiter.version>5.10.0</junit-jupiter.version>
<junit-platform.version>1.10.0</junit-platform.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,19 @@ public static QueryResult findBySql(final SqlToyContext sqlToyContext, final Sql
lastSql = SqlUtilsExt.signSql(lastSql, dbType, sqlToyConfig);
// 打印sql
SqlExecuteStat.showSql("执行查询", lastSql, paramsValue);
PreparedStatement pst = conn.prepareStatement(lastSql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
if (fetchSize > 0) {
pst.setFetchSize(fetchSize);
}
if (maxRows > 0) {
pst.setMaxRows(maxRows);
PreparedStatement pst = null;
// 常规单查询语句
if (!extend.sqlSegment) {
pst = conn.prepareStatement(lastSql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
if (fetchSize > 0) {
pst.setFetchSize(fetchSize);
}
if (maxRows > 0) {
pst.setMaxRows(maxRows);
}
} else {
// sql段落,含多句sql(正常不使用)
pst = conn.prepareStatement(lastSql);
}
ResultSet rs = null;
return (QueryResult) SqlUtil.preparedStatementProcess(null, pst, rs, new PreparedStatementResultHandler() {
Expand Down Expand Up @@ -621,7 +628,7 @@ public static Long saveOrUpdateAll(SqlToyContext sqlToyContext, List<?> entities
for (int meter = 0; meter < relatedColumnSize; meter++) {
relatedColValue[meter] = rowData[relatedColumn[meter]];
}
//这里不做是否为null的校验,因为不明确是新增还是修改
// 这里不做是否为null的校验,因为不明确是新增还是修改
}
// 主键
if (hasId && StringUtil.isBlank(rowData[pkIndex])) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,16 @@ public QueryExecutor showSql(Boolean showSql) {
return this;
}

/**
* @TODO 是否是sql片段,即不是单独的一句查询(正常无需使用)
* @param sqlSegment
* @return
*/
public QueryExecutor sqlSegment(boolean sqlSegment) {
innerModel.sqlSegment = sqlSegment;
return this;
}

public QueryExecutorExtend getInnerModel() {
return innerModel;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ public class QueryExecutorExtend implements Serializable {
*/
public Class entityClass = null;

/**
* 是否是sql片段(正常无需使用)
*/
public boolean sqlSegment = false;

// 分表策略配置
public List<ShardingStrategyConfig> tableShardings = new ArrayList<ShardingStrategyConfig>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public static void process(RowsChainRelativeModel rowsRelative, LabelIndexModel
divedData = Double.parseDouble(divedRowList.get(colIndex).toString());
}
if (divedData == 0) {
divRowList.set(colIndex + 1, (divData == 0) ? 0 : "");
divRowList.set(colIndex + 1, (divData == 0) ? 0 : defaultValue);
} else {
value = new BigDecimal(((divData - ((isIncrement) ? divedData : 0)) * multiply) / divedData)
.setScale(radixSize, RoundingMode.FLOOR);
Expand Down
4 changes: 2 additions & 2 deletions trunk/sqltoy-spring-boot-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.sagframe</groupId>
<version>5.2.75</version>
<version>5.2.76</version>
<name>sagacity-sqltoy-starter</name>
<artifactId>sagacity-sqltoy-starter</artifactId>
<description>sqltoy springboot starter</description>
<url>https://github.com/sagframe/sagacity-sqltoy</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring-boot.version>2.7.17</spring-boot.version>
<sqltoy.version>5.2.75</sqltoy.version>
<sqltoy.version>5.2.76</sqltoy.version>
</properties>
<licenses>
<license>
Expand Down

0 comments on commit 63a67ee

Please sign in to comment.