From a9d78e25c93bb4b109f8159e0a35e31c95762371 Mon Sep 17 00:00:00 2001 From: easylife Date: Wed, 26 Apr 2017 11:11:05 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=A8=A1=E6=9D=BFIdType?= =?UTF-8?q?=E5=BC=95=E5=85=A5=E5=8C=85=E5=90=8D=E5=88=B0com.baomidou.mybat?= =?UTF-8?q?isplus.enums.IdType?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/template/entity.java.vm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/template/entity.java.vm b/src/main/resources/template/entity.java.vm index 69eee6e..076bf73 100644 --- a/src/main/resources/template/entity.java.vm +++ b/src/main/resources/template/entity.java.vm @@ -4,7 +4,7 @@ package ${package.Entity}; import com.baomidou.mybatisplus.activerecord.Model; #end #if(${idGenType}!="ID_WORKER") -import com.baomidou.mybatisplus.annotations.IdType; +import com.baomidou.mybatisplus.enums.IdType; import com.baomidou.mybatisplus.annotations.TableId; #end import com.baomidou.mybatisplus.annotations.TableField; -- Gitee From a7521c3da7d66a278ca9f046a6230e4af0f50223 Mon Sep 17 00:00:00 2001 From: easylife Date: Tue, 2 May 2017 14:27:19 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=AE=9E=E4=BD=93?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E5=90=AB=E6=9C=89BigDecimal=E6=97=B6?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E5=BC=95=E5=85=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/baomidou/config/po/TableInfo.java | 24 +++++++++++++------ src/main/resources/template/entity.java.vm | 3 +++ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/baomidou/config/po/TableInfo.java b/src/main/java/com/baomidou/config/po/TableInfo.java index 5cba13f..fce0e8c 100644 --- a/src/main/java/com/baomidou/config/po/TableInfo.java +++ b/src/main/java/com/baomidou/config/po/TableInfo.java @@ -1,6 +1,5 @@ package com.baomidou.config.po; - import org.apache.commons.lang.StringUtils; import java.util.List; @@ -26,6 +25,7 @@ public class TableInfo { private List fields; private String fieldNames; private boolean hasDate; + private boolean hasDecimal; public String getName() { return name; @@ -84,14 +84,14 @@ public class TableInfo { } public String getControllerName() { - return controllerName; - } + return controllerName; + } - public void setControllerName(String controllerName) { - this.controllerName = controllerName; - } + public void setControllerName(String controllerName) { + this.controllerName = controllerName; + } - public List getFields() { + public List getFields() { return fields; } @@ -135,6 +135,16 @@ public class TableInfo { return hasDate; } + public boolean isHasDecimal() { + for (TableField fieldInfo : fields) { + if (fieldInfo.getPropertyType().equals("BigDecimal")) { + hasDecimal = true; + break; + } + } + return hasDecimal; + } + /** * mapper xml中的字字段添加as * diff --git a/src/main/resources/template/entity.java.vm b/src/main/resources/template/entity.java.vm index 076bf73..aded641 100644 --- a/src/main/resources/template/entity.java.vm +++ b/src/main/resources/template/entity.java.vm @@ -15,6 +15,9 @@ import java.io.Serializable; #if(${table.hasDate}) import java.util.Date; #end +#if(${table.hasDecimal}) +import java.math.BigDecimal; +#end /** *

-- Gitee