From 6ec4bd8e5a4e1a3215cfec06c57c027b5fe9c7fa Mon Sep 17 00:00:00 2001 From: thinkgem Date: Wed, 30 Oct 2019 23:06:40 +0800 Subject: [PATCH] =?UTF-8?q?beetl=E6=96=B0=E5=A2=9EtoBoolean=E5=87=BD?= =?UTF-8?q?=E6=95=B0=EF=BC=8C=E7=AE=80=E5=8C=96=E8=B0=83=E7=94=A8=EF=BC=9B?= =?UTF-8?q?=E6=AD=A4=E9=A1=B9=E5=8D=87=E7=BA=A7=E6=B3=A8=E6=84=8F=EF=BC=9A?= =?UTF-8?q?=E4=B8=80=E5=AE=9A=E8=A6=81=E5=90=8C=E6=AD=A5=E6=9B=B4=E6=96=B0?= =?UTF-8?q?beetl-core.properties=E6=96=87=E4=BB=B6=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/config/beetl-core.properties | 1 + .../templates/modules/gen/crud/controller.xml | 4 +- .../templates/modules/gen/crud/service.xml | 6 +-- .../templates/modules/gen/crud/viewForm.xml | 2 +- .../modules/gen/include/dataGridScript.html | 4 +- .../modules/gen/include/formControl.html | 39 +++++++------------ .../templates/modules/gen/query/viewForm.xml | 2 +- 7 files changed, 24 insertions(+), 34 deletions(-) diff --git a/modules/core/src/main/resources/config/beetl-core.properties b/modules/core/src/main/resources/config/beetl-core.properties index f2a2b137..74d48a80 100644 --- a/modules/core/src/main/resources/config/beetl-core.properties +++ b/modules/core/src/main/resources/config/beetl-core.properties @@ -93,6 +93,7 @@ FN.parentTag=org.beetl.ext.fn.ParentTagFunction ##JeeSite自定义函数 FN.isBlank = com.jeesite.common.beetl.ext.fn.IsBlank FN.isNotBlank = com.jeesite.common.beetl.ext.fn.IsNotBlank +FN.toBoolean = com.jeesite.common.beetl.ext.fn.ToBoolean FN.toJson = com.jeesite.common.beetl.ext.fn.ToJson FN.fromJson = com.jeesite.common.beetl.ext.fn.FromJson FN.hasPermi = com.jeesite.common.beetl.ext.fn.HasPermi diff --git a/modules/core/src/main/resources/templates/modules/gen/crud/controller.xml b/modules/core/src/main/resources/templates/modules/gen/crud/controller.xml index ed3d0efe..76df546d 100644 --- a/modules/core/src/main/resources/templates/modules/gen/crud/controller.xml +++ b/modules/core/src/main/resources/templates/modules/gen/crud/controller.xml @@ -164,7 +164,7 @@ public class ${ClassName}Controller extends BaseController { ${className}Service.save(${className}); return renderResult(Global.TRUE, text("保存${functionNameSimple}成功!")); } - <% if(@ObjectUtils.toBoolean(table.optionMap['isHaveDisableEnable'])){ %> + <% if(toBoolean(table.optionMap['isHaveDisableEnable'])){ %> /** * 停用${functionNameSimple} @@ -199,7 +199,7 @@ public class ${ClassName}Controller extends BaseController { return renderResult(Global.TRUE, text("启用${functionNameSimple}成功")); } <% } %> - <% if(@ObjectUtils.toBoolean(table.optionMap['isHaveDelete'])){ %> + <% if(toBoolean(table.optionMap['isHaveDelete'])){ %> /** * 删除${functionNameSimple} diff --git a/modules/core/src/main/resources/templates/modules/gen/crud/service.xml b/modules/core/src/main/resources/templates/modules/gen/crud/service.xml index 595af5a5..de718b38 100644 --- a/modules/core/src/main/resources/templates/modules/gen/crud/service.xml +++ b/modules/core/src/main/resources/templates/modules/gen/crud/service.xml @@ -22,7 +22,7 @@ import com.jeesite.common.entity.Page; import com.jeesite.common.service.${table.isTreeEntity?'Tree':'Crud'}Service; import ${packageName}.${moduleName}.entity${isNotEmpty(subModuleName)?'.'+subModuleName:''}.${ClassName}; import ${packageName}.${moduleName}.dao${isNotEmpty(subModuleName)?'.'+subModuleName:''}.${ClassName}Dao; -<% if(@ObjectUtils.toBoolean(table.optionMap['isImageUpload']) || @ObjectUtils.toBoolean(table.optionMap['isFileUpload'])){ %> +<% if(toBoolean(table.optionMap['isImageUpload']) || toBoolean(table.optionMap['isFileUpload'])){ %> import com.jeesite.modules.file.utils.FileUploadUtils; <% } %> <% for (child in table.childList){ %> @@ -98,11 +98,11 @@ public class ${ClassName}Service extends ${table.isTreeEntity?'Tree':'Crud'}Serv @Transactional(readOnly=false) public void save(${ClassName} ${className}) { super.save(${className}); - <% if(@ObjectUtils.toBoolean(table.optionMap['isImageUpload'])){ %> + <% if(toBoolean(table.optionMap['isImageUpload'])){ %> // 保存上传图片 FileUploadUtils.saveFileUpload(${className}.getId(), "${className}_image"); <% } %> - <% if(@ObjectUtils.toBoolean(table.optionMap['isFileUpload'])){ %> + <% if(toBoolean(table.optionMap['isFileUpload'])){ %> // 保存上传附件 FileUploadUtils.saveFileUpload(${className}.getId(), "${className}_file"); <% } %> diff --git a/modules/core/src/main/resources/templates/modules/gen/crud/viewForm.xml b/modules/core/src/main/resources/templates/modules/gen/crud/viewForm.xml index e6d59afd..4c03ab52 100644 --- a/modules/core/src/main/resources/templates/modules/gen/crud/viewForm.xml +++ b/modules/core/src/main/resources/templates/modules/gen/crud/viewForm.xml @@ -7,7 +7,7 @@ 0){ diff --git a/modules/core/src/main/resources/templates/modules/gen/include/dataGridScript.html b/modules/core/src/main/resources/templates/modules/gen/include/dataGridScript.html index e8d1deda..427efec2 100644 --- a/modules/core/src/main/resources/templates/modules/gen/include/dataGridScript.html +++ b/modules/core/src/main/resources/templates/modules/gen/include/dataGridScript.html @@ -77,7 +77,7 @@ $('#dataGrid').dataGrid({ <% }else{ %> \<% if(hasPermi('${permissionPrefix}:edit')){ %> actions.push(' '); - <% if(@ObjectUtils.toBoolean(table.optionMap['isHaveDisableEnable'])){ %> + <% if(toBoolean(table.optionMap['isHaveDisableEnable'])){ %> if (row.status == Global.STATUS_NORMAL){ actions.push(' '); } @@ -85,7 +85,7 @@ $('#dataGrid').dataGrid({ actions.push(' '); } <% } %> - <% if(@ObjectUtils.toBoolean(table.optionMap['isHaveDelete'])){ %> + <% if(toBoolean(table.optionMap['isHaveDelete'])){ %> actions.push('及所有子${functionNameSimple}<% } %>吗?")}"<% if(table.isTreeEntity){ %> data-deltreenode="'+row.id+'"<% } %>> '); <% } %> <% if(table.isTreeEntity){ %> diff --git a/modules/core/src/main/resources/templates/modules/gen/include/formControl.html b/modules/core/src/main/resources/templates/modules/gen/include/formControl.html index 9562b037..ed3a1ad3 100644 --- a/modules/core/src/main/resources/templates/modules/gen/include/formControl.html +++ b/modules/core/src/main/resources/templates/modules/gen/include/formControl.html @@ -76,7 +76,7 @@
- <% + <% var attrs = ''; if (c.dataLength != '0'){ var s = { %> maxlength="${c.dataLength}"<% }; @@ -103,60 +103,49 @@ if (c.showType == 'input'){ // 如果为自定义主键,则第一个pk字段需输出isNewRecord if (c.isPk == '1' && table.pkList[0].columnName == c.columnName){ - %> - <${'#'}form:hidden path="isNewRecord"/> + %><${'#'}form:hidden path="isNewRecord"/> <% } - %> - <${'#'}form:input path="${c.attrName}"${attrs} class="form-control${cssClass}"/> + %><${'#'}form:input path="${c.attrName}"${attrs} class="form-control${cssClass}"/> <% } else if (c.showType == 'textarea') { - %> - <${'#'}form:textarea path="${c.attrName}" rows="4"${attrs} class="form-control${cssClass}"/> + %><${'#'}form:textarea path="${c.attrName}" rows="4"${attrs} class="form-control${cssClass}"/> <% } else if (c.showType == 'select' || c.showType == 'select_multiple') { var isMultiple = (c.showType == 'select_multiple'); - %> - <${'#'}form:select path="${c.attrName}" dictType="${c.optionMap['dictType']}"${isMultiple?' multiple="true"':''}${c.isRequired != '1'?' blankOption="true"':''} class="form-control${cssClass}" /> + %><${'#'}form:select path="${c.attrName}" dictType="${c.optionMap['dictType']}"${isMultiple?' multiple="true"':''}${c.isRequired != '1'?' blankOption="true"':''} class="form-control${cssClass}" /> <% } else if (c.showType == 'radio') { - %> - <${'#'}form:radio path="${c.attrName}" dictType="${c.optionMap['dictType']}" class="form-control${cssClass}" /> + %><${'#'}form:radio path="${c.attrName}" dictType="${c.optionMap['dictType']}" class="form-control${cssClass}" /> <% } else if (c.showType == 'checkbox') { - %> - <${'#'}form:checkbox path="${c.attrName}" dictType="${c.optionMap['dictType']}" class="form-control${cssClass}" /> + %><${'#'}form:checkbox path="${c.attrName}" dictType="${c.optionMap['dictType']}" class="form-control${cssClass}" /> <% } else if (c.showType == 'date' || c.showType == 'datetime') { var isTime = (c.showType == 'datetime'); - %> - <${'#'}form:input path="${c.attrName}" readonly="true" maxlength="20" class="form-control Wdate${cssClass}" + %><${'#'}form:input path="${c.attrName}" readonly="true" maxlength="20" class="form-control Wdate${cssClass}" dataFormat="date${isTime?'time':''}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd${isTime?' HH:mm':''}',isShowClear:${c.isRequired != '1'}});"/> <% } else if (c.showType == 'userselect') { - %> - <${'#'}form:treeselect id="${c.simpleAttrName}" title="\${text('用户选择')}" + %><${'#'}form:treeselect id="${c.simpleAttrName}" title="\${text('用户选择')}" path="${c.attrName}" labelPath="${c.attrName2}" url="\${ctx}/sys/office/treeData?isLoadUser=true" class="${cssClass}" allowClear="true"/> <% } else if (c.showType == 'officeselect') { - %> - <${'#'}form:treeselect id="${c.simpleAttrName}" title="\${text('机构选择')}" + %><${'#'}form:treeselect id="${c.simpleAttrName}" title="\${text('机构选择')}" path="${c.attrName}" labelPath="${c.attrName2}" url="\${ctx}/sys/office/treeData" class="${cssClass}" allowClear="true"/> <% } else if (c.showType == 'areaselect') { - %> - <${'#'}form:treeselect id="${c.simpleAttrName}" title="\${text('区域选择')}" + %><${'#'}form:treeselect id="${c.simpleAttrName}" title="\${text('区域选择')}" path="${c.attrName}" labelPath="${c.attrName2}" url="\${ctx}/sys/area/treeData" class="${cssClass}" allowClear="true"/> <% } - %> -
+ %> <% @@ -179,7 +168,7 @@ <% } // 输出上传图片控件 - if(@ObjectUtils.toBoolean(table.optionMap['isImageUpload'])){ + if(toBoolean(table.optionMap['isImageUpload'])){ %>
@@ -195,7 +184,7 @@ <% } // 输出上传附件控件 - if(@ObjectUtils.toBoolean(table.optionMap['isFileUpload'])){ + if(toBoolean(table.optionMap['isFileUpload'])){ %>
diff --git a/modules/core/src/main/resources/templates/modules/gen/query/viewForm.xml b/modules/core/src/main/resources/templates/modules/gen/query/viewForm.xml index f986a9a9..a722483d 100644 --- a/modules/core/src/main/resources/templates/modules/gen/query/viewForm.xml +++ b/modules/core/src/main/resources/templates/modules/gen/query/viewForm.xml @@ -7,7 +7,7 @@ 0){