+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.mybatisflex.annotation;
+
+import java.lang.annotation.*;
+
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.FIELD})
+public @interface ColumnMask {
+
+ /**
+ * 脱敏方式
+ */
+ String value();
+
+
+}
\ No newline at end of file
diff --git a/mybatis-flex-core/src/main/java/com/mybatisflex/core/mask/MaskFactory.java b/mybatis-flex-core/src/main/java/com/mybatisflex/core/mask/MaskFactory.java
new file mode 100644
index 00000000..af0a527b
--- /dev/null
+++ b/mybatis-flex-core/src/main/java/com/mybatisflex/core/mask/MaskFactory.java
@@ -0,0 +1,59 @@
+/**
+ * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.mybatisflex.core.mask;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 数据脱敏工厂类
+ */
+public class MaskFactory {
+
+
+ /**
+ * 脱敏处理器
+ */
+ private static Map processerMap = new HashMap<>();
+
+
+ static {
+ registerMaskProcesser(Masks.MOBILE, Masks.MOBILE_PROCESSER);
+ registerMaskProcesser(Masks.FIXED_PHONE, Masks.FIXED_PHONE_PROCESSER);
+ registerMaskProcesser(Masks.ID_CARD_NUMBER, Masks.ID_CARD_NUMBER_PROCESSER);
+ registerMaskProcesser(Masks.CHINESE_NAME, Masks.CHINESE_NAME_PROCESSER);
+ registerMaskProcesser(Masks.ADDRESS, Masks.ADDRESS_PROCESSER);
+ registerMaskProcesser(Masks.EMAIL, Masks.EMAIL_PROCESSER);
+ registerMaskProcesser(Masks.PASSWORD, Masks.PASSWORD_PROCESSER);
+ registerMaskProcesser(Masks.CAR_LICENSE, Masks.CAR_LICENSE_PROCESSER);
+ registerMaskProcesser(Masks.BANK_CARD_NUMBER, Masks.BANK_CARD_PROCESSER);
+ }
+
+
+ public static void registerMaskProcesser(String type, MaskProcesser processer) {
+ processerMap.put(type, processer);
+ }
+
+
+ public static Object mask(String type, Object data) {
+ MaskProcesser maskProcesser = processerMap.get(type);
+ if (maskProcesser == null) {
+ throw new IllegalStateException("Can not get mask processer for by type: " + type);
+ }
+ return maskProcesser.mask(data);
+ }
+
+}
diff --git a/mybatis-flex-core/src/main/java/com/mybatisflex/core/mask/MaskProcesser.java b/mybatis-flex-core/src/main/java/com/mybatisflex/core/mask/MaskProcesser.java
new file mode 100644
index 00000000..2ab96a06
--- /dev/null
+++ b/mybatis-flex-core/src/main/java/com/mybatisflex/core/mask/MaskProcesser.java
@@ -0,0 +1,24 @@
+/**
+ * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.mybatisflex.core.mask;
+
+/**
+ * 数据脱敏处理器
+ */
+public interface MaskProcesser {
+
+ Object mask(Object data);
+}
diff --git a/mybatis-flex-core/src/main/java/com/mybatisflex/core/mask/MaskTypeHandler.java b/mybatis-flex-core/src/main/java/com/mybatisflex/core/mask/MaskTypeHandler.java
new file mode 100644
index 00000000..972c5786
--- /dev/null
+++ b/mybatis-flex-core/src/main/java/com/mybatisflex/core/mask/MaskTypeHandler.java
@@ -0,0 +1,57 @@
+/**
+ * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.mybatisflex.core.mask;
+
+import org.apache.ibatis.type.BaseTypeHandler;
+import org.apache.ibatis.type.JdbcType;
+
+import java.sql.CallableStatement;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+public class MaskTypeHandler extends BaseTypeHandler