代码优化
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
*/
|
||||
package com.jeesite.common.utils.excel.fieldtype;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
@@ -31,14 +32,15 @@ public class PostListType implements FieldType {
|
||||
* 获取对象值(导入)
|
||||
*/
|
||||
public Object getValue(String val) {
|
||||
List<String> list = new ArrayList<String>();
|
||||
for (String s : StringUtils.split(val, ",")) {
|
||||
for (Post e : postList) {
|
||||
if (StringUtils.trimToEmpty(s).equals(e.getPostName())) {
|
||||
postList.add(e);
|
||||
list.add(e.getPostCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
return postList.size() > 0 ? postList : null;
|
||||
return list.size() > 0 ? list.toArray(new String[list.size()]) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,7 +52,7 @@ public class PostListType implements FieldType {
|
||||
List<Post> postList = (List<Post>) val;
|
||||
return ListUtils.extractToString(postList, "postName", ", ");
|
||||
}
|
||||
return "";
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*/
|
||||
package com.jeesite.common.utils.excel.fieldtype;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
@@ -31,14 +32,15 @@ public class RoleListType implements FieldType {
|
||||
* 获取对象值(导入)
|
||||
*/
|
||||
public Object getValue(String val) {
|
||||
List<String> list = new ArrayList<String>();
|
||||
for (String s : StringUtils.split(val, ",")) {
|
||||
for (Role e : roleList) {
|
||||
if (StringUtils.trimToEmpty(s).equals(e.getRoleName())) {
|
||||
roleList.add(e);
|
||||
list.add(e.getRoleCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
return roleList.size() > 0 ? roleList : null;
|
||||
return list.size() > 0 ? list.toArray(new String[list.size()]) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,7 +52,7 @@ public class RoleListType implements FieldType {
|
||||
List<Role> roleList = (List<Role>) val;
|
||||
return ListUtils.extractToString(roleList, "roleName", ", ");
|
||||
}
|
||||
return "";
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -83,7 +83,9 @@ for(c in table.columnList){
|
||||
component: 'TreeSelect',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
style: 'width: calc(50% - 60px)',
|
||||
},
|
||||
colProps: { lg: 24, md: 24 },
|
||||
},
|
||||
<% }
|
||||
for (c in table.columnList){
|
||||
@@ -108,7 +110,7 @@ for (c in table.columnList){
|
||||
field: '${c.attrName}',
|
||||
<% if(c.showType == 'input' || c.showType == 'textarea'){ %>
|
||||
<% if (c.simpleAttrType == 'Integer' && c.attrName == 'treeSort'){ %>
|
||||
helpMessage: '升序${c.dataLength}',
|
||||
helpMessage: '升序',
|
||||
component: 'InputNumber',
|
||||
defaultValue: '30',
|
||||
<% }else{ %>
|
||||
|
||||
Reference in New Issue
Block a user