Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@
<amqp-client.version>5.16.0</amqp-client.version>
<clickhouse-http-client.version>0.3.2-patch11</clickhouse-http-client.version>
<eureka.version>2.0.2</eureka.version>
<servo-core.version>0.13.2</servo-core.version>
<javatuples.version>1.2</javatuples.version>
<k8s-client.version>17.0.2</k8s-client.version>
<polaris.version>1.13.0</polaris.version>
Expand Down Expand Up @@ -578,6 +579,12 @@
<version>${eureka.version}</version>
</dependency>

<dependency>
<groupId>com.netflix.servo</groupId>
<artifactId>servo-core</artifactId>
<version>${servo-core.version}</version>
</dependency>

<dependency>
<groupId>io.kubernetes</groupId>
<artifactId>client-java-spring-integration</artifactId>
Expand Down
5 changes: 5 additions & 0 deletions shenyu-admin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@
<artifactId>mybatis-spring-boot-starter</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* 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.shenyu.admin.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;

@Configuration
@EnableJpaAuditing
public class JpaConfiguration {
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import org.apache.shenyu.admin.aspect.annotation.RestApi;
import org.apache.shenyu.admin.mapper.NamespaceMapper;
import org.apache.shenyu.admin.jpa.repository.NamespaceRepository;
import org.apache.shenyu.admin.model.page.CommonPager;
import org.apache.shenyu.admin.model.page.PageParameter;
import org.apache.shenyu.admin.model.query.AlertReceiverQuery;
Expand Down Expand Up @@ -111,7 +111,7 @@ public ShenyuAdminResult getReceiverDetail(@PathVariable("id") final String id)
public ShenyuAdminResult getReceivers(@RequestParam @NotNull final Integer currentPage,
@RequestParam @NotNull final Integer pageSize,
@Valid @Existed(message = "namespaceId is not existed",
provider = NamespaceMapper.class) final String namespaceId
provider = NamespaceRepository.class) final String namespaceId
) {
CommonPager<AlertReceiverDTO> commonPager = alertReceiverService.listByPage(new AlertReceiverQuery(new PageParameter(currentPage, pageSize), namespaceId));
return ShenyuAdminResult.success(commonPager);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import org.apache.commons.lang3.StringUtils;
import org.apache.shenyu.admin.aspect.annotation.RestApi;
import org.apache.shenyu.admin.mapper.ApiMapper;
import org.apache.shenyu.admin.jpa.repository.ApiRepository;
import org.apache.shenyu.admin.model.dto.ApiDTO;
import org.apache.shenyu.admin.model.page.CommonPager;
import org.apache.shenyu.admin.model.page.PageParameter;
Expand Down Expand Up @@ -83,7 +83,7 @@ public ShenyuAdminResult queryApis(final String apiPath, final Integer state,
@GetMapping("/{id}")
public ShenyuAdminResult detailApi(@PathVariable("id")
@Existed(message = "api is not existed",
provider = ApiMapper.class) final String id) {
provider = ApiRepository.class) final String id) {
ApiVO apiVO = apiService.findById(id);
return ShenyuAdminResult.success(ShenyuResultMessage.DETAIL_SUCCESS, apiVO);
}
Expand Down Expand Up @@ -111,7 +111,7 @@ public ShenyuAdminResult createApi(@Valid @RequestBody final ApiDTO apiDTO) {
@RequiresPermissions("system:api:edit")
public ShenyuAdminResult updateApi(@PathVariable("id")
@Existed(message = "api is not existed",
provider = ApiMapper.class) final String id,
provider = ApiRepository.class) final String id,
@Valid @RequestBody final ApiDTO apiDTO) {
apiDTO.setId(id);
return ShenyuAdminResult.success(apiService.createOrUpdate(apiDTO));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

import org.apache.commons.lang3.StringUtils;
import org.apache.shenyu.admin.aspect.annotation.RestApi;
import org.apache.shenyu.admin.mapper.AppAuthMapper;
import org.apache.shenyu.admin.mapper.AuthPathMapper;
import org.apache.shenyu.admin.mapper.NamespaceMapper;
import org.apache.shenyu.admin.jpa.repository.AppAuthRepository;
import org.apache.shenyu.admin.jpa.repository.AuthPathRepository;
import org.apache.shenyu.admin.jpa.repository.NamespaceRepository;
import org.apache.shenyu.admin.model.dto.AppAuthDTO;
import org.apache.shenyu.admin.model.dto.AuthApplyDTO;
import org.apache.shenyu.admin.model.dto.AuthPathWarpDTO;
Expand All @@ -33,7 +33,6 @@
import org.apache.shenyu.admin.model.vo.AppAuthVO;
import org.apache.shenyu.admin.service.AppAuthService;
import org.apache.shenyu.admin.service.PageService;
import org.apache.shenyu.admin.service.provider.AppKeyProvider;
import org.apache.shenyu.admin.utils.ShenyuResultMessage;
import org.apache.shenyu.admin.validation.annotation.Existed;
import org.apache.shiro.authz.annotation.RequiresPermissions;
Expand Down Expand Up @@ -85,7 +84,7 @@ public ShenyuAdminResult apply(@Valid @RequestBody final AuthApplyDTO authApplyD
@GetMapping("/updateSk")
public ShenyuAdminResult updateSk(@RequestParam("appKey")
@Existed(message = "app key not existed",
provider = AppKeyProvider.class) final String appKey,
provider = AppAuthRepository.class) final String appKey,
@RequestParam("appSecret") final String appSecret) {
return appAuthService.updateAppSecretByAppKey(appKey, appSecret);
}
Expand All @@ -106,7 +105,7 @@ public ShenyuAdminResult findPageByQuery(final String appKey, final String phone
@RequestParam @NotNull(message = "currentPage not null") final Integer currentPage,
@RequestParam @NotNull(message = "pageSize not null") final Integer pageSize,
@Valid @Existed(message = "namespaceId is not existed",
provider = NamespaceMapper.class) final String namespaceId) {
provider = NamespaceRepository.class) final String namespaceId) {
AppAuthQuery query = new AppAuthQuery();
query.setPhone(phone);
query.setAppKey(appKey);
Expand All @@ -126,7 +125,7 @@ public ShenyuAdminResult findPageByQuery(final String appKey, final String phone
@RequiresPermissions("system:authen:editResourceDetails")
public ShenyuAdminResult detail(@RequestParam("id")
@Existed(message = "app key not existed",
provider = AppAuthMapper.class) final String id) {
provider = AppAuthRepository.class) final String id) {
return ShenyuAdminResult.success(ShenyuResultMessage.DETAIL_SUCCESS, appAuthService.findById(id));
}

Expand All @@ -152,8 +151,8 @@ public ShenyuAdminResult updateDetail(@RequestBody @Valid final AppAuthDTO appAu
@RequiresPermissions("system:authen:editResourceDetails")
public ShenyuAdminResult detailPath(@RequestParam("id")
@Existed(message = "auth path not existed",
providerMethodName = "existedByAuthId",
provider = AuthPathMapper.class)
providerMethodName = "existsByAuthId",
provider = AuthPathRepository.class)
@NotBlank final String authId) {
return ShenyuAdminResult.success(ShenyuResultMessage.DETAIL_SUCCESS, appAuthService.detailPath(authId));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.shenyu.admin.aspect.annotation.RestApi;
import org.apache.shenyu.admin.exception.ValidFailException;
import org.apache.shenyu.admin.mapper.DashboardUserMapper;
import org.apache.shenyu.admin.jpa.repository.DashboardUserRepository;
import org.apache.shenyu.admin.model.custom.UserInfo;
import org.apache.shenyu.admin.model.dto.DashboardUserDTO;
import org.apache.shenyu.admin.model.dto.DashboardUserModifyPasswordDTO;
Expand Down Expand Up @@ -136,7 +136,7 @@ public ShenyuAdminResult createDashboardUser(@Valid @RequestBody final Dashboard
@PutMapping("/{id}")
@RequiresPermissions("system:manager:edit")
public ShenyuAdminResult updateDashboardUser(@PathVariable("id")
@Existed(provider = DashboardUserMapper.class,
@Existed(provider = DashboardUserRepository.class,
message = "user is not found") final String id,
@Valid @RequestBody final DashboardUserDTO dashboardUserDTO) {
dashboardUserDTO.setId(id);
Expand All @@ -156,7 +156,7 @@ public ShenyuAdminResult updateDashboardUser(@PathVariable("id")
*/
@PutMapping("/modify-password/{id}")
public ShenyuAdminResult modifyPassword(@PathVariable("id")
@Existed(provider = DashboardUserMapper.class,
@Existed(provider = DashboardUserRepository.class,
message = "user is not found") final String id,
@Valid @RequestBody final DashboardUserModifyPasswordDTO dashboardUserModifyPasswordDTO) {
UserInfo userInfo = (UserInfo) SecurityUtils.getSubject().getPrincipal();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package org.apache.shenyu.admin.controller;

import org.apache.shenyu.admin.aspect.annotation.RestApi;
import org.apache.shenyu.admin.mapper.NamespaceMapper;
import org.apache.shenyu.admin.jpa.repository.NamespaceRepository;
import org.apache.shenyu.admin.model.dto.DataPermissionDTO;
import org.apache.shenyu.admin.model.page.CommonPager;
import org.apache.shenyu.admin.model.page.PageParameter;
Expand Down Expand Up @@ -68,7 +68,7 @@ public ShenyuAdminResult listPageSelectorDataPermissions(@RequestParam("currentP
@RequestParam("pluginId") final String pluginId,
@RequestParam(value = "name", required = false) final String name,
@Valid @Existed(message = "namespaceId is not existed",
provider = NamespaceMapper.class) final String namespaceId) {
provider = NamespaceRepository.class) final String namespaceId) {
CommonPager<DataPermissionPageVO> selectorList = dataPermissionService.listSelectorsByPage(
new SelectorQuery(pluginId, name, new PageParameter(currentPage, pageSize), namespaceId), userId);
return ShenyuAdminResult.success(ShenyuResultMessage.QUERY_SUCCESS, selectorList);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import org.apache.commons.collections4.CollectionUtils;
import org.apache.shenyu.admin.aspect.annotation.RestApi;
import org.apache.shenyu.admin.mapper.DiscoveryHandlerMapper;
import org.apache.shenyu.admin.jpa.repository.DiscoveryHandlerRepository;
import org.apache.shenyu.admin.model.dto.DiscoveryUpstreamDTO;
import org.apache.shenyu.admin.model.result.ShenyuAdminResult;
import org.apache.shenyu.admin.service.DiscoveryUpstreamService;
Expand Down Expand Up @@ -83,7 +83,7 @@ public ShenyuAdminResult createDiscoveryUpstreamList(@Valid @RequestBody final L
@PutMapping("/{discoveryHandlerId}")
public ShenyuAdminResult updateDiscoveryUpstream(@PathVariable("discoveryHandlerId")
@Existed(message = "discovery upstream is not existed",
provider = DiscoveryHandlerMapper.class) final String discoveryHandlerId,
provider = DiscoveryHandlerRepository.class) final String discoveryHandlerId,
@Valid @RequestBody final List<DiscoveryUpstreamDTO> discoveryUpstreamDTO) {
return ShenyuAdminResult.success(discoveryUpstreamService.updateBatch(discoveryHandlerId, discoveryUpstreamDTO));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import jakarta.validation.constraints.NotNull;
import org.apache.commons.lang3.StringUtils;
import org.apache.shenyu.admin.aspect.annotation.RestApi;
import org.apache.shenyu.admin.mapper.NamespaceMapper;
import org.apache.shenyu.admin.jpa.repository.NamespaceRepository;
import org.apache.shenyu.admin.model.dto.BatchCommonDTO;
import org.apache.shenyu.admin.model.dto.BatchNamespaceCommonDTO;
import org.apache.shenyu.admin.model.dto.MetaDataDTO;
Expand Down Expand Up @@ -69,7 +69,7 @@ public ShenyuAdminResult queryList(final String path,
@RequestParam @NotNull(message = "currentPage not null") final Integer currentPage,
@RequestParam @NotNull(message = "pageSize not null") final Integer pageSize,
@Valid @Existed(message = "namespaceId is not existed",
provider = NamespaceMapper.class) final String namespaceId) {
provider = NamespaceRepository.class) final String namespaceId) {
CommonPager<MetaDataVO> commonPager = metaDataService.listByPage(new MetaDataQuery(path, new PageParameter(currentPage, pageSize), namespaceId));
return ShenyuAdminResult.success(ShenyuResultMessage.QUERY_SUCCESS, commonPager);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package org.apache.shenyu.admin.controller;

import org.apache.shenyu.admin.aspect.annotation.RestApi;
import org.apache.shenyu.admin.mapper.MockRequestRecordMapper;
import org.apache.shenyu.admin.jpa.repository.MockRequestRecordRepository;
import org.apache.shenyu.admin.model.dto.MockRequestRecordDTO;
import org.apache.shenyu.admin.model.page.PageParameter;
import org.apache.shenyu.admin.model.query.MockRequestRecordQuery;
Expand Down Expand Up @@ -79,7 +79,7 @@ public ShenyuAdminResult batchDelete(@RequestBody @NotEmpty final List<@NotBlank
* @return {@linkplain ShenyuAdminResult}
*/
@DeleteMapping("/{id}")
public ShenyuAdminResult delete(@PathVariable @Valid @Existed(provider = MockRequestRecordMapper.class,
public ShenyuAdminResult delete(@PathVariable @Valid @Existed(provider = MockRequestRecordRepository.class,
message = " is not existed") final String id) {
return ShenyuAdminResult.success(ShenyuResultMessage.DELETE_SUCCESS, mockRequestRecordService.delete(id));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package org.apache.shenyu.admin.controller;

import org.apache.shenyu.admin.aspect.annotation.RestApi;
import org.apache.shenyu.admin.mapper.NamespaceMapper;
import org.apache.shenyu.admin.jpa.repository.NamespaceRepository;
import org.apache.shenyu.admin.model.dto.NamespaceDTO;
import org.apache.shenyu.admin.model.page.CommonPager;
import org.apache.shenyu.admin.model.page.PageParameter;
Expand Down Expand Up @@ -117,7 +117,7 @@ public ShenyuAdminResult delete(@RequestBody final List<@NotBlank String> ids) {
@RequiresPermissions("system:namespace:edit")
public ShenyuAdminResult detailPlugin(@PathVariable("id")
@Existed(message = "namespaceId is not existed",
provider = NamespaceMapper.class) final String namespaceId) {
provider = NamespaceRepository.class) final String namespaceId) {
NamespaceVO namespaceVO = namespaceService.findByNamespaceId(namespaceId);
return ShenyuAdminResult.success(ShenyuResultMessage.DETAIL_SUCCESS, namespaceVO);
}
Expand Down
Loading
Loading