mirror of
https://github.com/moshowgame/SpringBootCodeGenerator.git
synced 2025-12-26 05:48:33 +08:00
优化Util下的BeanUtil,支持更多map.put的操作。整合CRUD模板到SQL(CRUD)模板。
This commit is contained in:
parent
271087331f
commit
3bbca9d780
@ -17,6 +17,8 @@
|
||||
- 提供众多通用模板,易于使用,复制粘贴加简单修改即可完成CRUD操作
|
||||
- 支持特殊字符模板(`#`请用`井`代替;`$`请用`¥`代替)
|
||||
- 根据comment=(mysql)或者comment on table(pgsql/oracle)生成类名注释
|
||||
- BeanUtil提供一些基本对象的使用方法供COPY
|
||||
|
||||
|
||||
# Url
|
||||
|
||||
@ -33,6 +35,7 @@
|
||||
|
||||
|更新日期|更新内容|
|
||||
|----|----|
|
||||
|20200628|优化Util下的BeanUtil,支持更多map.put的操作。整合CRUD模板到SQL(CRUD)模板。|
|
||||
|20200621|修复FreemarkerUtil的Path问题导致JAR包运行时无法获取template的问题。|
|
||||
|20200525|1.一些fix,关于封装工具类以及layui模板优化等.<br> 2.优化表备注的获取逻辑.<br> 3.生成时间格式改为yyyy-MM-dd,移除具体的时间,只保留日期|
|
||||
|20200522|1.新增insert-sql模式,支持对"insert into table (xxx) values (xxx)"语句进行处理,生成java代码(感谢三叔的建议).|
|
||||
|
||||
@ -139,9 +139,9 @@
|
||||
},
|
||||
{
|
||||
"id": "70",
|
||||
"name": "util",
|
||||
"name": "beanutil",
|
||||
"group": "util",
|
||||
"description": "util"
|
||||
"description": "beanutil"
|
||||
},
|
||||
{
|
||||
"id": "71",
|
||||
@ -156,27 +156,9 @@
|
||||
"description": "xml"
|
||||
},
|
||||
{
|
||||
"id": "80",
|
||||
"name": "select",
|
||||
"group": "sql",
|
||||
"description": "select"
|
||||
},
|
||||
{
|
||||
"id": "81",
|
||||
"name": "insert",
|
||||
"group": "sql",
|
||||
"description": "insert"
|
||||
},
|
||||
{
|
||||
"id": "82",
|
||||
"name": "update",
|
||||
"group": "sql",
|
||||
"description": "update"
|
||||
},
|
||||
{
|
||||
"id": "83",
|
||||
"name": "delete",
|
||||
"group": "sql",
|
||||
"description": "delete"
|
||||
"id": "73",
|
||||
"name": "sql",
|
||||
"group": "util",
|
||||
"description": "sql"
|
||||
}
|
||||
]
|
||||
@ -1,9 +0,0 @@
|
||||
<#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>
|
||||
@ -1,9 +0,0 @@
|
||||
<#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>
|
||||
@ -1,13 +0,0 @@
|
||||
<#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>
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
<#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,41 @@
|
||||
/**
|
||||
* ${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>
|
||||
|
||||
<#list classInfo.fieldList as fieldItem>
|
||||
// ${fieldItem.fieldComment}
|
||||
${classInfo.className?uncap_first}.set${fieldItem.fieldName?cap_first}(${classInfo.className?uncap_first}2.get${fieldItem.fieldName?cap_first}());
|
||||
</#list>
|
||||
|
||||
<#list classInfo.fieldList as fieldItem>
|
||||
// ${fieldItem.fieldComment}
|
||||
map.put("${fieldItem.fieldName?cap_first}",${classInfo.className?uncap_first}.get${fieldItem.fieldName?cap_first}());
|
||||
</#list>
|
||||
|
||||
<#list classInfo.fieldList as fieldItem>
|
||||
// ${fieldItem.fieldComment}
|
||||
map.put("${fieldItem.columnName}",${classInfo.className?uncap_first}.get${fieldItem.fieldName?cap_first}());
|
||||
</#list>
|
||||
|
||||
<#list classInfo.fieldList as fieldItem>
|
||||
map.put("${fieldItem.fieldComment}",${classInfo.className?uncap_first}.get${fieldItem.fieldName?cap_first}());
|
||||
</#list>
|
||||
|
||||
<#list classInfo.fieldList as fieldItem>
|
||||
// ${fieldItem.fieldComment}
|
||||
map.put("${fieldItem.fieldName?cap_first}",${classInfo.className?uncap_first}.get${fieldItem.fieldName?cap_first}());
|
||||
</#list>
|
||||
|
||||
</#if>
|
||||
@ -1,7 +1,7 @@
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
{
|
||||
<#list classInfo.fieldList as fieldItem>
|
||||
"${fieldItem.fieldName}":""<#if fieldItem_has_next>,</#if>
|
||||
"${fieldItem.fieldName}":"${fieldItem.fieldComment}"<#if fieldItem_has_next>,</#if>
|
||||
</#list>
|
||||
}
|
||||
</#if>
|
||||
|
||||
@ -0,0 +1,58 @@
|
||||
|
||||
<#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>
|
||||
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
${classInfo.tableName} t1
|
||||
LEFT JOIN xxx t2
|
||||
ON t1.${classInfo.tableName}_id=t2.${classInfo.tableName}_id
|
||||
WHERE 1=1;
|
||||
</#if>
|
||||
|
||||
<#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>
|
||||
|
||||
|
||||
<#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>
|
||||
|
||||
|
||||
|
||||
<#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>
|
||||
@ -1,21 +0,0 @@
|
||||
/**
|
||||
* ${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>
|
||||
|
||||
<#list classInfo.fieldList as fieldItem>
|
||||
// ${fieldItem.fieldComment}
|
||||
${classInfo.className?uncap_first}.set${fieldItem.fieldName?cap_first}(${classInfo.className?uncap_first}2.get${fieldItem.fieldName?cap_first}(););
|
||||
</#list>
|
||||
</#if>
|
||||
@ -5,7 +5,7 @@
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<${classInfo.className}>
|
||||
<#list classInfo.fieldList as fieldItem>
|
||||
<${fieldItem.fieldName}></${fieldItem.fieldName}>
|
||||
<${fieldItem.fieldName}>${fieldItem.fieldComment}</${fieldItem.fieldName}>
|
||||
</#list>
|
||||
</${classInfo.className}>
|
||||
</#if>
|
||||
|
||||
@ -306,16 +306,14 @@ CREATE TABLE 'userinfo' (
|
||||
<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 setWidth" id="btnGroupAddon">Mybatis</div>
|
||||
<div class="btn btn-secondary disabled setWidth" 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="mybatis">ibatisXml</button>
|
||||
<button type="button" class="btn btn-default generator" id="mapper">mapper</button>
|
||||
<button type="button" class="btn btn-default generator" id="mapper2">mapper2</button>
|
||||
<button type="button" class="btn btn-default generator" id="service">service</button>
|
||||
<button type="button" class="btn btn-default generator" id="service_impl">serviceImpl</button>
|
||||
<button type="button" class="btn btn-default generator" id="controller">controller</button>
|
||||
<button type="button" class="btn btn-default generator" id="beanutil">BeanUtil</button>
|
||||
<button type="button" class="btn btn-default generator" id="sql">SQL(CRUD)</button>
|
||||
<button type="button" class="btn btn-default generator" id="json">JSON</button>
|
||||
<button type="button" class="btn btn-default generator" id="xml">XML</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -390,28 +388,16 @@ CREATE TABLE 'userinfo' (
|
||||
<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 setWidth" id="btnGroupAddon">SQL</div>
|
||||
<div class="btn btn-secondary disabled setWidth" id="btnGroupAddon">Mybatis</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">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<div class="btn btn-secondary disabled setWidth" 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>
|
||||
<button type="button" class="btn btn-default generator" id="json">json</button>
|
||||
<button type="button" class="btn btn-default generator" id="xml">xml</button>
|
||||
<button type="button" class="btn btn-default generator" id="mybatis">ibatisXml</button>
|
||||
<button type="button" class="btn btn-default generator" id="mapper">mapper</button>
|
||||
<button type="button" class="btn btn-default generator" id="mapper2">mapper2</button>
|
||||
<button type="button" class="btn btn-default generator" id="service">service</button>
|
||||
<button type="button" class="btn btn-default generator" id="service_impl">serviceImpl</button>
|
||||
<button type="button" class="btn btn-default generator" id="controller">controller</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user