1.修复支持string-copy导致的以n结尾的字母不显示问题 2.jpa-entity新增swagger@ApiModel@ApiModelProperty注解和SQL字段@Column注解(感谢@yjq907的建议)

This commit is contained in:
MOSHOW.K.ZHENG
2019-11-28 22:19:53 +08:00
parent f746461188
commit a84a4c1087
5 changed files with 930 additions and 918 deletions

View File

@@ -27,6 +27,7 @@
|更新日期|更新内容| |更新日期|更新内容|
|-|-| |-|-|
|20191128|1.修复支持string-copy导致的以n结尾的字母不显示问题 2.jpa-entity新增swagger@ApiModel@ApiModelProperty注解和SQL字段@Column注解(感谢@yjq907的建议) |
|20191126|1.springboot2内置tomcat更换为性能更强大的undertow 2.修复tinyintTransType参数丢失问题 | |20191126|1.springboot2内置tomcat更换为性能更强大的undertow 2.修复tinyintTransType参数丢失问题 |
|20191124|1.java代码结构优化. 2.新增简单的json生成模式 3.新增简单的正则表达式匹配模式(感谢@ydq的贡献) 4.新增对复制String代码中的乱SQL代码的支持 5.优化对JSON的父子节点/处理JSONObject和JSONArray节点处理子节点缺失'{'头处理| |20191124|1.java代码结构优化. 2.新增简单的json生成模式 3.新增简单的正则表达式匹配模式(感谢@ydq的贡献) 4.新增对复制String代码中的乱SQL代码的支持 5.优化对JSON的父子节点/处理JSONObject和JSONArray节点处理子节点缺失'{'头处理|
|20191123|1.移除频繁出错和被过滤的layer,改为jquery-toast. 2.Util功能优化,新增json和xml.| |20191123|1.移除频繁出错和被过滤的layer,改为jquery-toast. 2.Util功能优化,新增json和xml.|

View File

@@ -5,14 +5,15 @@ import com.softdev.system.generator.entity.ParamInfo;
import com.softdev.system.generator.entity.ReturnT; import com.softdev.system.generator.entity.ReturnT;
import com.softdev.system.generator.service.GeneratorService; import com.softdev.system.generator.service.GeneratorService;
import com.softdev.system.generator.util.CodeGenerateException; import com.softdev.system.generator.util.CodeGenerateException;
import com.softdev.system.generator.util.FreemarkerTool;
import com.softdev.system.generator.util.TableParseUtil; import com.softdev.system.generator.util.TableParseUtil;
import freemarker.template.TemplateException; import freemarker.template.TemplateException;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
@@ -62,7 +63,8 @@ public class IndexController {
params.put("packageName", paramInfo.getPackageName()); params.put("packageName", paramInfo.getPackageName());
params.put("returnUtil", paramInfo.getReturnUtil()); params.put("returnUtil", paramInfo.getReturnUtil());
log.info("generator table:"+(classInfo==null?"":classInfo.getTableName())); log.info("generator table:"+(classInfo==null?"":classInfo.getTableName())
+",field size:"+((classInfo==null||classInfo.getFieldList()==null)?"":classInfo.getFieldList().size()));
// generate the code 需要加新的模板请在里面改 // generate the code 需要加新的模板请在里面改
Map<String, String> result = generatorService.getResultByParams(params); Map<String, String> result = generatorService.getResultByParams(params);

View File

@@ -1,14 +1,12 @@
package com.softdev.system.generator.util; package com.softdev.system.generator.util;
import cn.hutool.core.util.XmlUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.softdev.system.generator.entity.ClassInfo; import com.softdev.system.generator.entity.ClassInfo;
import com.softdev.system.generator.entity.FieldInfo; import com.softdev.system.generator.entity.FieldInfo;
import com.softdev.system.generator.entity.ParamInfo; import com.softdev.system.generator.entity.ParamInfo;
import org.w3c.dom.Document;
import java.io.IOException; import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
@@ -42,7 +40,7 @@ public class TableParseUtil {
//deal with special character //deal with special character
tableSql = tableSql.trim().replaceAll("'","`").replaceAll("\"","`").replaceAll("",",").toLowerCase(); tableSql = tableSql.trim().replaceAll("'","`").replaceAll("\"","`").replaceAll("",",").toLowerCase();
//deal with java string copy \n" //deal with java string copy \n"
tableSql = tableSql.trim().replaceAll("n`","").replaceAll("\\+","").replaceAll("``","`").replaceAll("\\\\",""); tableSql = tableSql.trim().replaceAll("\\\\n`","").replaceAll("\\+","").replaceAll("``","`").replaceAll("\\\\","");
// table Name // table Name
String tableName = null; String tableName = null;
if (tableSql.contains("TABLE") && tableSql.contains("(")) { if (tableSql.contains("TABLE") && tableSql.contains("(")) {

View File

@@ -1,8 +1,16 @@
import java.io.Serializable; package ${packageName}.entity;
import javax.persistence.*;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.GeneratedValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/** /**
* ${classInfo.classComment} * ${classInfo.classComment}
@@ -11,6 +19,7 @@ import java.util.List;
@Entity @Entity
@Data @Data
@Table(name="${classInfo.tableName}") @Table(name="${classInfo.tableName}")
@ApiModel("${classInfo.classComment}")
public class ${classInfo.className} implements Serializable { public class ${classInfo.className} implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@@ -22,6 +31,8 @@ public class ${classInfo.className} implements Serializable {
/** /**
* ${fieldItem.fieldComment} * ${fieldItem.fieldComment}
*/ */
@ApiModelProperty("${fieldItem.fieldComment}")
@Column("${fieldItem.columnName}")
private ${fieldItem.fieldClass} ${fieldItem.fieldName}; private ${fieldItem.fieldClass} ${fieldItem.fieldName};
</#list> </#list>

View File

@@ -139,15 +139,15 @@
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text">作者名称</span> <span class="input-group-text">作者名称</span>
</div> </div>
<input type="text" class="form-control" id="authorName" name="authorName" placeholder="大狼狗"> <input type="text" class="form-control" id="authorName" name="authorName" value="大狼狗">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text">返回封装</span> <span class="input-group-text">返回封装</span>
</div> </div>
<input type="text" class="form-control" id="returnUtil" name="returnUtil" placeholder="ApiReturnObject"> <input type="text" class="form-control" id="returnUtil" name="returnUtil" value="ApiReturnObject">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text">包名路径</span> <span class="input-group-text">包名路径</span>
</div> </div>
<input type="text" class="form-control" id="packageName" name="packageName" placeholder="com.softdev.system"> <input type="text" class="form-control" id="packageName" name="packageName" value="com.softdev.system">
</div> </div>
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">