Former-commit-id: 942e0434072b99cc5cb55502497aaa5c665c490a
master
王兵 5 years ago
parent afa8e6023a
commit ea1e9ecb51

@ -123,7 +123,6 @@ public class ProjectManager {
table.setFind(true);
table.setGet(true);
table.setSearch(false);
table.setSys(md.isHasSysFields());//获取是否默认添加系统字段
checkSysFields(table);// 检查或移除系统字段
md.putTable(table);
return table;

@ -99,11 +99,6 @@ public class XmlManager {
module.setModulePrefix(modulePrefix.item(0).getTextContent());
}
NodeList hasSysFields = moduleElement.getElementsByTagName("hasSysFields");
if (hasSysFields.getLength() == 1) {
module.setHasSysFields(getBoolean(hasSysFields.item(0).getTextContent()));
}
NodeList tables = moduleElement.getElementsByTagName("table");
if (tables.getLength() > 0) {
for (int j = 0; j < tables.getLength(); j++) {
@ -210,7 +205,6 @@ public class XmlManager {
moduleName.setTextContent(md.getModuleName());
moduleComment.setTextContent(md.getModuleComment());
modulePrefix.setTextContent(md.getModulePrefix());
hasSysFields.setTextContent(String.valueOf(md.isHasSysFields()));
module.appendChild(moduleComment);
module.appendChild(modulePrefix);
module.appendChild(moduleName);

@ -809,21 +809,19 @@ public class SpringBootCallable implements Callable {
}
for (Module mo : project.getModules()) {
if (mo.isHasSysFields()) {//标准模型才好生成简单的htm
for (Table table : mo.getTables()) {
if (table.getHtml()) {
File module = Tool.createPath(screen.getAbsolutePath(), mo.getModuleName());
HashMap<String, Object> ctx = new HashMap<String, Object>();
ctx.put("basePackage", project.getProjectBasePackage());
ctx.put("tool", Tool.class);
ctx.put("author", project.getProjectAuthor());
ctx.put("date", new Date());
ctx.put("table", table);
ctx.put("module", module.getName());
ctx.put("fields", table.getFields());
File file = Tool.createFile(module.getAbsolutePath(), table.getFName() + ".ftl");
freeMarkerManager.outputTemp(file, "SpringBoot/resources/templates/screen/module/mgr.ftl", ctx);
}
for (Table table : mo.getTables()) {
if (table.getHtml()) {
File module = Tool.createPath(screen.getAbsolutePath(), mo.getModuleName());
HashMap<String, Object> ctx = new HashMap<String, Object>();
ctx.put("basePackage", project.getProjectBasePackage());
ctx.put("tool", Tool.class);
ctx.put("author", project.getProjectAuthor());
ctx.put("date", new Date());
ctx.put("table", table);
ctx.put("module", module.getName());
ctx.put("fields", table.getFields());
File file = Tool.createFile(module.getAbsolutePath(), table.getFName() + ".ftl");
freeMarkerManager.outputTemp(file, "SpringBoot/resources/templates/screen/module/mgr.ftl", ctx);
}
}
}

@ -31,19 +31,10 @@ public class Module extends TreeItem {
private List<Table> tables = new ArrayList();
private String moduleName;
private boolean hasSysFields = true;
private String projectName;
private String projectBasePackage;
private String projectAuthor;
public boolean isHasSysFields() {
return hasSysFields;
}
public void setHasSysFields(boolean hasSysFields) {
this.hasSysFields = hasSysFields;
}
public String getModuleName() {
return moduleName;
}

@ -55,7 +55,7 @@ public class ${table.getCName()}ManagerImpl implements ${table.getCName()}Manage
return response;
}
<#if module.isHasSysFields()>
<#if table.sys>
long id = IDgenerator.nextId();
${table.getCName()} entity = MapperUtil.map(request, ${table.getCName()}.class);
entity.setId(id);
@ -68,7 +68,7 @@ public class ${table.getCName()}ManagerImpl implements ${table.getCName()}Manage
response.addError(ErrorType.BUSINESS_ERROR, Message.CREATE_FAILURE);
return response;
}
<#if module.isHasSysFields()>
<#if table.sys>
response.setId(id);
</#if>

@ -11,7 +11,7 @@ import javax.validation.constraints.NotNull;
* @since ${date?string("yyyy-MM-dd")}
*/
public class ${table.getCName()}DeleteRequest extends BaseUpdateRequest {
<#if module.isHasSysFields()>
<#if table.sys>
/**
* 主键

@ -11,7 +11,7 @@ import ${basePackage}.frame.base.BaseResponse;
*/
public class ${table.getCName()}CreateResponse extends BaseResponse {
<#if module.isHasSysFields()>
<#if table.sys>
/**
* 主键
*/

@ -25,9 +25,9 @@ COMMENT ON COLUMN "${module.modulePrefix?default("")}${table.tableName}"."${fiel
-- ----------------------------
CREATE TABLE `${module.modulePrefix?default("")}${table.tableName}` (
<#list table.fields as field>
${dBmapper.getFieldSql(field)}<#if field_has_next||module.hasSysFields>,</#if>
${dBmapper.getFieldSql(field)}<#if field_has_next||table.sys>,</#if>
</#list>
<#if module.hasSysFields>
<#if table.sys>
PRIMARY KEY (`ID`)
</#if>
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='${table.tableComment?default("")}';

@ -28,9 +28,9 @@ COMMENT ON COLUMN "${module.modulePrefix?default("")}${table.tableName}"."${fiel
-- ----------------------------
CREATE TABLE `${module.modulePrefix?default("")}${table.tableName}` (
<#list table.fields as field>
${dBmapper.getFieldSql(field)}<#if field_has_next||module.hasSysFields>,</#if>
${dBmapper.getFieldSql(field)}<#if field_has_next||table.sys>,</#if>
</#list>
<#if module.hasSysFields>
<#if table.sys>
PRIMARY KEY (`ID`)
</#if>
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='${table.tableComment?default("")}';

@ -72,7 +72,7 @@ public class ${table.getCName()}Test {
${table.getCName()}CreateResponse createResponse = ${table.getFName()}Manager.create(createRequest,token);
<#if module.isHasSysFields()>
<#if table.sys>
assertTrue(!createResponse.hasError() && createResponse.getId() > 0);
<#else>
assertTrue(!createResponse.hasError());

Loading…
Cancel
Save

Powered by TurnKey Linux.