Browse Source

依赖调整

= 7 years ago
parent
commit
631d68dd9e

+ 165 - 165
build.gradle

@@ -1,183 +1,183 @@
 ext {
-	configuration = [
-			javaVersion = JavaVersion.VERSION_1_7
-	]
-
-	libraries = [
-			mybatisSpringVersion = '1.3.1',
-			mybatisVersion = '3.4.5',
-			springVersion = '4.3.5.RELEASE',
-            springBootVersion = '1.5.9.RELEASE',
-	]
-
-	dependencies = [
-			"jsqlparser": "com.github.jsqlparser:jsqlparser:1.1",
-			"mybatis-spring": "org.mybatis:mybatis-spring:${mybatisSpringVersion}",
-			"mybatis": "org.mybatis:mybatis:${mybatisVersion}",
-			"spring-context-support":"org.springframework:spring-context-support:${springVersion}",
-            "spring-jdbc":"org.springframework:spring-jdbc:${springVersion}",
-            "spring-tx":"org.springframework:spring-tx:${springVersion}",
-
-            "aspectjweaver":"org.aspectj:aspectjweaver:1.8.9",
-            "mockito":"org.mockito:mockito-core:2.13.0",
-            "mybatis-ehcache":"org.mybatis.caches:mybatis-ehcache:1.1.0",
-            "slf4j-api":"org.slf4j:slf4j-api:1.7.25",
-            "logback-classic":"ch.qos.logback:logback-classic:1.2.2",
-            //test
-            "spring-test":"org.springframework:spring-test:${springVersion}",
-            "junit":"junit:junit:4.12",
-            "lombok":"org.projectlombok:lombok:1.16.16",
-			"fastjson":"com.alibaba:fastjson:1.2.37",
-			"tomcatjdbc":"org.apache.tomcat:tomcat-jdbc:9.0.2",
-            //datasource
-            "hikaricp":"com.zaxxer:HikariCP:2.7.0",
-            "druid":"com.alibaba:druid:1.0.29",
-            "commons-dbcp2":"org.apache.commons:commons-dbcp2:2.1.1",
-            "sqlserver":"com.microsoft.sqlserver:sqljdbc4:4.0",
-            "postgresql":"org.postgresql:postgresql:9.4.1212",
-            "oracle":"com.oracle:ojdbc14:10.2.0.5.0",
-            "h2":"com.h2database:h2:1.4.194",
-            "mysql":"mysql:mysql-connector-java:5.1.38",
-            //code generator
-            "velocity":"org.apache.velocity:velocity-engine-core:2.0",
-			"freemarker":"org.freemarker:freemarker:2.3.9",
-	]
+    configuration = [
+        javaVersion = JavaVersion.VERSION_1_7
+    ]
+
+    libraries = [
+        mybatisSpringVersion = '1.3.1',
+        mybatisVersion = '3.4.5',
+        springVersion = '4.3.5.RELEASE',
+        springBootVersion = '1.5.9.RELEASE',
+    ]
+
+    dependencies = [
+        "jsqlparser"            : "com.github.jsqlparser:jsqlparser:1.1",
+        "mybatis-spring"        : "org.mybatis:mybatis-spring:${mybatisSpringVersion}",
+        "mybatis"               : "org.mybatis:mybatis:${mybatisVersion}",
+        "spring-context-support": "org.springframework:spring-context-support:${springVersion}",
+        "spring-jdbc"           : "org.springframework:spring-jdbc:${springVersion}",
+        "spring-tx"             : "org.springframework:spring-tx:${springVersion}",
+
+        "aspectjweaver"         : "org.aspectj:aspectjweaver:1.8.9",
+        "mockito"               : "org.mockito:mockito-core:2.13.0",
+        "mybatis-ehcache"       : "org.mybatis.caches:mybatis-ehcache:1.1.0",
+        "slf4j-api"             : "org.slf4j:slf4j-api:1.7.25",
+        "logback-classic"       : "ch.qos.logback:logback-classic:1.2.2",
+        //test
+        "spring-test"           : "org.springframework:spring-test:${springVersion}",
+        "junit"                 : "junit:junit:4.12",
+        "lombok"                : "org.projectlombok:lombok:1.16.16",
+        "fastjson"              : "com.alibaba:fastjson:1.2.37",
+        "tomcatjdbc"            : "org.apache.tomcat:tomcat-jdbc:9.0.2",
+        //datasource
+        "hikaricp"              : "com.zaxxer:HikariCP:2.7.0",
+        "druid"                 : "com.alibaba:druid:1.0.29",
+        "commons-dbcp2"         : "org.apache.commons:commons-dbcp2:2.1.1",
+        "sqlserver"             : "com.microsoft.sqlserver:sqljdbc4:4.0",
+        "postgresql"            : "org.postgresql:postgresql:9.4.1212",
+        "oracle"                : "com.oracle:ojdbc14:10.2.0.5.0",
+        "h2"                    : "com.h2database:h2:1.4.194",
+        "mysql"                 : "mysql:mysql-connector-java:5.1.38",
+        //code generator
+        "velocity"              : "org.apache.velocity:velocity-engine-core:2.0",
+        "freemarker"            : "org.freemarker:freemarker:2.3.9",
+    ]
 }
 
-allprojects{
-	group = 'com.baomidou'
-	version = '3.0.1-SNAPSHOT'
+allprojects {
+    group = 'com.baomidou'
+    version = '3.0.1-SNAPSHOT'
 }
 
 
 description = "Mybatis 增强工具包 - 只做增强不做改变,简化CRUD操作"
 
 buildscript {
-	repositories {
-		maven { url "https://repo.spring.io/plugins-release" }
-	}
-	dependencies {
-		classpath("org.springframework.build.gradle:propdeps-plugin:0.0.7")
-	}
+    repositories {
+        maven { url "https://repo.spring.io/plugins-release" }
+    }
+    dependencies {
+        classpath("org.springframework.build.gradle:propdeps-plugin:0.0.7")
+    }
 }
 
 configure(subprojects) {
-	apply plugin: 'propdeps'
-	apply plugin: 'propdeps-idea'
-	apply plugin: 'propdeps-eclipse'
+    apply plugin: 'propdeps'
+    apply plugin: 'propdeps-idea'
+    apply plugin: 'propdeps-eclipse'
 }
 
-subprojects{
+subprojects {
 
-	apply plugin: 'java'
-	apply plugin: 'signing'
+    apply plugin: 'java'
+    apply plugin: 'signing'
     apply plugin: 'maven-deploy'
 
-	sourceCompatibility = "${javaVersion}"
-	targetCompatibility = "${javaVersion}"
-
-	//noinspection GroovyAssignabilityCheck
-	tasks.withType(JavaCompile) {
-		options.encoding = 'UTF-8'
-	}
-
-	repositories {
-		mavenLocal()
-		maven { url "http://maven.aliyun.com/nexus/content/groups/public/" }
-		maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
-		maven { url "http://www.cameliatk.jp/maven2/repository/thirdparty"}
-		jcenter()
-	}
-
-	task sourcesJar(type: Jar, dependsOn: classes) {
-		classifier = 'sources'
-		from sourceSets.main.allSource
-	}
-
-	javadoc {
-		options {
-			encoding "UTF-8"
-			charSet 'UTF-8'
-			author true
-			version true
-			failOnError false
-			links "http://docs.oracle.com/javase/7/docs/api"
-		}
-	}
-
-	task javadocJar(type: Jar, dependsOn: javadoc) {
-		classifier = 'javadoc'
-		from 'build/docs/javadoc'
-	}
-
-	artifacts {
-		archives sourcesJar
-		archives javadocJar
-	}
-
-	tasks.whenTaskAdded { task ->
-		if (task.name.contains('uploadArchives')||task.name.contains("signArchives")){
-			task.enabled = new File(project.property('signing.secretKeyRingFile') as String).isFile()
-		}
-	}
-
-	signing {
-		sign configurations.archives
-	}
-
-	// gradle clean build uploadArchives -Dun=用户名 -Dps=密码 -x test
-	uploadArchives {
-		repositories {
-			mavenDeployer {
-				beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
-				def userName = System.getProperty("un")
-				def passWord = System.getProperty("ps")
-				repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
-					//noinspection GroovyAssignabilityCheck
-					authentication(userName: userName, password: passWord)
-				}
-
-				snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
-					//noinspection GroovyAssignabilityCheck
-					authentication(userName: userName, password: passWord)
-				}
-
-				pom.version = "$project.version"
-				pom.artifactId = "$project.name"
-				pom.groupId = "$project.group"
-				pom.project {
-					//noinspection GroovyAssignabilityCheck
-					name 'mybatis-plus'
-					packaging 'jar'
-					description 'An enhanced toolkit of Mybatis to simplify development.'
-					url 'https://github.com/baomidou/mybatis-plus'
-
-					scm {
-						connection 'scm:git@github.com:Codearte/gradle-nexus-staging-plugin.git'
-						developerConnection 'scm:git@github.com:Codearte/gradle-nexus-staging-plugin.git'
-						url 'https://github.com/baomidou/mybatis-plus'
-					}
-
-					licenses {
-						license {
-							//noinspection GroovyAssignabilityCheck
-							name 'The Apache License, Version 2.0'
-							url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
-						}
-					}
-
-					developers {
-						developer {
-							id 'baomidou'
-							//noinspection GroovyAssignabilityCheck
-							name 'hubin'
-							email 'jobob@qq.com'
-						}
-					}
-				}
-			}
-		}
-	}
-
-	compileJava.dependsOn(processResources)
+    sourceCompatibility = "${javaVersion}"
+    targetCompatibility = "${javaVersion}"
+
+    //noinspection GroovyAssignabilityCheck
+    tasks.withType(JavaCompile) {
+        options.encoding = 'UTF-8'
+    }
+
+    repositories {
+        mavenLocal()
+        maven { url "http://maven.aliyun.com/nexus/content/groups/public/" }
+        maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
+        maven { url "http://www.cameliatk.jp/maven2/repository/thirdparty" }
+        jcenter()
+    }
+
+    task sourcesJar(type: Jar, dependsOn: classes) {
+        classifier = 'sources'
+        from sourceSets.main.allSource
+    }
+
+    javadoc {
+        options {
+            encoding "UTF-8"
+            charSet 'UTF-8'
+            author true
+            version true
+            failOnError false
+            links "http://docs.oracle.com/javase/7/docs/api"
+        }
+    }
+
+    task javadocJar(type: Jar, dependsOn: javadoc) {
+        classifier = 'javadoc'
+        from 'build/docs/javadoc'
+    }
+
+    artifacts {
+        archives sourcesJar
+        archives javadocJar
+    }
+
+    tasks.whenTaskAdded { task ->
+        if (task.name.contains('uploadArchives') || task.name.contains("signArchives")) {
+            task.enabled = new File(project.property('signing.secretKeyRingFile') as String).isFile()
+        }
+    }
+
+    signing {
+        sign configurations.archives
+    }
+
+    // gradle clean build uploadArchives -Dun=用户名 -Dps=密码 -x test
+    uploadArchives {
+        repositories {
+            mavenDeployer {
+                beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
+                def userName = System.getProperty("un")
+                def passWord = System.getProperty("ps")
+                repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
+                    //noinspection GroovyAssignabilityCheck
+                    authentication(userName: userName, password: passWord)
+                }
+
+                snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
+                    //noinspection GroovyAssignabilityCheck
+                    authentication(userName: userName, password: passWord)
+                }
+
+                pom.version = "$project.version"
+                pom.artifactId = "$project.name"
+                pom.groupId = "$project.group"
+                pom.project {
+                    //noinspection GroovyAssignabilityCheck
+                    name 'mybatis-plus'
+                    packaging 'jar'
+                    description 'An enhanced toolkit of Mybatis to simplify development.'
+                    url 'https://github.com/baomidou/mybatis-plus'
+
+                    scm {
+                        connection 'scm:git@github.com:Codearte/gradle-nexus-staging-plugin.git'
+                        developerConnection 'scm:git@github.com:Codearte/gradle-nexus-staging-plugin.git'
+                        url 'https://github.com/baomidou/mybatis-plus'
+                    }
+
+                    licenses {
+                        license {
+                            //noinspection GroovyAssignabilityCheck
+                            name 'The Apache License, Version 2.0'
+                            url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+                        }
+                    }
+
+                    developers {
+                        developer {
+                            id 'baomidou'
+                            //noinspection GroovyAssignabilityCheck
+                            name 'hubin'
+                            email 'jobob@qq.com'
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    compileJava.dependsOn(processResources)
 }

+ 2 - 1
mybatis-plus-annotations/build.gradle

@@ -3,5 +3,6 @@ apply plugin: 'java'
 sourceCompatibility = 1.7
 
 dependencies {
-    testCompile group: 'junit', name: 'junit', version: '4.12'
+    testCompile 'junit:junit:4.12'
+
 }

+ 15 - 25
mybatis-plus-core/build.gradle

@@ -5,29 +5,19 @@ sourceCompatibility = 1.7
 dependencies {
     compile project(":mybatis-plus-annotations")
     compile rootProject.ext.dependencies["mybatis"]
-	compile rootProject.ext.dependencies["jsqlparser"]
-//	compile rootProject.ext.dependencies["mybatis-spring"]
-//	optional rootProject.ext.dependencies["spring-context-support"]
-//	optional rootProject.ext.dependencies["spring-jdbc"]
-	testCompile rootProject.ext.dependencies["mybatis-ehcache"]
-	testCompile rootProject.ext.dependencies["logback-classic"]
-	testCompile rootProject.ext.dependencies["junit"]
-	testCompile (rootProject.ext.dependencies["commons-dbcp2"]){
-		exclude module: "commons-logging"
-	}
-//	testCompile rootProject.ext.dependencies["sqlserver"]
-//	testCompile rootProject.ext.dependencies["postgresql"]
-//	testCompile rootProject.ext.dependencies["oracle"]
-//	testCompile rootProject.ext.dependencies["h2"]
-//	testCompile rootProject.ext.dependencies["mysql"]
-//	testCompile rootProject.ext.dependencies["slf4j-api"]
-//	testCompile rootProject.ext.dependencies["spring-test"]
-//	testCompile rootProject.ext.dependencies["spring-webmvc"]
-//	testCompile rootProject.ext.dependencies["sqlserver"]
-	testCompile rootProject.ext.dependencies["aspectjweaver"]
-	testCompile rootProject.ext.dependencies["lombok"]
-	testCompile rootProject.ext.dependencies["hikaricp"]
-	testCompile rootProject.ext.dependencies["druid"]
-	testCompile rootProject.ext.dependencies["fastjson"]
-	testCompile rootProject.ext.dependencies["tomcatjdbc"]
+    compile rootProject.ext.dependencies["jsqlparser"]
+
+    testCompile rootProject.ext.dependencies["mybatis-ehcache"]
+    testCompile rootProject.ext.dependencies["logback-classic"]
+    testCompile rootProject.ext.dependencies["junit"]
+    testCompile(rootProject.ext.dependencies["commons-dbcp2"]) {
+        exclude module: "commons-logging"
+    }
+    testCompile rootProject.ext.dependencies["aspectjweaver"]
+    testCompile rootProject.ext.dependencies["lombok"]
+    testCompile rootProject.ext.dependencies["hikaricp"]
+    testCompile rootProject.ext.dependencies["druid"]
+    testCompile rootProject.ext.dependencies["fastjson"]
+    testCompile rootProject.ext.dependencies["tomcatjdbc"]
+
 }

+ 4 - 1
mybatis-plus-extension/build.gradle

@@ -6,7 +6,10 @@ dependencies {
     compile project(":mybatis-plus-core")
     compile rootProject.ext.dependencies["mybatis-spring"]
     compile rootProject.ext.dependencies["mybatis"]
+ 
     provided rootProject.ext.dependencies["spring-context-support"]
     provided rootProject.ext.dependencies["spring-jdbc"]
-    testCompile group: 'junit', name: 'junit', version: '4.12'
+
+    testCompile 'junit:junit:4.12'
+
 }

+ 12 - 12
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/activerecord/Model.java

@@ -29,6 +29,7 @@ import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;
 import com.baomidou.mybatisplus.core.pagination.Page;
 import com.baomidou.mybatisplus.core.toolkit.sql.SqlHelper;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.baomidou.mybatisplus.extension.toolkit.SqlRunner;
 
 /**
  * <p>
@@ -39,7 +40,6 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
  * @author hubin
  * @Date 2016-11-06
  */
-@SuppressWarnings({"rawtypes"})
 public abstract class Model<T extends Model> implements Serializable {
 
     private static final long serialVersionUID = 1L;
@@ -49,7 +49,7 @@ public abstract class Model<T extends Model> implements Serializable {
      * 插入(字段选择插入)
      * </p>
      */
-    @Transactional
+    @Transactional(rollbackFor = Exception.class)
     public boolean insert() {
         return SqlHelper.retBool(sqlSession().insert(sqlStatement(SqlMethod.INSERT_ONE), this));
     }
@@ -59,7 +59,7 @@ public abstract class Model<T extends Model> implements Serializable {
      * 插入(所有字段插入)
      * </p>
      */
-    @Transactional
+    @Transactional(rollbackFor = Exception.class)
     public boolean insertAllColumn() {
         return SqlHelper.retBool(sqlSession().insert(sqlStatement(SqlMethod.INSERT_ONE_ALL_COLUMN), this));
     }
@@ -69,7 +69,7 @@ public abstract class Model<T extends Model> implements Serializable {
      * 插入 OR 更新
      * </p>
      */
-    @Transactional
+    @Transactional(rollbackFor = Exception.class)
     public boolean insertOrUpdate() {
         if (StringUtils.checkValNull(pkVal())) {
             // insert
@@ -90,7 +90,7 @@ public abstract class Model<T extends Model> implements Serializable {
      * @param id 主键ID
      * @return
      */
-    @Transactional
+    @Transactional(rollbackFor = Exception.class)
     public boolean deleteById(Serializable id) {
         return SqlHelper.delBool(sqlSession().delete(sqlStatement(SqlMethod.DELETE_BY_ID), id));
     }
@@ -102,7 +102,7 @@ public abstract class Model<T extends Model> implements Serializable {
      *
      * @return
      */
-    @Transactional
+    @Transactional(rollbackFor = Exception.class)
     public boolean deleteById() {
         if (StringUtils.checkValNull(pkVal())) {
             throw new MybatisPlusException("deleteById primaryKey is null.");
@@ -119,7 +119,7 @@ public abstract class Model<T extends Model> implements Serializable {
      * @param args        查询条件值
      * @return
      */
-    @Transactional
+    @Transactional(rollbackFor = Exception.class)
     public boolean delete(String whereClause, Object... args) {
         return delete(Wrapper.<T>getInstance().where(whereClause, args));
     }
@@ -132,7 +132,7 @@ public abstract class Model<T extends Model> implements Serializable {
      * @param wrapper
      * @return
      */
-    @Transactional
+    @Transactional(rollbackFor = Exception.class)
     public boolean delete(Wrapper wrapper) {
         Map<String, Object> map = new HashMap<>();
         map.put("ew", wrapper);
@@ -144,7 +144,7 @@ public abstract class Model<T extends Model> implements Serializable {
      * 更新(字段选择更新)
      * </p>
      */
-    @Transactional
+    @Transactional(rollbackFor = Exception.class)
     public boolean updateById() {
         if (StringUtils.checkValNull(pkVal())) {
             throw new MybatisPlusException("updateById primaryKey is null.");
@@ -160,7 +160,7 @@ public abstract class Model<T extends Model> implements Serializable {
      * 更新(所有字段更新)
      * </p>
      */
-    @Transactional
+    @Transactional(rollbackFor = Exception.class)
     public boolean updateAllColumnById() {
         if (StringUtils.checkValNull(pkVal())) {
             throw new MybatisPlusException("updateAllColumnById primaryKey is null.");
@@ -180,7 +180,7 @@ public abstract class Model<T extends Model> implements Serializable {
      * @param args        查询条件值
      * @return
      */
-    @Transactional
+    @Transactional(rollbackFor = Exception.class)
     public boolean update(String whereClause, Object... args) {
         // update
         return update(Wrapper.<T>getInstance().where(whereClause, args));
@@ -194,7 +194,7 @@ public abstract class Model<T extends Model> implements Serializable {
      * @param wrapper
      * @return
      */
-    @Transactional
+    @Transactional(rollbackFor = Exception.class)
     public boolean update(Wrapper wrapper) {
         Map<String, Object> map = new HashMap<>();
         map.put("et", this);

+ 11 - 9
mybatis-plus-generate/build.gradle

@@ -1,12 +1,14 @@
 dependencies {
-	compile project(":mybatis-plus-extension")
-	optional rootProject.ext.dependencies["velocity"]
+    compile project(":mybatis-plus-extension")
+
+    optional rootProject.ext.dependencies["velocity"]
     optional rootProject.ext.dependencies["freemarker"]
-	testCompile rootProject.ext.dependencies["sqlserver"]
-	testCompile rootProject.ext.dependencies["postgresql"]
-	testCompile rootProject.ext.dependencies["oracle"]
-	testCompile rootProject.ext.dependencies["h2"]
-	testCompile rootProject.ext.dependencies["mysql"]
-	testCompile rootProject.ext.dependencies["logback-classic"]
-	testCompile rootProject.ext.dependencies["junit"]
+
+    testCompile rootProject.ext.dependencies["sqlserver"]
+    testCompile rootProject.ext.dependencies["postgresql"]
+    testCompile rootProject.ext.dependencies["oracle"]
+    testCompile rootProject.ext.dependencies["h2"]
+    testCompile rootProject.ext.dependencies["mysql"]
+    testCompile rootProject.ext.dependencies["logback-classic"]
+    testCompile rootProject.ext.dependencies["junit"]
 }

+ 1 - 0
mybatis-plus/build.gradle

@@ -1,4 +1,5 @@
 dependencies{
     compile project(":mybatis-plus-core")
     compile project(":mybatis-plus-generate")
+
 }