diff --git a/.gitignore b/.gitignore
index 9f355fbf3a8a58288256b5568b19f0ec058ecbc7..e0658ce7d80e68d8d96752bc14c70f99c6a90829 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@
/.project
/.DS_Store
/.idea/
+*.iml
diff --git a/doc/SUMMARY.md b/doc/SUMMARY.md
index 22d27a2e0a8c4b6be7deb563672a2015098921e8..99c124becad7e0fdf4428401e1bf42dbd4777a5f 100644
--- a/doc/SUMMARY.md
+++ b/doc/SUMMARY.md
@@ -17,4 +17,4 @@
* [<sqlmap>](configreference/element-sqlmap.md)
-* [案例]()
\ No newline at end of file
+* [案例]()
diff --git a/doc/configreference/element-operation.md b/doc/configreference/element-operation.md
index 2264f4a342f463f37cf6f135564df92295a85f35..1a186d729b5e28743b6e9629a6d37eb8a4dc8cfa 100644
--- a/doc/configreference/element-operation.md
+++ b/doc/configreference/element-operation.md
@@ -31,4 +31,4 @@ operation为table的子标签,与resultMap标签同级,MyBatis的一条SQL
***
-```
\ No newline at end of file
+```
diff --git a/doc/configreference/element-param.md b/doc/configreference/element-param.md
index ca4fa5fa3ddde1d3832906e84708d0fd172f7d3c..3ae8c14ec5976c33d76723ba218fe853d4716aeb 100644
--- a/doc/configreference/element-param.md
+++ b/doc/configreference/element-param.md
@@ -23,4 +23,4 @@ None
***
-```
\ No newline at end of file
+```
diff --git a/pom.xml b/pom.xml
index b6e7939851abfb82ce91fa4cd11a5754488d63c0..7635b2685fd85c1e0876c74ec3d4640f30643fc3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,255 +1,237 @@
-
- 4.0.0
- org.smartboot.maven.plugin
- maven-mydalgen-plugin
- 1.0.4
-
- ${project.artifactId}
- smartboot-mybatisdalgen
- https://git.oschina.net/smartboot/maven-mybatisdalgen-plugin
-
- maven-plugin
-
-
- org.apache.commons
- commons-digester3
- 3.2
-
-
- org.apache.commons
- commons-collections4
- 4.1
-
-
- org.apache.velocity
- velocity
- 1.7
-
-
-
- commons-io
- commons-io
- 2.5
-
-
- org.apache.commons
- commons-lang3
- 3.5
-
-
-
- org.apache.maven
- maven-plugin-api
- 3.3.9
-
-
- mysql
- mysql-connector-java
- 5.1.40
-
-
-
- org.apache.maven.plugin-tools
- maven-plugin-annotations
- 3.5
- provided
-
-
-
- org.apache.maven.shared
- maven-plugin-testing-harness
- 1.1
- test
-
-
- junit
- junit
- 4.12
- test
-
-
-
-
-
- The Apache License, Version 2.0
- http://www.apache.org/licenses/LICENSE-2.0.txt
-
-
-
-
-
-
- Seer
- 三刀
- zhengjunweimail@163.com
-
- SmartBoot作者
-
- https://git.oschina.net/smartdms/
- GMT+8
-
- https://git.oschina.net/uploads/75/351975_smartdms.jpg
-
-
-
-
-
- https://git.oschina.net/smartboot/maven-mybatisdalgen-plugin
- scm:git:https://git.oschina.net/smartboot/maven-mybatisdalgen-plugin.git
- scm:git:ssh://git.oschina.net:smartboot/maven-mybatisdalgen-plugin.git
- master
-
-
-
- ossrh
- https://oss.sonatype.org/content/repositories/snapshots
-
-
- ossrh
- https://oss.sonatype.org/service/local/staging/deploy/maven2/
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-plugin-plugin
- 3.4
-
-
-
-
- true
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.1
-
- 1.6
- 1.6
-
-
-
- org.sonatype.plugins
- nexus-staging-maven-plugin
- 1.6.7
- true
-
- ossrh
- https://oss.sonatype.org/
- true
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.2.1
-
-
- attach-sources
-
- jar-no-fork
-
-
-
-
-
- org.apache.maven.plugins
- maven-javadoc-plugin
- 2.9.1
-
- true
- -Xdoclint:none
-
-
-
- attach-javadocs
-
- jar
-
-
-
-
-
- org.apache.maven.plugins
- maven-gpg-plugin
- 1.5
-
-
- sign-artifacts
- verify
-
- sign
-
-
-
-
-
- org.apache.maven.plugins
- maven-release-plugin
- 2.5
-
- true
- false
- release
- deploy
-
-
-
-
-
-
-
- org.eclipse.m2e
- lifecycle-mapping
- 1.0.0
-
-
-
-
-
-
- org.apache.maven.plugins
-
-
- maven-plugin-plugin
-
-
- [3.4,)
-
-
- descriptor
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- alimaven
- aliyun maven
- http://maven.aliyun.com/nexus/content/groups/public/
-
-
-
-
- alimaven
- aliyun maven
- http://maven.aliyun.com/nexus/content/groups/public/
-
-
-
\ No newline at end of file
+
+ 4.0.0
+ org.smartboot.maven.plugin
+ maven-mydalgen-plugin
+ 1.0.8-hipac
+
+ ${project.artifactId}
+ smartboot-mybatisdalgen
+ https://git.oschina.net/smartboot/maven-mybatisdalgen-plugin
+
+ maven-plugin
+
+
+ org.apache.commons
+ commons-digester3
+ 3.2
+
+
+ org.apache.commons
+ commons-collections4
+ 4.1
+
+
+ org.apache.velocity
+ velocity
+ 1.7
+
+
+
+ commons-io
+ commons-io
+ 2.5
+
+
+ org.apache.commons
+ commons-lang3
+ 3.5
+
+
+
+ org.apache.maven
+ maven-plugin-api
+ 3.3.9
+
+
+ mysql
+ mysql-connector-java
+ 5.1.40
+
+
+
+ org.apache.maven.plugin-tools
+ maven-plugin-annotations
+ 3.5
+ provided
+
+
+
+ org.apache.maven.shared
+ maven-plugin-testing-harness
+ 1.1
+ test
+
+
+ junit
+ junit
+ 4.12
+ test
+
+
+
+
+
+ The Apache License, Version 2.0
+ http://www.apache.org/licenses/LICENSE-2.0.txt
+
+
+
+
+
+
+ Seer
+ 三刀
+ zhengjunweimail@163.com
+
+ SmartBoot作者
+
+ https://git.oschina.net/smartdms/
+ GMT+8
+
+ https://git.oschina.net/uploads/75/351975_smartdms.jpg
+
+
+
+
+
+ https://git.oschina.net/smartboot/maven-mybatisdalgen-plugin
+ scm:git:https://git.oschina.net/smartboot/maven-mybatisdalgen-plugin.git
+ scm:git:ssh://git.oschina.net:smartboot/maven-mybatisdalgen-plugin.git
+ master
+
+
+
+
+
+ yangt
+ snapshots Repository
+ http://maven.hipac.cn/nexus/content/repositories/snapshots
+
+
+ yangt
+ releases Repository
+ http://maven.hipac.cn/nexus/content/repositories/releases/
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-plugin-plugin
+ 3.4
+
+
+
+
+ true
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.1
+
+ 1.6
+ 1.6
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ 2.2.1
+
+
+ attach-sources
+
+ jar-no-fork
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 2.9.1
+
+ true
+ -Xdoclint:none
+ /Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/bin/javadoc
+
+
+
+ attach-javadocs
+
+ jar
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-release-plugin
+ 2.5
+
+ true
+ false
+ release
+ deploy
+
+
+
+
+
+
+
+ org.eclipse.m2e
+ lifecycle-mapping
+ 1.0.0
+
+
+
+
+
+
+ org.apache.maven.plugins
+
+
+ maven-plugin-plugin
+
+
+ [3.4,)
+
+
+ descriptor
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ alimaven
+ aliyun maven
+ http://maven.aliyun.com/nexus/content/groups/public/
+
+
+
+
+ alimaven
+ aliyun maven
+ http://maven.aliyun.com/nexus/content/groups/public/
+
+
+
diff --git a/src/main/java/org/smartboot/maven/plugin/mydalgen/ColumnMap.java b/src/main/java/org/smartboot/maven/plugin/mydalgen/ColumnMap.java
deleted file mode 100644
index 7429c236b2b4cd7377d112b448852822739c82ad..0000000000000000000000000000000000000000
--- a/src/main/java/org/smartboot/maven/plugin/mydalgen/ColumnMap.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2001, Aslak Hellesøy, BEKK Consulting
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * - Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * - Neither the name of BEKK Consulting nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- */
-package org.smartboot.maven.plugin.mydalgen;
-
-/**
- * @author Aslak Helles
- * @created 19. mai 2002
- */
-public class ColumnMap {
- /**
- * @todo-javadoc Describe the field
- */
- private final String _primaryKey;
- /**
- * @todo-javadoc Describe the field
- */
- private final String _foreignKey;
-
-
- /**
- * Describe what the ColumnMap constructor does
- *
- * @todo-javadoc Write javadocs for constructor
- * @todo-javadoc Write javadocs for method parameter
- * @todo-javadoc Write javadocs for method parameter
- * @param primaryKey Describe what the parameter does
- * @param foreignKey Describe what the parameter does
- */
- public ColumnMap(String primaryKey, String foreignKey) {
- _primaryKey = primaryKey;
- _foreignKey = foreignKey;
- }
-
-
- /**
- * Gets the PrimaryKey attribute of the ColumnMap object
- *
- * @return The PrimaryKey value
- */
- public String getPrimaryKey() {
- return _primaryKey;
- }
-
-
- /**
- * Gets the ForeignKey attribute of the ColumnMap object
- *
- * @return The ForeignKey value
- */
- public String getForeignKey() {
- return _foreignKey;
- }
-}
diff --git a/src/main/java/org/smartboot/maven/plugin/mydalgen/plugins/mybatis/IWalletOperation.java b/src/main/java/org/smartboot/maven/plugin/mydalgen/plugins/mybatis/IWalletOperation.java
index a75ca737f6b4e2e1f00ac10e75136d871452c401..591a707689145c03654b2f779589a2ac4901d678 100644
--- a/src/main/java/org/smartboot/maven/plugin/mydalgen/plugins/mybatis/IWalletOperation.java
+++ b/src/main/java/org/smartboot/maven/plugin/mydalgen/plugins/mybatis/IWalletOperation.java
@@ -96,7 +96,7 @@ public abstract class IWalletOperation extends PreferenceAware implements Operat
}
/**
- * @param table
+ * @param t
*/
public void setTable(Table t) {
table = t;
diff --git a/src/main/java/org/smartboot/maven/plugin/mydalgen/plugins/mybatis/IWalletTable.java b/src/main/java/org/smartboot/maven/plugin/mydalgen/plugins/mybatis/IWalletTable.java
index 7924464339462bd662a3b85a4d0503547add27e6..bc81d9b60282a4d3bedf237ae3721c2ac7200010 100644
--- a/src/main/java/org/smartboot/maven/plugin/mydalgen/plugins/mybatis/IWalletTable.java
+++ b/src/main/java/org/smartboot/maven/plugin/mydalgen/plugins/mybatis/IWalletTable.java
@@ -46,8 +46,8 @@ public class IWalletTable extends JavaTable {
public static final String DO_PATTERN = "{0}DO";
public static final String DAO_PATTERN = "{0}DAO";
public static final String IBATIS_PATTERN = "{0}DaoImpl";
- public static final String DO_PACKAGE = "dataobject";
- public static final String DAO_PACKAGE = "dao";
+ public static final String DO_PACKAGE = "entity";
+ public static final String DAO_PACKAGE = "mapper";
public static final String IBATIS_PACKAGE = "dao.impl";
public static final String RESULT_MAP_PREFIX = "RM-";
diff --git a/src/main/java/org/smartboot/maven/plugin/mydalgen/plugins/mybatis/config/IWalletConfig.java b/src/main/java/org/smartboot/maven/plugin/mydalgen/plugins/mybatis/config/IWalletConfig.java
index 8fe1c7613e850c8eeee80c0170b19de7bb723cd1..126f856c9dfe7e9099e9fb63aaeccfddda803f68 100644
--- a/src/main/java/org/smartboot/maven/plugin/mydalgen/plugins/mybatis/config/IWalletConfig.java
+++ b/src/main/java/org/smartboot/maven/plugin/mydalgen/plugins/mybatis/config/IWalletConfig.java
@@ -182,6 +182,11 @@ public class IWalletConfig {
digester.addSetProperties("table/operation/extraparams/param", "generictype", "genericType");
digester.addSetNext("table/operation/extraparams/param", "addExtraParam");
+ digester.addObjectCreate("table/operation/result", IWalletResultConfig.class);
+ digester.addSetProperties("table/operation/result", "javatype", "javaType");
+ digester.addSetProperties("table/operation/result", "generictype", "genericType");
+ digester.addSetNext("table/operation/result", "addResult");
+
digester.addCallMethod("table/operation/sql", "setSql", 0);
digester.addCallMethod("table/operation/sqlmap", "setSqlmap", 0);
// added by yangyanzhao 2010-02-08
diff --git a/src/main/java/org/smartboot/maven/plugin/mydalgen/plugins/mybatis/config/IWalletOperationConfig.java b/src/main/java/org/smartboot/maven/plugin/mydalgen/plugins/mybatis/config/IWalletOperationConfig.java
index 274727847ab19b480fa0b12f10ef29e8e6597496..913c0400fdbd0a0a092a480f090aea4de2659f3f 100644
--- a/src/main/java/org/smartboot/maven/plugin/mydalgen/plugins/mybatis/config/IWalletOperationConfig.java
+++ b/src/main/java/org/smartboot/maven/plugin/mydalgen/plugins/mybatis/config/IWalletOperationConfig.java
@@ -51,6 +51,9 @@ public class IWalletOperationConfig {
/** extra params */
private List extraParams = new ArrayList();
+ /** result */
+ private IWalletResultConfig result = new IWalletResultConfig();
+
/**
* the sql statement of the operation.
*
@@ -270,6 +273,18 @@ public class IWalletOperationConfig {
extraParams.add(paramConfig);
}
+ public IWalletResultConfig getResult(){
+ return result;
+ }
+
+ /**
+ * add result
+ * @param resultConfig
+ */
+ public void addResult(IWalletResultConfig resultConfig){
+ result = resultConfig;
+ }
+
/**
* @return Returns the append.
*/
diff --git a/src/main/java/org/smartboot/maven/plugin/mydalgen/plugins/mybatis/config/IWalletResultConfig.java b/src/main/java/org/smartboot/maven/plugin/mydalgen/plugins/mybatis/config/IWalletResultConfig.java
new file mode 100644
index 0000000000000000000000000000000000000000..05ef2d7a59301dc7888513aae449056b291cd9b0
--- /dev/null
+++ b/src/main/java/org/smartboot/maven/plugin/mydalgen/plugins/mybatis/config/IWalletResultConfig.java
@@ -0,0 +1,51 @@
+/**
+ * www.hipac.cn Inc.
+ * Copyright (c) 2004-2020 All Rights Reserved.
+ */
+package org.smartboot.maven.plugin.mydalgen.plugins.mybatis.config;
+
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+/**
+ * result标签属性配置
+ *
+ * @author jingtianer
+ * @version maven-mydalgen-plugin, v 0.1 2020-12-22 11:08 jingtianer Exp $
+ */
+public class IWalletResultConfig {
+
+ /** 参数类型 */
+ private String javaType;
+
+ /** 泛型类型 */
+ private String genericType;
+
+ public IWalletResultConfig(){
+ super();
+ }
+
+ public String getJavaType() {
+ return javaType;
+ }
+
+ public void setJavaType(String javaType) {
+ this.javaType = javaType;
+ }
+
+ public String getGenericType() {
+ return genericType;
+ }
+
+ public void setGenericType(String genericType) {
+ this.genericType = genericType;
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this);
+ }
+
+}
diff --git a/src/main/java/org/smartboot/maven/plugin/mydalgen/plugins/mybatis/operation/IWalletInsert.java b/src/main/java/org/smartboot/maven/plugin/mydalgen/plugins/mybatis/operation/IWalletInsert.java
index d08ef0f56e63c7636a1772656c764d2c8aead68b..851f42f760abeb64904158fc6a72c5058cc179e3 100644
--- a/src/main/java/org/smartboot/maven/plugin/mydalgen/plugins/mybatis/operation/IWalletInsert.java
+++ b/src/main/java/org/smartboot/maven/plugin/mydalgen/plugins/mybatis/operation/IWalletInsert.java
@@ -18,115 +18,117 @@ import org.smartboot.maven.plugin.mydalgen.plugins.mybatis.util.DalUtil;
*/
public class IWalletInsert extends IWalletOperation {
- public static final String OP_TYPE = "insert";
-
- /**
- * Constructor for IWalletInsert.
- */
-
- public IWalletInsert(IWalletOperationConfig opConfig) {
-
- super(opConfig);
-
- // 向下兼容,当没有配置机密性及完整性时,不进行SQL拼接
- if (opConfig.getTableConfig().getConfidentiality() != null
- || opConfig.getTableConfig().getIntegrity() != null) {
- getFinalSql(opConfig);
- }
-
- paramType = PARAM_TYPE_OBJECT;
-
- multiplicity = MULTIPLICITY_ONE;
- }
-
- /**
- * 机密性和完整性方案,获得配置后的SQL语句
- *
- * @param opConfig
- */
- private void getFinalSql(IWalletOperationConfig opConfig) {
- // add by yuanxiao -------------
- // 获得传入的SQL
- String sql = opConfig.getSqlParser().getSql();
-
- // 获得insert语句中第一个右括号
- int indexFParenthesisStart = StringUtils.indexOfAny(sql, ")");
-
- StringBuffer sb = new StringBuffer();
-
- // 取第一个括号前的子串
- String firstString = StringUtils.substring(sql, 0, indexFParenthesisStart);
-
- // 截取第一个括号到第二个括号前的
- String secondString = StringUtils.substring(sql, indexFParenthesisStart, sql.length() - 2);
-
- sb.append(firstString);
-
- if (opConfig.getTableConfig().getConfidentiality() != null) {
- sb.append(",").append(opConfig.getTableConfig().getConfidentiality()).append("_confidentiality");
- }
- if (opConfig.getTableConfig().getIntegrity() != null) {
- sb.append(",").append(opConfig.getTableConfig().getIntegrity()).append("_integrity");
- }
- sb.append(secondString);
-
- sb.append(",").append("?").append(",").append("?").append(");");
-
- String finalSql = sb.toString();
-
- opConfig.setSql(finalSql);
- }
-
- /**
- * @return
- *
- * @see org.smartboot.maven.plugin.mydalgen.plugins.mybatis.Operation#getReturnTypeName()
- */
- public String getSimpleReturnType() {
- String returnType = DalUtil.getSimpleJavaType(getReturnType());//自定义的主键设置为void
- return "String".equals(returnType) ? "void" : returnType;
- }
-
- public String getReturnType() {
- if (getTable().getPkColumn() == null) {
- // add by zhaoxu 2007-10-26
- // 当无主键或多主键时,使用虚拟主键
- String dummyPk = opConfig.getTableConfig().getDummyPk();
- if (StringUtils.isNotBlank(dummyPk)) {
- Column dummyPkColumn = getTable().getColumn(dummyPk);
- if (dummyPkColumn != null) {
- return ((IWalletColumn) dummyPkColumn).getJavaType();
- }
- }
- throw new IllegalStateException(getTable().getSqlName() + "无主键或多主键,可在table属性中指定虚拟主键dummypk。");
- } else {
- return ((IWalletColumn) getTable().getPkColumn()).getJavaType();
- }
- }
-
- /**
- * @return
- *
- * @see org.smartboot.maven.plugin.mydalgen.plugins.mybatis.Operation#getTemplateSuffix()
- */
- public String getTemplateSuffix() {
- return OP_TYPE;
- }
-
- /**
- * @param t
- *
- * @see org.smartboot.maven.plugin.mydalgen.plugins.mybatis.IWalletOperation#setTable(org.smartboot.maven.plugin.mydalgen.Table)
- */
- @Override
- public void setTable(Table t) {
- super.setTable(t);
- }
-
- /**
- * @return
- */
- public String getMappedStatementType() {
- return OP_TYPE;
- }
+ public static final String OP_TYPE = "insert";
+
+ /**
+ * Constructor for IWalletInsert.
+ */
+
+ public IWalletInsert(IWalletOperationConfig opConfig) {
+
+ super(opConfig);
+
+ // 向下兼容,当没有配置机密性及完整性时,不进行SQL拼接
+ if (opConfig.getTableConfig().getConfidentiality() != null
+ || opConfig.getTableConfig().getIntegrity() != null) {
+ getFinalSql(opConfig);
+ }
+
+ if (PARAM_TYPE_PRIMITIVE.equals(opConfig.getParamType())) {
+ paramType = PARAM_TYPE_PRIMITIVE;
+ } else {
+ // default
+ paramType = PARAM_TYPE_OBJECT;
+ }
+
+ multiplicity = MULTIPLICITY_ONE;
+ }
+
+ /**
+ * 机密性和完整性方案,获得配置后的SQL语句
+ *
+ * @param opConfig
+ */
+ private void getFinalSql(IWalletOperationConfig opConfig) {
+ // add by yuanxiao -------------
+ // 获得传入的SQL
+ String sql = opConfig.getSqlParser().getSql();
+
+ // 获得insert语句中第一个右括号
+ int indexFParenthesisStart = StringUtils.indexOfAny(sql, ")");
+
+ StringBuffer sb = new StringBuffer();
+
+ // 取第一个括号前的子串
+ String firstString = StringUtils.substring(sql, 0, indexFParenthesisStart);
+
+ // 截取第一个括号到第二个括号前的
+ String secondString = StringUtils.substring(sql, indexFParenthesisStart, sql.length() - 2);
+
+ sb.append(firstString);
+
+ if (opConfig.getTableConfig().getConfidentiality() != null) {
+ sb.append(",").append(opConfig.getTableConfig().getConfidentiality()).append("_confidentiality");
+ }
+ if (opConfig.getTableConfig().getIntegrity() != null) {
+ sb.append(",").append(opConfig.getTableConfig().getIntegrity()).append("_integrity");
+ }
+ sb.append(secondString);
+
+ sb.append(",").append("?").append(",").append("?").append(");");
+
+ String finalSql = sb.toString();
+
+ opConfig.setSql(finalSql);
+ }
+
+ /**
+ * @return
+ * @see org.smartboot.maven.plugin.mydalgen.plugins.mybatis.Operation#getReturnTypeName()
+ */
+ public String getSimpleReturnType() {
+ String returnType = DalUtil.getSimpleJavaType(getReturnType());//自定义的主键设置为void
+ return "String".equals(returnType) ? "void" : returnType;
+ }
+
+ public String getReturnType() {
+ if (getTable().getPkColumn() == null) {
+ // add by zhaoxu 2007-10-26
+ // 当无主键或多主键时,使用虚拟主键
+ String dummyPk = opConfig.getTableConfig().getDummyPk();
+ if (StringUtils.isNotBlank(dummyPk)) {
+ Column dummyPkColumn = getTable().getColumn(dummyPk);
+ if (dummyPkColumn != null) {
+ return ((IWalletColumn) dummyPkColumn).getJavaType();
+ }
+ }
+ throw new IllegalStateException(getTable().getSqlName() + "无主键或多主键,可在table属性中指定虚拟主键dummypk。");
+ } else {
+ return ((IWalletColumn) getTable().getPkColumn()).getJavaType();
+ }
+ }
+
+ /**
+ * @return
+ * @see org.smartboot.maven.plugin.mydalgen.plugins.mybatis.Operation#getTemplateSuffix()
+ */
+ public String getTemplateSuffix() {
+ return OP_TYPE;
+ }
+
+ /**
+ * @param t
+ * @see org.smartboot.maven.plugin.mydalgen.plugins.mybatis.IWalletOperation#setTable(org.smartboot.maven.plugin.mydalgen.Table)
+ */
+ @Override
+ public void setTable(Table t) {
+ super.setTable(t);
+ }
+
+ /**
+ * @return
+ */
+ public String getMappedStatementType() {
+ return OP_TYPE;
+ }
}
diff --git a/src/main/java/org/smartboot/maven/plugin/mydalgen/plugins/mybatis/operation/IWalletSelect.java b/src/main/java/org/smartboot/maven/plugin/mydalgen/plugins/mybatis/operation/IWalletSelect.java
index 213e37cf7caefb2e39541961fbf6a70fa5b259dd..01c986333b0d5555eee812b1b8e7dd4a7966b69e 100644
--- a/src/main/java/org/smartboot/maven/plugin/mydalgen/plugins/mybatis/operation/IWalletSelect.java
+++ b/src/main/java/org/smartboot/maven/plugin/mydalgen/plugins/mybatis/operation/IWalletSelect.java
@@ -11,6 +11,7 @@ import org.smartboot.maven.plugin.mydalgen.Table;
import org.smartboot.maven.plugin.mydalgen.plugins.mybatis.IWalletOperation;
import org.smartboot.maven.plugin.mydalgen.plugins.mybatis.IWalletTable;
import org.smartboot.maven.plugin.mydalgen.plugins.mybatis.config.IWalletOperationConfig;
+import org.smartboot.maven.plugin.mydalgen.plugins.mybatis.config.IWalletResultConfig;
import org.smartboot.maven.plugin.mydalgen.plugins.mybatis.util.DalUtil;
import Zql.ZQuery;
@@ -161,6 +162,11 @@ public class IWalletSelect extends IWalletOperation {
public String getReturnType() {
if (MULTIPLICITY_MANY.equals(multiplicity)) {
addImprotForGenericType();
+ // 配置了result标签,则导入result标签中的javaType
+ IWalletResultConfig resultConfig = opConfig.getResult();
+ if(null != resultConfig && StringUtils.isNotBlank(resultConfig.getJavaType())){
+ return resultConfig.getJavaType();
+ }
return DEFAULT_MANY_RETURN_TYPE_NO_PAGING;
}
@@ -192,27 +198,40 @@ public class IWalletSelect extends IWalletOperation {
* @see org.smartboot.maven.plugin.mydalgen.plugins.mybatis.Operation#getSimpleReturnType()
*/
public String getSimpleReturnType() {
- String simpleReturnType = DalUtil.getSimpleJavaType(getReturnType());
- if (StringUtils.equals("List", simpleReturnType)) {
- String itemType = getColumnType();
- if (StringUtils.equals(itemType, "long")) {
- itemType = "Long";
- } else if (StringUtils.equals(itemType, "int")) {
- itemType = "Integer";
- } else if (StringUtils.equals(itemType, "map")) {
- itemType = "java.util.Map";
- } else {
- itemType = DalUtil.getSimpleJavaType(itemType);
+ IWalletResultConfig resultConfig = opConfig.getResult();
+ // 未配置result标签,则走老的逻辑
+ if(null == resultConfig || StringUtils.isBlank(resultConfig.getJavaType())){
+ String simpleReturnType = DalUtil.getSimpleJavaType(getReturnType());
+ if (StringUtils.equals("List", simpleReturnType)) {
+ String itemType = getColumnType();
+ if (StringUtils.equals(itemType, "long")) {
+ itemType = "Long";
+ } else if (StringUtils.equals(itemType, "int")) {
+ itemType = "Integer";
+ } else if (StringUtils.equals(itemType, "map")) {
+ itemType = "java.util.Map";
+ } else {
+ itemType = DalUtil.getSimpleJavaType(itemType);
+ }
+
+ simpleReturnType += "<" + itemType + ">";
+ }
+ if (StringUtils.equals(simpleReturnType, "map")) {
+ simpleReturnType = "java.util.Map";
+ }
+ return simpleReturnType;
+ }else{
+ String javaType = resultConfig.getJavaType();
+ int index = javaType.lastIndexOf(".");
+ if (index >= 0) {
+ javaType = javaType.substring(index + 1);
+ }
+ if(StringUtils.isNotBlank(resultConfig.getGenericType())){
+ return javaType + "<" + resultConfig.getGenericType() + ">";
+ }else{
+ return javaType;
}
-
- simpleReturnType += "<" + itemType + ">";
- }
-
- if (StringUtils.equals(simpleReturnType, "map")) {
- simpleReturnType = "java.util.Map";
}
-
- return simpleReturnType;
}
/**