更新mybatis-generator配置文件

This commit is contained in:
lixiangrong 2016-04-09 23:38:02 +08:00
parent 398853c3a2
commit 144ba4c19e
5 changed files with 52 additions and 24 deletions

View File

@ -173,6 +173,13 @@
<verbose>true</verbose> <verbose>true</verbose>
<overwrite>true</overwrite> <overwrite>true</overwrite>
</configuration> </configuration>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.38</version>
</dependency>
</dependencies>
</plugin> </plugin>
<!-- 指定JDK编译版本 --> <!-- 指定JDK编译版本 -->

View File

@ -3,20 +3,11 @@ package osc.git.eh3.test;
import java.sql.Connection; import java.sql.Connection;
import java.sql.DriverManager; import java.sql.DriverManager;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID; import java.util.UUID;
import net.sf.json.JSONObject; public class TestJdbc143 {
import osc.git.eh3.redis.JedisUtil;
public class TestJdbc3 {
private static Connection getConn() { private static Connection getConn() {
String driver = "com.mysql.jdbc.Driver"; String driver = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://115.182.33.143:3306/wins-dsp-new?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&connectTimeout=60000&socketTimeout=60000"; String url = "jdbc:mysql://115.182.33.143:3306/wins-dsp-new?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&connectTimeout=60000&socketTimeout=60000";
@ -36,6 +27,7 @@ public class TestJdbc3 {
public static void main(String[] args) { public static void main(String[] args) {
insertData(); insertData();
// updateData();
} }
private static void insertData(){ private static void insertData(){
@ -45,6 +37,26 @@ public class TestJdbc3 {
String cid = UUID.randomUUID().toString(); String cid = UUID.randomUUID().toString();
String sql = "INSERT INTO `dsp_t_statis_by_day` (`time`, `creativeid`, `category`, `imprs`, `clks`, `cost`, `downloads`, `regists`, `flag`, `createtime`) VALUES ('2014-12-06 00:00:00', '"+cid+"', '2', '961', '9', '201860.7000', '0', '0', '0', '2015-09-14 15:07:42');"; String sql = "INSERT INTO `dsp_t_statis_by_day` (`time`, `creativeid`, `category`, `imprs`, `clks`, `cost`, `downloads`, `regists`, `flag`, `createtime`) VALUES ('2014-12-06 00:00:00', '"+cid+"', '2', '961', '9', '201860.7000', '0', '0', '0', '2015-09-14 15:07:42');";
PreparedStatement pstmt; PreparedStatement pstmt;
try {
pstmt = (PreparedStatement) conn.prepareStatement(sql);
pstmt.executeUpdate();
if(i%200 == 0){
Thread.sleep(200);
}
} catch (Exception e) {
e.printStackTrace();
}
}
System.out.println(new Date());
}
private static void updateData(){
Connection conn = getConn();
System.out.println(new Date());
for (int i = 0; i < 800; i++) {
String sql = "UPDATE `dsp_t_statis_by_day` SET `clks`='"+i+"' WHERE `creativeid`='068860ba-2df2-42cb-bf66-f0515c5a83aa'";
PreparedStatement pstmt;
try { try {
pstmt = (PreparedStatement) conn.prepareStatement(sql); pstmt = (PreparedStatement) conn.prepareStatement(sql);
pstmt.executeUpdate(); pstmt.executeUpdate();

View File

@ -3,23 +3,14 @@ package osc.git.eh3.test;
import java.sql.Connection; import java.sql.Connection;
import java.sql.DriverManager; import java.sql.DriverManager;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID; import java.util.UUID;
import net.sf.json.JSONObject; public class TestJdbc26 {
import osc.git.eh3.redis.JedisUtil;
public class TestJdbc2 {
private static Connection getConn() { private static Connection getConn() {
String driver = "com.mysql.jdbc.Driver"; String driver = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://192.168.3.11:3306/wins-dsp-new?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&connectTimeout=60000&socketTimeout=60000"; String url = "jdbc:mysql://111.235.158.26:3306/wins-dsp-new?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&connectTimeout=60000&socketTimeout=60000";
String username = "root"; String username = "root";
String password = "pxene"; String password = "pxene";
Connection conn = null; Connection conn = null;
@ -36,6 +27,7 @@ public class TestJdbc2 {
public static void main(String[] args) { public static void main(String[] args) {
insertData(); insertData();
// updateData();
} }
private static void insertData(){ private static void insertData(){
@ -45,6 +37,25 @@ public class TestJdbc2 {
String cid = UUID.randomUUID().toString(); String cid = UUID.randomUUID().toString();
String sql = "INSERT INTO `dsp_t_statis_by_day` (`time`, `creativeid`, `category`, `imprs`, `clks`, `cost`, `downloads`, `regists`, `flag`, `createtime`) VALUES ('2014-12-06 00:00:00', '"+cid+"', '2', '961', '9', '201860.7000', '0', '0', '0', '2015-09-14 15:07:42');"; String sql = "INSERT INTO `dsp_t_statis_by_day` (`time`, `creativeid`, `category`, `imprs`, `clks`, `cost`, `downloads`, `regists`, `flag`, `createtime`) VALUES ('2014-12-06 00:00:00', '"+cid+"', '2', '961', '9', '201860.7000', '0', '0', '0', '2015-09-14 15:07:42');";
PreparedStatement pstmt; PreparedStatement pstmt;
try {
pstmt = (PreparedStatement) conn.prepareStatement(sql);
pstmt.executeUpdate();
if(i%200 == 0){
Thread.sleep(200);
}
} catch (Exception e) {
e.printStackTrace();
}
}
System.out.println(new Date());
}
private static void updateData(){
Connection conn = getConn();
System.out.println(new Date());
for (int i = 0; i < 800; i++) {
String sql = "UPDATE `dsp_t_statis_by_day` SET `clks`='"+i+"' WHERE `creativeid`='068860ba-2df2-42cb-bf66-f0515c5a83aa'";
PreparedStatement pstmt;
try { try {
pstmt = (PreparedStatement) conn.prepareStatement(sql); pstmt = (PreparedStatement) conn.prepareStatement(sql);
pstmt.executeUpdate(); pstmt.executeUpdate();

View File

@ -9,7 +9,7 @@ public class TestRedisData {
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
showSom("27ef277d-25e7-4347-b07f-9668a8a802cd"); showSom("b8093670-ceb0-4c1d-9413-8bb23a1217f2");
} }
public static void showSom(String groupid){ public static void showSom(String groupid){

View File

@ -3,7 +3,6 @@
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"> "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration> <generatorConfiguration>
<classPathEntry location="C:\Users\lixiangrong\.m2\repository\mysql\mysql-connector-java\5.1.38\mysql-connector-java-5.1.38.jar"/>
<context id="MySQL" targetRuntime="MyBatis3"> <context id="MySQL" targetRuntime="MyBatis3">
<commentGenerator> <commentGenerator>
<property name="suppressDate" value="true"/> <property name="suppressDate" value="true"/>
@ -27,5 +26,4 @@
<table tableName="dsp_t_geohash_precision" domainObjectName="GeohashPrecisionModel" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true"></table> <table tableName="dsp_t_geohash_precision" domainObjectName="GeohashPrecisionModel" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true"></table>
</context> </context>
</generatorConfiguration> </generatorConfiguration>