Skip to content

Commit

Permalink
Merge branch 'master' into fix-ext-plugin-path
Browse files Browse the repository at this point in the history
  • Loading branch information
Aias00 authored Jan 23, 2025
2 parents 9531cc0 + 65735aa commit 6eae743
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,4 +196,13 @@ public interface AppAuthMapper extends ExistProvider {
* @return list
*/
List<AppAuthVO> selectByCondition(@Param("condition") AppAuthQuery condition);


/**
* Find by namespace id list.
*
* @param namespaceIds the namespaceIds
* @return the list
*/
List<AppAuthDO> findByNamespaceIds(List<String> namespaceIds);
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@
import org.apache.shenyu.admin.mapper.DiscoveryMapper;
import org.apache.shenyu.admin.mapper.MetaDataMapper;
import org.apache.shenyu.admin.mapper.NamespaceMapper;
import org.apache.shenyu.admin.mapper.AppAuthMapper;
import org.apache.shenyu.admin.mapper.NamespacePluginRelMapper;
import org.apache.shenyu.admin.mapper.RuleMapper;
import org.apache.shenyu.admin.mapper.SelectorMapper;
import org.apache.shenyu.admin.model.dto.NamespaceDTO;
import org.apache.shenyu.admin.model.entity.AuthPathDO;
import org.apache.shenyu.admin.model.entity.AppAuthDO;
import org.apache.shenyu.admin.model.entity.DiscoveryDO;
import org.apache.shenyu.admin.model.entity.MetaDataDO;
import org.apache.shenyu.admin.model.entity.NamespaceDO;
Expand Down Expand Up @@ -80,6 +81,8 @@ public class NamespaceServiceImpl implements NamespaceService {

private final NamespacePluginRelMapper namespacePluginRelMapper;

private final AppAuthMapper appAuthMapper;


public NamespaceServiceImpl(final NamespaceMapper namespaceMapper,
final NamespaceUserService namespaceUserService,
Expand All @@ -89,7 +92,8 @@ public NamespaceServiceImpl(final NamespaceMapper namespaceMapper,
final RuleMapper ruleMapper,
final AuthPathMapper authPathMapper,
final MetaDataMapper metaDataMapper,
final DiscoveryMapper discoveryMapper) {
final DiscoveryMapper discoveryMapper,
final AppAuthMapper appAuthMapper) {
this.namespaceMapper = namespaceMapper;
this.namespaceUserService = namespaceUserService;
this.namespaceEventPublisher = namespaceEventPublisher;
Expand All @@ -99,6 +103,7 @@ public NamespaceServiceImpl(final NamespaceMapper namespaceMapper,
this.authPathMapper = authPathMapper;
this.metaDataMapper = metaDataMapper;
this.discoveryMapper = discoveryMapper;
this.appAuthMapper = appAuthMapper;
}

@Override
Expand Down Expand Up @@ -152,9 +157,9 @@ public String delete(final List<String> ids) {
if (CollectionUtils.isNotEmpty(metaDataDOList)) {
throw new ShenyuAdminException("metaData exist under those namespace!");
}
List<AuthPathDO> authPathDOList = authPathMapper.findByNamespaceIds(namespaceIdList);
if (CollectionUtils.isNotEmpty(authPathDOList)) {
throw new ShenyuAdminException("authPath exist under those namespace!");
List<AppAuthDO> appPathDOList = appAuthMapper.findByNamespaceIds(namespaceIdList);
if (CollectionUtils.isNotEmpty(appPathDOList)) {
throw new ShenyuAdminException("appPath exist under those namespace!");
}
List<DiscoveryDO> discoveryDOList = discoveryMapper.selectAllByNamespaceIds(namespaceIdList);
if (CollectionUtils.isNotEmpty(discoveryDOList)) {
Expand Down
10 changes: 10 additions & 0 deletions shenyu-admin/src/main/resources/mappers/app-auth-sqlmap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@
WHERE app_key = #{appKey, jdbcType=VARCHAR}
</select>

<select id="findByNamespaceIds" parameterType="java.lang.String" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM app_auth
WHERE namespace_id IN
<foreach item="namespaceId" collection="namespaceIds" open="(" separator="," close=")">
#{namespaceId, jdbcType=VARCHAR}
</foreach>
</select>

<select id="selectByQuery" parameterType="org.apache.shenyu.admin.model.query.AppAuthQuery" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
Expand Down

0 comments on commit 6eae743

Please sign in to comment.