Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
common
Project
Project
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
曲欣亮
common
Commits
c0b08c84
Commit
c0b08c84
authored
Mar 12, 2020
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
61b8a8bd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
163 additions
and
125 deletions
+163
-125
pom.xml
pom.xml
+125
-120
JdbcTemplate.java
src/main/java/com/egolm/common/jdbc/JdbcTemplate.java
+38
-5
No files found.
pom.xml
View file @
c0b08c84
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
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.egolm
</groupId>
<artifactId>
common
</artifactId>
<version>
0.0.1-RELEASE
</version>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-webmvc
</artifactId>
<version>
4.2.4.RELEASE
</version>
</dependency>
<dependency>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-jdbc
</artifactId>
<version>
4.2.4.RELEASE
</version>
</dependency>
<dependency>
<groupId>
org.springframework.data
</groupId>
<artifactId>
spring-data-redis
</artifactId>
<version>
1.8.3.RELEASE
</version>
</dependency>
<dependency>
<groupId>
cglib
</groupId>
<artifactId>
cglib-full
</artifactId>
<version>
2.0.2
</version>
</dependency>
<dependency>
<groupId>
com.belerweb
</groupId>
<artifactId>
pinyin4j
</artifactId>
<version>
2.5.0
</version>
</dependency>
<dependency>
<groupId>
log4j
</groupId>
<artifactId>
log4j
</artifactId>
<version>
1.2.16
</version>
</dependency>
<dependency>
<groupId>
commons-codec
</groupId>
<artifactId>
commons-codec
</artifactId>
<version>
1.10
</version>
</dependency>
<dependency>
<groupId>
com.google.code.gson
</groupId>
<artifactId>
gson
</artifactId>
<version>
2.8.2
</version>
</dependency>
<dependency>
<groupId>
javax.servlet
</groupId>
<artifactId>
javax.servlet-api
</artifactId>
<version>
3.0.1
</version>
</dependency>
<dependency>
<groupId>
javax.persistence
</groupId>
<artifactId>
persistence-api
</artifactId>
<version>
1.0.2
</version>
</dependency>
<dependency>
<groupId>
javax.mail
</groupId>
<artifactId>
javax.mail-api
</artifactId>
<version>
1.5.0-b01
</version>
</dependency>
<dependency>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi
</artifactId>
<version>
3.8
</version>
</dependency>
<dependency>
<groupId>
org.bouncycastle
</groupId>
<artifactId>
bcprov-jdk16
</artifactId>
<version>
1.46
</version>
</dependency>
<dependency>
<groupId>
com.jcraft
</groupId>
<artifactId>
jsch
</artifactId>
<version>
0.1.54
</version>
</dependency>
<dependency>
<groupId>
commons-net
</groupId>
<artifactId>
commons-net
</artifactId>
<version>
3.4
</version>
</dependency>
<dependency>
<groupId>
dom4j
</groupId>
<artifactId>
dom4j
</artifactId>
<version>
1.6.1
</version>
</dependency>
<dependency>
<groupId>
org.apache.httpcomponents
</groupId>
<artifactId>
httpclient
</artifactId>
<version>
4.5.2
</version>
</dependency>
<dependency>
<groupId>
commons-httpclient
</groupId>
<artifactId>
commons-httpclient
</artifactId>
<version>
3.1
</version>
</dependency>
<dependency>
<groupId>
com.sun.mail
</groupId>
<artifactId>
javax.mail
</artifactId>
<version>
1.6.1
</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>
maven-compiler-plugin
</artifactId>
<version>
3.3
</version>
<configuration>
<source>
1.8
</source>
<target>
1.8
</target>
</configuration>
</plugin>
</plugins>
</build>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
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.egolm
</groupId>
<artifactId>
common
</artifactId>
<version>
0.0.1-RELEASE
</version>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-webmvc
</artifactId>
<version>
4.2.4.RELEASE
</version>
</dependency>
<dependency>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-jdbc
</artifactId>
<version>
4.2.4.RELEASE
</version>
</dependency>
<dependency>
<groupId>
org.springframework.data
</groupId>
<artifactId>
spring-data-redis
</artifactId>
<version>
1.8.3.RELEASE
</version>
</dependency>
<dependency>
<groupId>
cglib
</groupId>
<artifactId>
cglib-full
</artifactId>
<version>
2.0.2
</version>
</dependency>
<dependency>
<groupId>
com.belerweb
</groupId>
<artifactId>
pinyin4j
</artifactId>
<version>
2.5.0
</version>
</dependency>
<dependency>
<groupId>
log4j
</groupId>
<artifactId>
log4j
</artifactId>
<version>
1.2.16
</version>
</dependency>
<dependency>
<groupId>
commons-codec
</groupId>
<artifactId>
commons-codec
</artifactId>
<version>
1.10
</version>
</dependency>
<dependency>
<groupId>
com.google.code.gson
</groupId>
<artifactId>
gson
</artifactId>
<version>
2.8.2
</version>
</dependency>
<dependency>
<groupId>
javax.servlet
</groupId>
<artifactId>
javax.servlet-api
</artifactId>
<version>
3.0.1
</version>
</dependency>
<dependency>
<groupId>
javax.persistence
</groupId>
<artifactId>
persistence-api
</artifactId>
<version>
1.0.2
</version>
</dependency>
<dependency>
<groupId>
javax.mail
</groupId>
<artifactId>
javax.mail-api
</artifactId>
<version>
1.5.0-b01
</version>
</dependency>
<dependency>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi
</artifactId>
<version>
3.8
</version>
</dependency>
<dependency>
<groupId>
org.bouncycastle
</groupId>
<artifactId>
bcprov-jdk16
</artifactId>
<version>
1.46
</version>
</dependency>
<dependency>
<groupId>
com.jcraft
</groupId>
<artifactId>
jsch
</artifactId>
<version>
0.1.54
</version>
</dependency>
<dependency>
<groupId>
commons-net
</groupId>
<artifactId>
commons-net
</artifactId>
<version>
3.4
</version>
</dependency>
<dependency>
<groupId>
dom4j
</groupId>
<artifactId>
dom4j
</artifactId>
<version>
1.6.1
</version>
</dependency>
<dependency>
<groupId>
org.apache.httpcomponents
</groupId>
<artifactId>
httpclient
</artifactId>
<version>
4.5.2
</version>
</dependency>
<dependency>
<groupId>
commons-httpclient
</groupId>
<artifactId>
commons-httpclient
</artifactId>
<version>
3.1
</version>
</dependency>
<dependency>
<groupId>
com.sun.mail
</groupId>
<artifactId>
javax.mail
</artifactId>
<version>
1.6.1
</version>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
fastjson
</artifactId>
<version>
1.2.62
</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>
maven-compiler-plugin
</artifactId>
<version>
3.3
</version>
<configuration>
<source>
1.8
</source>
<target>
1.8
</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
src/main/java/com/egolm/common/jdbc/JdbcTemplate.java
View file @
c0b08c84
...
...
@@ -2,6 +2,8 @@ package com.egolm.common.jdbc;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Modifier
;
import
java.math.BigDecimal
;
import
java.math.BigInteger
;
import
java.sql.CallableStatement
;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
...
...
@@ -24,6 +26,7 @@ import org.springframework.jdbc.support.GeneratedKeyHolder;
import
org.springframework.jdbc.support.KeyHolder
;
import
com.egolm.common.DateUtil
;
import
com.egolm.common.GsonUtil
;
import
com.egolm.common.ReflexUtil
;
import
com.egolm.common.StringUtil
;
import
com.egolm.common.Util
;
...
...
@@ -586,14 +589,44 @@ public class JdbcTemplate extends org.springframework.jdbc.core.JdbcTemplate {
public
void
setValue
(
Object
value
)
{
this
.
value
=
value
;
}
public
Number
getNumber
(
)
{
return
(
Number
)
value
;
public
<
T
>
T
getValue
(
Class
<
T
>
requireType
)
{
return
Util
.
objTo
(
this
.
getValue
(),
requireType
)
;
}
public
String
getString
()
{
return
(
String
)
value
;
return
this
.
getValue
(
String
.
class
)
;
}
public
Date
getDate
()
{
return
(
Date
)
value
;
return
this
.
getValue
(
Date
.
class
);
}
public
Number
getNumber
()
{
return
(
Number
)
value
;
}
public
Long
getLong
()
{
return
this
.
getValue
(
Long
.
class
);
}
public
Integer
getInteger
()
{
return
this
.
getValue
(
Integer
.
class
);
}
public
BigDecimal
getBigDecimal
()
{
return
this
.
getValue
(
BigDecimal
.
class
);
}
public
BigInteger
getBigInteger
()
{
return
this
.
getValue
(
BigInteger
.
class
);
}
public
Double
getDouble
()
{
return
this
.
getValue
(
Double
.
class
);
}
public
Float
getFloat
()
{
return
this
.
getValue
(
Float
.
class
);
}
public
Short
getShort
()
{
return
this
.
getValue
(
Short
.
class
);
}
public
Byte
getByte
()
{
return
this
.
getValue
(
Byte
.
class
);
}
public
Boolean
getBoolean
()
{
return
this
.
getValue
(
Boolean
.
class
);
}
}
...
...
@@ -641,7 +674,7 @@ public class JdbcTemplate extends org.springframework.jdbc.core.JdbcTemplate {
if
(
sql_level
==
1
)
{
logger
.
debug
(
sql
);
}
else
if
(
sql_level
>
1
)
{
logger
.
debug
(
sql
+
" "
+
String
Util
.
toJson
(
args
));
logger
.
debug
(
sql
+
" "
+
Gson
Util
.
toJson
(
args
));
}
}
...
...
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