Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sqlrest
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
comm
sqlrest
Commits
a88b41e4
Commit
a88b41e4
authored
Aug 29, 2025
by
inrgihc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码问题优化
parent
17de3fc7
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
14 deletions
+10
-14
sqlrest-cache/src/main/java/org/dromara/sqlrest/cache/redis/RedisDistributedCache.java
+4
-3
sqlrest-core/src/main/java/org/dromara/sqlrest/core/exec/module/DbVarModule.java
+3
-9
sqlrest-core/src/main/java/org/dromara/sqlrest/core/exec/module/LogVarModule.java
+3
-2
No files found.
sqlrest-cache/src/main/java/org/dromara/sqlrest/cache/redis/RedisDistributedCache.java
View file @
a88b41e4
...
...
@@ -10,15 +10,16 @@
package
org
.
dromara
.
sqlrest
.
cache
.
redis
;
import
cn.hutool.json.JSONUtil
;
import
org.dromara.sqlrest.cache.DistributedCache
;
import
java.util.Objects
;
import
java.util.concurrent.TimeUnit
;
import
org.dromara.sqlrest.cache.DistributedCache
;
public
class
RedisDistributedCache
implements
DistributedCache
{
private
final
String
FORMAT
=
"%s#%s"
;
private
static
final
String
FORMAT
=
"%s#%s"
;
private
final
String
name
;
private
JedisClient
client
;
private
final
JedisClient
client
;
public
RedisDistributedCache
(
String
name
,
JedisClient
client
)
{
this
.
name
=
Objects
.
requireNonNull
(
name
,
"cache name must not be null"
);
...
...
sqlrest-core/src/main/java/org/dromara/sqlrest/core/exec/module/DbVarModule.java
View file @
a88b41e4
...
...
@@ -18,6 +18,7 @@ import java.util.Arrays;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
javax.sql.DataSource
;
...
...
@@ -59,11 +60,7 @@ public class DbVarModule implements VarModuleInterface {
this
.
jdbcTemplate
=
new
JdbcTemplate
(
dataSource
);
this
.
productType
=
productType
;
this
.
params
=
params
;
if
(
null
==
strategy
)
{
strategy
=
NamingStrategyEnum
.
NONE
;
}
this
.
converter
=
strategy
.
getFunction
();
this
.
converter
=
Optional
.
ofNullable
(
strategy
).
orElse
(
NamingStrategyEnum
.
NONE
).
getFunction
();
this
.
printSqlLog
=
printSqlLog
;
}
...
...
@@ -84,10 +81,7 @@ public class DbVarModule implements VarModuleInterface {
}
private
Map
<
String
,
Object
>
build
(
Map
<
String
,
Object
>
row
)
{
if
(
null
==
row
)
{
return
null
;
}
return
ConvertUtils
.
to
(
row
,
converter
);
return
Optional
.
ofNullable
(
row
).
map
(
r
->
ConvertUtils
.
to
(
r
,
converter
)).
orElse
(
null
);
}
private
List
<
Map
<
String
,
Object
>>
build
(
List
<
Map
<
String
,
Object
>>
rows
)
{
...
...
sqlrest-core/src/main/java/org/dromara/sqlrest/core/exec/module/LogVarModule.java
View file @
a88b41e4
...
...
@@ -9,12 +9,12 @@
/////////////////////////////////////////////////////////////
package
org
.
dromara
.
sqlrest
.
core
.
exec
.
module
;
import
java.text.MessageFormat
;
import
lombok.NoArgsConstructor
;
import
org.dromara.sqlrest.common.service.VarModuleInterface
;
import
org.dromara.sqlrest.core.exec.annotation.Comment
;
import
org.dromara.sqlrest.core.exec.annotation.Module
;
import
org.dromara.sqlrest.core.exec.logger.DebugExecuteLogger
;
import
org.slf4j.helpers.MessageFormatter
;
import
org.springframework.stereotype.Service
;
@Service
...
...
@@ -31,6 +31,7 @@ public class LogVarModule implements VarModuleInterface {
@Comment
(
"打印调试日志信息"
)
public
void
print
(
@Comment
(
"message"
)
String
message
,
Object
...
arguments
)
{
DebugExecuteLogger
.
add
(
MessageFormat
.
format
(
message
,
arguments
));
// https://blog.csdn.net/weixin_44792849/article/details/131854226
DebugExecuteLogger
.
add
(
MessageFormatter
.
arrayFormat
(
message
,
arguments
).
getMessage
());
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment