Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
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
YZG
yzg-util
Commits
d3ed698b
Commit
d3ed698b
authored
Sep 15, 2021
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改实例化关系
parent
b96db6b2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
9 deletions
+18
-9
DbPrintSql.java
...-db/src/main/java/com/yanzuoguang/db/impl/DbPrintSql.java
+18
-9
No files found.
yzg-util-db/src/main/java/com/yanzuoguang/db/impl/DbPrintSql.java
View file @
d3ed698b
...
...
@@ -29,12 +29,17 @@ public class DbPrintSql {
// 进行SQL语句参数替换,后面增加一个空格,方便后续用正则表达式进行替换处理
String
[]
split
=
sql
.
split
(
"\\?"
);
// 参数位置
int
pos
=
0
;
// 循环获取参数
while
(
pos
<
split
.
length
)
{
// 获取位置信息
sb
.
append
(
split
[
pos
]);
// 获取位置
if
(
pos
==
split
.
length
-
1
)
{
break
;
}
// 获取对象
Object
item
=
paras
.
length
>
pos
?
paras
[
pos
]
:
null
;
String
str
=
StringHelper
.
toString
(
item
);
String
strTo
=
str
;
...
...
@@ -64,6 +69,7 @@ public class DbPrintSql {
* @param paras 参数
*/
public
void
print
(
Class
targetClass
,
String
sqlName
,
long
start
,
int
row
,
String
sql
,
Object
...
paras
)
{
try
{
// 日志表忽略打印
if
(!
configDb
.
isPrintSql
())
{
return
;
...
...
@@ -76,5 +82,8 @@ public class DbPrintSql {
sql
=
getStringSql
(
sql
,
paras
);
// 打印SQL语句
Log
.
infoTag
(
DbPrintSql
.
class
,
String
.
format
(
"%d row %s.%s"
,
row
,
targetClass
.
getSimpleName
(),
sqlName
),
sql
);
}
catch
(
Exception
ex
)
{
Log
.
error
(
DbPrintSql
.
class
,
ex
);
}
}
}
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