fix(系统设置): 权限页面的数据回显问题

This commit is contained in:
shiziyuan9527 2022-08-10 13:25:05 +08:00 committed by shiziyuan9527
parent 5b05eadeb8
commit 15b9d260b5
4 changed files with 18 additions and 5 deletions

View File

@ -3,10 +3,13 @@ package io.metersphere.dto;
import lombok.Data; import lombok.Data;
import java.io.Serializable;
import java.util.List; import java.util.List;
@Data @Data
public class GroupJson { public class GroupJson implements Serializable {
private static final long serialVersionUID = 1L;
private List<GroupResource> resource; private List<GroupResource> resource;
private List<GroupPermission> permissions; private List<GroupPermission> permissions;
} }

View File

@ -2,8 +2,12 @@ package io.metersphere.dto;
import lombok.Data; import lombok.Data;
import java.io.Serializable;
@Data @Data
public class GroupPermission { public class GroupPermission implements Serializable {
private static final long serialVersionUID = 1L;
private String id; private String id;
private String name; private String name;
private String resourceId; private String resourceId;

View File

@ -2,8 +2,12 @@ package io.metersphere.dto;
import lombok.Data; import lombok.Data;
import java.io.Serializable;
@Data @Data
public class GroupResource { public class GroupResource implements Serializable {
private static final long serialVersionUID = 1L;
private String id; private String id;
private String name; private String name;
private Boolean license = false; private Boolean license = false;

View File

@ -23,6 +23,7 @@ import io.metersphere.log.vo.OperatingLogDetails;
import io.metersphere.log.vo.system.SystemReference; import io.metersphere.log.vo.system.SystemReference;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.SerializationUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.session.ExecutorType; import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSession;
@ -178,8 +179,9 @@ public class GroupService {
if (groupJson == null) { if (groupJson == null) {
MSException.throwException(Translator.get("read_permission_file_fail")); MSException.throwException(Translator.get("read_permission_file_fail"));
} }
List<GroupResource> resource = groupJson.getResource(); GroupJson groupJsonCopy = SerializationUtils.clone(groupJson);
List<GroupPermission> permissions = groupJson.getPermissions(); List<GroupResource> resource = groupJsonCopy.getResource();
List<GroupPermission> permissions = groupJsonCopy.getPermissions();
List<GroupResourceDTO> dtoPermissions = dto.getPermissions(); List<GroupResourceDTO> dtoPermissions = dto.getPermissions();
dtoPermissions.addAll(getResourcePermission(resource, permissions, group.getType(), permissionList)); dtoPermissions.addAll(getResourcePermission(resource, permissions, group.getType(), permissionList));
return dto; return dto;