serializer = new EncryptedJsonSerializer(
+ writer.getSerializer(), deserializer);
+ writer.assignSerializer(serializer);
+ newWriter.add(writer);
+ }
+ }
+
+ return newWriter;
+ }
+}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/crypto/EncryptionModule.java b/eiam-common/src/main/java/cn/topiam/employee/common/crypto/EncryptionModule.java
new file mode 100644
index 00000000..ec66395a
--- /dev/null
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/crypto/EncryptionModule.java
@@ -0,0 +1,75 @@
+/*
+ * eiam-common - Employee Identity and Access Management Program
+ * Copyright © 2020-2023 TopIAM (support@topiam.cn)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+package cn.topiam.employee.common.crypto;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import com.fasterxml.jackson.databind.module.SimpleModule;
+
+/**
+ * @author TopIAM
+ * Created by support@topiam.cn on 2022/12/22 21:53
+ */
+public class EncryptionModule extends SimpleModule {
+
+ private final Type serializer;
+ private final Type deserializer;
+
+ public EncryptionModule() {
+ this.serializer = null;
+ this.deserializer = null;
+ }
+
+ public EncryptionModule(Type serializer, Type deserializer) {
+ this.serializer = serializer;
+ this.deserializer = deserializer;
+ }
+
+ @Override
+ public void setupModule(SetupContext setupContext) {
+ setupContext.addBeanSerializerModifier(new EncryptedSerializerModifier(serializer));
+ setupContext.addBeanDeserializerModifier(new EncryptedDeserializerModifier(deserializer));
+ }
+
+ public static ObjectMapper serializerEncrypt() {
+ return createMapper(Type.ENCRYPT, Type.NONE);
+ }
+
+ public static ObjectMapper deserializerEncrypt() {
+ return createMapper(Type.NONE, Type.ENCRYPT);
+ }
+
+ public static ObjectMapper serializerDecrypt() {
+ return createMapper(Type.DECRYPT, Type.NONE);
+ }
+
+ public static ObjectMapper deserializerDecrypt() {
+ return createMapper(Type.NONE, Type.DECRYPT);
+ }
+
+ public static ObjectMapper createMapper(Type serializer, Type deserializer) {
+ ObjectMapper objectMapper = new ObjectMapper();
+ objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+ objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
+ objectMapper.registerModule(new EncryptionModule(serializer, deserializer));
+ return objectMapper;
+ }
+}
\ No newline at end of file
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/crypto/Type.java b/eiam-common/src/main/java/cn/topiam/employee/common/crypto/Type.java
new file mode 100644
index 00000000..ae8de653
--- /dev/null
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/crypto/Type.java
@@ -0,0 +1,38 @@
+/*
+ * eiam-common - Employee Identity and Access Management Program
+ * Copyright © 2020-2023 TopIAM (support@topiam.cn)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+package cn.topiam.employee.common.crypto;
+
+/**
+ * @author TopIAM
+ * Created by support@topiam.cn on 2022/12/22 21:53
+ */
+public enum Type {
+ /**
+ * Encrypt
+ */
+ ENCRYPT,
+ /**
+ * Decrypt
+ */
+ DECRYPT,
+
+ /**
+ * None
+ */
+ NONE
+}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/account/OrganizationEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/account/OrganizationEntity.java
index 59e4c521..d6b13219 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/account/OrganizationEntity.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/account/OrganizationEntity.java
@@ -25,14 +25,19 @@ import javax.persistence.Entity;
import javax.persistence.Table;
import org.hibernate.Hibernate;
+import org.hibernate.annotations.SQLDelete;
+import org.hibernate.annotations.SQLDeleteAll;
+import org.hibernate.annotations.Where;
import cn.topiam.employee.common.enums.DataOrigin;
import cn.topiam.employee.common.enums.OrganizationType;
-import cn.topiam.employee.support.repository.domain.BaseEntity;
+import cn.topiam.employee.support.repository.domain.LogicDeleteEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_WHERE;
/**
*
@@ -46,8 +51,11 @@ import lombok.ToString;
@Setter
@ToString
@Entity
-@Table(name = "`organization`")
-public class OrganizationEntity extends BaseEntity {
+@Table(name = "organization")
+@SQLDelete(sql = "update organization set " + SOFT_DELETE_SET + " where id_ = ?")
+@SQLDeleteAll(sql = "update organization set " + SOFT_DELETE_SET + " where id_ = ?")
+@Where(clause = SOFT_DELETE_WHERE)
+public class OrganizationEntity extends LogicDeleteEntity {
@Serial
private static final long serialVersionUID = 8143944323232082295L;
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/account/OrganizationMemberEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/account/OrganizationMemberEntity.java
index c6dd357f..d3ee275a 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/account/OrganizationMemberEntity.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/account/OrganizationMemberEntity.java
@@ -24,13 +24,18 @@ import javax.persistence.Entity;
import javax.persistence.Table;
import org.hibernate.Hibernate;
+import org.hibernate.annotations.SQLDelete;
+import org.hibernate.annotations.SQLDeleteAll;
+import org.hibernate.annotations.Where;
-import cn.topiam.employee.support.repository.domain.BaseEntity;
+import cn.topiam.employee.support.repository.domain.LogicDeleteEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_WHERE;
/**
* 组织机构成员
@@ -43,8 +48,11 @@ import lombok.experimental.Accessors;
@ToString
@Accessors(chain = true)
@Entity
-@Table(name = "`organization_member`")
-public class OrganizationMemberEntity extends BaseEntity {
+@Table(name = "organization_member")
+@SQLDelete(sql = "update organization_member set " + SOFT_DELETE_SET + " where id_ = ?")
+@SQLDeleteAll(sql = "update organization_member set " + SOFT_DELETE_SET + " where id_ = ?")
+@Where(clause = SOFT_DELETE_WHERE)
+public class OrganizationMemberEntity extends LogicDeleteEntity {
/**
* 组织机构ID
*/
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/account/UserDetailEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/account/UserDetailEntity.java
index f872d729..f1c37995 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/account/UserDetailEntity.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/account/UserDetailEntity.java
@@ -25,14 +25,19 @@ import javax.persistence.Entity;
import javax.persistence.Table;
import org.hibernate.Hibernate;
+import org.hibernate.annotations.SQLDelete;
+import org.hibernate.annotations.SQLDeleteAll;
+import org.hibernate.annotations.Where;
import cn.topiam.employee.common.enums.UserIdType;
-import cn.topiam.employee.support.repository.domain.BaseEntity;
+import cn.topiam.employee.support.repository.domain.LogicDeleteEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_WHERE;
/**
*
@@ -48,7 +53,10 @@ import lombok.experimental.Accessors;
@Accessors(chain = true)
@Entity
@Table(name = "user_detail")
-public class UserDetailEntity extends BaseEntity {
+@SQLDelete(sql = "update user_detail set " + SOFT_DELETE_SET + " where id_ = ?")
+@SQLDeleteAll(sql = "update user_detail set " + SOFT_DELETE_SET + " where id_ = ?")
+@Where(clause = SOFT_DELETE_WHERE)
+public class UserDetailEntity extends LogicDeleteEntity {
@Serial
private static final long serialVersionUID = -3599183663669763315L;
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/account/UserEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/account/UserEntity.java
index e09da282..5a546393 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/account/UserEntity.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/account/UserEntity.java
@@ -28,17 +28,22 @@ import javax.persistence.Table;
import javax.persistence.Transient;
import org.hibernate.Hibernate;
+import org.hibernate.annotations.SQLDelete;
+import org.hibernate.annotations.SQLDeleteAll;
+import org.hibernate.annotations.Where;
import com.fasterxml.jackson.annotation.JsonIgnore;
import cn.topiam.employee.common.enums.DataOrigin;
import cn.topiam.employee.common.enums.UserStatus;
-import cn.topiam.employee.support.repository.domain.BaseEntity;
+import cn.topiam.employee.support.repository.domain.LogicDeleteEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_WHERE;
/**
*
@@ -53,8 +58,11 @@ import lombok.experimental.Accessors;
@ToString
@Accessors(chain = true)
@Entity
-@Table(name = "`user`")
-public class UserEntity extends BaseEntity {
+@Table(name = "user")
+@SQLDelete(sql = "update user set " + SOFT_DELETE_SET + " where id_ = ?")
+@SQLDeleteAll(sql = "update user set " + SOFT_DELETE_SET + " where id_ = ?")
+@Where(clause = SOFT_DELETE_WHERE)
+public class UserEntity extends LogicDeleteEntity {
@Serial
private static final long serialVersionUID = -2619231849746900857L;
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/account/UserGroupEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/account/UserGroupEntity.java
index b22055f6..86033a8a 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/account/UserGroupEntity.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/account/UserGroupEntity.java
@@ -23,12 +23,18 @@ import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
-import cn.topiam.employee.support.repository.domain.BaseEntity;
+import org.hibernate.annotations.SQLDelete;
+import org.hibernate.annotations.SQLDeleteAll;
+import org.hibernate.annotations.Where;
+
+import cn.topiam.employee.support.repository.domain.LogicDeleteEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_WHERE;
/**
*
@@ -43,8 +49,11 @@ import lombok.experimental.Accessors;
@ToString
@Accessors(chain = true)
@Entity
-@Table(name = "`user_group`")
-public class UserGroupEntity extends BaseEntity {
+@Table(name = "user_group")
+@SQLDelete(sql = "update user_group set " + SOFT_DELETE_SET + " where id_ = ?")
+@SQLDeleteAll(sql = "update user_group set " + SOFT_DELETE_SET + " where id_ = ?")
+@Where(clause = SOFT_DELETE_WHERE)
+public class UserGroupEntity extends LogicDeleteEntity {
@Serial
private static final long serialVersionUID = -2619231849746900857L;
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/account/UserGroupMemberEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/account/UserGroupMemberEntity.java
index e64282cd..4233275e 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/account/UserGroupMemberEntity.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/account/UserGroupMemberEntity.java
@@ -21,12 +21,18 @@ import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
-import cn.topiam.employee.support.repository.domain.BaseEntity;
+import org.hibernate.annotations.SQLDelete;
+import org.hibernate.annotations.SQLDeleteAll;
+import org.hibernate.annotations.Where;
+
+import cn.topiam.employee.support.repository.domain.LogicDeleteEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_WHERE;
/**
* 用户组成员
@@ -39,8 +45,11 @@ import lombok.experimental.Accessors;
@ToString
@Accessors(chain = true)
@Entity
-@Table(name = "`user_group_member`")
-public class UserGroupMemberEntity extends BaseEntity {
+@Table(name = "user_group_member")
+@SQLDelete(sql = "update user_group_member set " + SOFT_DELETE_SET + " where id_ = ?")
+@SQLDeleteAll(sql = "update user_group_member set " + SOFT_DELETE_SET + " where id_ = ?")
+@Where(clause = SOFT_DELETE_WHERE)
+public class UserGroupMemberEntity extends LogicDeleteEntity {
/**
* 组ID
*/
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/account/UserHistoryPasswordEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/account/UserHistoryPasswordEntity.java
index 9ba74092..9381fa73 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/account/UserHistoryPasswordEntity.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/account/UserHistoryPasswordEntity.java
@@ -24,14 +24,20 @@ import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
+import org.hibernate.annotations.SQLDelete;
+import org.hibernate.annotations.SQLDeleteAll;
+import org.hibernate.annotations.Where;
+
import com.fasterxml.jackson.annotation.JsonIgnore;
-import cn.topiam.employee.support.repository.domain.BaseEntity;
+import cn.topiam.employee.support.repository.domain.LogicDeleteEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_WHERE;
/**
*
@@ -46,8 +52,11 @@ import lombok.experimental.Accessors;
@ToString
@Accessors(chain = true)
@Entity
-@Table(name = "`user_history_password`")
-public class UserHistoryPasswordEntity extends BaseEntity {
+@Table(name = "user_history_password")
+@SQLDelete(sql = "update user_history_password set " + SOFT_DELETE_SET + " where id_ = ?")
+@SQLDeleteAll(sql = "update user_history_password set " + SOFT_DELETE_SET + " where id_ = ?")
+@Where(clause = SOFT_DELETE_WHERE)
+public class UserHistoryPasswordEntity extends LogicDeleteEntity {
@Serial
private static final long serialVersionUID = -2619231849746900857L;
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/account/UserIdpBindEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/account/UserIdpBindEntity.java
index 1171373c..d06bf831 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/account/UserIdpBindEntity.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/account/UserIdpBindEntity.java
@@ -24,13 +24,18 @@ import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
-import cn.topiam.employee.common.enums.IdentityProviderType;
-import cn.topiam.employee.support.repository.domain.BaseEntity;
+import org.hibernate.annotations.SQLDelete;
+import org.hibernate.annotations.SQLDeleteAll;
+import org.hibernate.annotations.Where;
+
+import cn.topiam.employee.support.repository.domain.LogicDeleteEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_WHERE;
/**
* 用户认证方式绑定表
@@ -40,47 +45,50 @@ import lombok.experimental.Accessors;
*/
@Entity
@Table(name = "user_idp_bind")
+@SQLDelete(sql = "update user_idp_bind set " + SOFT_DELETE_SET + " where id_ = ?")
+@SQLDeleteAll(sql = "update user_idp_bind set " + SOFT_DELETE_SET + " where id_ = ?")
+@Where(clause = SOFT_DELETE_WHERE)
@Accessors(chain = true)
@Getter
@Setter
@ToString
-public class UserIdpBindEntity extends BaseEntity {
+public class UserIdpBindEntity extends LogicDeleteEntity {
@Serial
- private static final long serialVersionUID = -14364708756807242L;
+ private static final long serialVersionUID = -14364708756807242L;
/**
* 用户ID
*/
@Column(name = "user_id")
- private Long userId;
+ private Long userId;
/**
* OpenId
*/
@Column(name = "open_id")
- private String openId;
+ private String openId;
/**
* 身份提供商 ID
*/
@Column(name = "idp_id")
- private String idpId;
+ private String idpId;
/**
* 身份提供商 类型
*/
@Column(name = "idp_type")
- private IdentityProviderType idpType;
+ private String idpType;
/**
* 绑定时间
*/
@Column(name = "bind_time")
- private LocalDateTime bindTime;
+ private LocalDateTime bindTime;
/**
* 附加信息
*/
@Column(name = "addition_info")
- private String additionInfo;
+ private String additionInfo;
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppAccessPolicyEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppAccessPolicyEntity.java
index 823e2494..4def668b 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppAccessPolicyEntity.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppAccessPolicyEntity.java
@@ -21,13 +21,19 @@ import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
+import org.hibernate.annotations.SQLDelete;
+import org.hibernate.annotations.SQLDeleteAll;
+import org.hibernate.annotations.Where;
+
import cn.topiam.employee.common.enums.PolicySubjectType;
-import cn.topiam.employee.support.repository.domain.BaseEntity;
+import cn.topiam.employee.support.repository.domain.LogicDeleteEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_WHERE;
/**
* 应用授权策略
@@ -41,7 +47,10 @@ import lombok.experimental.Accessors;
@Entity
@Accessors(chain = true)
@Table(name = "app_access_policy")
-public class AppAccessPolicyEntity extends BaseEntity {
+@SQLDelete(sql = "update app_access_policy set " + SOFT_DELETE_SET + " where id_ = ?")
+@SQLDeleteAll(sql = "update app_access_policy set " + SOFT_DELETE_SET + " where id_ = ?")
+@Where(clause = SOFT_DELETE_WHERE)
+public class AppAccessPolicyEntity extends LogicDeleteEntity {
/**
* 应用ID
*/
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppAccountEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppAccountEntity.java
index 41252ea6..84ca85f5 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppAccountEntity.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppAccountEntity.java
@@ -21,12 +21,18 @@ import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
-import cn.topiam.employee.support.repository.domain.BaseEntity;
+import org.hibernate.annotations.SQLDelete;
+import org.hibernate.annotations.SQLDeleteAll;
+import org.hibernate.annotations.Where;
+
+import cn.topiam.employee.support.repository.domain.LogicDeleteEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_WHERE;
/**
* 应用账户
@@ -40,7 +46,10 @@ import lombok.experimental.Accessors;
@Entity
@Accessors(chain = true)
@Table(name = "app_account")
-public class AppAccountEntity extends BaseEntity {
+@SQLDelete(sql = "update app_account set " + SOFT_DELETE_SET + " where id_ = ?")
+@SQLDeleteAll(sql = "update app_account set " + SOFT_DELETE_SET + " where id_ = ?")
+@Where(clause = SOFT_DELETE_WHERE)
+public class AppAccountEntity extends LogicDeleteEntity {
/**
* 应用ID
*/
@@ -58,4 +67,10 @@ public class AppAccountEntity extends BaseEntity {
*/
@Column(name = "account_")
private String account;
+
+ /**
+ * 账户密码
+ */
+ @Column(name = "password_")
+ private String password;
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppCasConfigEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppCasConfigEntity.java
index 0f2d67f0..c2977183 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppCasConfigEntity.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppCasConfigEntity.java
@@ -25,6 +25,7 @@ import org.hibernate.annotations.TypeDef;
import com.vladmihalcea.hibernate.type.json.JsonStringType;
+import cn.topiam.employee.common.enums.app.CasUserIdentityType;
import cn.topiam.employee.support.repository.domain.BaseEntity;
import lombok.Getter;
@@ -50,12 +51,18 @@ public class AppCasConfigEntity extends BaseEntity {
* APP ID
*/
@Column(name = "app_id")
- private Long appId;
+ private Long appId;
/**
- * SP 接受回调地址
+ * 用户身份类型
*/
- @Column(name = "sp_callback_url")
- private String spCallbackUrl;
+ @Column(name = "user_identity_type")
+ private CasUserIdentityType userIdentityType;
+
+ /**
+ * 客户端服务URL
+ */
+ @Column(name = "client_service_url")
+ private String clientServiceUrl;
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppCertEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppCertEntity.java
index b4b69aae..81111318 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppCertEntity.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppCertEntity.java
@@ -24,13 +24,19 @@ import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
+import org.hibernate.annotations.SQLDelete;
+import org.hibernate.annotations.SQLDeleteAll;
+import org.hibernate.annotations.Where;
+
import cn.topiam.employee.common.enums.app.AppCertUsingType;
-import cn.topiam.employee.support.repository.domain.BaseEntity;
+import cn.topiam.employee.support.repository.domain.LogicDeleteEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_WHERE;
/**
* @author TopIAM
@@ -42,7 +48,10 @@ import lombok.experimental.Accessors;
@Entity
@Accessors(chain = true)
@Table(name = "app_cert")
-public class AppCertEntity extends BaseEntity {
+@SQLDelete(sql = "update app_cert set " + SOFT_DELETE_SET + " where id_ = ?")
+@SQLDeleteAll(sql = "update app_cert set " + SOFT_DELETE_SET + " where id_ = ?")
+@Where(clause = SOFT_DELETE_WHERE)
+public class AppCertEntity extends LogicDeleteEntity {
/**
* 应用ID
*/
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppEntity.java
index 1367c07b..c784481e 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppEntity.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppEntity.java
@@ -21,16 +21,22 @@ import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
+import org.hibernate.annotations.SQLDelete;
+import org.hibernate.annotations.SQLDeleteAll;
+import org.hibernate.annotations.Where;
+
import cn.topiam.employee.common.enums.app.AppProtocol;
import cn.topiam.employee.common.enums.app.AppType;
import cn.topiam.employee.common.enums.app.AuthorizationType;
import cn.topiam.employee.common.enums.app.InitLoginType;
-import cn.topiam.employee.support.repository.domain.BaseEntity;
+import cn.topiam.employee.support.repository.domain.LogicDeleteEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_WHERE;
/**
* 应用
@@ -44,7 +50,10 @@ import lombok.experimental.Accessors;
@Entity
@Accessors(chain = true)
@Table(name = "app")
-public class AppEntity extends BaseEntity {
+@SQLDelete(sql = "update app set " + SOFT_DELETE_SET + " where id_ = ?")
+@SQLDeleteAll(sql = "update app set " + SOFT_DELETE_SET + " where id_ = ?")
+@Where(clause = SOFT_DELETE_WHERE)
+public class AppEntity extends LogicDeleteEntity {
/**
* 应用名称
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppFormConfigEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppFormConfigEntity.java
new file mode 100644
index 00000000..2fa6c528
--- /dev/null
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppFormConfigEntity.java
@@ -0,0 +1,107 @@
+/*
+ * eiam-common - Employee Identity and Access Management Program
+ * Copyright © 2020-2023 TopIAM (support@topiam.cn)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+package cn.topiam.employee.common.entity.app;
+
+import java.io.Serializable;
+import java.util.List;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Table;
+
+import org.hibernate.annotations.*;
+
+import com.vladmihalcea.hibernate.type.json.JsonStringType;
+
+import cn.topiam.employee.common.enums.app.FormSubmitType;
+import cn.topiam.employee.support.repository.domain.LogicDeleteEntity;
+
+import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+import lombok.experimental.Accessors;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_WHERE;
+
+/**
+ * APP Form 配置
+ *
+ * @author TopIAM
+ * Created by support@topiam.cn on 2022/12/13 22:31
+ */
+@Getter
+@Setter
+@ToString
+@Entity
+@Accessors(chain = true)
+@Table(name = "app_form_config")
+@SQLDelete(sql = "update app_form_config set " + SOFT_DELETE_SET + " where id_ = ?")
+@SQLDeleteAll(sql = "update app_form_config set " + SOFT_DELETE_SET + " where id_ = ?")
+@TypeDef(name = "json", typeClass = JsonStringType.class)
+@Where(clause = SOFT_DELETE_WHERE)
+public class AppFormConfigEntity extends LogicDeleteEntity {
+
+ /**
+ * APP ID
+ */
+ @Column(name = "app_id")
+ private Long appId;
+
+ /**
+ * 登录URL
+ */
+ @Column(name = "login_url")
+ private String loginUrl;
+
+ /**
+ * 登录名属性名称
+ */
+ @Column(name = "username_field")
+ private String usernameField;
+
+ /**
+ * 登录密码属性名称
+ */
+ @Column(name = "password_field")
+ private String passwordField;
+
+ /**
+ * 登录提交方式
+ */
+ @Column(name = "submit_type")
+ private FormSubmitType submitType;
+
+ /**
+ * 登录其他信息
+ */
+ @Column(name = "other_field")
+ @Type(type = "json")
+ private List otherField;
+
+ @Data
+ @Schema(description = "表单其他信息")
+ public static class OtherField implements Serializable {
+
+ private String fieldName;
+
+ private String fieldValue;
+ }
+}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppOidcConfigEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppOidcConfigEntity.java
index efedbf1b..b1d60aab 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppOidcConfigEntity.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppOidcConfigEntity.java
@@ -23,17 +23,18 @@ import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
-import org.hibernate.annotations.Type;
-import org.hibernate.annotations.TypeDef;
+import org.hibernate.annotations.*;
import com.vladmihalcea.hibernate.type.json.JsonStringType;
-import cn.topiam.employee.support.repository.domain.BaseEntity;
+import cn.topiam.employee.support.repository.domain.LogicDeleteEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_WHERE;
/**
* APP OIDC 配置
@@ -47,8 +48,11 @@ import lombok.experimental.Accessors;
@Entity
@Accessors(chain = true)
@Table(name = "app_oidc_config")
+@SQLDelete(sql = "update app_oidc_config set " + SOFT_DELETE_SET + " where id_ = ?")
+@SQLDeleteAll(sql = "update app_oidc_config set " + SOFT_DELETE_SET + " where id_ = ?")
@TypeDef(name = "json", typeClass = JsonStringType.class)
-public class AppOidcConfigEntity extends BaseEntity {
+@Where(clause = SOFT_DELETE_WHERE)
+public class AppOidcConfigEntity extends LogicDeleteEntity {
/**
* APP ID
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppPermissionActionEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppPermissionActionEntity.java
index 097bfeb1..7c6cf858 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppPermissionActionEntity.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppPermissionActionEntity.java
@@ -21,13 +21,19 @@ import java.io.Serial;
import javax.persistence.*;
+import org.hibernate.annotations.SQLDelete;
+import org.hibernate.annotations.SQLDeleteAll;
+import org.hibernate.annotations.Where;
+
import cn.topiam.employee.common.enums.PermissionActionType;
-import cn.topiam.employee.support.repository.domain.BaseEntity;
+import cn.topiam.employee.support.repository.domain.LogicDeleteEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_WHERE;
/**
* 应用权限
@@ -40,8 +46,11 @@ import lombok.experimental.Accessors;
@ToString
@Entity
@Accessors(chain = true)
-@Table(name = "`app_permission_action`")
-public class AppPermissionActionEntity extends BaseEntity {
+@Table(name = "app_permission_action")
+@SQLDelete(sql = "update app_permission_action set " + SOFT_DELETE_SET + " where id_ = ?")
+@SQLDeleteAll(sql = "update app_permission_action set " + SOFT_DELETE_SET + " where id_ = ?")
+@Where(clause = SOFT_DELETE_WHERE)
+public class AppPermissionActionEntity extends LogicDeleteEntity {
@Serial
private static final long serialVersionUID = -3954680915360748087L;
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppPermissionPolicyEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppPermissionPolicyEntity.java
index f8b51c68..50aa2c82 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppPermissionPolicyEntity.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppPermissionPolicyEntity.java
@@ -21,15 +21,21 @@ import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
+import org.hibernate.annotations.SQLDelete;
+import org.hibernate.annotations.SQLDeleteAll;
+import org.hibernate.annotations.Where;
+
import cn.topiam.employee.common.enums.PolicyEffect;
import cn.topiam.employee.common.enums.PolicyObjectType;
import cn.topiam.employee.common.enums.PolicySubjectType;
-import cn.topiam.employee.support.repository.domain.BaseEntity;
+import cn.topiam.employee.support.repository.domain.LogicDeleteEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_WHERE;
/**
* 应用策略
@@ -42,8 +48,11 @@ import lombok.experimental.Accessors;
@ToString
@Entity
@Accessors(chain = true)
-@Table(name = "`app_permission_policy`")
-public class AppPermissionPolicyEntity extends BaseEntity {
+@Table(name = "app_permission_policy")
+@SQLDelete(sql = "update app_permission_policy set " + SOFT_DELETE_SET + " where id_ = ?")
+@SQLDeleteAll(sql = "update app_permission_policy set " + SOFT_DELETE_SET + " where id_ = ?")
+@Where(clause = SOFT_DELETE_WHERE)
+public class AppPermissionPolicyEntity extends LogicDeleteEntity {
/**
* 应用id
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppPermissionResourceEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppPermissionResourceEntity.java
index 4ebea00b..f9f4e994 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppPermissionResourceEntity.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppPermissionResourceEntity.java
@@ -22,7 +22,11 @@ import java.util.List;
import javax.persistence.*;
-import cn.topiam.employee.support.repository.domain.BaseEntity;
+import org.hibernate.annotations.SQLDelete;
+import org.hibernate.annotations.SQLDeleteAll;
+import org.hibernate.annotations.Where;
+
+import cn.topiam.employee.support.repository.domain.LogicDeleteEntity;
import lombok.Getter;
import lombok.Setter;
@@ -30,6 +34,9 @@ import lombok.ToString;
import lombok.experimental.Accessors;
import static javax.persistence.FetchType.LAZY;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_WHERE;
+
/**
*
* 应用资源关联
@@ -43,8 +50,11 @@ import static javax.persistence.FetchType.LAZY;
@ToString
@Entity
@Accessors(chain = true)
-@Table(name = "`app_permission_resource`")
-public class AppPermissionResourceEntity extends BaseEntity {
+@Table(name = "app_permission_resource")
+@SQLDelete(sql = "update app_permission_resource set " + SOFT_DELETE_SET + " where id_ = ?")
+@SQLDeleteAll(sql = "update app_permission_resource set " + SOFT_DELETE_SET + " where id_ = ?")
+@Where(clause = SOFT_DELETE_WHERE)
+public class AppPermissionResourceEntity extends LogicDeleteEntity {
@Serial
private static final long serialVersionUID = 7342074686605139968L;
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppPermissionRoleEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppPermissionRoleEntity.java
index cf01d0d3..3b36e343 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppPermissionRoleEntity.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppPermissionRoleEntity.java
@@ -23,12 +23,18 @@ import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
-import cn.topiam.employee.support.repository.domain.BaseEntity;
+import org.hibernate.annotations.SQLDelete;
+import org.hibernate.annotations.SQLDeleteAll;
+import org.hibernate.annotations.Where;
+
+import cn.topiam.employee.support.repository.domain.LogicDeleteEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_WHERE;
/**
*
@@ -43,8 +49,11 @@ import lombok.experimental.Accessors;
@ToString
@Entity
@Accessors(chain = true)
-@Table(name = "`app_permission_role`")
-public class AppPermissionRoleEntity extends BaseEntity {
+@Table(name = "app_permission_role")
+@SQLDelete(sql = "update app_permission_role set " + SOFT_DELETE_SET + " where id_ = ?")
+@SQLDeleteAll(sql = "update app_permission_role set " + SOFT_DELETE_SET + " where id_ = ?")
+@Where(clause = SOFT_DELETE_WHERE)
+public class AppPermissionRoleEntity extends LogicDeleteEntity {
@Serial
private static final long serialVersionUID = -7761332532995424593L;
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppSaml2ConfigEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppSaml2ConfigEntity.java
index 935ede51..c22920e9 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppSaml2ConfigEntity.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppSaml2ConfigEntity.java
@@ -26,20 +26,21 @@ import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
-import org.hibernate.annotations.Type;
-import org.hibernate.annotations.TypeDef;
+import org.hibernate.annotations.*;
import com.fasterxml.jackson.annotation.JsonAlias;
import com.vladmihalcea.hibernate.type.json.JsonStringType;
import cn.topiam.employee.common.enums.app.*;
-import cn.topiam.employee.support.repository.domain.BaseEntity;
+import cn.topiam.employee.support.repository.domain.LogicDeleteEntity;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_WHERE;
/**
* APP SAML 配置
@@ -53,8 +54,11 @@ import lombok.experimental.Accessors;
@Entity
@Accessors(chain = true)
@Table(name = "app_saml2_config")
+@SQLDelete(sql = "update app_saml2_config set " + SOFT_DELETE_SET + " where id_ = ?")
+@SQLDeleteAll(sql = "update app_saml2_config set " + SOFT_DELETE_SET + " where id_ = ?")
@TypeDef(name = "json", typeClass = JsonStringType.class)
-public class AppSaml2ConfigEntity extends BaseEntity {
+@Where(clause = SOFT_DELETE_WHERE)
+public class AppSaml2ConfigEntity extends LogicDeleteEntity {
/**
* APP ID
*/
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppTsaConfigEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppTsaConfigEntity.java
new file mode 100644
index 00000000..06993dc4
--- /dev/null
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppTsaConfigEntity.java
@@ -0,0 +1,128 @@
+/*
+ * eiam-common - Employee Identity and Access Management Program
+ * Copyright © 2020-2023 TopIAM (support@topiam.cn)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+package cn.topiam.employee.common.entity.app;
+
+import java.io.Serializable;
+import java.util.List;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Table;
+
+import org.hibernate.annotations.*;
+
+import com.vladmihalcea.hibernate.type.json.JsonStringType;
+
+import cn.topiam.employee.support.repository.domain.LogicDeleteEntity;
+
+import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+import lombok.experimental.Accessors;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_WHERE;
+
+/**
+ * APP Form 配置
+ *
+ * @author TopIAM
+ * Created by support@topiam.cn on 2022/12/13 22:31
+ */
+@Getter
+@Setter
+@ToString
+@Entity
+@Accessors(chain = true)
+@Table(name = "app_tsa_config")
+@SQLDelete(sql = "update app_tsa_config set " + SOFT_DELETE_SET + " where id_ = ?")
+@SQLDeleteAll(sql = "update app_tsa_config set " + SOFT_DELETE_SET + " where id_ = ?")
+@TypeDef(name = "json", typeClass = JsonStringType.class)
+@Where(clause = SOFT_DELETE_WHERE)
+public class AppTsaConfigEntity extends LogicDeleteEntity {
+
+ /**
+ * APP ID
+ */
+ @Column(name = "app_id")
+ private Long appId;
+
+ /**
+ * 登录页面
+ */
+ @Column(name = "login_page")
+ private String loginPage;
+
+ /**
+ * 自动登录步骤
+ */
+ @Column(name = "auto_login_steps")
+ @Type(type = "json")
+ private List autoLoginSteps;
+
+ /**
+ * 创建账号步骤
+ */
+ @Column(name = "create_account_steps")
+ @Type(type = "json")
+ private List createAccountSteps;
+
+ @Data
+ @Schema(description = "自动登录步骤")
+ public static class AutoLoginStep implements Serializable {
+
+ private String action;
+
+ private String target;
+
+ private String value;
+ }
+
+ @Data
+ @Schema(description = "创建账号步骤")
+ public static class CreateAccountStep implements Serializable {
+
+ private String title;
+
+ private String titleI18n;
+
+ private FormItemProp formItemProps;
+ }
+
+ @Data
+ @Schema(description = "表单内容")
+ public static class FormItemProp implements Serializable {
+
+ private List name;
+
+ private List rules;
+ }
+
+ @Data
+ @Schema(description = "表单验证规则")
+ public static class Rule implements Serializable {
+
+ private Boolean required;
+
+ private String message;
+
+ private String messageI18n;
+ }
+}
diff --git a/eiam-application/eiam-application-form/src/main/java/cn/topiam/employee/application/form/model/AppFormConfigGetResult.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/po/AppFormConfigPO.java
similarity index 60%
rename from eiam-application/eiam-application-form/src/main/java/cn/topiam/employee/application/form/model/AppFormConfigGetResult.java
rename to eiam-common/src/main/java/cn/topiam/employee/common/entity/app/po/AppFormConfigPO.java
index 89635696..c15d5cbd 100644
--- a/eiam-application/eiam-application-form/src/main/java/cn/topiam/employee/application/form/model/AppFormConfigGetResult.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/po/AppFormConfigPO.java
@@ -1,5 +1,5 @@
/*
- * eiam-application-form - Employee Identity and Access Management Program
+ * eiam-common - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
@@ -15,42 +15,61 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
-package cn.topiam.employee.application.form.model;
-
-import java.io.Serializable;
+package cn.topiam.employee.common.entity.app.po;
+import cn.topiam.employee.common.entity.app.AppFormConfigEntity;
import cn.topiam.employee.common.enums.app.AuthorizationType;
import cn.topiam.employee.common.enums.app.InitLoginType;
import lombok.Data;
-
-import io.swagger.v3.oas.annotations.Parameter;
-import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.EqualsAndHashCode;
/**
- * Form 配置返回
*
* @author TopIAM
- * Created by support@topiam.cn on 2022/5/31 22:46
+ * Created by support@topiam.cn on 2022/12/13 23:45
*/
@Data
-@Schema(description = "Form 配置返回结果")
-public class AppFormConfigGetResult implements Serializable {
+@EqualsAndHashCode(callSuper = true)
+public class AppFormConfigPO extends AppFormConfigEntity {
+
+ /**
+ * 应用编码
+ */
+ private String appCode;
+
+ /**
+ * 模版
+ */
+ private String appTemplate;
+
+ /**
+ * 客户端ID
+ */
+ private String clientId;
+
+ /**
+ * 客户端秘钥
+ */
+ private String clientSecret;
+
/**
* SSO 发起方
*/
- @Parameter(description = "SSO 发起方")
private InitLoginType initLoginType;
/**
* SSO 登录链接
*/
- @Parameter(description = "SSO 登录链接")
private String initLoginUrl;
/**
* 授权范围
*/
- @Parameter(description = "SSO 授权范围")
private AuthorizationType authorizationType;
+
+ /**
+ * 应用是否启用
+ */
+ private Boolean enabled;
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/po/AppTsaConfigPO.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/po/AppTsaConfigPO.java
new file mode 100644
index 00000000..65edad5e
--- /dev/null
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/po/AppTsaConfigPO.java
@@ -0,0 +1,74 @@
+/*
+ * eiam-common - Employee Identity and Access Management Program
+ * Copyright © 2020-2023 TopIAM (support@topiam.cn)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+package cn.topiam.employee.common.entity.app.po;
+
+import cn.topiam.employee.common.entity.app.AppTsaConfigEntity;
+import cn.topiam.employee.common.enums.app.AuthorizationType;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ *
+ * @author TopIAM
+ * Created by support@topiam.cn on 2022/01/14 10:45
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class AppTsaConfigPO extends AppTsaConfigEntity {
+
+ /**
+ * 应用编码
+ */
+ private String appCode;
+
+ /**
+ * 模版
+ */
+ private String appTemplate;
+
+ /**
+ * 客户端ID
+ */
+ private String clientId;
+
+ /**
+ * 客户端秘钥
+ */
+ private String clientSecret;
+
+ // /**
+ // * SSO 发起方
+ // */
+ // private InitLoginType initLoginType;
+
+ /**
+ * SSO 登录链接
+ */
+ private String initLoginUrl;
+
+ /**
+ * 授权范围
+ */
+ private AuthorizationType authorizationType;
+
+ /**
+ * 应用是否启用
+ */
+ private Boolean enabled;
+}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/authentication/IdentityProviderEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/authentication/IdentityProviderEntity.java
index 4bb9876e..4e77e331 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/authentication/IdentityProviderEntity.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/authentication/IdentityProviderEntity.java
@@ -23,14 +23,18 @@ import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
-import cn.topiam.employee.common.enums.IdentityProviderCategory;
-import cn.topiam.employee.common.enums.IdentityProviderType;
-import cn.topiam.employee.support.repository.domain.BaseEntity;
+import org.hibernate.annotations.SQLDelete;
+import org.hibernate.annotations.SQLDeleteAll;
+import org.hibernate.annotations.Where;
+
+import cn.topiam.employee.support.repository.domain.LogicDeleteEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_WHERE;
/**
*
@@ -46,51 +50,54 @@ import lombok.experimental.Accessors;
@Entity
@Accessors(chain = true)
@Table(name = "identity_provider")
-public class IdentityProviderEntity extends BaseEntity {
+@SQLDelete(sql = "update identity_provider set " + SOFT_DELETE_SET + " where id_ = ?")
+@SQLDeleteAll(sql = "update identity_provider set " + SOFT_DELETE_SET + " where id_ = ?")
+@Where(clause = SOFT_DELETE_WHERE)
+public class IdentityProviderEntity extends LogicDeleteEntity {
@Serial
- private static final long serialVersionUID = -7936931011805155568L;
+ private static final long serialVersionUID = -7936931011805155568L;
/**
* 名称
*/
@Column(name = "name_")
- private String name;
+ private String name;
/**
* 唯一CODE 不可修改
*/
@Column(name = "code_")
- private String code;
+ private String code;
/**
* 平台
*/
@Column(name = "type_")
- private IdentityProviderType type;
+ private String type;
/**
* 分类
*/
@Column(name = "category_")
- private IdentityProviderCategory category;
+ private String category;
/**
* 配置JSON串
*/
@Column(name = "config_")
- private String config;
+ private String config;
/**
* 是否启用
*/
@Column(name = "is_enabled")
- private Boolean enabled;
+ private Boolean enabled;
/**
* 是否展示
*/
@Column(name = "is_displayed")
- private Boolean displayed;
+ private Boolean displayed;
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/identitysource/IdentitySourceEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/identitysource/IdentitySourceEntity.java
index 18056331..d6b4f15d 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/identitysource/IdentitySourceEntity.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/identitysource/IdentitySourceEntity.java
@@ -23,18 +23,23 @@ import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
+import org.hibernate.annotations.SQLDelete;
+import org.hibernate.annotations.SQLDeleteAll;
import org.hibernate.annotations.Type;
+import org.hibernate.annotations.Where;
import cn.topiam.employee.common.entity.identitysource.config.JobConfig;
import cn.topiam.employee.common.entity.identitysource.config.StrategyConfig;
-import cn.topiam.employee.common.enums.identityprovider.IdentitySourceProvider;
-import cn.topiam.employee.support.repository.domain.BaseEntity;
+import cn.topiam.employee.common.enums.identitysource.IdentitySourceProvider;
+import cn.topiam.employee.support.repository.domain.LogicDeleteEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import lombok.extern.slf4j.Slf4j;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_WHERE;
/**
*
@@ -51,7 +56,10 @@ import lombok.extern.slf4j.Slf4j;
@Accessors(chain = true)
@Slf4j
@Table(name = "identity_source")
-public class IdentitySourceEntity extends BaseEntity {
+@SQLDelete(sql = "update identity_source set " + SOFT_DELETE_SET + " where id_ = ?")
+@SQLDeleteAll(sql = "update identity_source set " + SOFT_DELETE_SET + " where id_ = ?")
+@Where(clause = SOFT_DELETE_WHERE)
+public class IdentitySourceEntity extends LogicDeleteEntity {
@Serial
private static final long serialVersionUID = -7936931011805155568L;
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/identitysource/IdentitySourceEventRecordEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/identitysource/IdentitySourceEventRecordEntity.java
index 31559b40..a08fa618 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/identitysource/IdentitySourceEventRecordEntity.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/identitysource/IdentitySourceEventRecordEntity.java
@@ -23,16 +23,22 @@ import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
+import org.hibernate.annotations.SQLDelete;
+import org.hibernate.annotations.SQLDeleteAll;
+import org.hibernate.annotations.Where;
+
import cn.topiam.employee.common.enums.SyncStatus;
import cn.topiam.employee.common.enums.identitysource.IdentitySourceActionType;
import cn.topiam.employee.common.enums.identitysource.IdentitySourceObjectType;
-import cn.topiam.employee.support.repository.domain.BaseEntity;
+import cn.topiam.employee.support.repository.domain.LogicDeleteEntity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_WHERE;
/**
* 身份源事件记录
@@ -47,7 +53,10 @@ import lombok.experimental.Accessors;
@Accessors(chain = true)
@NoArgsConstructor
@Table(name = "identity_source_event_record")
-public class IdentitySourceEventRecordEntity extends BaseEntity {
+@SQLDelete(sql = "update identity_source_event_record set " + SOFT_DELETE_SET + " where id_ = ?")
+@SQLDeleteAll(sql = "update identity_source_event_record set " + SOFT_DELETE_SET + " where id_ = ?")
+@Where(clause = SOFT_DELETE_WHERE)
+public class IdentitySourceEventRecordEntity extends LogicDeleteEntity {
/**
* 身份源ID
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/identitysource/IdentitySourceSyncHistoryEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/identitysource/IdentitySourceSyncHistoryEntity.java
index 0b458833..9c22cc9d 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/identitysource/IdentitySourceSyncHistoryEntity.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/identitysource/IdentitySourceSyncHistoryEntity.java
@@ -23,16 +23,22 @@ import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
+import org.hibernate.annotations.SQLDelete;
+import org.hibernate.annotations.SQLDeleteAll;
+import org.hibernate.annotations.Where;
+
import cn.topiam.employee.common.enums.SyncStatus;
import cn.topiam.employee.common.enums.TriggerType;
import cn.topiam.employee.common.enums.identitysource.IdentitySourceObjectType;
-import cn.topiam.employee.support.repository.domain.BaseEntity;
+import cn.topiam.employee.support.repository.domain.LogicDeleteEntity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_WHERE;
/**
* 身份源同步记录表
@@ -47,7 +53,10 @@ import lombok.experimental.Accessors;
@Accessors(chain = true)
@NoArgsConstructor
@Table(name = "identity_source_sync_history")
-public class IdentitySourceSyncHistoryEntity extends BaseEntity {
+@SQLDelete(sql = "update identity_source_sync_history set " + SOFT_DELETE_SET + " where id_ = ?")
+@SQLDeleteAll(sql = "update identity_source_sync_history set " + SOFT_DELETE_SET + " where id_ = ?")
+@Where(clause = SOFT_DELETE_WHERE)
+public class IdentitySourceSyncHistoryEntity extends LogicDeleteEntity {
/**
* 批号
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/identitysource/IdentitySourceSyncRecordEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/identitysource/IdentitySourceSyncRecordEntity.java
index 89f94eb6..b47e3614 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/identitysource/IdentitySourceSyncRecordEntity.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/identitysource/IdentitySourceSyncRecordEntity.java
@@ -21,16 +21,22 @@ import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
+import org.hibernate.annotations.SQLDelete;
+import org.hibernate.annotations.SQLDeleteAll;
+import org.hibernate.annotations.Where;
+
import cn.topiam.employee.common.enums.SyncStatus;
import cn.topiam.employee.common.enums.identitysource.IdentitySourceActionType;
import cn.topiam.employee.common.enums.identitysource.IdentitySourceObjectType;
-import cn.topiam.employee.support.repository.domain.BaseEntity;
+import cn.topiam.employee.support.repository.domain.LogicDeleteEntity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_WHERE;
/**
* 身份源同步详情
@@ -45,7 +51,10 @@ import lombok.experimental.Accessors;
@Accessors(chain = true)
@NoArgsConstructor
@Table(name = "identity_source_sync_record")
-public class IdentitySourceSyncRecordEntity extends BaseEntity {
+@SQLDelete(sql = "update identity_source_sync_record set " + SOFT_DELETE_SET + " where id_ = ?")
+@SQLDeleteAll(sql = "update identity_source_sync_record set " + SOFT_DELETE_SET + " where id_ = ?")
+@Where(clause = SOFT_DELETE_WHERE)
+public class IdentitySourceSyncRecordEntity extends LogicDeleteEntity {
/**
* 同步历史ID
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/identitysource/config/JobConfig.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/identitysource/config/JobConfig.java
index d5256f71..0e546e29 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/identitysource/config/JobConfig.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/identitysource/config/JobConfig.java
@@ -170,14 +170,14 @@ public class JobConfig {
}
}
//模式为定时 解析时分秒
- if (mode.equals(JobConfig.Mode.timed)) {
+ if (mode.equals(Mode.timed)) {
LocalTime time = LocalTime.parse(value, DateTimeFormatter.ofPattern("H[H]:mm:ss"));
hour = on(time.getHour());
minute = on(time.getMinute());
second = on(time.getSecond());
}
//模式为周期(0- 某个小时)执行
- if (mode.equals(JobConfig.Mode.period)) {
+ if (mode.equals(Mode.period)) {
hour = new Every(on(0), new IntegerFieldValue(Integer.parseInt(value)));
minute = on(0);
second = on(0);
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/MailSendRecordEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/message/MailSendRecordEntity.java
similarity index 74%
rename from eiam-common/src/main/java/cn/topiam/employee/common/entity/MailSendRecordEntity.java
rename to eiam-common/src/main/java/cn/topiam/employee/common/entity/message/MailSendRecordEntity.java
index c5eec298..cfa788fe 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/MailSendRecordEntity.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/message/MailSendRecordEntity.java
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
-package cn.topiam.employee.common.entity;
+package cn.topiam.employee.common.entity.message;
import java.time.LocalDateTime;
@@ -23,14 +23,20 @@ import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
+import org.hibernate.annotations.SQLDelete;
+import org.hibernate.annotations.SQLDeleteAll;
+import org.hibernate.annotations.Where;
+
import cn.topiam.employee.common.enums.MailType;
import cn.topiam.employee.common.message.enums.MailProvider;
-import cn.topiam.employee.support.repository.domain.BaseEntity;
+import cn.topiam.employee.support.repository.domain.LogicDeleteEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_WHERE;
/**
* 邮件发送记录
@@ -44,7 +50,10 @@ import lombok.experimental.Accessors;
@Setter
@ToString
@Table(name = "mail_send_record")
-public class MailSendRecordEntity extends BaseEntity {
+@SQLDelete(sql = "update mail_send_record set " + SOFT_DELETE_SET + " where id_ = ?")
+@SQLDeleteAll(sql = "update mail_send_record set " + SOFT_DELETE_SET + " where id_ = ?")
+@Where(clause = SOFT_DELETE_WHERE)
+public class MailSendRecordEntity extends LogicDeleteEntity {
/**
* subject
*/
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/SmsSendRecordEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/message/SmsSendRecordEntity.java
similarity index 75%
rename from eiam-common/src/main/java/cn/topiam/employee/common/entity/SmsSendRecordEntity.java
rename to eiam-common/src/main/java/cn/topiam/employee/common/entity/message/SmsSendRecordEntity.java
index 915df827..a6c741b8 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/SmsSendRecordEntity.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/message/SmsSendRecordEntity.java
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
-package cn.topiam.employee.common.entity;
+package cn.topiam.employee.common.entity.message;
import java.time.LocalDateTime;
@@ -23,15 +23,21 @@ import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
+import org.hibernate.annotations.SQLDelete;
+import org.hibernate.annotations.SQLDeleteAll;
+import org.hibernate.annotations.Where;
+
import cn.topiam.employee.common.enums.MessageCategory;
import cn.topiam.employee.common.enums.SmsType;
import cn.topiam.employee.common.message.enums.SmsProvider;
-import cn.topiam.employee.support.repository.domain.BaseEntity;
+import cn.topiam.employee.support.repository.domain.LogicDeleteEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_WHERE;
/**
* 短信记录发送表
@@ -45,7 +51,10 @@ import lombok.experimental.Accessors;
@Setter
@ToString
@Table(name = "sms_send_record")
-public class SmsSendRecordEntity extends BaseEntity {
+@SQLDelete(sql = "update sms_send_record set " + SOFT_DELETE_SET + " where id_ = ?")
+@SQLDeleteAll(sql = "update sms_send_record set " + SOFT_DELETE_SET + " where id_ = ?")
+@Where(clause = SOFT_DELETE_WHERE)
+public class SmsSendRecordEntity extends LogicDeleteEntity {
/**
* phone_
*/
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/setting/AdministratorEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/setting/AdministratorEntity.java
index a3c436ce..f41c5849 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/setting/AdministratorEntity.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/setting/AdministratorEntity.java
@@ -24,13 +24,19 @@ import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
+import org.hibernate.annotations.SQLDelete;
+import org.hibernate.annotations.SQLDeleteAll;
+import org.hibernate.annotations.Where;
+
import cn.topiam.employee.common.enums.UserStatus;
-import cn.topiam.employee.support.repository.domain.BaseEntity;
+import cn.topiam.employee.support.repository.domain.LogicDeleteEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_WHERE;
/**
*
@@ -45,8 +51,11 @@ import lombok.experimental.Accessors;
@ToString
@Accessors(chain = true)
@Entity
-@Table(name = "`administrator`")
-public class AdministratorEntity extends BaseEntity {
+@Table(name = "administrator")
+@SQLDelete(sql = "update administrator set " + SOFT_DELETE_SET + " where id_ = ?")
+@SQLDeleteAll(sql = "update administrator set " + SOFT_DELETE_SET + " where id_ = ?")
+@Where(clause = SOFT_DELETE_WHERE)
+public class AdministratorEntity extends LogicDeleteEntity {
@Serial
private static final long serialVersionUID = -2619231849746900857L;
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/setting/MailTemplateEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/setting/MailTemplateEntity.java
index e664e9ce..f9f60324 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/setting/MailTemplateEntity.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/setting/MailTemplateEntity.java
@@ -23,13 +23,19 @@ import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
+import org.hibernate.annotations.SQLDelete;
+import org.hibernate.annotations.SQLDeleteAll;
+import org.hibernate.annotations.Where;
+
import cn.topiam.employee.common.enums.MailType;
-import cn.topiam.employee.support.repository.domain.BaseEntity;
+import cn.topiam.employee.support.repository.domain.LogicDeleteEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_WHERE;
/**
*
@@ -45,7 +51,10 @@ import lombok.experimental.Accessors;
@Entity
@Accessors(chain = true)
@Table(name = "mail_template")
-public class MailTemplateEntity extends BaseEntity {
+@SQLDelete(sql = "update mail_template set " + SOFT_DELETE_SET + " where id_ = ?")
+@SQLDeleteAll(sql = "update mail_template set " + SOFT_DELETE_SET + " where id_ = ?")
+@Where(clause = SOFT_DELETE_WHERE)
+public class MailTemplateEntity extends LogicDeleteEntity {
@Serial
private static final long serialVersionUID = 5983857137670090984L;
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/setting/SettingEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/setting/SettingEntity.java
index 3ceb0101..9a1b2cf9 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/setting/SettingEntity.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/setting/SettingEntity.java
@@ -21,12 +21,18 @@ import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
-import cn.topiam.employee.support.repository.domain.BaseEntity;
+import org.hibernate.annotations.SQLDelete;
+import org.hibernate.annotations.SQLDeleteAll;
+import org.hibernate.annotations.Where;
+
+import cn.topiam.employee.support.repository.domain.LogicDeleteEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_WHERE;
/**
*
@@ -41,8 +47,11 @@ import lombok.experimental.Accessors;
@ToString
@Entity
@Accessors(chain = true)
-@Table(name = "`setting`")
-public class SettingEntity extends BaseEntity {
+@Table(name = "setting")
+@SQLDelete(sql = "update setting set " + SOFT_DELETE_SET + " where id_ = ?")
+@SQLDeleteAll(sql = "update setting set " + SOFT_DELETE_SET + " where id_ = ?")
+@Where(clause = SOFT_DELETE_WHERE)
+public class SettingEntity extends LogicDeleteEntity {
/**
* name
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/enums/AuthenticationType.java b/eiam-common/src/main/java/cn/topiam/employee/common/enums/AuthenticationType.java
index 934617fb..cd6b5a4b 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/enums/AuthenticationType.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/enums/AuthenticationType.java
@@ -68,7 +68,6 @@ public enum AuthenticationType implements BaseEnum {
throw new NullPointerException("未获取到对应平台");
}
- @Override
public String getCode() {
return code;
}
@@ -77,7 +76,6 @@ public enum AuthenticationType implements BaseEnum {
this.code = code;
}
- @Override
public String getDesc() {
return desc;
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/enums/CaptchaProviderType.java b/eiam-common/src/main/java/cn/topiam/employee/common/enums/CaptchaProviderType.java
index 4e0bf8cf..86abcc51 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/enums/CaptchaProviderType.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/enums/CaptchaProviderType.java
@@ -76,7 +76,6 @@ public enum CaptchaProviderType implements BaseEnum {
this.desc = desc;
}
- @Override
public String getCode() {
return code;
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/enums/DataOrigin.java b/eiam-common/src/main/java/cn/topiam/employee/common/enums/DataOrigin.java
index f8f918a8..0ec8864c 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/enums/DataOrigin.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/enums/DataOrigin.java
@@ -64,12 +64,10 @@ public enum DataOrigin implements BaseEnum {
this.desc = desc;
}
- @Override
public String getCode() {
return code;
}
- @Override
public String getDesc() {
return desc;
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/enums/IdentityProviderType.java b/eiam-common/src/main/java/cn/topiam/employee/common/enums/IdentityProviderType.java
deleted file mode 100644
index 0c746866..00000000
--- a/eiam-common/src/main/java/cn/topiam/employee/common/enums/IdentityProviderType.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * eiam-common - Employee Identity and Access Management Program
- * Copyright © 2020-2023 TopIAM (support@topiam.cn)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-package cn.topiam.employee.common.enums;
-
-import com.fasterxml.jackson.annotation.JsonValue;
-
-import cn.topiam.employee.support.web.converter.EnumConvert;
-import static cn.topiam.employee.common.constants.AuthorizeConstants.AUTHORIZATION_REQUEST_URI;
-import static cn.topiam.employee.common.constants.AuthorizeConstants.LOGIN_PATH;
-
-/**
- * 认证提供商
- *
- * @author TopIAM
- * Created by support@topiam.cn on 2020/8/13 22:18
- */
-public enum IdentityProviderType implements BaseEnum {
- /**
- * 微信扫码登录
- */
- WECHAT_SCAN_CODE("wechat_scan_code", "微信扫码登录",
- "通过微信扫码进行身份认证"),
- /**
- * 钉钉扫码登录
- */
- DINGTALK_SCAN_CODE("dingtalk_scan_code",
- "钉钉扫码认证",
-
- "通过钉钉扫码进行身份认证"),
- /**
- * 钉钉Oauth2
- */
- DINGTALK_OAUTH("dingtalk_oauth", "钉钉Oauth认证",
- "通过钉钉进行身份认证"),
- /**
- * 企业微信
- */
- WECHATWORK_SCAN_CODE("wechatwork_scan_code",
- "企业微信扫码认证",
-
- "通过企业微信同步的用户可使用企业微信扫码登录进行身份认证"),
- /**
- * QQ
- */
- QQ("qq_oauth", "QQ认证", "通过QQ进行身份认证"),
- /**
- * 微博
- */
- WEIBO("weibo_oauth", "微博认证", "通过微博进行身份认证"),
- /**
- * Github
- */
- GITHUB("github_oauth", "Github",
- "通过 GitHub 进行身份认证"),
- /**
- * Google
- */
- GOOGLE("google_oauth", "Google",
- "通过 Google 进行身份认证"),
- /**
- * 支付宝扫码认证
- */
- ALIPAY("alipay_oauth", "支付宝认证",
- "通过支付宝进行身份认证"),
-
- /**
- * LDAP
- */
- LDAP("ldap", "LDAP 认证源", "通过 LDAP 认证源进行身份验证");
-
- @JsonValue
- private final String code;
- private final String name;
- private final String desc;
-
- IdentityProviderType(String code, String name, String desc) {
- this.code = code;
- this.name = name;
- this.desc = desc;
- }
-
- @Override
- public String getCode() {
- return code;
- }
-
- public String getName() {
- return name;
- }
-
- @Override
- public String getDesc() {
- return desc;
- }
-
- public String getAuthorizationPathPrefix() {
- return AUTHORIZATION_REQUEST_URI + "/" + getCode();
- }
-
- public String getLoginPathPrefix() {
- return LOGIN_PATH + "/" + getCode();
- }
-
- /**
- * 获取认证平台
- *
- * @param code {@link String}
- * @return {@link IdentityProviderType}
- */
- @EnumConvert
- public static IdentityProviderType getType(String code) {
- IdentityProviderType[] values = values();
- for (IdentityProviderType status : values) {
- if (String.valueOf(status.getCode()).equals(code)) {
- return status;
- }
- }
- return null;
- }
-}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/enums/Language.java b/eiam-common/src/main/java/cn/topiam/employee/common/enums/Language.java
index 329f0c08..3419fc6e 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/enums/Language.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/enums/Language.java
@@ -61,7 +61,6 @@ public enum Language implements BaseEnum {
return locale;
}
- @Override
public String getDesc() {
return desc;
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/enums/ListEnumDeserializer.java b/eiam-common/src/main/java/cn/topiam/employee/common/enums/ListEnumDeserializer.java
index 13703bcf..b989c177 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/enums/ListEnumDeserializer.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/enums/ListEnumDeserializer.java
@@ -22,7 +22,10 @@ import java.lang.reflect.Field;
import java.util.*;
import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.databind.*;
+import com.fasterxml.jackson.databind.BeanProperty;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.JsonDeserializer;
+import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.deser.ContextualDeserializer;
import com.fasterxml.jackson.databind.node.ArrayNode;
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/enums/MessageCategory.java b/eiam-common/src/main/java/cn/topiam/employee/common/enums/MessageCategory.java
index 9f077f8e..7d5eeb9b 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/enums/MessageCategory.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/enums/MessageCategory.java
@@ -52,12 +52,10 @@ public enum MessageCategory implements BaseEnum {
this.desc = desc;
}
- @Override
public String getCode() {
return code;
}
- @Override
public String getDesc() {
return desc;
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/enums/MfaFactor.java b/eiam-common/src/main/java/cn/topiam/employee/common/enums/MfaFactor.java
index ff657716..5d62eb73 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/enums/MfaFactor.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/enums/MfaFactor.java
@@ -57,12 +57,10 @@ public enum MfaFactor implements BaseEnum {
this.desc = desc;
}
- @Override
public String getCode() {
return code;
}
- @Override
public String getDesc() {
return desc;
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/enums/MfaMode.java b/eiam-common/src/main/java/cn/topiam/employee/common/enums/MfaMode.java
index 83db5123..c0c0b073 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/enums/MfaMode.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/enums/MfaMode.java
@@ -56,12 +56,10 @@ public enum MfaMode implements BaseEnum {
this.desc = desc;
}
- @Override
public String getCode() {
return code;
}
- @Override
public String getDesc() {
return desc;
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/enums/OrganizationType.java b/eiam-common/src/main/java/cn/topiam/employee/common/enums/OrganizationType.java
index 6c831b6e..477eee4f 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/enums/OrganizationType.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/enums/OrganizationType.java
@@ -60,12 +60,10 @@ public enum OrganizationType implements BaseEnum {
this.desc = desc;
}
- @Override
public String getCode() {
return code;
}
- @Override
public String getDesc() {
return desc;
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/enums/PermissionActionType.java b/eiam-common/src/main/java/cn/topiam/employee/common/enums/PermissionActionType.java
index 6bb62285..99db64b7 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/enums/PermissionActionType.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/enums/PermissionActionType.java
@@ -62,12 +62,10 @@ public enum PermissionActionType implements BaseEnum {
this.desc = desc;
}
- @Override
public String getCode() {
return code;
}
- @Override
public String getDesc() {
return desc;
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/enums/PolicyEffect.java b/eiam-common/src/main/java/cn/topiam/employee/common/enums/PolicyEffect.java
index 8b7d34cf..d368d3bd 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/enums/PolicyEffect.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/enums/PolicyEffect.java
@@ -52,12 +52,10 @@ public enum PolicyEffect implements BaseEnum {
this.desc = desc;
}
- @Override
public String getCode() {
return code;
}
- @Override
public String getDesc() {
return desc;
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/enums/PolicyObjectType.java b/eiam-common/src/main/java/cn/topiam/employee/common/enums/PolicyObjectType.java
index e29cf037..ba86dc5e 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/enums/PolicyObjectType.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/enums/PolicyObjectType.java
@@ -56,12 +56,10 @@ public enum PolicyObjectType implements BaseEnum {
this.desc = desc;
}
- @Override
public String getCode() {
return code;
}
- @Override
public String getDesc() {
return desc;
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/enums/PolicySubjectType.java b/eiam-common/src/main/java/cn/topiam/employee/common/enums/PolicySubjectType.java
index 2618085a..19369d9b 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/enums/PolicySubjectType.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/enums/PolicySubjectType.java
@@ -65,12 +65,10 @@ public enum PolicySubjectType implements BaseEnum {
this.desc = desc;
}
- @Override
public String getCode() {
return code;
}
- @Override
public String getDesc() {
return desc;
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/enums/SmsType.java b/eiam-common/src/main/java/cn/topiam/employee/common/enums/SmsType.java
index ae593939..0ffdfac5 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/enums/SmsType.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/enums/SmsType.java
@@ -33,8 +33,8 @@ public enum SmsType implements BaseEnum {
*/
BIND_PHONE("bind_phone", "绑定手机号", MessageCategory.CODE),
/**
- * 绑定,修改手机号成功
- */
+ * 绑定,修改手机号成功
+ */
BIND_PHONE_SUCCESS("bind_phone_success", "绑定手机号成功",
MessageCategory.CODE),
/**
@@ -63,7 +63,7 @@ public enum SmsType implements BaseEnum {
RESET_PASSWORD_SUCCESS("reset_password_success", "重置密码成功",
MessageCategory.NOTICE),
/**
- * 登录验证 未使用
+ * 登录验证
*/
LOGIN("login", "登录验证", MessageCategory.CODE),
@@ -110,12 +110,10 @@ public enum SmsType implements BaseEnum {
this.category = category;
}
- @Override
public String getCode() {
return code;
}
- @Override
public String getDesc() {
return desc;
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/enums/SyncStatus.java b/eiam-common/src/main/java/cn/topiam/employee/common/enums/SyncStatus.java
index 02bf561a..6c98e1b0 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/enums/SyncStatus.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/enums/SyncStatus.java
@@ -59,12 +59,10 @@ public enum SyncStatus implements BaseEnum {
this.desc = desc;
}
- @Override
public String getCode() {
return code;
}
- @Override
public String getDesc() {
return desc;
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/enums/TriggerType.java b/eiam-common/src/main/java/cn/topiam/employee/common/enums/TriggerType.java
index f8b80f06..a361faab 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/enums/TriggerType.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/enums/TriggerType.java
@@ -46,12 +46,10 @@ public enum TriggerType implements BaseEnum {
this.desc = desc;
}
- @Override
public String getCode() {
return code;
}
- @Override
public String getDesc() {
return desc;
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/enums/UserGender.java b/eiam-common/src/main/java/cn/topiam/employee/common/enums/UserGender.java
index 5c46a108..f8dd9cba 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/enums/UserGender.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/enums/UserGender.java
@@ -50,12 +50,10 @@ public enum UserGender implements BaseEnum {
this.desc = desc;
}
- @Override
public String getCode() {
return code;
}
- @Override
public String getDesc() {
return desc;
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/enums/UserIdType.java b/eiam-common/src/main/java/cn/topiam/employee/common/enums/UserIdType.java
index 8d778871..a854373c 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/enums/UserIdType.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/enums/UserIdType.java
@@ -49,12 +49,10 @@ public enum UserIdType implements BaseEnum {
this.desc = desc;
}
- @Override
public String getCode() {
return code;
}
- @Override
public String getDesc() {
return desc;
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/enums/UserStatus.java b/eiam-common/src/main/java/cn/topiam/employee/common/enums/UserStatus.java
index a9379a25..d3b3f32e 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/enums/UserStatus.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/enums/UserStatus.java
@@ -66,12 +66,10 @@ public enum UserStatus implements BaseEnum {
this.desc = desc;
}
- @Override
public String getCode() {
return code;
}
- @Override
public String getDesc() {
return desc;
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/enums/UserType.java b/eiam-common/src/main/java/cn/topiam/employee/common/enums/UserType.java
index 3f0ebd83..181903ca 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/enums/UserType.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/enums/UserType.java
@@ -72,7 +72,6 @@ public enum UserType implements BaseEnum {
throw new NullPointerException("未获取到类型");
}
- @Override
public String getCode() {
return code;
}
@@ -81,7 +80,6 @@ public enum UserType implements BaseEnum {
this.code = code;
}
- @Override
public String getDesc() {
return desc;
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/enums/app/AppCertUsingType.java b/eiam-common/src/main/java/cn/topiam/employee/common/enums/app/AppCertUsingType.java
index e3073109..3c20436f 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/enums/app/AppCertUsingType.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/enums/app/AppCertUsingType.java
@@ -54,7 +54,6 @@ public enum AppCertUsingType implements BaseEnum {
this.desc = desc;
}
- @Override
public String getCode() {
return code;
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/enums/app/AppProtocol.java b/eiam-common/src/main/java/cn/topiam/employee/common/enums/app/AppProtocol.java
index 51b040ca..6af6e6fb 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/enums/app/AppProtocol.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/enums/app/AppProtocol.java
@@ -52,7 +52,12 @@ public enum AppProtocol implements BaseEnum {
/**
* FORM表单
*/
- FORM("form", "表单代填");
+ FORM("form", "表单代填"),
+
+ /**
+ * TSA
+ */
+ TSA("tsa", "TSA");
@JsonValue
private final String code;
@@ -66,7 +71,6 @@ public enum AppProtocol implements BaseEnum {
this.desc = desc;
}
- @Override
public String getCode() {
return code;
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/enums/app/AppType.java b/eiam-common/src/main/java/cn/topiam/employee/common/enums/app/AppType.java
index bbfd6886..59ea6fe9 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/enums/app/AppType.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/enums/app/AppType.java
@@ -42,7 +42,11 @@ public enum AppType implements BaseEnum {
/**
* 自研
*/
- SELF_DEVELOPED("self_developed", "自研应用");
+ SELF_DEVELOPED("self_developed", "自研应用"),
+ /**
+ * TSA
+ */
+ TSA("tsa", "TSA"),;
/**
* code
@@ -59,12 +63,10 @@ public enum AppType implements BaseEnum {
this.desc = desc;
}
- @Override
public String getCode() {
return code;
}
- @Override
public String getDesc() {
return desc;
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/enums/app/AuthorizationType.java b/eiam-common/src/main/java/cn/topiam/employee/common/enums/app/AuthorizationType.java
index 68a2a648..fecc29ae 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/enums/app/AuthorizationType.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/enums/app/AuthorizationType.java
@@ -53,12 +53,10 @@ public enum AuthorizationType implements BaseEnum {
this.desc = desc;
}
- @Override
public String getCode() {
return code;
}
- @Override
public String getDesc() {
return desc;
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/enums/app/CasUserIdentityType.java b/eiam-common/src/main/java/cn/topiam/employee/common/enums/app/CasUserIdentityType.java
new file mode 100644
index 00000000..06d94c9e
--- /dev/null
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/enums/app/CasUserIdentityType.java
@@ -0,0 +1,78 @@
+/*
+ * eiam-common - Employee Identity and Access Management Program
+ * Copyright © 2020-2023 TopIAM (support@topiam.cn)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+package cn.topiam.employee.common.enums.app;
+
+import com.fasterxml.jackson.annotation.JsonValue;
+
+import cn.topiam.employee.support.web.converter.EnumConvert;
+
+/**
+ * Cas 用户标识类型
+ *
+ * @author TopIAM
+ * Created by support@topiam.cn on 2022/5/22 23:49
+ */
+public enum CasUserIdentityType {
+ /**
+ * 用户名
+ */
+ USER_USERNAME("user.username"),
+ /**
+ * 姓名
+ */
+ USER_FULL_NAME("user.fullName"),
+ /**
+ * 昵称
+ */
+ USER_NICK_NAME("user.nickName"),
+ /**
+ * 邮箱
+ */
+ USER_EMAIL("user.email"),
+ /**
+ * 应用账户
+ */
+ APP_USERNAME("app_user.username");
+
+ @JsonValue
+ private final String code;
+
+ CasUserIdentityType(String code) {
+ this.code = code;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ @EnumConvert
+ public static CasUserIdentityType getType(String code) {
+ CasUserIdentityType[] values = values();
+ for (CasUserIdentityType status : values) {
+ if (String.valueOf(status.getCode()).equals(code)) {
+ return status;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public String toString() {
+ return code;
+ }
+}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/enums/app/FormSubmitType.java b/eiam-common/src/main/java/cn/topiam/employee/common/enums/app/FormSubmitType.java
new file mode 100644
index 00000000..00964ace
--- /dev/null
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/enums/app/FormSubmitType.java
@@ -0,0 +1,84 @@
+/*
+ * eiam-common - Employee Identity and Access Management Program
+ * Copyright © 2020-2023 TopIAM (support@topiam.cn)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+package cn.topiam.employee.common.enums.app;
+
+import com.fasterxml.jackson.annotation.JsonValue;
+
+import cn.topiam.employee.common.enums.BaseEnum;
+import cn.topiam.employee.support.web.converter.EnumConvert;
+
+/**
+ *
+ * @author SanLi
+ * Created by qinggang.zuo@gmail.com / 2689170096@qq.com on 2022/12/21 17:20
+ */
+public enum FormSubmitType implements BaseEnum {
+ /**
+ * POST
+ */
+ POST("post", "POST"),
+ /**
+ * GET
+ */
+ GET("get", "GET");
+
+ /**
+ * code
+ */
+ @JsonValue
+ private final String code;
+ /**
+ * desc
+ */
+ private final String desc;
+
+ FormSubmitType(String code, String desc) {
+ this.code = code;
+ this.desc = desc;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public String getDesc() {
+ return desc;
+ }
+
+ /**
+ * 获取类型
+ *
+ * @param code {@link String}
+ * @return {@link InitLoginType}
+ */
+ @EnumConvert
+ public static FormSubmitType getType(String code) {
+ FormSubmitType[] values = values();
+ for (FormSubmitType status : values) {
+ if (String.valueOf(status.getCode()).equals(code)) {
+ return status;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public String toString() {
+ return this.code;
+ }
+}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/enums/app/SamlAttributeStatementValueType.java b/eiam-common/src/main/java/cn/topiam/employee/common/enums/app/SamlAttributeStatementValueType.java
index e46d4a22..0f8e3336 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/enums/app/SamlAttributeStatementValueType.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/enums/app/SamlAttributeStatementValueType.java
@@ -84,7 +84,6 @@ public enum SamlAttributeStatementValueType implements BaseEnum {
return null;
}
- @Override
public String getCode() {
return code;
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/enums/app/converter/CasUserIdentityTypeConverter.java b/eiam-common/src/main/java/cn/topiam/employee/common/enums/app/converter/CasUserIdentityTypeConverter.java
new file mode 100644
index 00000000..c46fdfff
--- /dev/null
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/enums/app/converter/CasUserIdentityTypeConverter.java
@@ -0,0 +1,46 @@
+/*
+ * eiam-common - Employee Identity and Access Management Program
+ * Copyright © 2020-2023 TopIAM (support@topiam.cn)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+package cn.topiam.employee.common.enums.app.converter;
+
+import java.util.Objects;
+
+import javax.persistence.AttributeConverter;
+import javax.persistence.Converter;
+
+import cn.topiam.employee.common.enums.app.CasUserIdentityType;
+
+/**
+ * @author TopIAM
+ * Created by support@topiam.cn on 2022/5/22 23:25
+ */
+@Converter(autoApply = true)
+public class CasUserIdentityTypeConverter implements
+ AttributeConverter {
+ @Override
+ public String convertToDatabaseColumn(CasUserIdentityType attribute) {
+ if (Objects.isNull(attribute)) {
+ return null;
+ }
+ return attribute.getCode();
+ }
+
+ @Override
+ public CasUserIdentityType convertToEntityAttribute(String dbData) {
+ return CasUserIdentityType.getType(dbData);
+ }
+}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/enums/converter/IdentityProviderTypeConverter.java b/eiam-common/src/main/java/cn/topiam/employee/common/enums/app/converter/FormSubmitTypeConverter.java
similarity index 75%
rename from eiam-common/src/main/java/cn/topiam/employee/common/enums/converter/IdentityProviderTypeConverter.java
rename to eiam-common/src/main/java/cn/topiam/employee/common/enums/app/converter/FormSubmitTypeConverter.java
index cae8b060..b983e49a 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/enums/converter/IdentityProviderTypeConverter.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/enums/app/converter/FormSubmitTypeConverter.java
@@ -15,22 +15,21 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
-package cn.topiam.employee.common.enums.converter;
+package cn.topiam.employee.common.enums.app.converter;
import java.util.Objects;
import javax.persistence.AttributeConverter;
import javax.persistence.Converter;
-import cn.topiam.employee.common.enums.IdentityProviderType;
+import cn.topiam.employee.common.enums.app.FormSubmitType;
/**
* @author TopIAM
- * Created by support@topiam.cn on 2020/12/11 19:42
+ * Created by support@topiam.cn on 2020/12/11 23:48
*/
@Converter(autoApply = true)
-public class IdentityProviderTypeConverter implements
- AttributeConverter {
+public class FormSubmitTypeConverter implements AttributeConverter {
/**
* Converts the value stored in the entity attribute into the
@@ -41,11 +40,11 @@ public class IdentityProviderTypeConverter implements
* column
*/
@Override
- public String convertToDatabaseColumn(IdentityProviderType attribute) {
- if (!Objects.isNull(attribute)) {
- return attribute.getCode();
+ public String convertToDatabaseColumn(FormSubmitType attribute) {
+ if (Objects.isNull(attribute)) {
+ return null;
}
- return null;
+ return attribute.getCode();
}
/**
@@ -62,7 +61,7 @@ public class IdentityProviderTypeConverter implements
* attribute
*/
@Override
- public IdentityProviderType convertToEntityAttribute(String dbData) {
- return IdentityProviderType.getType(dbData);
+ public FormSubmitType convertToEntityAttribute(String dbData) {
+ return FormSubmitType.getType(dbData);
}
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/enums/identitysource/IdentitySourceActionType.java b/eiam-common/src/main/java/cn/topiam/employee/common/enums/identitysource/IdentitySourceActionType.java
index 5bd97d26..708d735b 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/enums/identitysource/IdentitySourceActionType.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/enums/identitysource/IdentitySourceActionType.java
@@ -57,12 +57,10 @@ public enum IdentitySourceActionType implements BaseEnum {
this.desc = desc;
}
- @Override
public String getCode() {
return code;
}
- @Override
public String getDesc() {
return desc;
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/enums/identitysource/IdentitySourceObjectType.java b/eiam-common/src/main/java/cn/topiam/employee/common/enums/identitysource/IdentitySourceObjectType.java
index 14716843..9241a35f 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/enums/identitysource/IdentitySourceObjectType.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/enums/identitysource/IdentitySourceObjectType.java
@@ -55,12 +55,10 @@ public enum IdentitySourceObjectType implements BaseEnum {
this.desc = desc;
}
- @Override
public String getCode() {
return code;
}
- @Override
public String getDesc() {
return desc;
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/enums/identityprovider/IdentitySourceProvider.java b/eiam-common/src/main/java/cn/topiam/employee/common/enums/identitysource/IdentitySourceProvider.java
similarity index 98%
rename from eiam-common/src/main/java/cn/topiam/employee/common/enums/identityprovider/IdentitySourceProvider.java
rename to eiam-common/src/main/java/cn/topiam/employee/common/enums/identitysource/IdentitySourceProvider.java
index 2ae3b9e2..67e09ef4 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/enums/identityprovider/IdentitySourceProvider.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/enums/identitysource/IdentitySourceProvider.java
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
-package cn.topiam.employee.common.enums.identityprovider;
+package cn.topiam.employee.common.enums.identitysource;
import com.fasterxml.jackson.annotation.JsonValue;
@@ -80,7 +80,6 @@ public enum IdentitySourceProvider implements BaseEnum {
return null;
}
- @Override
public String getCode() {
return code;
}
@@ -89,7 +88,6 @@ public enum IdentitySourceProvider implements BaseEnum {
return name;
}
- @Override
public String getDesc() {
return desc;
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/enums/identityprovider/converter/IdentitySourceProviderConverter.java b/eiam-common/src/main/java/cn/topiam/employee/common/enums/identitysource/converter/IdentitySourceProviderConverter.java
similarity index 94%
rename from eiam-common/src/main/java/cn/topiam/employee/common/enums/identityprovider/converter/IdentitySourceProviderConverter.java
rename to eiam-common/src/main/java/cn/topiam/employee/common/enums/identitysource/converter/IdentitySourceProviderConverter.java
index 73225c17..186dbdbd 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/enums/identityprovider/converter/IdentitySourceProviderConverter.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/enums/identitysource/converter/IdentitySourceProviderConverter.java
@@ -15,14 +15,14 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
-package cn.topiam.employee.common.enums.identityprovider.converter;
+package cn.topiam.employee.common.enums.identitysource.converter;
import java.util.Objects;
import javax.persistence.AttributeConverter;
import javax.persistence.Converter;
-import cn.topiam.employee.common.enums.identityprovider.IdentitySourceProvider;
+import cn.topiam.employee.common.enums.identitysource.IdentitySourceProvider;
/**
* 身份源提供商
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/geo/District.java b/eiam-common/src/main/java/cn/topiam/employee/common/geo/District.java
new file mode 100644
index 00000000..aa4c0546
--- /dev/null
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/geo/District.java
@@ -0,0 +1,739 @@
+/*
+ * eiam-common - Employee Identity and Access Management Program
+ * Copyright © 2020-2023 TopIAM (support@topiam.cn)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+package cn.topiam.employee.common.geo;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * GeoLocationResponse
+ *
+ * @author TopIAM
+ * Created by support@topiam.cn on 2023/02/04 14:19
+ */
+public final class District {
+ public static final Map PROVINCE_DISTRICT = new HashMap<>() {
+ {
+ put("北京市", "110000");
+ put("天津市", "120000");
+ put("河北省", "130000");
+ put(" 石家庄市", "130100");
+ put(" 唐山市", "130200");
+ put(" 秦皇岛市", "130300");
+ put(" 邯郸市", "130400");
+ put(" 邢台市", "130500");
+ put(" 保定市", "130600");
+ put(" 张家口市", "130700");
+ put(" 承德市", "130800");
+ put(" 沧州市", "130900");
+ put(" 廊坊市", "131000");
+ put(" 衡水市", "131100");
+ put("山西省", "140000");
+ put(" 太原市", "140100");
+ put(" 大同市", "140200");
+ put(" 阳泉市", "140300");
+ put(" 长治市", "140400");
+ put(" 晋城市", "140500");
+ put(" 朔州市", "140600");
+ put(" 晋中市", "140700");
+ put(" 运城市", "140800");
+ put(" 忻州市", "140900");
+ put(" 临汾市", "141000");
+ put(" 吕梁市", "141100");
+ put("内蒙古自治区", "150000");
+ put(" 呼和浩特市", "150100");
+ put(" 包头市", "150200");
+ put(" 乌海市", "150300");
+ put(" 赤峰市", "150400");
+ put(" 通辽市", "150500");
+ put(" 鄂尔多斯市", "150600");
+ put(" 呼伦贝尔市", "150700");
+ put(" 巴彦淖尔市", "150800");
+ put(" 乌兰察布市", "150900");
+ put(" 兴安盟", "152200");
+ put(" 锡林郭勒盟", "152500");
+ put(" 阿拉善盟", "152900");
+ put("辽宁省", "210000");
+ put(" 沈阳市", "210100");
+ put(" 大连市", "210200");
+ put(" 鞍山市", "210300");
+ put(" 抚顺市", "210400");
+ put(" 本溪市", "210500");
+ put(" 丹东市", "210600");
+ put(" 锦州市", "210700");
+ put(" 营口市", "210800");
+ put(" 阜新市", "210900");
+ put(" 辽阳市", "211000");
+ put(" 盘锦市", "211100");
+ put(" 铁岭市", "211200");
+ put(" 朝阳市", "211300");
+ put(" 葫芦岛市", "211400");
+ put("吉林省", "220000");
+ put(" 长春市", "220100");
+ put(" 吉林市", "220200");
+ put(" 四平市", "220300");
+ put(" 辽源市", "220400");
+ put(" 通化市", "220500");
+ put(" 白山市", "220600");
+ put(" 松原市", "220700");
+ put(" 白城市", "220800");
+ put(" 延边朝鲜族自治州", "222400");
+ put("黑龙江省", "230000");
+ put(" 哈尔滨市", "230100");
+ put(" 齐齐哈尔市", "230200");
+ put(" 鸡西市", "230300");
+ put(" 鹤岗市", "230400");
+ put(" 双鸭山市", "230500");
+ put(" 大庆市", "230600");
+ put(" 伊春市", "230700");
+ put(" 佳木斯市", "230800");
+ put(" 七台河市", "230900");
+ put(" 牡丹江市", "231000");
+ put(" 黑河市", "231100");
+ put(" 绥化市", "231200");
+ put(" 大兴安岭地区", "232700");
+ put("上海市", "310000");
+ put("江苏省", "320000");
+ put(" 南京市", "320100");
+ put(" 无锡市", "320200");
+ put(" 徐州市", "320300");
+ put(" 常州市", "320400");
+ put(" 苏州市", "320500");
+ put(" 南通市", "320600");
+ put(" 连云港市", "320700");
+ put(" 淮安市", "320800");
+ put(" 盐城市", "320900");
+ put(" 扬州市", "321000");
+ put(" 镇江市", "321100");
+ put(" 泰州市", "321200");
+ put(" 宿迁市", "321300");
+ put("浙江省", "330000");
+ put(" 杭州市", "330100");
+ put(" 宁波市", "330200");
+ put(" 温州市", "330300");
+ put(" 嘉兴市", "330400");
+ put(" 湖州市", "330500");
+ put(" 绍兴市", "330600");
+ put(" 金华市", "330700");
+ put(" 衢州市", "330800");
+ put(" 舟山市", "330900");
+ put(" 台州市", "331000");
+ put(" 丽水市", "331100");
+ put("安徽省", "340000");
+ put(" 合肥市", "340100");
+ put(" 芜湖市", "340200");
+ put(" 蚌埠市", "340300");
+ put(" 淮南市", "340400");
+ put(" 马鞍山市", "340500");
+ put(" 淮北市", "340600");
+ put(" 铜陵市", "340700");
+ put(" 安庆市", "340800");
+ put(" 黄山市", "341000");
+ put(" 滁州市", "341100");
+ put(" 阜阳市", "341200");
+ put(" 宿州市", "341300");
+ put(" 六安市", "341500");
+ put(" 亳州市", "341600");
+ put(" 池州市", "341700");
+ put(" 宣城市", "341800");
+ put("福建省", "350000");
+ put(" 福州市", "350100");
+ put(" 厦门市", "350200");
+ put(" 莆田市", "350300");
+ put(" 三明市", "350400");
+ put(" 泉州市", "350500");
+ put(" 漳州市", "350600");
+ put(" 南平市", "350700");
+ put(" 龙岩市", "350800");
+ put(" 宁德市", "350900");
+ put("江西省", "360000");
+ put(" 南昌市", "360100");
+ put(" 景德镇市", "360200");
+ put(" 萍乡市", "360300");
+ put(" 九江市", "360400");
+ put(" 新余市", "360500");
+ put(" 鹰潭市", "360600");
+ put(" 赣州市", "360700");
+ put(" 吉安市", "360800");
+ put(" 宜春市", "360900");
+ put(" 抚州市", "361000");
+ put(" 上饶市", "361100");
+ put("山东省", "370000");
+ put(" 济南市", "370100");
+ put(" 青岛市", "370200");
+ put(" 淄博市", "370300");
+ put(" 枣庄市", "370400");
+ put(" 东营市", "370500");
+ put(" 烟台市", "370600");
+ put(" 潍坊市", "370700");
+ put(" 济宁市", "370800");
+ put(" 泰安市", "370900");
+ put(" 威海市", "371000");
+ put(" 日照市", "371100");
+ put(" 临沂市", "371300");
+ put(" 德州市", "371400");
+ put(" 聊城市", "371500");
+ put(" 滨州市", "371600");
+ put(" 菏泽市", "371700");
+ put("河南省", "410000");
+ put(" 郑州市", "410100");
+ put(" 开封市", "410200");
+ put(" 洛阳市", "410300");
+ put(" 平顶山市", "410400");
+ put(" 安阳市", "410500");
+ put(" 鹤壁市", "410600");
+ put(" 新乡市", "410700");
+ put(" 焦作市", "410800");
+ put(" 濮阳市", "410900");
+ put(" 许昌市", "411000");
+ put(" 漯河市", "411100");
+ put(" 三门峡市", "411200");
+ put(" 南阳市", "411300");
+ put(" 商丘市", "411400");
+ put(" 信阳市", "411500");
+ put(" 周口市", "411600");
+ put(" 驻马店市", "411700");
+ put("湖北省", "420000");
+ put(" 武汉市", "420100");
+ put(" 黄石市", "420200");
+ put(" 十堰市", "420300");
+ put(" 宜昌市", "420500");
+ put(" 襄阳市", "420600");
+ put(" 鄂州市", "420700");
+ put(" 荆门市", "420800");
+ put(" 孝感市", "420900");
+ put(" 荆州市", "421000");
+ put(" 黄冈市", "421100");
+ put(" 咸宁市", "421200");
+ put(" 随州市", "421300");
+ put(" 恩施土家族苗族自治州", "422800");
+ put("湖南省", "430000");
+ put(" 长沙市", "430100");
+ put(" 株洲市", "430200");
+ put(" 湘潭市", "430300");
+ put(" 衡阳市", "430400");
+ put(" 邵阳市", "430500");
+ put(" 岳阳市", "430600");
+ put(" 常德市", "430700");
+ put(" 张家界市", "430800");
+ put(" 益阳市", "430900");
+ put(" 郴州市", "431000");
+ put(" 永州市", "431100");
+ put(" 怀化市", "431200");
+ put(" 娄底市", "431300");
+ put(" 湘西土家族苗族自治州", "433100");
+ put("广东省", "440000");
+ put(" 广州市", "440100");
+ put(" 韶关市", "440200");
+ put(" 深圳市", "440300");
+ put(" 珠海市", "440400");
+ put(" 汕头市", "440500");
+ put(" 佛山市", "440600");
+ put(" 江门市", "440700");
+ put(" 湛江市", "440800");
+ put(" 茂名市", "440900");
+ put(" 肇庆市", "441200");
+ put(" 惠州市", "441300");
+ put(" 梅州市", "441400");
+ put(" 汕尾市", "441500");
+ put(" 河源市", "441600");
+ put(" 阳江市", "441700");
+ put(" 清远市", "441800");
+ put(" 东莞市", "441900");
+ put(" 中山市", "442000");
+ put(" 潮州市", "445100");
+ put(" 揭阳市", "445200");
+ put(" 云浮市", "445300");
+ put("广西壮族自治区", "450000");
+ put(" 南宁市", "450100");
+ put(" 柳州市", "450200");
+ put(" 桂林市", "450300");
+ put(" 梧州市", "450400");
+ put(" 北海市", "450500");
+ put(" 防城港市", "450600");
+ put(" 钦州市", "450700");
+ put(" 贵港市", "450800");
+ put(" 玉林市", "450900");
+ put(" 百色市", "451000");
+ put(" 贺州市", "451100");
+ put(" 河池市", "451200");
+ put(" 来宾市", "451300");
+ put(" 崇左市", "451400");
+ put("海南省", "460000");
+ put(" 海口市", "460100");
+ put(" 三亚市", "460200");
+ put(" 三沙市", "460300");
+ put(" 儋州市", "460400");
+ put("重庆市", "500000");
+ put("四川省", "510000");
+ put(" 成都市", "510100");
+ put(" 自贡市", "510300");
+ put(" 攀枝花市", "510400");
+ put(" 泸州市", "510500");
+ put(" 德阳市", "510600");
+ put(" 绵阳市", "510700");
+ put(" 广元市", "510800");
+ put(" 遂宁市", "510900");
+ put(" 内江市", "511000");
+ put(" 乐山市", "511100");
+ put(" 南充市", "511300");
+ put(" 眉山市", "511400");
+ put(" 宜宾市", "511500");
+ put(" 广安市", "511600");
+ put(" 达州市", "511700");
+ put(" 雅安市", "511800");
+ put(" 巴中市", "511900");
+ put(" 资阳市", "512000");
+ put(" 阿坝藏族羌族自治州", "513200");
+ put(" 甘孜藏族自治州", "513300");
+ put(" 凉山彝族自治州", "513400");
+ put("贵州省", "520000");
+ put(" 贵阳市", "520100");
+ put(" 六盘水市", "520200");
+ put(" 遵义市", "520300");
+ put(" 安顺市", "520400");
+ put(" 毕节市", "520500");
+ put(" 铜仁市", "520600");
+ put(" 黔西南布依族苗族自治州", "522300");
+ put(" 黔东南苗族侗族自治州", "522600");
+ put(" 黔南布依族苗族自治州", "522700");
+ put("云南省", "530000");
+ put(" 昆明市", "530100");
+ put(" 曲靖市", "530300");
+ put(" 玉溪市", "530400");
+ put(" 保山市", "530500");
+ put(" 昭通市", "530600");
+ put(" 丽江市", "530700");
+ put(" 普洱市", "530800");
+ put(" 临沧市", "530900");
+ put(" 楚雄彝族自治州", "532300");
+ put(" 红河哈尼族彝族自治州", "532500");
+ put(" 文山壮族苗族自治州", "532600");
+ put(" 西双版纳傣族自治州", "532800");
+ put(" 大理白族自治州", "532900");
+ put(" 德宏傣族景颇族自治州", "533100");
+ put(" 怒江傈僳族自治州", "533300");
+ put(" 迪庆藏族自治州", "533400");
+ put("西藏自治区", "540000");
+ put(" 拉萨市", "540100");
+ put(" 日喀则市", "540200");
+ put(" 昌都市", "540300");
+ put(" 林芝市", "540400");
+ put(" 山南市", "540500");
+ put(" 那曲市", "540600");
+ put(" 阿里地区", "542500");
+ put("陕西省", "610000");
+ put(" 西安市", "610100");
+ put(" 铜川市", "610200");
+ put(" 宝鸡市", "610300");
+ put(" 咸阳市", "610400");
+ put(" 渭南市", "610500");
+ put(" 延安市", "610600");
+ put(" 汉中市", "610700");
+ put(" 榆林市", "610800");
+ put(" 安康市", "610900");
+ put(" 商洛市", "611000");
+ put("甘肃省", "620000");
+ put(" 兰州市", "620100");
+ put(" 嘉峪关市", "620200");
+ put(" 金昌市", "620300");
+ put(" 白银市", "620400");
+ put(" 天水市", "620500");
+ put(" 武威市", "620600");
+ put(" 张掖市", "620700");
+ put(" 平凉市", "620800");
+ put(" 酒泉市", "620900");
+ put(" 庆阳市", "621000");
+ put(" 定西市", "621100");
+ put(" 陇南市", "621200");
+ put(" 临夏回族自治州", "622900");
+ put(" 甘南藏族自治州", "623000");
+ put("青海省", "630000");
+ put(" 西宁市", "630100");
+ put(" 海东市", "630200");
+ put(" 海北藏族自治州", "632200");
+ put(" 黄南藏族自治州", "632300");
+ put(" 海南藏族自治州", "632500");
+ put(" 果洛藏族自治州", "632600");
+ put(" 玉树藏族自治州", "632700");
+ put(" 海西蒙古族藏族自治州", "632800");
+ put("宁夏回族自治区", "640000");
+ put(" 银川市", "640100");
+ put(" 石嘴山市", "640200");
+ put(" 吴忠市", "640300");
+ put(" 固原市", "640400");
+ put(" 中卫市", "640500");
+ put("新疆维吾尔自治区", "650000");
+ put(" 乌鲁木齐市", "650100");
+ put(" 克拉玛依市", "650200");
+ put(" 吐鲁番市", "650400");
+ put(" 哈密市", "650500");
+ put(" 昌吉回族自治州", "652300");
+ put(" 博尔塔拉蒙古自治州", "652700");
+ put(" 巴音郭楞蒙古自治州", "652800");
+ put(" 阿克苏地区", "652900");
+ put(" 克孜勒苏柯尔克孜自治州", "653000");
+ put(" 喀什地区", "653100");
+ put(" 和田地区", "653200");
+ put(" 伊犁哈萨克自治州", "654000");
+ put(" 塔城地区", "654200");
+ put(" 阿勒泰地区", "654300");
+ put("台湾省", "710000");
+ put("香港特别行政区", "810000");
+ put("澳门特别行政区", "820000");
+ }
+ };
+
+ public static final Map CITY_DISTRICT = new HashMap<>() {
+ {
+ put("石家庄市", "130100");
+ put("唐山市", "130200");
+ put("秦皇岛市", "130300");
+ put("邯郸市", "130400");
+ put("邢台市", "130500");
+ put("保定市", "130600");
+ put("张家口市", "130700");
+ put("承德市", "130800");
+ put("沧州市", "130900");
+ put("廊坊市", "131000");
+ put("衡水市", "131100");
+ put("太原市", "140100");
+ put("大同市", "140200");
+ put("阳泉市", "140300");
+ put("长治市", "140400");
+ put("晋城市", "140500");
+ put("朔州市", "140600");
+ put("晋中市", "140700");
+ put("运城市", "140800");
+ put("忻州市", "140900");
+ put("临汾市", "141000");
+ put("吕梁市", "141100");
+ put("呼和浩特市", "150100");
+ put("包头市", "150200");
+ put("乌海市", "150300");
+ put("赤峰市", "150400");
+ put("通辽市", "150500");
+ put("鄂尔多斯市", "150600");
+ put("呼伦贝尔市", "150700");
+ put("巴彦淖尔市", "150800");
+ put("乌兰察布市", "150900");
+ put("兴安盟", "152200");
+ put("锡林郭勒盟", "152500");
+ put("阿拉善盟", "152900");
+ put("沈阳市", "210100");
+ put("大连市", "210200");
+ put("鞍山市", "210300");
+ put("抚顺市", "210400");
+ put("本溪市", "210500");
+ put("丹东市", "210600");
+ put("锦州市", "210700");
+ put("营口市", "210800");
+ put("阜新市", "210900");
+ put("辽阳市", "211000");
+ put("盘锦市", "211100");
+ put("铁岭市", "211200");
+ put("朝阳市", "211300");
+ put("葫芦岛市", "211400");
+ put("长春市", "220100");
+ put("吉林市", "220200");
+ put("四平市", "220300");
+ put("辽源市", "220400");
+ put("通化市", "220500");
+ put("白山市", "220600");
+ put("松原市", "220700");
+ put("白城市", "220800");
+ put("延边朝鲜族自治州", "222400");
+ put("哈尔滨市", "230100");
+ put("齐齐哈尔市", "230200");
+ put("鸡西市", "230300");
+ put("鹤岗市", "230400");
+ put("双鸭山市", "230500");
+ put("大庆市", "230600");
+ put("伊春市", "230700");
+ put("佳木斯市", "230800");
+ put("七台河市", "230900");
+ put("牡丹江市", "231000");
+ put("黑河市", "231100");
+ put("绥化市", "231200");
+ put("大兴安岭地区", "232700");
+ put("南京市", "320100");
+ put("无锡市", "320200");
+ put("徐州市", "320300");
+ put("常州市", "320400");
+ put("苏州市", "320500");
+ put("南通市", "320600");
+ put("连云港市", "320700");
+ put("淮安市", "320800");
+ put("盐城市", "320900");
+ put("扬州市", "321000");
+ put("镇江市", "321100");
+ put("泰州市", "321200");
+ put("宿迁市", "321300");
+ put("杭州市", "330100");
+ put("宁波市", "330200");
+ put("温州市", "330300");
+ put("嘉兴市", "330400");
+ put("湖州市", "330500");
+ put("绍兴市", "330600");
+ put("金华市", "330700");
+ put("衢州市", "330800");
+ put("舟山市", "330900");
+ put("台州市", "331000");
+ put("丽水市", "331100");
+ put("合肥市", "340100");
+ put("芜湖市", "340200");
+ put("蚌埠市", "340300");
+ put("淮南市", "340400");
+ put("马鞍山市", "340500");
+ put("淮北市", "340600");
+ put("铜陵市", "340700");
+ put("安庆市", "340800");
+ put("黄山市", "341000");
+ put("滁州市", "341100");
+ put("阜阳市", "341200");
+ put("宿州市", "341300");
+ put("六安市", "341500");
+ put("亳州市", "341600");
+ put("池州市", "341700");
+ put("宣城市", "341800");
+ put("福州市", "350100");
+ put("厦门市", "350200");
+ put("莆田市", "350300");
+ put("三明市", "350400");
+ put("泉州市", "350500");
+ put("漳州市", "350600");
+ put("南平市", "350700");
+ put("龙岩市", "350800");
+ put("宁德市", "350900");
+ put("南昌市", "360100");
+ put("景德镇市", "360200");
+ put("萍乡市", "360300");
+ put("九江市", "360400");
+ put("新余市", "360500");
+ put("鹰潭市", "360600");
+ put("赣州市", "360700");
+ put("吉安市", "360800");
+ put("宜春市", "360900");
+ put("抚州市", "361000");
+ put("上饶市", "361100");
+ put("济南市", "370100");
+ put("青岛市", "370200");
+ put("淄博市", "370300");
+ put("枣庄市", "370400");
+ put("东营市", "370500");
+ put("烟台市", "370600");
+ put("潍坊市", "370700");
+ put("济宁市", "370800");
+ put("泰安市", "370900");
+ put("威海市", "371000");
+ put("日照市", "371100");
+ put("临沂市", "371300");
+ put("德州市", "371400");
+ put("聊城市", "371500");
+ put("滨州市", "371600");
+ put("菏泽市", "371700");
+ put("郑州市", "410100");
+ put("开封市", "410200");
+ put("洛阳市", "410300");
+ put("平顶山市", "410400");
+ put("安阳市", "410500");
+ put("鹤壁市", "410600");
+ put("新乡市", "410700");
+ put("焦作市", "410800");
+ put("濮阳市", "410900");
+ put("许昌市", "411000");
+ put("漯河市", "411100");
+ put("三门峡市", "411200");
+ put("南阳市", "411300");
+ put("商丘市", "411400");
+ put("信阳市", "411500");
+ put("周口市", "411600");
+ put("驻马店市", "411700");
+ put("武汉市", "420100");
+ put("黄石市", "420200");
+ put("十堰市", "420300");
+ put("宜昌市", "420500");
+ put("襄阳市", "420600");
+ put("鄂州市", "420700");
+ put("荆门市", "420800");
+ put("孝感市", "420900");
+ put("荆州市", "421000");
+ put("黄冈市", "421100");
+ put("咸宁市", "421200");
+ put("随州市", "421300");
+ put("恩施土家族苗族自治州", "422800");
+ put("长沙市", "430100");
+ put("株洲市", "430200");
+ put("湘潭市", "430300");
+ put("衡阳市", "430400");
+ put("邵阳市", "430500");
+ put("岳阳市", "430600");
+ put("常德市", "430700");
+ put("张家界市", "430800");
+ put("益阳市", "430900");
+ put("郴州市", "431000");
+ put("永州市", "431100");
+ put("怀化市", "431200");
+ put("娄底市", "431300");
+ put("湘西土家族苗族自治州", "433100");
+ put("广州市", "440100");
+ put("韶关市", "440200");
+ put("深圳市", "440300");
+ put("珠海市", "440400");
+ put("汕头市", "440500");
+ put("佛山市", "440600");
+ put("江门市", "440700");
+ put("湛江市", "440800");
+ put("茂名市", "440900");
+ put("肇庆市", "441200");
+ put("惠州市", "441300");
+ put("梅州市", "441400");
+ put("汕尾市", "441500");
+ put("河源市", "441600");
+ put("阳江市", "441700");
+ put("清远市", "441800");
+ put("东莞市", "441900");
+ put("中山市", "442000");
+ put("潮州市", "445100");
+ put("揭阳市", "445200");
+ put("云浮市", "445300");
+ put("南宁市", "450100");
+ put("柳州市", "450200");
+ put("桂林市", "450300");
+ put("梧州市", "450400");
+ put("北海市", "450500");
+ put("防城港市", "450600");
+ put("钦州市", "450700");
+ put("贵港市", "450800");
+ put("玉林市", "450900");
+ put("百色市", "451000");
+ put("贺州市", "451100");
+ put("河池市", "451200");
+ put("来宾市", "451300");
+ put("崇左市", "451400");
+ put("海口市", "460100");
+ put("三亚市", "460200");
+ put("三沙市", "460300");
+ put("儋州市", "460400");
+ put("成都市", "510100");
+ put("自贡市", "510300");
+ put("攀枝花市", "510400");
+ put("泸州市", "510500");
+ put("德阳市", "510600");
+ put("绵阳市", "510700");
+ put("广元市", "510800");
+ put("遂宁市", "510900");
+ put("内江市", "511000");
+ put("乐山市", "511100");
+ put("南充市", "511300");
+ put("眉山市", "511400");
+ put("宜宾市", "511500");
+ put("广安市", "511600");
+ put("达州市", "511700");
+ put("雅安市", "511800");
+ put("巴中市", "511900");
+ put("资阳市", "512000");
+ put("阿坝藏族羌族自治州", "513200");
+ put("甘孜藏族自治州", "513300");
+ put("凉山彝族自治州", "513400");
+ put("贵阳市", "520100");
+ put("六盘水市", "520200");
+ put("遵义市", "520300");
+ put("安顺市", "520400");
+ put("毕节市", "520500");
+ put("铜仁市", "520600");
+ put("黔西南布依族苗族自治州", "522300");
+ put("黔东南苗族侗族自治州", "522600");
+ put("黔南布依族苗族自治州", "522700");
+ put("昆明市", "530100");
+ put("曲靖市", "530300");
+ put("玉溪市", "530400");
+ put("保山市", "530500");
+ put("昭通市", "530600");
+ put("丽江市", "530700");
+ put("普洱市", "530800");
+ put("临沧市", "530900");
+ put("楚雄彝族自治州", "532300");
+ put("红河哈尼族彝族自治州", "532500");
+ put("文山壮族苗族自治州", "532600");
+ put("西双版纳傣族自治州", "532800");
+ put("大理白族自治州", "532900");
+ put("德宏傣族景颇族自治州", "533100");
+ put("怒江傈僳族自治州", "533300");
+ put("迪庆藏族自治州", "533400");
+ put("拉萨市", "540100");
+ put("日喀则市", "540200");
+ put("昌都市", "540300");
+ put("林芝市", "540400");
+ put("山南市", "540500");
+ put("那曲市", "540600");
+ put("阿里地区", "542500");
+ put("西安市", "610100");
+ put("铜川市", "610200");
+ put("宝鸡市", "610300");
+ put("咸阳市", "610400");
+ put("渭南市", "610500");
+ put("延安市", "610600");
+ put("汉中市", "610700");
+ put("榆林市", "610800");
+ put("安康市", "610900");
+ put("商洛市", "611000");
+ put("兰州市", "620100");
+ put("嘉峪关市", "620200");
+ put("金昌市", "620300");
+ put("白银市", "620400");
+ put("天水市", "620500");
+ put("武威市", "620600");
+ put("张掖市", "620700");
+ put("平凉市", "620800");
+ put("酒泉市", "620900");
+ put("庆阳市", "621000");
+ put("定西市", "621100");
+ put("陇南市", "621200");
+ put("临夏回族自治州", "622900");
+ put("甘南藏族自治州", "623000");
+ put("西宁市", "630100");
+ put("海东市", "630200");
+ put("海北藏族自治州", "632200");
+ put("黄南藏族自治州", "632300");
+ put("海南藏族自治州", "632500");
+ put("果洛藏族自治州", "632600");
+ put("玉树藏族自治州", "632700");
+ put("海西蒙古族藏族自治州", "632800");
+ put("银川市", "640100");
+ put("石嘴山市", "640200");
+ put("吴忠市", "640300");
+ put("固原市", "640400");
+ put("中卫市", "640500");
+ put("乌鲁木齐市", "650100");
+ put("克拉玛依市", "650200");
+ put("吐鲁番市", "650400");
+ put("哈密市", "650500");
+ put("昌吉回族自治州", "652300");
+ put("博尔塔拉蒙古自治州", "652700");
+ put("巴音郭楞蒙古自治州", "652800");
+ put("阿克苏地区", "652900");
+ put("克孜勒苏柯尔克孜自治州", "653000");
+ put("喀什地区", "653100");
+ put("和田地区", "653200");
+ put("伊犁哈萨克自治州", "654000");
+ put("塔城地区", "654200");
+ put("阿勒泰地区", "654300");
+ }
+ };
+}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/geo/maxmind/MaxmindGeoLocationServiceImpl.java b/eiam-common/src/main/java/cn/topiam/employee/common/geo/maxmind/MaxmindGeoLocationServiceImpl.java
index 9102638d..53978e1a 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/geo/maxmind/MaxmindGeoLocationServiceImpl.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/geo/maxmind/MaxmindGeoLocationServiceImpl.java
@@ -34,6 +34,7 @@ import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.ResourceAccessException;
@@ -54,6 +55,8 @@ import lombok.extern.slf4j.Slf4j;
import dev.failsafe.Failsafe;
import dev.failsafe.RetryPolicy;
+import static cn.topiam.employee.common.geo.District.CITY_DISTRICT;
+import static cn.topiam.employee.common.geo.District.PROVINCE_DISTRICT;
import static cn.topiam.employee.common.geo.maxmind.enums.GeoLocationProvider.MAXMIND;
/**
@@ -116,9 +119,9 @@ public class MaxmindGeoLocationServiceImpl implements GeoLocationService {
.setCountryName(country.getName())
.setCountryCode(country.getGeoNameId().toString())
.setCityName(city.getName())
- .setCityCode(String.valueOf(city.getGeoNameId()))
+ .setCityCode(StringUtils.defaultString(CITY_DISTRICT.get(city.getName()), String.valueOf(city.getGeoNameId())))
.setProvinceName(subdivision.getName())
- .setProvinceCode(subdivision.getIsoCode())
+ .setProvinceCode(StringUtils.defaultString(PROVINCE_DISTRICT.get(subdivision.getName()), subdivision.getIsoCode()))
.setLongitude(location.getLongitude())
.setLatitude(location.getLatitude())
.setProvider(MAXMIND);
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/geo/maxmind/MaxmindProviderConfig.java b/eiam-common/src/main/java/cn/topiam/employee/common/geo/maxmind/MaxmindProviderConfig.java
index 94e2eb0b..59f95d2c 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/geo/maxmind/MaxmindProviderConfig.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/geo/maxmind/MaxmindProviderConfig.java
@@ -19,6 +19,7 @@ package cn.topiam.employee.common.geo.maxmind;
import javax.validation.constraints.NotEmpty;
+import cn.topiam.employee.common.crypto.Encrypt;
import cn.topiam.employee.common.geo.GeoLocationProviderConfig;
import lombok.Data;
@@ -35,6 +36,7 @@ public class MaxmindProviderConfig extends GeoLocationProviderConfig.GeoLocation
/**
* 密码
*/
+ @Encrypt
@NotEmpty(message = "密码不能为空")
private String sessionKey;
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/message/mail/MailProviderConfig.java b/eiam-common/src/main/java/cn/topiam/employee/common/message/mail/MailProviderConfig.java
index 6a5aacd5..20c2abf5 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/message/mail/MailProviderConfig.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/message/mail/MailProviderConfig.java
@@ -20,9 +20,9 @@ package cn.topiam.employee.common.message.mail;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
+import cn.topiam.employee.common.crypto.EncryptContextHelp;
import cn.topiam.employee.common.message.enums.MailProvider;
import cn.topiam.employee.common.message.enums.MailSafetyType;
-import cn.topiam.employee.support.util.AesUtils;
import lombok.Builder;
import lombok.Data;
@@ -86,6 +86,6 @@ public class MailProviderConfig {
private String secret;
public String getDecryptSecret() {
- return AesUtils.decrypt(this.secret);
+ return EncryptContextHelp.decrypt(this.secret);
}
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/message/sms/aliyun/AliyunSmsProviderConfig.java b/eiam-common/src/main/java/cn/topiam/employee/common/message/sms/aliyun/AliyunSmsProviderConfig.java
index 23bfcf3e..9ccb84f9 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/message/sms/aliyun/AliyunSmsProviderConfig.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/message/sms/aliyun/AliyunSmsProviderConfig.java
@@ -19,6 +19,7 @@ package cn.topiam.employee.common.message.sms.aliyun;
import javax.validation.constraints.NotEmpty;
+import cn.topiam.employee.common.crypto.Encrypt;
import cn.topiam.employee.common.message.sms.SmsProviderConfig;
import lombok.Data;
@@ -45,6 +46,7 @@ public class AliyunSmsProviderConfig extends SmsProviderConfig {
/**
* accessKeySecret
*/
+ @Encrypt
@NotEmpty(message = "accessKeySecret不能为空")
private String accessKeySecret;
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/message/sms/qiniu/QiNiuSmsProviderConfig.java b/eiam-common/src/main/java/cn/topiam/employee/common/message/sms/qiniu/QiNiuSmsProviderConfig.java
index 1f21e672..05e52295 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/message/sms/qiniu/QiNiuSmsProviderConfig.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/message/sms/qiniu/QiNiuSmsProviderConfig.java
@@ -19,6 +19,7 @@ package cn.topiam.employee.common.message.sms.qiniu;
import javax.validation.constraints.NotEmpty;
+import cn.topiam.employee.common.crypto.Encrypt;
import cn.topiam.employee.common.message.sms.SmsProviderConfig;
import lombok.Data;
@@ -44,6 +45,7 @@ public class QiNiuSmsProviderConfig extends SmsProviderConfig {
/**
* secretKey
*/
+ @Encrypt
@NotEmpty(message = "secretKey不能为空")
private String secretKey;
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/message/sms/tencent/TencentSmsProviderConfig.java b/eiam-common/src/main/java/cn/topiam/employee/common/message/sms/tencent/TencentSmsProviderConfig.java
index e67e8f66..208372e3 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/message/sms/tencent/TencentSmsProviderConfig.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/message/sms/tencent/TencentSmsProviderConfig.java
@@ -19,6 +19,7 @@ package cn.topiam.employee.common.message.sms.tencent;
import javax.validation.constraints.NotEmpty;
+import cn.topiam.employee.common.crypto.Encrypt;
import cn.topiam.employee.common.message.sms.SmsProviderConfig;
import lombok.Data;
@@ -45,6 +46,7 @@ public class TencentSmsProviderConfig extends SmsProviderConfig {
/**
* secretKey
*/
+ @Encrypt
@NotEmpty(message = "SecretKey不能为空")
private String secretKey;
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/message/sms/tencent/TencentSmsProviderSend.java b/eiam-common/src/main/java/cn/topiam/employee/common/message/sms/tencent/TencentSmsProviderSend.java
index 85036b92..105822d5 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/message/sms/tencent/TencentSmsProviderSend.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/message/sms/tencent/TencentSmsProviderSend.java
@@ -89,9 +89,7 @@ public class TencentSmsProviderSend implements SmsProviderSend {
/* 模板参数: 模板参数的个数需要与 TemplateId 对应模板的变量个数保持一致,若无模板参数,则设置为空 */
Map parameters = sendSmsParam.getParameters();
List templateParamList = new ArrayList<>();
- parameters.forEach((key, value) -> {
- templateParamList.add(value);
- });
+ parameters.forEach((key, value) -> templateParamList.add(value));
req.setTemplateParamSet(templateParamList.toArray(new String[0]));
/* 下发手机号码,采用 E.164 标准,+[国家或地区码][手机号]
* 示例如:+8613711112222, 其中前面有一个+号 ,86为国家码,13711112222为手机号,最多不要超过200个手机号 */
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/OrganizationMemberRepository.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/OrganizationMemberRepository.java
index 4e6e2f43..5bcfa77b 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/OrganizationMemberRepository.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/OrganizationMemberRepository.java
@@ -19,7 +19,6 @@ package cn.topiam.employee.common.repository.account;
import java.util.List;
-import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
@@ -28,6 +27,8 @@ import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import cn.topiam.employee.common.entity.account.OrganizationMemberEntity;
+import cn.topiam.employee.support.repository.LogicDeleteRepository;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
/**
* 组织机构成员
@@ -36,7 +37,8 @@ import cn.topiam.employee.common.entity.account.OrganizationMemberEntity;
* Created by support@topiam.cn on 2021/11/30 03:06
*/
@Repository
-public interface OrganizationMemberRepository extends JpaRepository,
+public interface OrganizationMemberRepository extends
+ LogicDeleteRepository,
QuerydslPredicateExecutor,
OrganizationMemberCustomizedRepository {
@@ -46,7 +48,10 @@ public interface OrganizationMemberRepository extends JpaRepository userIds);
/**
@@ -72,6 +79,8 @@ public interface OrganizationMemberRepository extends JpaRepository
@@ -44,8 +44,7 @@ import cn.topiam.employee.common.enums.DataOrigin;
* Created by support@topiam.cn on 2020-08-09
*/
@Repository
-public interface OrganizationRepository extends CrudRepository,
- PagingAndSortingRepository,
+public interface OrganizationRepository extends LogicDeleteRepository,
JpaSpecificationExecutor,
QuerydslPredicateExecutor,
OrganizationRepositoryCustomized {
@@ -197,4 +196,13 @@ public interface OrganizationRepository extends CrudRepository findByIdInOrderByOrderAsc(Collection parentIds);
+ /**
+ * findByIdContainsDeleted
+ *
+ * @param id must not be {@literal null}.
+ * @return {@link OrganizationEntity}
+ */
+ @NotNull
+ @Query(value = "SELECT * FROM organization WHERE id_ = :id", nativeQuery = true)
+ Optional findByIdContainsDeleted(@NotNull @Param(value = "id") String id);
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/UserDetailRepository.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/UserDetailRepository.java
index d1883241..a2528190 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/UserDetailRepository.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/UserDetailRepository.java
@@ -23,12 +23,13 @@ import java.util.Optional;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
-import org.springframework.data.repository.CrudRepository;
-import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
import cn.topiam.employee.common.entity.account.UserDetailEntity;
+import cn.topiam.employee.support.repository.LogicDeleteRepository;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_HQL_SET;
/**
*
@@ -39,8 +40,7 @@ import cn.topiam.employee.common.entity.account.UserDetailEntity;
* Created by support@topiam.cn on 2020-08-07
*/
@Repository
-public interface UserDetailRepository extends PagingAndSortingRepository,
- CrudRepository,
+public interface UserDetailRepository extends LogicDeleteRepository,
QuerydslPredicateExecutor,
UserDetailRepositoryCustomized {
/**
@@ -56,16 +56,21 @@ public interface UserDetailRepository extends PagingAndSortingRepository userIds);
+ @Transactional(rollbackFor = Exception.class)
+ @Query(value = "UPDATE UserDetailEntity SET " + SOFT_DELETE_HQL_SET
+ + " WHERE userId IN (:userIds)")
+ void deleteAllByUserIds(@Param("userIds") Iterable userIds);
/**
* 根据用户ID查询用户详情
@@ -73,7 +78,5 @@ public interface UserDetailRepository extends PagingAndSortingRepository findAllByUserIds(@Param("userIds") Iterable userIds);
+ List findAllByUserIdIn(List userIds);
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/UserGroupMemberRepository.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/UserGroupMemberRepository.java
index 3391b807..56b94296 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/UserGroupMemberRepository.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/UserGroupMemberRepository.java
@@ -19,7 +19,6 @@ package cn.topiam.employee.common.repository.account;
import java.util.List;
-import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
@@ -28,6 +27,8 @@ import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import cn.topiam.employee.common.entity.account.UserGroupMemberEntity;
+import cn.topiam.employee.support.repository.LogicDeleteRepository;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
/**
* 用户组成员
@@ -36,7 +37,8 @@ import cn.topiam.employee.common.entity.account.UserGroupMemberEntity;
* Created by support@topiam.cn on 2021/11/30 03:04
*/
@Repository
-public interface UserGroupMemberRepository extends JpaRepository,
+public interface UserGroupMemberRepository extends
+ LogicDeleteRepository,
QuerydslPredicateExecutor,
UserGroupMemberRepositoryCustomized {
@@ -46,7 +48,10 @@ public interface UserGroupMemberRepository extends JpaRepository userIds);
/**
@@ -73,6 +80,8 @@ public interface UserGroupMemberRepository extends JpaRepository
@@ -33,8 +37,16 @@ import cn.topiam.employee.common.entity.account.UserGroupEntity;
* Created by support@topiam.cn on 2020-07-31
*/
@Repository
-public interface UserGroupRepository extends CrudRepository,
- PagingAndSortingRepository,
+public interface UserGroupRepository extends LogicDeleteRepository,
QuerydslPredicateExecutor {
+ /**
+ * findByIdContainsDeleted
+ *
+ * @param id must not be {@literal null}.
+ * @return {@link UserGroupEntity}
+ */
+ @NotNull
+ @Query(value = "SELECT * FROM user_group WHERE id_ = :id", nativeQuery = true)
+ Optional findByIdContainsDeleted(@NotNull @Param(value = "id") Long id);
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/UserHistoryPasswordRepository.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/UserHistoryPasswordRepository.java
index def209b6..27e656c7 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/UserHistoryPasswordRepository.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/UserHistoryPasswordRepository.java
@@ -20,11 +20,10 @@ package cn.topiam.employee.common.repository.account;
import java.util.List;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
-import org.springframework.data.repository.CrudRepository;
-import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;
import cn.topiam.employee.common.entity.account.UserHistoryPasswordEntity;
+import cn.topiam.employee.support.repository.LogicDeleteRepository;
/**
*
@@ -36,8 +35,7 @@ import cn.topiam.employee.common.entity.account.UserHistoryPasswordEntity;
*/
@Repository
public interface UserHistoryPasswordRepository extends
- CrudRepository,
- PagingAndSortingRepository,
+ LogicDeleteRepository,
QuerydslPredicateExecutor {
/**
* 根据用户ID查询历史密码
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/UserIdpRepository.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/UserIdpRepository.java
index 645ddba9..a966587a 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/UserIdpRepository.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/UserIdpRepository.java
@@ -18,10 +18,10 @@
package cn.topiam.employee.common.repository.account;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
-import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import cn.topiam.employee.common.entity.account.UserIdpBindEntity;
+import cn.topiam.employee.support.repository.LogicDeleteRepository;
/**
* 用户身份绑定表
@@ -30,7 +30,7 @@ import cn.topiam.employee.common.entity.account.UserIdpBindEntity;
* Created by support@topiam.cn on 2022/4/3 22:18
*/
@Repository
-public interface UserIdpRepository extends CrudRepository,
+public interface UserIdpRepository extends LogicDeleteRepository,
QuerydslPredicateExecutor,
UserIdpRepositoryCustomized {
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/UserRepository.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/UserRepository.java
index 1b5f9e82..f18c424b 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/UserRepository.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/UserRepository.java
@@ -29,8 +29,6 @@ import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
-import org.springframework.data.repository.CrudRepository;
-import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
@@ -38,7 +36,9 @@ import org.springframework.transaction.annotation.Transactional;
import cn.topiam.employee.common.entity.account.UserEntity;
import cn.topiam.employee.common.enums.DataOrigin;
import cn.topiam.employee.common.enums.UserStatus;
+import cn.topiam.employee.support.repository.LogicDeleteRepository;
import static cn.topiam.employee.common.constants.AccountConstants.USER_CACHE_NAME;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_WHERE;
/**
*
@@ -50,8 +50,7 @@ import static cn.topiam.employee.common.constants.AccountConstants.USER_CACHE_NA
*/
@Repository
@CacheConfig(cacheNames = { USER_CACHE_NAME })
-public interface UserRepository extends CrudRepository,
- PagingAndSortingRepository,
+public interface UserRepository extends LogicDeleteRepository,
QuerydslPredicateExecutor, UserRepositoryCustomized {
/**
* findById
@@ -62,7 +61,18 @@ public interface UserRepository extends CrudRepository,
@NotNull
@Override
@Cacheable(key = "#p0", unless = "#result==null")
- Optional findById(@NotNull Long id);
+ Optional findById(@NotNull @Param(value = "id") Long id);
+
+ /**
+ * findByIdContainsDeleted
+ *
+ * @param id must not be {@literal null}.
+ * @return {@link UserEntity}
+ */
+ @NotNull
+ @Cacheable(key = "#p0", unless = "#result==null")
+ @Query(value = "SELECT * FROM user WHERE id_ = :id", nativeQuery = true)
+ Optional findByIdContainsDeleted(@NotNull @Param(value = "id") Long id);
/**
* findById
@@ -195,7 +205,8 @@ public interface UserRepository extends CrudRepository,
* @param expireWarnDays {@link Integer} 即将到期日期
* @return {@link UserEntity}
*/
- @Query(value = "SELECT * FROM `user` WHERE DATE_ADD(DATE_FORMAT(last_update_password_time,'%Y-%m-%d'), INTERVAL :expireWarnDays DAY ) <= CURDATE() and user.status_ != 'locked'", nativeQuery = true)
+ @Query(value = "SELECT * FROM `user` WHERE DATE_ADD(DATE_FORMAT(last_update_password_time,'%Y-%m-%d'), INTERVAL :expireWarnDays DAY ) <= CURDATE() and user.status_ != 'locked' AND "
+ + SOFT_DELETE_WHERE, nativeQuery = true)
List findPasswordExpireWarnUser(@Param(value = "expireWarnDays") Integer expireWarnDays);
/**
@@ -204,7 +215,8 @@ public interface UserRepository extends CrudRepository,
* @param expireDays {@link Integer} 密码过期日期
* @return {@link UserEntity}
*/
- @Query(value = "SELECT * FROM `user` WHERE DATE_ADD(DATE_FORMAT(last_update_password_time,'%Y-%m-%d'), INTERVAL :expireDays DAY ) BETWEEN DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 HOUR),'%Y-%m-%d %h') AND DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 HOUR),'%Y-%m-%d %h') and user.status_ != 'password_expired_locked'", nativeQuery = true)
+ @Query(value = "SELECT * FROM `user` WHERE DATE_ADD(DATE_FORMAT(last_update_password_time,'%Y-%m-%d'), INTERVAL :expireDays DAY ) BETWEEN DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 HOUR),'%Y-%m-%d %h') AND DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 HOUR),'%Y-%m-%d %h') AND user.status_ != 'password_expired_locked' AND "
+ + SOFT_DELETE_WHERE, nativeQuery = true)
List findPasswordExpireUser(@Param(value = "expireDays") Integer expireDays);
/**
@@ -212,7 +224,8 @@ public interface UserRepository extends CrudRepository,
*
* @return {@link UserEntity}
*/
- @Query(value = "SELECT * from `user` WHERE expire_date <= CURDATE() and status_ != 'expired_locked'", nativeQuery = true)
+ @Query(value = "SELECT * FROM `user` WHERE expire_date <= CURDATE() and status_ != 'expired_locked' AND "
+ + SOFT_DELETE_WHERE, nativeQuery = true)
List findExpireUser();
/**
@@ -230,13 +243,6 @@ public interface UserRepository extends CrudRepository,
@Param(value = "sharedSecret") String sharedSecret,
@Param(value = "totpBind") Boolean totpBind);
- /**
- * 根据第三方扩展ID 删除用户
- *
- * @param externalIds {@link List}
- */
- void deleteAllByExternalIdIn(Collection externalIds);
-
/**
* 根据用户名查询全部
*
@@ -268,4 +274,17 @@ public interface UserRepository extends CrudRepository,
* @return {@link List}
*/
List findAllByIdNotInAndDataOrigin(Collection ids, DataOrigin dataOrigin);
+
+ /**
+ * 更新认证成功信息
+ *
+ * @param id {@link String}
+ * @param ip {@link String}
+ * @param loginTime {@link LocalDateTime}
+ */
+ @CacheEvict(allEntries = true)
+ @Transactional(rollbackFor = Exception.class)
+ @Modifying
+ @Query(value = "UPDATE user SET auth_total = (IFNULL(auth_total,0) +1),last_auth_ip = ?2,last_auth_time = ?3 WHERE id_ = ?1", nativeQuery = true)
+ void updateAuthSucceedInfo(String id, String ip, LocalDateTime loginTime);
}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/UserRepositoryCustomized.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/UserRepositoryCustomized.java
index 67769df8..c3385255 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/UserRepositoryCustomized.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/UserRepositoryCustomized.java
@@ -44,7 +44,7 @@ public interface UserRepositoryCustomized {
Page getUserList(UserListQuery query, Pageable pageable);
/**
- * 获取用户组成员列表
+ * 获取用户组不存在成员列表
*
* @param query {@link UserListNotInGroupQuery}
* @param pageable {@link Pageable}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/impl/UserGroupMemberRepositoryCustomizedImpl.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/impl/UserGroupMemberRepositoryCustomizedImpl.java
index 7227a360..c7dd7d38 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/impl/UserGroupMemberRepositoryCustomizedImpl.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/impl/UserGroupMemberRepositoryCustomizedImpl.java
@@ -83,12 +83,13 @@ public class UserGroupMemberRepositoryCustomizedImpl implements
group_concat( organization_.display_path ) AS org_display_path
FROM
user_group_member ugm
- INNER JOIN user u ON ugm.user_id = u.id_
- INNER JOIN user_group ug ON ug.id_ = ugm.group_id
- LEFT JOIN organization_member ON ( u.id_ = organization_member.user_id )
- LEFT JOIN organization organization_ ON ( organization_.id_ = organization_member.org_id )
+ INNER JOIN user u ON ugm.user_id = u.id_ AND u.is_deleted = '0'
+ INNER JOIN user_group ug ON ug.id_ = ugm.group_id AND ug.is_deleted = '0'
+ LEFT JOIN organization_member ON ( u.id_ = organization_member.user_id AND organization_member.is_deleted = '0')
+ LEFT JOIN organization organization_ ON ( organization_.id_ = organization_member.org_id AND organization_.is_deleted = '0')
WHERE
- ugm.group_id = '%s'
+ ugm.is_deleted = '0'
+ AND ugm.group_id = '%s'
AND ug.id_ = '%s'
""".formatted(query.getId(), query.getId()));
//用户名
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/impl/UserIdpRepositoryCustomizedImpl.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/impl/UserIdpRepositoryCustomizedImpl.java
index 12f6d539..36f979e8 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/impl/UserIdpRepositoryCustomizedImpl.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/impl/UserIdpRepositoryCustomizedImpl.java
@@ -22,6 +22,7 @@ import java.util.Optional;
import org.apache.commons.lang3.StringUtils;
import org.springframework.cache.annotation.CacheConfig;
+import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
@@ -54,7 +55,7 @@ public class UserIdpRepositoryCustomizedImpl implements UserIdpRepositoryCustomi
@Override
public Optional findByIdpIdAndOpenId(String idpId, String openId) {
//@formatter:off
- StringBuilder builder = new StringBuilder("SELECT uidp.*,`user`.username_,idp.name_ as idp_name FROM user_idp_bind uidp LEFT JOIN `user` ON uidp.user_id = `user`.id_ LEFT JOIN identity_provider idp ON uidp.idp_id = idp.id_ WHERE 1=1");
+ StringBuilder builder = new StringBuilder("SELECT uidp.*,`user`.username_,idp.name_ as idp_name FROM user_idp_bind uidp LEFT JOIN `user` ON uidp.user_id = `user`.id_ AND `user`.is_deleted = '0' LEFT JOIN identity_provider idp ON uidp.idp_id = idp.id_ AND idp.is_deleted = '0' WHERE uidp.is_deleted = '0' ");
//身份提供商ID
if (StringUtils.isNoneBlank(idpId)) {
builder.append(" AND uidp.idp_id = '").append(idpId).append("'");
@@ -65,8 +66,13 @@ public class UserIdpRepositoryCustomizedImpl implements UserIdpRepositoryCustomi
}
//@formatter:on
String sql = builder.toString();
- UserIdpBindPo userIdpBindPo = jdbcTemplate.queryForObject(sql, new UserIdpBindPoMapper());
- return Optional.ofNullable(userIdpBindPo);
+ try {
+ UserIdpBindPo userIdpBindPo = jdbcTemplate.queryForObject(sql,
+ new UserIdpBindPoMapper());
+ return Optional.ofNullable(userIdpBindPo);
+ } catch (EmptyResultDataAccessException e) {
+ return Optional.empty();
+ }
}
/**
@@ -79,7 +85,7 @@ public class UserIdpRepositoryCustomizedImpl implements UserIdpRepositoryCustomi
@Override
public Optional findByIdpIdAndUserId(String idpId, Long userId) {
//@formatter:off
- StringBuilder builder = new StringBuilder("SELECT uidp.*,`user`.username_,idp.name_ as idp_name FROM user_idp_bind uidp LEFT JOIN `user` ON uidp.user_id = `user`.id_ LEFT JOIN identity_provider idp ON uidp.idp_id = idp.id_ WHERE 1=1");
+ StringBuilder builder = new StringBuilder("SELECT uidp.*,`user`.username_,idp.name_ as idp_name FROM user_idp_bind uidp LEFT JOIN `user` ON uidp.user_id = `user`.id_ AND `user`.is_deleted = '0' LEFT JOIN identity_provider idp ON uidp.idp_id = idp.id_ AND idp.is_deleted = '0' WHERE uidp.is_deleted = '0' ");
//身份提供商ID
if (StringUtils.isNoneBlank(idpId)) {
builder.append(" AND uidp.idp_id = '").append(idpId).append("'");
@@ -90,8 +96,13 @@ public class UserIdpRepositoryCustomizedImpl implements UserIdpRepositoryCustomi
}
//@formatter:on
String sql = builder.toString();
- UserIdpBindPo userIdpBindPo = jdbcTemplate.queryForObject(sql, new UserIdpBindPoMapper());
- return Optional.ofNullable(userIdpBindPo);
+ try {
+ UserIdpBindPo userIdpBindPo = jdbcTemplate.queryForObject(sql,
+ new UserIdpBindPoMapper());
+ return Optional.ofNullable(userIdpBindPo);
+ } catch (EmptyResultDataAccessException e) {
+ return Optional.empty();
+ }
}
/**
@@ -103,7 +114,7 @@ public class UserIdpRepositoryCustomizedImpl implements UserIdpRepositoryCustomi
@Override
public Iterable getUserIdpBindList(Long userId) {
//@formatter:off
- StringBuilder builder = new StringBuilder("SELECT uidp.*,idp.name_ as idp_name FROM user_idp_bind uidp LEFT JOIN identity_provider idp ON uidp.idp_id = idp.id_ WHERE 1=1");
+ StringBuilder builder = new StringBuilder("SELECT uidp.*,idp.name_ as idp_name FROM user_idp_bind uidp LEFT JOIN identity_provider idp ON uidp.idp_id = idp.id_ AND idp.is_deleted = '0' WHERE uidp.is_deleted = '0' ");
//用户ID
if (Objects.nonNull(userId)) {
builder.append(" AND uidp.user_id = '").append(userId).append("'");
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/impl/UserRepositoryCustomizedImpl.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/impl/UserRepositoryCustomizedImpl.java
index 6d0e385b..763bbe77 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/impl/UserRepositoryCustomizedImpl.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/impl/UserRepositoryCustomizedImpl.java
@@ -68,7 +68,7 @@ public class UserRepositoryCustomizedImpl implements UserRepositoryCustomized {
@Override
public Page getUserList(UserListQuery query, Pageable pageable) {
//@formatter:off
- StringBuilder builder = new StringBuilder("SELECT `user`.id_, `user`.username_,`user`.password_, `user`.email_, `user`.phone_,`user`.phone_area_code, `user`.full_name ,`user`.nick_name, `user`.avatar_ , `user`.status_, `user`.data_origin, `user`.email_verified, `user`.phone_verified, `user`.shared_secret, `user`.totp_bind , `user`.auth_total, `user`.last_auth_ip, `user`.last_auth_time, `user`.expand_, `user`.external_id , `user`.expire_date,`user`.create_by, `user`.create_time, `user`.update_by , `user`.update_time, `user`.remark_, group_concat(organization_.display_path) AS org_display_path FROM `user` INNER JOIN `organization_member` ON (`user`.id_ = organization_member.user_id) INNER JOIN `organization` organization_ ON (organization_.id_ = organization_member.org_id) WHERE 1=1");
+ StringBuilder builder = new StringBuilder("SELECT `user`.id_, `user`.username_,`user`.password_, `user`.email_, `user`.phone_,`user`.phone_area_code, `user`.full_name ,`user`.nick_name, `user`.avatar_ , `user`.status_, `user`.data_origin, `user`.email_verified, `user`.phone_verified, `user`.shared_secret, `user`.totp_bind , `user`.auth_total, `user`.last_auth_ip, `user`.last_auth_time, `user`.expand_, `user`.external_id , `user`.expire_date,`user`.create_by, `user`.create_time, `user`.update_by , `user`.update_time, `user`.remark_, group_concat(organization_.display_path) AS org_display_path FROM `user` INNER JOIN `organization_member` ON (`user`.id_ = organization_member.user_id) INNER JOIN `organization` organization_ ON (organization_.id_ = organization_member.org_id) WHERE `user`.is_deleted = 0");
//组织条件
if (StringUtils.isNoneBlank(query.getOrganizationId())) {
//包含子节点
@@ -118,7 +118,7 @@ public class UserRepositoryCustomizedImpl implements UserRepositoryCustomized {
}
/**
- * 获取用户组成员列表
+ * 获取用户组不存在成员列表
*
* @param query {@link UserListNotInGroupQuery}
* @param pageable {@link Pageable}
@@ -127,48 +127,52 @@ public class UserRepositoryCustomizedImpl implements UserRepositoryCustomized {
@Override
public Page getUserListNotInGroupId(UserListNotInGroupQuery query, Pageable pageable) {
//@formatter:off
- StringBuilder builder = new StringBuilder("SELECT\n" +
- " \t`user`.id_,\n" +
- " \t`user`.username_,\n" +
- " \t`user`.password_,\n" +
- " \t`user`.email_,\n" +
- " \t`user`.phone_,\n" +
- " \t`user`.phone_area_code,\n" +
- " \t`user`.full_name,\n" +
- " \t`user`.nick_name,\n" +
- " \t`user`.avatar_,\n" +
- " \t`user`.status_,\n" +
- " \t`user`.data_origin,\n" +
- " \t`user`.email_verified,\n" +
- " \t`user`.phone_verified,\n" +
- " \t`user`.shared_secret,\n" +
- " \t`user`.totp_bind,\n" +
- " \t`user`.auth_total,\n" +
- " \t`user`.last_auth_ip,\n" +
- " \t`user`.last_auth_time,\n" +
- " \t`user`.expand_,\n" +
- " \t`user`.external_id,\n" +
- " \t`user`.expire_date,\n" +
- " \t`user`.create_by,\n" +
- " \t`user`.create_time,\n" +
- " \t`user`.update_by,\n" +
- " \t`user`.update_time,\n" +
- " \t`user`.remark_,\n" +
- " \tgroup_concat( organization_.display_path ) AS org_display_path \n" +
- " FROM\n" +
- " `user` \n" +
- " LEFT JOIN `organization_member` ON ( `user`.id_ = organization_member.user_id )\n" +
- " LEFT JOIN `organization` organization_ ON ( organization_.id_ = organization_member.org_id ) \n" +
- " WHERE\n" +
- " \tuser.id_ NOT IN (\n" +
- " \tSELECT\n" +
- " \t\tu.id_ \n" +
- " \tFROM\n" +
- " \t\tuser u\n" +
- " \t\tINNER JOIN user_group_member ugm ON ugm.user_id = u.id_\n" +
- " \t\tINNER JOIN user_group ug ON ug.id_ = ugm.group_id \n" +
- " \tWHERE\n" +
- " \tug.id_ = '%s' AND ugm.group_id = '%s')".formatted(query.getId(), query.getId()));
+ StringBuilder builder = new StringBuilder(
+ """
+ SELECT
+ `user`.id_,
+ `user`.username_,
+ `user`.password_,
+ `user`.email_,
+ `user`.phone_,
+ `user`.phone_area_code,
+ `user`.full_name,
+ `user`.nick_name,
+ `user`.avatar_,
+ `user`.status_,
+ `user`.data_origin,
+ `user`.email_verified,
+ `user`.phone_verified,
+ `user`.shared_secret,
+ `user`.totp_bind,
+ `user`.auth_total,
+ `user`.last_auth_ip,
+ `user`.last_auth_time,
+ `user`.expand_,
+ `user`.external_id,
+ `user`.expire_date,
+ `user`.create_by,
+ `user`.create_time,
+ `user`.update_by,
+ `user`.update_time,
+ `user`.remark_,
+ group_concat( organization_.display_path ) AS org_display_path
+ FROM `user`
+ LEFT JOIN `organization_member` ON ( `user`.id_ = organization_member.user_id AND organization_member.is_deleted = '0' )
+ LEFT JOIN `organization` organization_ ON ( organization_.id_ = organization_member.org_id AND organization_.is_deleted = '0' )
+ WHERE
+ user.is_deleted = 0 AND
+ user.id_ NOT IN (
+ SELECT
+ u.id_
+ FROM
+ user u
+ INNER JOIN user_group_member ugm ON ugm.user_id = u.id_
+ INNER JOIN user_group ug ON ug.id_ = ugm.group_id
+ WHERE
+ u.is_deleted = '0'
+ AND ug.id_ = '%s' AND ugm.group_id = '%s')
+ """.formatted(query.getId(), query.getId()));
if (StringUtils.isNoneBlank(query.getKeyword())) {
builder.append(" AND user.username_ LIKE '%").append(query.getKeyword()).append("%'");
builder.append(" OR user.full_name LIKE '%").append(query.getKeyword()).append("%'");
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/impl/mapper/UserIdpBindPoMapper.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/impl/mapper/UserIdpBindPoMapper.java
index d370c7ad..6e844753 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/impl/mapper/UserIdpBindPoMapper.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/account/impl/mapper/UserIdpBindPoMapper.java
@@ -25,7 +25,6 @@ import org.springframework.jdbc.core.RowMapper;
import org.springframework.lang.NonNull;
import cn.topiam.employee.common.entity.account.po.UserIdpBindPo;
-import cn.topiam.employee.common.enums.IdentityProviderType;
/**
* @author TopIAM
@@ -52,7 +51,7 @@ public class UserIdpBindPoMapper implements RowMapper {
userIdpBindPo.setUserId(rs.getLong("user_id"));
userIdpBindPo.setOpenId(rs.getString("open_id"));
userIdpBindPo.setIdpId(rs.getString("idp_id"));
- userIdpBindPo.setIdpType(IdentityProviderType.getType(rs.getString("idp_type")));
+ userIdpBindPo.setIdpType(rs.getString("idp_type"));
userIdpBindPo.setBindTime(rs.getTimestamp("bind_time").toLocalDateTime());
userIdpBindPo.setAdditionInfo(rs.getString("addition_info"));
if (isExistColumn(rs, "username_")) {
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppAccessPolicyRepository.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppAccessPolicyRepository.java
index 6232c5cf..21a0fe8a 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppAccessPolicyRepository.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppAccessPolicyRepository.java
@@ -19,12 +19,17 @@ package cn.topiam.employee.common.repository.app;
import java.util.Optional;
-import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
+import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
import cn.topiam.employee.common.entity.app.AppAccessPolicyEntity;
import cn.topiam.employee.common.enums.PolicySubjectType;
+import cn.topiam.employee.support.repository.LogicDeleteRepository;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
/**
* 应用授权策略 Repository
@@ -33,7 +38,8 @@ import cn.topiam.employee.common.enums.PolicySubjectType;
* Created by support@topiam.cn on 2022/6/4 19:54
*/
@Repository
-public interface AppAccessPolicyRepository extends JpaRepository,
+public interface AppAccessPolicyRepository extends
+ LogicDeleteRepository,
QuerydslPredicateExecutor,
AppAccessPolicyRepositoryCustomized {
/**
@@ -41,7 +47,11 @@ public interface AppAccessPolicyRepository extends JpaRepository,
+public interface AppAccountRepository extends LogicDeleteRepository,
QuerydslPredicateExecutor,
AppAccountRepositoryCustomized {
/**
@@ -78,7 +83,11 @@ public interface AppAccountRepository extends JpaRepository,
+public interface AppCertRepository extends LogicDeleteRepository,
QuerydslPredicateExecutor {
/**
* 根据应用ID查询证书
@@ -77,7 +82,11 @@ public interface AppCertRepository extends JpaRepository,
* @param appId {@link Long}
*/
@CacheEvict(allEntries = true)
- void deleteByAppId(Long appId);
+ @Modifying
+ @Transactional(rollbackFor = Exception.class)
+ @Query(value = "UPDATE app_cert SET " + SOFT_DELETE_SET
+ + " WHERE app_id = :appId", nativeQuery = true)
+ void deleteByAppId(@Param("appId") Long appId);
/**
* find by id
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppFormConfigRepository.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppFormConfigRepository.java
new file mode 100644
index 00000000..3ab1efee
--- /dev/null
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppFormConfigRepository.java
@@ -0,0 +1,85 @@
+/*
+ * eiam-common - Employee Identity and Access Management Program
+ * Copyright © 2020-2023 TopIAM (support@topiam.cn)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+package cn.topiam.employee.common.repository.app;
+
+import java.util.Optional;
+
+import org.jetbrains.annotations.NotNull;
+import org.springframework.cache.annotation.CacheConfig;
+import org.springframework.cache.annotation.CacheEvict;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.querydsl.QuerydslPredicateExecutor;
+import org.springframework.data.repository.query.Param;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+import cn.topiam.employee.common.entity.app.AppFormConfigEntity;
+import cn.topiam.employee.support.repository.LogicDeleteRepository;
+import static cn.topiam.employee.common.constants.ProtocolConstants.FORM_CONFIG_CACHE_NAME;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
+
+/**
+ * @author TopIAM
+ */
+@Repository
+@CacheConfig(cacheNames = { FORM_CONFIG_CACHE_NAME })
+public interface AppFormConfigRepository extends LogicDeleteRepository,
+ QuerydslPredicateExecutor,
+ AppFormConfigRepositoryCustomized {
+ /**
+ * 按应用 ID 删除
+ *
+ * @param appId {@link Long}
+ */
+ @CacheEvict(allEntries = true)
+ @Modifying
+ @Transactional(rollbackFor = Exception.class)
+ @Query(value = "UPDATE app_form_config SET " + SOFT_DELETE_SET
+ + " WHERE app_id = :appId", nativeQuery = true)
+ void deleteByAppId(@Param("appId") Long appId);
+
+ /**
+ * delete
+ *
+ * @param id must not be {@literal null}.
+ */
+ @CacheEvict(allEntries = true)
+ @Override
+ void deleteById(@NotNull Long id);
+
+ /**
+ * save
+ *
+ * @param entity must not be {@literal null}.
+ * @param {@link S}
+ * @return {@link AppFormConfigEntity}
+ */
+ @NotNull
+ @Override
+ @CacheEvict(allEntries = true)
+ S save(@NotNull S entity);
+
+ /**
+ * 根据应用ID获取配置
+ *
+ * @param appId {@link Long}
+ * @return {@link AppFormConfigEntity}
+ */
+ Optional findByAppId(Long appId);
+}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppFormConfigRepositoryCustomized.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppFormConfigRepositoryCustomized.java
new file mode 100644
index 00000000..27433d7a
--- /dev/null
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppFormConfigRepositoryCustomized.java
@@ -0,0 +1,50 @@
+/*
+ * eiam-common - Employee Identity and Access Management Program
+ * Copyright © 2020-2023 TopIAM (support@topiam.cn)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+package cn.topiam.employee.common.repository.app;
+
+import cn.topiam.employee.common.entity.app.po.AppFormConfigPO;
+
+/**
+ * @author TopIAM
+ * Created by support@topiam.cn on 2022/12/13 22:58
+ */
+public interface AppFormConfigRepositoryCustomized {
+ /**
+ * 根据应用ID获取
+ *
+ * @param appId {@link Long}
+ * @return {@link AppFormConfigPO}
+ */
+ AppFormConfigPO getByAppId(Long appId);
+
+ /**
+ * 根据应用 Client 获取
+ *
+ * @param clientId {@link String}
+ * @return {@link AppFormConfigPO}
+ */
+ AppFormConfigPO getByClientId(String clientId);
+
+ /**
+ * 根据应用编码查询应用配置
+ *
+ * @param appCode {@link String}
+ * @return {@link AppFormConfigPO}
+ */
+ AppFormConfigPO findByAppCode(String appCode);
+}
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppOidcConfigRepository.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppOidcConfigRepository.java
index 827d834c..e513fbf0 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppOidcConfigRepository.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppOidcConfigRepository.java
@@ -22,19 +22,24 @@ import java.util.Optional;
import org.jetbrains.annotations.NotNull;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
-import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
+import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
import cn.topiam.employee.common.entity.app.AppOidcConfigEntity;
+import cn.topiam.employee.support.repository.LogicDeleteRepository;
import static cn.topiam.employee.common.constants.ProtocolConstants.OIDC_CONFIG_CACHE_NAME;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
/**
* @author TopIAM
*/
@Repository
@CacheConfig(cacheNames = { OIDC_CONFIG_CACHE_NAME })
-public interface AppOidcConfigRepository extends JpaRepository,
+public interface AppOidcConfigRepository extends LogicDeleteRepository,
QuerydslPredicateExecutor,
AppOidcConfigRepositoryCustomized {
/**
@@ -43,7 +48,11 @@ public interface AppOidcConfigRepository extends JpaRepository,
- PagingAndSortingRepository,
+ LogicDeleteRepository,
QuerydslPredicateExecutor {
/**
* findAllByResource
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppPermissionPolicyRepository.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppPermissionPolicyRepository.java
index 4febb017..1fe46923 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppPermissionPolicyRepository.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppPermissionPolicyRepository.java
@@ -23,13 +23,13 @@ import java.util.Collection;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
-import org.springframework.data.repository.CrudRepository;
-import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import cn.topiam.employee.common.entity.app.AppPermissionPolicyEntity;
+import cn.topiam.employee.support.repository.LogicDeleteRepository;
+import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
/**
* @author TopIAM
@@ -37,29 +37,40 @@ import cn.topiam.employee.common.entity.app.AppPermissionPolicyEntity;
*/
@Repository
public interface AppPermissionPolicyRepository extends AppPermissionPolicyRepositoryCustomized,
- CrudRepository,
- PagingAndSortingRepository,
+ LogicDeleteRepository,
QuerydslPredicateExecutor {
/**
* 按主体 ID 删除所有
*
* @param subjectIds {@link String}
*/
- void deleteAllBySubjectIdIn(Collection subjectIds);
+ @Modifying
+ @Transactional(rollbackFor = Exception.class)
+ @Query(value = "UPDATE app_permission_policy SET " + SOFT_DELETE_SET
+ + " WHERE subject_id IN (:subjectIds)", nativeQuery = true)
+ void deleteAllBySubjectIdIn(@Param("subjectIds") Collection subjectIds);
/**
* 按客体 ID 删除所有
*
* @param objectIds {@link String}
*/
- void deleteAllByObjectIdIn(Collection objectIds);
+ @Modifying
+ @Transactional(rollbackFor = Exception.class)
+ @Query(value = "UPDATE app_permission_policy SET " + SOFT_DELETE_SET
+ + " WHERE object_id IN (:objectIds)", nativeQuery = true)
+ void deleteAllByObjectIdIn(@Param("objectIds") Collection objectIds);
/**
* 根据主体删除所有
*
* @param objectId
*/
- void deleteAllByObjectId(Long objectId);
+ @Modifying
+ @Transactional(rollbackFor = Exception.class)
+ @Query(value = "UPDATE app_permission_policy SET " + SOFT_DELETE_SET
+ + " WHERE object_id = :objectId", nativeQuery = true)
+ void deleteAllByObjectId(@Param("objectId") Long objectId);
/**
* 更新启用/禁用
diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppPermissionResourceRepository.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppPermissionResourceRepository.java
index 18d7ba09..2b457f42 100644
--- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppPermissionResourceRepository.java
+++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppPermissionResourceRepository.java
@@ -17,13 +17,18 @@
*/
package cn.topiam.employee.common.repository.app;
+import java.util.Optional;
+
+import org.jetbrains.annotations.NotNull;
+import org.springframework.cache.annotation.Cacheable;
+import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
-import org.springframework.data.repository.CrudRepository;
-import org.springframework.data.repository.PagingAndSortingRepository;
+import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import cn.topiam.employee.common.entity.app.AppPermissionResourceEntity;
import cn.topiam.employee.common.repository.authorization.ResourceRepositoryCustomized;
+import cn.topiam.employee.support.repository.LogicDeleteRepository;
/**
*
@@ -35,9 +40,18 @@ import cn.topiam.employee.common.repository.authorization.ResourceRepositoryCust
*/
@Repository
public interface AppPermissionResourceRepository extends
- CrudRepository,
+ LogicDeleteRepository,
ResourceRepositoryCustomized,
- PagingAndSortingRepository,
QuerydslPredicateExecutor