Skip to content

Commit

Permalink
解决名称空间删除报错问题
Browse files Browse the repository at this point in the history
  • Loading branch information
liyabing committed Jan 22, 2025
1 parent 2120a1e commit 0427a86
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 5 deletions.
8 changes: 7 additions & 1 deletion db/upgrade/2.7.0-upgrade-2.7.1-mysql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,10 @@
-- limitations under the License.

-- this file works for MySQL.
INSERT INTO `plugin_handle` VALUES ('1722804548510507032', '19', 'handleType', 'handleType', 2, 3, 1, '{"required":"0","rule":""}', '2025-01-02 17:20:50.233', '2025-01-02 17:20:50.233');
INSERT INTO `plugin_handle` VALUES ('1722804548510507032', '19', 'handleType', 'handleType', 2, 3, 1, '{"required":"0","rule":""}', '2025-01-02 17:20:50.233', '2025-01-02 17:20:50.233');

ALTER TABLE `auth_path` ADD COLUMN `namespace_id` varchar(50) NOT NULL COMMENT 'namespaceId' AFTER `path`;

UPDATE auth_path
SET namespace_id = '649330b6-c2d7-4edc-be8e-8a54df9eb385'
WHERE namespace_id IS NULL;
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,17 @@ public final class AuthPathDO extends BaseDO {

private Boolean enabled;

private String namespaceId;

public AuthPathDO() {
}

public AuthPathDO(final String authId, final String appName, final String path, final Boolean enabled) {
public AuthPathDO(final String authId, final String appName, final String path, final Boolean enabled, final String namespaceId) {
this.authId = authId;
this.appName = appName;
this.path = path;
this.enabled = enabled;
this.namespaceId= namespaceId;
}

/**
Expand Down Expand Up @@ -119,6 +122,15 @@ public void setEnabled(final Boolean enabled) {
this.enabled = enabled;
}

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

/**
* Build AuthPathDO object with given params.
*
Expand All @@ -127,14 +139,15 @@ public void setEnabled(final Boolean enabled) {
* @param appName {@linkplain String}
* @return {@linkplain AuthPathDO}
*/
public static AuthPathDO create(final String path, final String authId, final String appName) {
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())
.authId(authId)
.appName(appName)
.path(path)
.enabled(true)
.namespaceId(namespaceId)
.dateCreated(currentTime)
.dateUpdated(currentTime)
.build();
Expand All @@ -152,12 +165,12 @@ 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(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);
return Objects.hash(super.hashCode(), authId, appName, path, enabled,namespaceId);
}

/**
Expand All @@ -179,6 +192,8 @@ public static final class AuthPathDOBuilder {

private Boolean enabled;

private String namespaceId;

private String id;

private Timestamp dateCreated;
Expand Down Expand Up @@ -243,6 +258,17 @@ public AuthPathDOBuilder id(final String id) {
return this;
}

/**
* namespaceId.
*
* @param namespaceId namespaceId
* @return AppAuthDOBuilder
*/
public AuthPathDOBuilder namespaceId(final String namespaceId) {
this.namespaceId = namespaceId;
return this;
}

/**
* dateCreated.
*
Expand Down Expand Up @@ -277,6 +303,7 @@ public AuthPathDO build() {
authPathDO.setPath(path);
authPathDO.setEnabled(enabled);
authPathDO.setId(id);
authPathDO.setNamespaceId(namespaceId);
authPathDO.setDateCreated(dateCreated);
authPathDO.setDateUpdated(dateUpdated);
return authPathDO;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<result column="auth_id" jdbcType="VARCHAR" property="authId"/>
<result column="app_name" jdbcType="VARCHAR" property="appName"/>
<result column="path" jdbcType="VARCHAR" property="path"/>
<result column="namespace_id" jdbcType="VARCHAR" property="namespaceId"/>
<result column="enabled" jdbcType="TINYINT" property="enabled"/>
<result column="date_created" jdbcType="TIMESTAMP" property="dateCreated"/>
<result column="date_updated" jdbcType="TIMESTAMP" property="dateUpdated"/>
Expand Down

0 comments on commit 0427a86

Please sign in to comment.