mirror of
https://github.com/moshowgame/SpringBootCodeGenerator.git
synced 2025-12-26 05:48:33 +08:00
1. 添加对象get set模板
2. 添加sql模板 3. 启动类添加日志输出,方便项目使用
This commit is contained in:
parent
ed91c94f00
commit
55a4383094
@ -1,11 +1,14 @@
|
||||
package com.softdev.system.generator;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
@Slf4j
|
||||
public class GeneratorWebApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(GeneratorWebApplication.class,args);
|
||||
log.info("项目启动启动成功!访问地址: http://localhost:1234/generator");
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,6 +89,13 @@ public class IndexController {
|
||||
//mybatis plus
|
||||
result.put("pluscontroller", freemarkerTool.processString("code-generator/mybatis-plus/pluscontroller.ftl", params));
|
||||
result.put("plusmapper", freemarkerTool.processString("code-generator/mybatis-plus/plusmapper.ftl", params));
|
||||
//util
|
||||
result.put("util", freemarkerTool.processString("code-generator/util/util.ftl", params));
|
||||
//sql generate
|
||||
result.put("select", freemarkerTool.processString("code-generator/sql/select.ftl", params));
|
||||
result.put("insert", freemarkerTool.processString("code-generator/sql/insert.ftl", params));
|
||||
result.put("update", freemarkerTool.processString("code-generator/sql/update.ftl", params));
|
||||
result.put("delete", freemarkerTool.processString("code-generator/sql/delete.ftl", params));
|
||||
|
||||
// 计算,生成代码行数
|
||||
int lineNum = 0;
|
||||
@ -108,4 +115,4 @@ public class IndexController {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
DELETE
|
||||
FROM
|
||||
${classInfo.tableName}
|
||||
WHERE
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
${fieldItem.columnName} = ''<#if fieldItem_has_next>,</#if>
|
||||
</#list>;
|
||||
</#if>
|
||||
@ -0,0 +1,9 @@
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
INSERT INTO ${classInfo.tableName} ( <#list classInfo.fieldList as fieldItem >${fieldItem.columnName}<#if fieldItem_has_next>,</#if></#list> )
|
||||
VALUES
|
||||
(
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
''<#if fieldItem_has_next>,</#if>
|
||||
</#list>
|
||||
);
|
||||
</#if>
|
||||
@ -0,0 +1,13 @@
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
SELECT
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
${fieldItem.columnName}<#if fieldItem_has_next>,</#if>
|
||||
</#list>
|
||||
FROM
|
||||
${classInfo.tableName}
|
||||
WHERE
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
<#if fieldItem_index != 0>AND </#if>${fieldItem.columnName} = ''
|
||||
</#list>;
|
||||
</#if>
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
UPDATE ${classInfo.tableName}
|
||||
SET
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
${fieldItem.columnName} = ''<#if fieldItem_has_next>,</#if>
|
||||
</#list>
|
||||
WHERE
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
${fieldItem.columnName} = ''<#if fieldItem_has_next>,</#if>
|
||||
</#list>;
|
||||
</#if>
|
||||
@ -0,0 +1,16 @@
|
||||
/**
|
||||
* ${classInfo.classComment}对象Get Set
|
||||
* @author ${authorName} ${.now?string('yyyy-MM-dd')}
|
||||
*/
|
||||
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem>
|
||||
// ${fieldItem.fieldComment}
|
||||
${fieldItem.fieldClass} ${fieldItem.fieldName} = ${classInfo.className?uncap_first}.get${fieldItem.fieldName?cap_first}();
|
||||
</#list>
|
||||
|
||||
<#list classInfo.fieldList as fieldItem>
|
||||
// ${fieldItem.fieldComment}
|
||||
${classInfo.className?uncap_first}.set${fieldItem.fieldName?cap_first}();
|
||||
</#list>
|
||||
</#if>
|
||||
@ -250,6 +250,19 @@ CREATE TABLE `userinfo` (
|
||||
<button type="button" class="btn btn-default generator" id="jtdao">dao</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-toolbar col-md-7" role="toolbar" aria-label="Toolbar with button groups">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<div class="btn btn-secondary disabled" id="btnGroupAddon">SQL</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group" role="group" aria-label="First group">
|
||||
<button type="button" class="btn btn-default generator" id="select">select</button>
|
||||
<button type="button" class="btn btn-default generator" id="insert">insert</button>
|
||||
<button type="button" class="btn btn-default generator" id="update">update</button>
|
||||
<button type="button" class="btn btn-default generator" id="delete">delete</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-top: 10px;">
|
||||
<div class="btn-toolbar col-md-5" role="toolbar" aria-label="Toolbar with button groups">
|
||||
@ -262,6 +275,16 @@ CREATE TABLE `userinfo` (
|
||||
<button type="button" class="btn btn-default generator" id="beetlentitydto">entitydto(lombok+swagger)</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-toolbar col-md-5" role="toolbar" aria-label="Toolbar with button groups">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<div class="btn btn-secondary disabled" id="btnGroupAddon">Util</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group" role="group" aria-label="First group">
|
||||
<button type="button" class="btn btn-default generator" id="util">bean get set</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<textarea id="genCodeArea" class="form-control btn-lg" ></textarea>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user