employeePosts 参数数组转换为字符串,逗号分隔。

This commit is contained in:
thinkgem
2021-11-03 21:33:15 +08:00
parent a90052d7f2
commit 9e25ba658c
2 changed files with 6 additions and 5 deletions

View File

@@ -380,7 +380,7 @@ public class InitCoreData extends BaseInitDataTests {
entity.setUserRoleString(val);
return true;
}else if ("employee.employeePosts".equals(header)){
entity.getEmployee().setEmployeePosts(new String[]{val});
entity.getEmployee().setEmployeePosts(val);
return true;
}
}

View File

@@ -145,13 +145,14 @@ public class Employee extends DataEntity<Employee> {
this.employeePostList = employeePostList;
}
public String[] getEmployeePosts() {
public String getEmployeePosts() {
List<String> list = ListUtils.extractToList(employeePostList, "postCode");
return list.toArray(new String[list.size()]);
return StringUtils.join(list, ",");
}
public void setEmployeePosts(String[] employeePosts) {
for (String val : employeePosts){
public void setEmployeePosts(String employeePosts) {
String[] list = StringUtils.split(employeePosts, ",");
for (String val : list){
if (StringUtils.isNotBlank(val)){
EmployeePost e = new EmployeePost();
e.setPostCode(val);