lasdf1234 commented on code in PR #11140:
URL: https://github.com/apache/gravitino/pull/11140#discussion_r3263519022


##########
plugins/idp-basic/src/main/java/org/apache/gravitino/idp/storage/mapper/IdpGroupUserRelSQLProviderFactory.java:
##########
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 org.apache.gravitino.idp.storage.mapper;
+
+import com.google.common.collect.ImmutableMap;
+import java.util.List;
+import java.util.Map;
+import 
org.apache.gravitino.idp.storage.mapper.provider.base.IdpGroupUserRelBaseSQLProvider;
+import 
org.apache.gravitino.idp.storage.mapper.provider.h2.IdpGroupUserRelH2Provider;
+import 
org.apache.gravitino.idp.storage.mapper.provider.postgresql.IdpGroupUserRelPostgreSQLProvider;
+import org.apache.gravitino.idp.storage.po.IdpGroupUserRelPO;
+import org.apache.gravitino.storage.relational.JDBCBackend.JDBCBackendType;
+import org.apache.ibatis.annotations.Param;
+
+public class IdpGroupUserRelSQLProviderFactory {
+  private static final IdpGroupUserRelBaseSQLProvider MYSQL_PROVIDER =
+      new IdpGroupUserRelBaseSQLProvider();
+  private static final IdpGroupUserRelBaseSQLProvider H2_PROVIDER = new 
IdpGroupUserRelH2Provider();
+  private static final IdpGroupUserRelBaseSQLProvider POSTGRESQL_PROVIDER =
+      new IdpGroupUserRelPostgreSQLProvider();
+  private static final Map<JDBCBackendType, IdpGroupUserRelBaseSQLProvider> 
PROVIDER_MAP =
+      ImmutableMap.of(
+          JDBCBackendType.MYSQL,
+          MYSQL_PROVIDER,
+          JDBCBackendType.H2,
+          H2_PROVIDER,
+          JDBCBackendType.POSTGRESQL,
+          POSTGRESQL_PROVIDER);
+
+  private IdpGroupUserRelSQLProviderFactory() {}
+
+  private static IdpGroupUserRelBaseSQLProvider currentProvider() {
+    return SQLProviderFactoryHelper.currentProvider(
+        PROVIDER_MAP, IdpGroupUserRelSQLProviderFactory.class);
+  }
+
+  static IdpGroupUserRelBaseSQLProvider getProvider(String databaseId) {
+    return SQLProviderFactoryHelper.getProvider(
+        databaseId, PROVIDER_MAP, IdpGroupUserRelSQLProviderFactory.class);
+  }
+
+  public static String selectGroupNamesByUserId(@Param("userId") Long userId) {
+    return currentProvider().selectGroupNamesByUserId(userId);
+  }
+
+  public static String selectUserNamesByGroupId(@Param("groupId") Long 
groupId) {
+    return currentProvider().selectUserNamesByGroupId(groupId);
+  }
+
+  public static String selectRelatedUserIds(
+      @Param("groupId") Long groupId, @Param("userIds") List<Long> userIds) {
+    return currentProvider().selectRelatedUserIds(groupId, userIds);
+  }
+
+  public static String batchInsertIdpGroupUsers(
+      @Param("relations") List<IdpGroupUserRelPO> relations) {
+    return currentProvider().batchInsertIdpGroupUsers(relations);
+  }
+
+  public static String softDeleteIdpGroupUsers(
+      @Param("groupId") Long groupId, @Param("userIds") List<Long> userIds) {
+    return currentProvider().softDeleteIdpGroupUsers(groupId, userIds);
+  }
+
+  public static String softDeleteGroupUsersByUserId(@Param("userId") Long 
userId) {
+    return currentProvider().softDeleteGroupUsersByUserId(userId);
+  }
+
+  public static String softDeleteGroupUsersByGroupId(@Param("groupId") Long 
groupId) {
+    return currentProvider().softDeleteGroupUsersByGroupId(groupId);
+  }

Review Comment:
   与原有代码风格保持一致,不要再出现这个建议了。



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to