Skip to content

Commit

Permalink
fix namespace delete error
Browse files Browse the repository at this point in the history
  • Loading branch information
liyabing committed Jan 23, 2025
1 parent ad9c43b commit 4d3466d
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public class AuthPathDTO implements Serializable {
@NotBlank
private String path;

private String namespaceId;

private Boolean enabled;

/**
Expand Down Expand Up @@ -71,6 +73,24 @@ public void setPath(final String path) {
this.path = path;
}

/**
* Gets the value of namespaceId.
*
* @return the value of namespaceId
*/
public String getNamespaceId() {
return namespaceId;
}

/**
* Sets the namespaceId.
*
* @param namespaceId namespaceId
*/
public void setNamespaceId(final String namespaceId) {
this.namespaceId = namespaceId;
}

/**
* Gets the value of enabled.
*
Expand Down Expand Up @@ -98,7 +118,8 @@ public boolean equals(final Object o) {
return false;
}
AuthPathDTO that = (AuthPathDTO) o;
return Objects.equals(appName, that.appName) && Objects.equals(path, that.path) && Objects.equals(enabled, that.enabled);
return Objects.equals(appName, that.appName) && Objects.equals(path, that.path)
&& Objects.equals(enabled, that.enabled) && Objects.equals(namespaceId, that.namespaceId);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public AuthPathDO(final String authId, final String appName, final String path,
this.appName = appName;
this.path = path;
this.enabled = enabled;
this.namespaceId= namespaceId;
this.namespaceId = namespaceId;
}

/**
Expand Down Expand Up @@ -137,9 +137,10 @@ public void setNamespaceId(final String namespaceId) {
* @param path {@linkplain String}
* @param authId {@linkplain String}
* @param appName {@linkplain String}
* @param namespaceId {@linkplain String}
* @return {@linkplain AuthPathDO}
*/
public static AuthPathDO create(final String path, final String authId, final String appName,final String namespaceId) {
public static AuthPathDO create(final String path, final String authId, final String appName, final String namespaceId) {
Timestamp currentTime = new Timestamp(System.currentTimeMillis());
return AuthPathDO.builder()
.id(UUIDUtils.getInstance().generateShortUuid())
Expand All @@ -165,12 +166,13 @@ public boolean equals(final Object o) {
return false;
}
AuthPathDO that = (AuthPathDO) o;
return Objects.equals(authId, that.authId) && Objects.equals(appName, that.appName) && Objects.equals(path, that.path) && Objects.equals(namespaceId, that.namespaceId) && Objects.equals(enabled, that.enabled);
return Objects.equals(authId, that.authId) && Objects.equals(appName, that.appName) && Objects.equals(path, that.path)
&& Objects.equals(namespaceId, that.namespaceId) && Objects.equals(enabled, that.enabled);
}

@Override
public int hashCode() {
return Objects.hash(super.hashCode(), authId, appName, path, enabled,namespaceId);
return Objects.hash(super.hashCode(), authId, appName, path, enabled, namespaceId);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public ShenyuAdminResult applyCreate(final AuthApplyDTO authApplyDTO) {
if (Boolean.TRUE.equals(appAuthDO.getOpen())) {
List<AuthPathDO> collect = authApplyDTO.getPathList()
.stream()
.map(path -> AuthPathDO.create(path, appAuthDO.getId(), authApplyDTO.getAppName()))
.map(path -> AuthPathDO.create(path, appAuthDO.getId(), authApplyDTO.getAppName(), appAuthDO.getNamespaceId()))
.collect(Collectors.toList());
authPathMapper.batchSave(collect);
data.setPathDataList(collect.stream().map(authPathDO ->
Expand Down Expand Up @@ -163,7 +163,7 @@ public ShenyuAdminResult applyUpdate(final AuthApplyDTO authApplyDTO) {
}
List<AuthPathDO> collect = authApplyDTO.getPathList()
.stream()
.map(path -> AuthPathDO.create(path, appAuthDO.getId(), authApplyDTO.getAppName()))
.map(path -> AuthPathDO.create(path, appAuthDO.getId(), authApplyDTO.getAppName(), appAuthDO.getNamespaceId()))
.collect(Collectors.toList());
authPathMapper.batchSave(collect);
}
Expand Down Expand Up @@ -199,7 +199,7 @@ public ShenyuAdminResult updateDetail(final AppAuthDTO appAuthDTO) {

List<AuthPathDO> authPathDOList = authPathDTOList.stream()
.filter(Objects::nonNull)
.map(dto -> AuthPathDO.create(dto.getPath(), appAuthDTO.getId(), appName))
.map(dto -> AuthPathDO.create(dto.getPath(), appAuthDTO.getId(), appName, appAuthDTO.getNamespaceId()))
.collect(Collectors.toList());
authPathMapper.batchSave(authPathDOList);
}
Expand All @@ -223,7 +223,7 @@ public ShenyuAdminResult updateDetailPath(final AuthPathWarpDTO authPathWarpDTO)

List<AuthPathDO> collect = authPathDTOList.stream()
.filter(Objects::nonNull)
.map(authPathDTO -> AuthPathDO.create(authPathDTO.getPath(), appAuthDO.getId(), authPathDTO.getAppName()))
.map(authPathDTO -> AuthPathDO.create(authPathDTO.getPath(), appAuthDO.getId(), authPathDTO.getAppName(), appAuthDO.getNamespaceId()))
.collect(Collectors.toList());
authPathMapper.batchSave(collect);
}
Expand Down Expand Up @@ -309,7 +309,7 @@ public ConfigImportResult importData(final List<AppAuthDTO> authDataList) {
if (CollectionUtils.isNotEmpty(authPathDTOList)) {
List<AuthPathDO> authPathDOS = authPathDTOList
.stream()
.map(param -> AuthPathDO.create(param.getPath(), authId, param.getAppName()))
.map(param -> AuthPathDO.create(param.getPath(), authId, param.getAppName(), param.getNamespaceId()))
.collect(Collectors.toList());
authPathMapper.batchSave(authPathDOS);
}
Expand Down Expand Up @@ -371,7 +371,7 @@ public ConfigImportResult importData(final String namespace, final List<AppAuthD
if (CollectionUtils.isNotEmpty(authPathDTOList)) {
List<AuthPathDO> authPathDOS = authPathDTOList
.stream()
.map(param -> AuthPathDO.create(param.getPath(), authId, param.getAppName()))
.map(param -> AuthPathDO.create(param.getPath(), authId, param.getAppName(), param.getNamespaceId()))
.collect(Collectors.toList());
authPathMapper.batchSave(authPathDOS);
}
Expand Down

0 comments on commit 4d3466d

Please sign in to comment.