Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gjjs-bd-common
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
s_guodong
gjjs-bd-common
Commits
18a2664d
Commit
18a2664d
authored
Nov 02, 2023
by
s_guodong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
时间格式转换
parent
9cddcd4b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
12 deletions
+17
-12
MyBatisDaoSession.java
...com/brilliance/mda/support/mybatis/MyBatisDaoSession.java
+17
-12
No files found.
gjjs-bd-mybatis-support/src/main/java/com/brilliance/mda/support/mybatis/MyBatisDaoSession.java
View file @
18a2664d
...
...
@@ -15,6 +15,7 @@ import com.brilliance.mda.support.mybatis.dync.mapper.DbExecuteMapper;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
jdk.nashorn.internal.ir.annotations.Ignore
;
import
oracle.sql.TIMESTAMP
;
import
org.apache.commons.beanutils.MethodUtils
;
import
org.mybatis.spring.SqlSessionTemplate
;
import
org.slf4j.Logger
;
...
...
@@ -309,27 +310,29 @@ public class MyBatisDaoSession extends AbstractDaoSession implements IDaoSession
method
.
invoke
(
module
,
((
BigDecimal
)
fieldVal
).
intValue
());
}
else
{
//如果是CLOB类型的数据,将数据转换为String
if
(
fieldVal
instanceof
oracle
.
sql
.
CLOB
)
{
try
(
Reader
rsReader
=
((
oracle
.
sql
.
CLOB
)
fieldVal
).
getCharacterStream
())
{
char
[]
chs
=
new
char
[
2048
];
if
(
fieldVal
instanceof
oracle
.
sql
.
CLOB
)
{
try
(
Reader
rsReader
=
((
oracle
.
sql
.
CLOB
)
fieldVal
).
getCharacterStream
())
{
char
[]
chs
=
new
char
[
2048
];
StringBuffer
sb
=
new
StringBuffer
();
int
i
=
0
;
while
((
i
=
rsReader
.
read
(
chs
))!=
-
1
)
{
sb
.
append
(
chs
,
0
,
i
);
int
i
=
0
;
while
((
i
=
rsReader
.
read
(
chs
))
!=
-
1
)
{
sb
.
append
(
chs
,
0
,
i
);
}
System
.
out
.
println
(
"clob to string >>"
+
sb
.
toString
());
System
.
out
.
println
(
"clob to string >>"
+
sb
.
toString
());
method
.
invoke
(
module
,
sb
.
toString
());
}
catch
(
Exception
e
)
{
log
.
error
(
"执行方法{}时CLOB类型数据转String异常"
,
methodName
);
}
catch
(
Exception
e
)
{
log
.
error
(
"执行方法{}时CLOB类型数据转String异常"
,
methodName
);
}
}
else
{
}
else
if
(
fieldVal
instanceof
TIMESTAMP
)
{
TIMESTAMP
a
=
(
TIMESTAMP
)
fieldVal
;
fieldVal
=
a
.
dateValue
();
method
.
invoke
(
module
,
fieldVal
);
}
else
{
method
.
invoke
(
module
,
fieldVal
);
}
}
}
}
catch
(
InvocationTargetException
e
)
{
e
.
printStackTrace
();
}
catch
(
NoSuchMethodException
e
)
{
log
.
info
(
"类{}中,根据方法名{},入参类型{}未找到方法"
,
iModule
.
getDataClass
().
getName
(),
methodName
,
field
.
getType
());
throw
new
RuleExecuteException
(
"执行方法出错"
,
e
);
...
...
@@ -340,6 +343,8 @@ public class MyBatisDaoSession extends AbstractDaoSession implements IDaoSession
log
.
error
(
"类{}执行方法{},需要入参类型{},实际传入参数类型{}"
,
iModule
.
getDataClass
().
getName
(),
methodName
,
field
.
getType
(),
fieldVal
.
getClass
().
getName
());
throw
new
RuleExecuteException
(
"执行方法出错"
,
e
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
...
...
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