beetl新增toBoolean函数,简化调用;此项升级注意:一定要同步更新beetl-core.properties文件。

This commit is contained in:
thinkgem
2019-10-30 23:06:40 +08:00
parent 390c36ab93
commit 6ec4bd8e5a
7 changed files with 24 additions and 34 deletions

View File

@@ -93,6 +93,7 @@ FN.parentTag=org.beetl.ext.fn.ParentTagFunction
##JeeSite自定义函数 ##JeeSite自定义函数
FN.isBlank = com.jeesite.common.beetl.ext.fn.IsBlank FN.isBlank = com.jeesite.common.beetl.ext.fn.IsBlank
FN.isNotBlank = com.jeesite.common.beetl.ext.fn.IsNotBlank 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.toJson = com.jeesite.common.beetl.ext.fn.ToJson
FN.fromJson = com.jeesite.common.beetl.ext.fn.FromJson FN.fromJson = com.jeesite.common.beetl.ext.fn.FromJson
FN.hasPermi = com.jeesite.common.beetl.ext.fn.HasPermi FN.hasPermi = com.jeesite.common.beetl.ext.fn.HasPermi

View File

@@ -164,7 +164,7 @@ public class ${ClassName}Controller extends BaseController {
${className}Service.save(${className}); ${className}Service.save(${className});
return renderResult(Global.TRUE, text("保存${functionNameSimple}成功!")); return renderResult(Global.TRUE, text("保存${functionNameSimple}成功!"));
} }
<% if(@ObjectUtils.toBoolean(table.optionMap['isHaveDisableEnable'])){ %> <% if(toBoolean(table.optionMap['isHaveDisableEnable'])){ %>
/** /**
* 停用${functionNameSimple} * 停用${functionNameSimple}
@@ -199,7 +199,7 @@ public class ${ClassName}Controller extends BaseController {
return renderResult(Global.TRUE, text("启用${functionNameSimple}成功")); return renderResult(Global.TRUE, text("启用${functionNameSimple}成功"));
} }
<% } %> <% } %>
<% if(@ObjectUtils.toBoolean(table.optionMap['isHaveDelete'])){ %> <% if(toBoolean(table.optionMap['isHaveDelete'])){ %>
/** /**
* 删除${functionNameSimple} * 删除${functionNameSimple}

View File

@@ -22,7 +22,7 @@ import com.jeesite.common.entity.Page;
import com.jeesite.common.service.${table.isTreeEntity?'Tree':'Crud'}Service; import com.jeesite.common.service.${table.isTreeEntity?'Tree':'Crud'}Service;
import ${packageName}.${moduleName}.entity${isNotEmpty(subModuleName)?'.'+subModuleName:''}.${ClassName}; import ${packageName}.${moduleName}.entity${isNotEmpty(subModuleName)?'.'+subModuleName:''}.${ClassName};
import ${packageName}.${moduleName}.dao${isNotEmpty(subModuleName)?'.'+subModuleName:''}.${ClassName}Dao; 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; import com.jeesite.modules.file.utils.FileUploadUtils;
<% } %> <% } %>
<% for (child in table.childList){ %> <% for (child in table.childList){ %>
@@ -98,11 +98,11 @@ public class ${ClassName}Service extends ${table.isTreeEntity?'Tree':'Crud'}Serv
@Transactional(readOnly=false) @Transactional(readOnly=false)
public void save(${ClassName} ${className}) { public void save(${ClassName} ${className}) {
super.save(${className}); super.save(${className});
<% if(@ObjectUtils.toBoolean(table.optionMap['isImageUpload'])){ %> <% if(toBoolean(table.optionMap['isImageUpload'])){ %>
// 保存上传图片 // 保存上传图片
FileUploadUtils.saveFileUpload(${className}.getId(), "${className}_image"); FileUploadUtils.saveFileUpload(${className}.getId(), "${className}_image");
<% } %> <% } %>
<% if(@ObjectUtils.toBoolean(table.optionMap['isFileUpload'])){ %> <% if(toBoolean(table.optionMap['isFileUpload'])){ %>
// 保存上传附件 // 保存上传附件
FileUploadUtils.saveFileUpload(${className}.getId(), "${className}_file"); FileUploadUtils.saveFileUpload(${className}.getId(), "${className}_file");
<% } %> <% } %>

View File

@@ -7,7 +7,7 @@
<content><![CDATA[ <content><![CDATA[
<% <%
var extLibs = ''; var extLibs = '';
if(@ObjectUtils.toBoolean(table.optionMap['isImageUpload']) || @ObjectUtils.toBoolean(table.optionMap['isFileUpload'])){ if(toBoolean(table.optionMap['isImageUpload']) || toBoolean(table.optionMap['isFileUpload'])){
extLibs = extLibs + ',\'fileupload\''; extLibs = extLibs + ',\'fileupload\'';
} }
if(table.childList.~size > 0){ if(table.childList.~size > 0){

View File

@@ -77,7 +77,7 @@ $('#dataGrid').dataGrid({
<% }else{ %> <% }else{ %>
\<% if(hasPermi('${permissionPrefix}:edit')){ %> \<% if(hasPermi('${permissionPrefix}:edit')){ %>
actions.push('<a href="\${ctx}/${urlPrefix}/form?${idParam}" class="btnList" title="\${text("编辑${functionNameSimple}")}"><i class="fa fa-pencil"></i></a>&nbsp;'); actions.push('<a href="\${ctx}/${urlPrefix}/form?${idParam}" class="btnList" title="\${text("编辑${functionNameSimple}")}"><i class="fa fa-pencil"></i></a>&nbsp;');
<% if(@ObjectUtils.toBoolean(table.optionMap['isHaveDisableEnable'])){ %> <% if(toBoolean(table.optionMap['isHaveDisableEnable'])){ %>
if (row.status == Global.STATUS_NORMAL){ if (row.status == Global.STATUS_NORMAL){
actions.push('<a href="\${ctx}/${urlPrefix}/disable?${idParam}" class="btnList" title="\${text("停用${functionNameSimple}")}" data-confirm="\${text("确认要停用该${functionNameSimple}吗?")}"><i class="glyphicon glyphicon-ban-circle"></i></a>&nbsp;'); actions.push('<a href="\${ctx}/${urlPrefix}/disable?${idParam}" class="btnList" title="\${text("停用${functionNameSimple}")}" data-confirm="\${text("确认要停用该${functionNameSimple}吗?")}"><i class="glyphicon glyphicon-ban-circle"></i></a>&nbsp;');
} }
@@ -85,7 +85,7 @@ $('#dataGrid').dataGrid({
actions.push('<a href="\${ctx}/${urlPrefix}/enable?${idParam}" class="btnList" title="\${text("启用${functionNameSimple}")}" data-confirm="\${text("确认要启用该${functionNameSimple}吗?")}"><i class="glyphicon glyphicon-ok-circle"></i></a>&nbsp;'); actions.push('<a href="\${ctx}/${urlPrefix}/enable?${idParam}" class="btnList" title="\${text("启用${functionNameSimple}")}" data-confirm="\${text("确认要启用该${functionNameSimple}吗?")}"><i class="glyphicon glyphicon-ok-circle"></i></a>&nbsp;');
} }
<% } %> <% } %>
<% if(@ObjectUtils.toBoolean(table.optionMap['isHaveDelete'])){ %> <% if(toBoolean(table.optionMap['isHaveDelete'])){ %>
actions.push('<a href="\${ctx}/${urlPrefix}/delete?${idParam}" class="btnList" title="\${text("删除${functionNameSimple}")}" data-confirm="\${text("确认要删除该${functionNameSimple}<% if(table.isTreeEntity){ %>及所有子${functionNameSimple}<% } %>吗?")}"<% if(table.isTreeEntity){ %> data-deltreenode="'+row.id+'"<% } %>><i class="fa fa-trash-o"></i></a>&nbsp;'); actions.push('<a href="\${ctx}/${urlPrefix}/delete?${idParam}" class="btnList" title="\${text("删除${functionNameSimple}")}" data-confirm="\${text("确认要删除该${functionNameSimple}<% if(table.isTreeEntity){ %>及所有子${functionNameSimple}<% } %>吗?")}"<% if(table.isTreeEntity){ %> data-deltreenode="'+row.id+'"<% } %>><i class="fa fa-trash-o"></i></a>&nbsp;');
<% } %> <% } %>
<% if(table.isTreeEntity){ %> <% if(table.isTreeEntity){ %>

View File

@@ -76,7 +76,7 @@
<label class="control-label col-sm-${gridRowCol[1]}" title=""> <label class="control-label col-sm-${gridRowCol[1]}" title="">
<span class="required ${c.isNull == '1' ? 'hide' : ''}">*</span> \${text('${c.columnLabel}')}<i class="fa icon-question hide"></i></label> <span class="required ${c.isNull == '1' ? 'hide' : ''}">*</span> \${text('${c.columnLabel}')}<i class="fa icon-question hide"></i></label>
<div class="col-sm-${gridRowCol[2]}"> <div class="col-sm-${gridRowCol[2]}">
<% <%
var attrs = ''; var attrs = '';
if (c.dataLength != '0'){ if (c.dataLength != '0'){
var s = { %> maxlength="${c.dataLength}"<% }; var s = { %> maxlength="${c.dataLength}"<% };
@@ -103,60 +103,49 @@
if (c.showType == 'input'){ if (c.showType == 'input'){
// 如果为自定义主键则第一个pk字段需输出isNewRecord // 如果为自定义主键则第一个pk字段需输出isNewRecord
if (c.isPk == '1' && table.pkList[0].columnName == c.columnName){ 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') { } 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') { } else if (c.showType == 'select' || c.showType == 'select_multiple') {
var isMultiple = (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') { } 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') { } 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') { } else if (c.showType == 'date' || c.showType == 'datetime') {
var isTime = (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'}});"/> dataFormat="date${isTime?'time':''}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd${isTime?' HH:mm':''}',isShowClear:${c.isRequired != '1'}});"/>
<% <%
} else if (c.showType == 'userselect') { } 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}" path="${c.attrName}" labelPath="${c.attrName2}"
url="\${ctx}/sys/office/treeData?isLoadUser=true" url="\${ctx}/sys/office/treeData?isLoadUser=true"
class="${cssClass}" allowClear="true"/> class="${cssClass}" allowClear="true"/>
<% <%
} else if (c.showType == 'officeselect') { } 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}" path="${c.attrName}" labelPath="${c.attrName2}"
url="\${ctx}/sys/office/treeData" url="\${ctx}/sys/office/treeData"
class="${cssClass}" allowClear="true"/> class="${cssClass}" allowClear="true"/>
<% <%
} else if (c.showType == 'areaselect') { } 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}" path="${c.attrName}" labelPath="${c.attrName2}"
url="\${ctx}/sys/area/treeData" url="\${ctx}/sys/area/treeData"
class="${cssClass}" allowClear="true"/> class="${cssClass}" allowClear="true"/>
<% <%
} }
%> %></div>
</div>
</div> </div>
</div> </div>
<% <%
@@ -179,7 +168,7 @@
<% <%
} }
// 输出上传图片控件 // 输出上传图片控件
if(@ObjectUtils.toBoolean(table.optionMap['isImageUpload'])){ if(toBoolean(table.optionMap['isImageUpload'])){
%> %>
<div class="row"> <div class="row">
<div class="col-xs-12"> <div class="col-xs-12">
@@ -195,7 +184,7 @@
<% <%
} }
// 输出上传附件控件 // 输出上传附件控件
if(@ObjectUtils.toBoolean(table.optionMap['isFileUpload'])){ if(toBoolean(table.optionMap['isFileUpload'])){
%> %>
<div class="row"> <div class="row">
<div class="col-xs-12"> <div class="col-xs-12">

View File

@@ -7,7 +7,7 @@
<content><![CDATA[ <content><![CDATA[
<% <%
var extLibs = ''; var extLibs = '';
if(@ObjectUtils.toBoolean(table.optionMap['isImageUpload']) || @ObjectUtils.toBoolean(table.optionMap['isFileUpload'])){ if(toBoolean(table.optionMap['isImageUpload']) || toBoolean(table.optionMap['isFileUpload'])){
extLibs = extLibs + ',\'fileupload\''; extLibs = extLibs + ',\'fileupload\'';
} }
if(table.childList.~size > 0){ if(table.childList.~size > 0){