修复处理number/decimal(x,x)类型的逻辑(感谢@arthaschan的反馈),修复JdbcTemplates模板两处错误(感谢@everflourish的反馈)。

This commit is contained in:
moshowgame@126.com 2019-01-05 23:40:35 +08:00
parent d2283b4507
commit 6fb2cbae63
4 changed files with 13 additions and 6 deletions

View File

@ -16,6 +16,7 @@ SpringBootCodeGenerator
<tr><td>CSDN博客</td> <td>http://blog.csdn.net/moshowgame</td></tr>
<tr><td></td> <td></td></tr>
<tr><td>更新日期</td> <td>更新内容</td></tr>
<tr><td>20190106<td>修复处理number/decimal(x,x)类型的逻辑(感谢@arthaschan的反馈修复JdbcTemplates模板两处错误感谢@everflourish的反馈)。</td></tr>
<tr><td>20181212<td>首页UI优化新增MybatisPlus模块感谢@三叔同事的建议),修复作者名和包名获取失败问题(感谢@Yanch1994的反馈)。</td></tr>
<tr><td>20181122<td>优化正则表达式点号的处理优化处理字段类型对number类型增加intlongBigDecimal的区分判断感谢@lshz0088的指导)。</td></tr>
<tr><td>20181108<td>修复非字段描述"KEY FK_xxxx (xxxx)"导致生成KEY字段情况感谢@tornadoorz反馈)。</td></tr>

View File

@ -1,7 +1,6 @@
package com.softdev.system.generator.util;
import com.softdev.system.generator.entity.ClassInfo;
import com.softdev.system.generator.entity.FieldInfo;
@ -185,9 +184,17 @@ public class TableParseUtil {
if(startKh>=0){
int endKh=columnLine.indexOf(")",startKh);
String[] fanwei=columnLine.substring(startKh+1,endKh).split("");
if("0".equals(fanwei[1])){
//如果没有小数位数
//2019-1-5 zhengk 修复@arthaschan反馈的超出范围错误
//System.out.println("fanwei"+ JSON.toJSONString(fanwei));
// //number(20,6) fanwei["20","6"]
// //number(0,6) fanwei["0","6"]
// //number(20,0) fanwei["20","0"]
// //number(20) fanwei["20"]
//如果括号里是1位或者2位且第二位为0则进行特殊处理只有有小数位都设置为BigDecimal
if((fanwei.length>1&&"0".equals(fanwei[1]))||fanwei.length==1){
int length=Integer.valueOf(fanwei[0]);
if(fanwei.length>1) length=Integer.valueOf(fanwei[1]);
//数字范围9位及一下用Integer大的用Long
if(length<=9){
fieldClass = Integer.class.getSimpleName();
}else{

View File

@ -5,7 +5,7 @@ import java.util.List;
* ${classInfo.classComment}
* @author ${authorName} ${.now?string('yyyy-MM-dd')}
*/
public interface IAccountDAO {
public interface I${classInfo.className}DAO {
int add(${classInfo.classComment} ${classInfo.className?uncap_first});

View File

@ -28,8 +28,7 @@ public class ${classInfo.className}DaoImpl implements I${classInfo.className}Dao
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
<#list classInfo.fieldList as fieldItem ><#if fieldItem_index gt 0 >${classInfo.className?uncap_first}.get${fieldItem.fieldName?cap_first}(),</#if></#list>
<#list classInfo.fieldList as fieldItem ><#if fieldItem_index = 0 >${classInfo.className?uncap_first}.get${fieldItem.fieldName?cap_first}()</#if></#list>
</#if>
</#if>;
}
@Override