mirror of
https://github.com/moshowgame/SpringBootCodeGenerator.git
synced 2025-12-26 05:48:33 +08:00
new swagger-ui model
This commit is contained in:
parent
cf709fad07
commit
9b3e9c9fc8
17
README.md
17
README.md
@ -1,3 +1,18 @@
|
||||

|
||||

|
||||
SpringBootCodeGenerator
|
||||
----
|
||||
SpringBoot代码生成器。用于生成mybatis和jpa相关代码,基于xxl-codegenerator。
|
||||
SpringBoot代码生成器。用于生成mybatis和jpa相关代码,基于xxl-codegenerator。
|
||||
<br><br>
|
||||
|
||||
<table><tbody>
|
||||
<tr><td>访问路径</td> <td>http://127.0.0.1:1234/generator</td></tr>
|
||||
<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>20180915<td>新增Swagger-UI模板。修复一些命名和导入问题。JPA的Entity默认第一个字段为Id,如果不是请手工修改。</td></tr>
|
||||
<tr><td>20180913<td>修复字段没有描述以及类型为DATE型导致的问题。新增JPA的Controller模板。</td></tr>
|
||||
<tr><td>20180831<td>初始化项目。新增JPA系列Entity+Repository模板。</td></tr>
|
||||
</tbody></table>
|
||||
|
||||
<table>
|
||||
@ -64,6 +64,7 @@ public class IndexController {
|
||||
result.put("model_code", freemarkerTool.processString("xxl-code-generator/model.ftl", params));
|
||||
|
||||
result.put("entity_code", freemarkerTool.processString("xxl-code-generator/entity.ftl", params));
|
||||
result.put("swaggerui_code", freemarkerTool.processString("xxl-code-generator/swaggerui.ftl", params));
|
||||
result.put("repository_code", freemarkerTool.processString("xxl-code-generator/repository.ftl", params));
|
||||
|
||||
result.put("jpacontroller_code", freemarkerTool.processString("xxl-code-generator/jpacontroller.ftl", params));
|
||||
@ -76,7 +77,7 @@ public class IndexController {
|
||||
}
|
||||
}
|
||||
logger.info("生成代码行数:{}", lineNum);
|
||||
|
||||
logger.info("生成代码数据:{}", result);
|
||||
return new ReturnT<Map<String, String>>(result);
|
||||
} catch (IOException | TemplateException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
|
||||
@ -31,17 +31,9 @@ $(function () {
|
||||
var entity_ide;
|
||||
var repository_ide;
|
||||
var jpacontroller_ide;
|
||||
var swaggerui_ide;
|
||||
function initCodeArea(){
|
||||
jpacontroller_ide = CodeMirror.fromTextArea(document.getElementById("jpacontroller_ide"), {
|
||||
lineNumbers: true,
|
||||
matchBrackets: true,
|
||||
mode: "text/x-java",
|
||||
lineWrapping:true,
|
||||
readOnly:true,
|
||||
foldGutter: true,
|
||||
gutters:["CodeMirror-linenumbers", "CodeMirror-foldgutter"]
|
||||
});
|
||||
jpacontroller_ide.setSize('auto','auto');
|
||||
|
||||
|
||||
// controller_ide
|
||||
controller_ide = CodeMirror.fromTextArea(document.getElementById("controller_ide"), {
|
||||
@ -136,6 +128,28 @@ $(function () {
|
||||
gutters:["CodeMirror-linenumbers", "CodeMirror-foldgutter"]
|
||||
});
|
||||
repository_ide.setSize('auto','auto');
|
||||
|
||||
jpacontroller_ide = CodeMirror.fromTextArea(document.getElementById("jpacontroller_ide"), {
|
||||
lineNumbers: true,
|
||||
matchBrackets: true,
|
||||
mode: "text/x-java",
|
||||
lineWrapping:true,
|
||||
readOnly:true,
|
||||
foldGutter: true,
|
||||
gutters:["CodeMirror-linenumbers", "CodeMirror-foldgutter"]
|
||||
});
|
||||
jpacontroller_ide.setSize('auto','auto');
|
||||
|
||||
swaggerui_ide = CodeMirror.fromTextArea(document.getElementById("swaggerui_ide"), {
|
||||
lineNumbers: true,
|
||||
matchBrackets: true,
|
||||
mode: "text/x-java",
|
||||
lineWrapping:true,
|
||||
readOnly:true,
|
||||
foldGutter: true,
|
||||
gutters:["CodeMirror-linenumbers", "CodeMirror-foldgutter"]
|
||||
});
|
||||
swaggerui_ide.setSize('auto','auto');
|
||||
}
|
||||
|
||||
initCodeArea();
|
||||
@ -187,6 +201,10 @@ $(function () {
|
||||
|
||||
jpacontroller_ide.setValue(data.data.jpacontroller_code);
|
||||
jpacontroller_ide.setSize('auto','auto');
|
||||
|
||||
console.log(data.data.swaggerui_code);
|
||||
swaggerui_ide.setValue(data.data.swaggerui_code);
|
||||
swaggerui_ide.setSize('auto','auto');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
@ -60,6 +60,7 @@ CREATE TABLE `userinfo` (
|
||||
<li><a href="#entity" data-toggle="tab">Entity</a></li>
|
||||
<li><a href="#repository" data-toggle="tab">Repository</a></li>
|
||||
<li><a href="#jpacontroller" data-toggle="tab">JpaController</a></li>
|
||||
<li><a href="#swaggerui" data-toggle="tab">Swagger-UI</a></li>
|
||||
|
||||
</ul>
|
||||
<div class="tab-content no-padding">
|
||||
@ -76,7 +77,12 @@ CREATE TABLE `userinfo` (
|
||||
</div>
|
||||
<div class="chart tab-pane active" id="jpacontroller" >
|
||||
<div class="box-body ">
|
||||
Repository:<textarea id="jpacontroller_ide" ></textarea>
|
||||
Controller:<textarea id="jpacontroller_ide" ></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="chart tab-pane active" id="swaggerui" >
|
||||
<div class="box-body ">
|
||||
Swagger-UI:<textarea id="swaggerui_ide" ></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -21,7 +21,8 @@ import java.util.List;
|
||||
@Table(name="${classInfo.tableName}")
|
||||
public class ${classInfo.className} implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
/**
|
||||
|
||||
@ -55,11 +55,8 @@ public class ${classInfo.className}Controller {
|
||||
@RequestParam(required = false, defaultValue = "0") int pageNumber,
|
||||
@RequestParam(required = false, defaultValue = "10") int pageSize) {
|
||||
|
||||
//创建匹配器,即如何使用查询条件
|
||||
ExampleMatcher matcher = ExampleMatcher.matching() //构建对象
|
||||
//这里追加查询处理方式。例如xxx字段采用“包含”的方式查询
|
||||
//.withMatcher("xxx", GenericPropertyMatchers.contains())
|
||||
;
|
||||
//创建匹配器,需要查询条件请修改此处代码
|
||||
ExampleMatcher matcher = ExampleMatcher.matchingAll();
|
||||
|
||||
//创建实例
|
||||
Example<${classInfo.className}> example = Example.of(${classInfo.className?uncap_first}, matcher);
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
@ApiOperation(value = "${classInfo.classComment}", notes = "${classInfo.classComment}")
|
||||
@ApiImplicitParams({
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
@ApiImplicitParam(name = "${fieldItem.fieldName}", value = "${fieldItem.fieldComment}", required = false, dataType = "${fieldItem.fieldClass}"),
|
||||
</#list>
|
||||
</#if>
|
||||
}
|
||||
)
|
||||
Loading…
x
Reference in New Issue
Block a user