This is an automated email from the ASF dual-hosted git repository.
xiaoyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new 05febd38d [Type:fature] add new pagination scheme (#3152)
05febd38d is described below
commit 05febd38d0b3b841eee3ae4902776e1828a4613d
Author: likeguo <[email protected]>
AuthorDate: Thu Apr 14 22:45:16 2022 +0800
[Type:fature] add new pagination scheme (#3152)
* paging scheme
* Revert "paging scheme"
This reverts commit d12de7d4
* paging scheme
* paging scheme
* paging scheme
* paging scheme
* paging scheme
---
.../http/http-debug-app-auth-controller-api.http | 45 +++++++-
.../shenyu/admin/controller/AppAuthController.java | 8 +-
.../shenyu/admin/controller/PagedController.java | 65 +++++++++++
.../apache/shenyu/admin/mapper/AppAuthMapper.java | 9 ++
.../shenyu/admin/model/page/PageCondition.java | 104 +++++++++++++++++
.../{ShenyuAdminResult.java => AdminResult.java} | 128 +++++----------------
.../admin/model/result/ShenyuAdminResult.java | 96 +---------------
.../shenyu/admin/service/AppAuthService.java | 2 +-
.../apache/shenyu/admin/service/PageService.java | 69 +++++++++++
.../admin/service/impl/AppAuthServiceImpl.java | 7 +-
.../org/apache/shenyu/admin/utils/ResultUtil.java | 64 +++++++++++
.../src/main/resources/mappers/app-auth-sqlmap.xml | 14 +++
12 files changed, 412 insertions(+), 199 deletions(-)
diff --git a/shenyu-admin/src/http/http-debug-app-auth-controller-api.http
b/shenyu-admin/src/http/http-debug-app-auth-controller-api.http
index eb34ec7b2..be9a97abb 100644
--- a/shenyu-admin/src/http/http-debug-app-auth-controller-api.http
+++ b/shenyu-admin/src/http/http-debug-app-auth-controller-api.http
@@ -17,11 +17,54 @@
# if you debug api, replace your own token
+### app auth list search
+POST http://localhost:9095/appAuth/list/search
+Accept: application/json
+Content-Type: application/json
+X-Access-Token:
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyTmFtZSI6ImFkbWluIiwiZXhwIjoxNjQ4NjUwMDg2fQ.aDeChT_Ey6FwYDdzSkc9ZLBHd5v-LVUZ6BPcYqJCo-Y
+
+{
+ "pageNum": 1,
+ "pageSize": 12,
+ "condition": {
+ "appKey": "9ABE7111A59B4F9CA9A5BA5BB5973F6F"
+ }
+}
+
+### app auth list search adaptor
+POST http://localhost:9095/appAuth/list/search/adaptor
+Accept: application/json
+Content-Type: application/json
+X-Access-Token:
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyTmFtZSI6ImFkbWluIiwiZXhwIjoxNjQ4NjUwMDg2fQ.aDeChT_Ey6FwYDdzSkc9ZLBHd5v-LVUZ6BPcYqJCo-Y
+
+{
+ "pageNum": 1,
+ "pageSize": 12,
+ "condition": {
+ }
+}
+
+### updateSk
+POST http://localhost:9095/appAuth/apply
+Accept: application/json
+Content-Type: application/json
+X-Access-Token:
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyTmFtZSI6ImFkbWluIiwiZXhwIjoxNjQ4NjUwMDg2fQ.aDeChT_Ey6FwYDdzSkc9ZLBHd5v-LVUZ6BPcYqJCo-Y
+
+{
+ "appName": "appName",
+ "userId": 123,
+ "open": true,
+ "phone": "189827364",
+ "pathList": [
+ "test"
+ ]
+}
+
### updateSk
GET http://localhost:9095/appAuth/updateSk?appKey=123&appSecret=123
Accept: application/json
Content-Type: application/json
-X-Access-Token:
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyTmFtZSI6ImFkbWluIiwiZXhwIjoxNjQ2MzIyMTI4fQ.amilvuSJfMM-qt9bYsEr-Ih12NKC9aK-3mB-VUq-fdo
+X-Access-Token:
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyTmFtZSI6ImFkbWluIiwiZXhwIjoxNjQ4NjUwMDg2fQ.aDeChT_Ey6FwYDdzSkc9ZLBHd5v-LVUZ6BPcYqJCo-Y
{
"id": 123,
diff --git
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/controller/AppAuthController.java
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/controller/AppAuthController.java
index fce9f6474..5899128ad 100644
---
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/controller/AppAuthController.java
+++
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/controller/AppAuthController.java
@@ -30,6 +30,7 @@ import org.apache.shenyu.admin.model.query.AppAuthQuery;
import org.apache.shenyu.admin.model.result.ShenyuAdminResult;
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;
@@ -54,7 +55,7 @@ import java.util.List;
@Validated
@RestController
@RequestMapping("/appAuth")
-public class AppAuthController {
+public class AppAuthController implements PagedController<AppAuthQuery,
AppAuthVO> {
private final AppAuthService appAuthService;
@@ -207,4 +208,9 @@ public class AppAuthController {
public ShenyuAdminResult syncData() {
return appAuthService.syncData();
}
+
+ @Override
+ public PageService<AppAuthQuery, AppAuthVO> pageService() {
+ return appAuthService;
+ }
}
diff --git
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/controller/PagedController.java
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/controller/PagedController.java
new file mode 100644
index 000000000..bd2298357
--- /dev/null
+++
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/controller/PagedController.java
@@ -0,0 +1,65 @@
+/*
+ * 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.controller;
+
+import com.github.pagehelper.PageInfo;
+
+import org.apache.shenyu.admin.model.page.CommonPager;
+import org.apache.shenyu.admin.model.page.PageCondition;
+import org.apache.shenyu.admin.model.result.AdminResult;
+import org.apache.shenyu.admin.service.PageService;
+import org.apache.shenyu.admin.utils.ResultUtil;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+/**
+ * PagedController.
+ */
+public interface PagedController<V, T> {
+
+ /**
+ * list - paged query.
+ *
+ * @param pageCondition page condition
+ * @return PageInfo
+ */
+ @PostMapping("list/search")
+ default AdminResult<PageInfo<T>> search(@RequestBody @Validated final
PageCondition<V> pageCondition) {
+ return ResultUtil.ok(pageService().searchByPage(pageCondition));
+ }
+
+ /**
+ * list - paged query-adaptor.
+ *
+ * @param pageCondition page condition
+ * @return CommonPager
+ */
+ @PostMapping("list/search/adaptor")
+ default AdminResult<CommonPager<T>> searchAdaptor(
+ @RequestBody @Validated final PageCondition<V> pageCondition) {
+ return ResultUtil.ok(pageService().searchByPageToPager(pageCondition));
+ }
+
+ /**
+ * page service.
+ *
+ * @return paged service
+ */
+ PageService<V, T> pageService();
+}
diff --git
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/mapper/AppAuthMapper.java
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/mapper/AppAuthMapper.java
index 490672430..6d523e55d 100644
---
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/mapper/AppAuthMapper.java
+++
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/mapper/AppAuthMapper.java
@@ -21,6 +21,7 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.shenyu.admin.model.entity.AppAuthDO;
import org.apache.shenyu.admin.model.query.AppAuthQuery;
+import org.apache.shenyu.admin.model.vo.AppAuthVO;
import org.apache.shenyu.admin.validation.ExistProvider;
import java.io.Serializable;
@@ -171,4 +172,12 @@ public interface AppAuthMapper extends ExistProvider {
* @return the app auth do
*/
AppAuthDO findByAppKey(String appKey);
+
+ /**
+ * select by condition.
+ *
+ * @param condition condition.
+ * @return list
+ */
+ List<AppAuthVO> selectByCondition(@Param("condition") AppAuthQuery
condition);
}
diff --git
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/page/PageCondition.java
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/page/PageCondition.java
new file mode 100644
index 000000000..601aa1794
--- /dev/null
+++
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/page/PageCondition.java
@@ -0,0 +1,104 @@
+/*
+ * 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.model.page;
+
+import javax.validation.Valid;
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotNull;
+
+/**
+ * page condition.
+ */
+public class PageCondition<T> {
+
+ /**
+ * current page num.
+ */
+ @NotNull
+ private Integer pageNum;
+
+ /**
+ * page size.
+ */
+ @NotNull
+ @Max(value = 1000, message = "size max support is 1000")
+ @Min(value = 1, message = "size min support is 1")
+ private Integer pageSize;
+
+ /**
+ * condition.
+ */
+ @Valid
+ @NotNull
+ private T condition;
+
+ /**
+ * get page num.
+ *
+ * @return page num
+ */
+ public Integer getPageNum() {
+ return pageNum;
+ }
+
+ /**
+ * set page num.
+ *
+ * @param pageNum page num
+ */
+ public void setPageNum(final Integer pageNum) {
+ this.pageNum = pageNum;
+ }
+
+ /**
+ * get page size.
+ *
+ * @return page size
+ */
+ public Integer getPageSize() {
+ return pageSize;
+ }
+
+ /**
+ * page size.
+ *
+ * @param pageSize page size
+ */
+ public void setPageSize(final Integer pageSize) {
+ this.pageSize = pageSize;
+ }
+
+ /**
+ * get condition.
+ *
+ * @return condition
+ */
+ public T getCondition() {
+ return condition;
+ }
+
+ /**
+ * set condition.
+ *
+ * @param condition condition
+ */
+ public void setCondition(final T condition) {
+ this.condition = condition;
+ }
+}
diff --git
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/result/ShenyuAdminResult.java
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/result/AdminResult.java
similarity index 54%
copy from
shenyu-admin/src/main/java/org/apache/shenyu/admin/model/result/ShenyuAdminResult.java
copy to
shenyu-admin/src/main/java/org/apache/shenyu/admin/model/result/AdminResult.java
index ee3210827..371c0bc24 100644
---
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/result/ShenyuAdminResult.java
+++
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/result/AdminResult.java
@@ -17,32 +17,29 @@
package org.apache.shenyu.admin.model.result;
-import org.apache.shenyu.common.exception.CommonErrorCode;
-import org.springframework.http.HttpStatus;
-
import java.io.Serializable;
import java.util.Objects;
/**
- * ShenyuAdminResult.
+ * AdminResult.
*/
-public class ShenyuAdminResult implements Serializable {
-
+public class AdminResult<T> implements Serializable {
+
private static final long serialVersionUID = -2792556188993845048L;
-
+
private Integer code;
-
+
private String message;
-
- private Object data;
-
+
+ private T data;
+
/**
* Instantiates a new shenyu result.
*/
- public ShenyuAdminResult() {
-
+ public AdminResult() {
+
}
-
+
/**
* Instantiates a new shenyu result.
*
@@ -50,87 +47,13 @@ public class ShenyuAdminResult implements Serializable {
* @param message the message
* @param data the data
*/
- public ShenyuAdminResult(final Integer code, final String message, final
Object data) {
+ public AdminResult(final Integer code, final String message, final T data)
{
this.code = code;
this.message = message;
this.data = data;
}
-
- /**
- * return success.
- *
- * @return {@linkplain ShenyuAdminResult}
- */
- public static ShenyuAdminResult success() {
- return success("");
- }
-
- /**
- * return success.
- *
- * @param msg msg
- * @return {@linkplain ShenyuAdminResult}
- */
- public static ShenyuAdminResult success(final String msg) {
- return success(msg, null);
- }
-
- /**
- * return success.
- *
- * @param data this is result data.
- * @return {@linkplain ShenyuAdminResult}
- */
- public static ShenyuAdminResult success(final Object data) {
- return success(null, data);
- }
-
- /**
- * return success.
- *
- * @param msg this ext msg.
- * @param data this is result data.
- * @return {@linkplain ShenyuAdminResult}
- */
- public static ShenyuAdminResult success(final String msg, final Object
data) {
- return get(CommonErrorCode.SUCCESSFUL, msg, data);
- }
-
- /**
- * return error .
- *
- * @param msg error msg
- * @return {@linkplain ShenyuAdminResult}
- */
- public static ShenyuAdminResult error(final String msg) {
- return error(CommonErrorCode.ERROR, msg);
- }
-
- /**
- * return error .
- *
- * @param code error code
- * @param msg error msg
- * @return {@linkplain ShenyuAdminResult}
- */
- public static ShenyuAdminResult error(final int code, final String msg) {
- return get(code, msg, null);
- }
-
- /**
- * return timeout .
- *
- * @param msg error msg
- * @return {@linkplain ShenyuAdminResult}
- */
- public static ShenyuAdminResult timeout(final String msg) {
- return error(HttpStatus.REQUEST_TIMEOUT.value(), msg);
- }
-
- private static ShenyuAdminResult get(final int code, final String msg,
final Object data) {
- return new ShenyuAdminResult(code, msg, data);
- }
-
+
+
/**
* Gets the value of code.
*
@@ -139,7 +62,7 @@ public class ShenyuAdminResult implements Serializable {
public Integer getCode() {
return code;
}
-
+
/**
* Sets the code.
*
@@ -148,7 +71,7 @@ public class ShenyuAdminResult implements Serializable {
public void setCode(final Integer code) {
this.code = code;
}
-
+
/**
* Gets the value of message.
*
@@ -157,7 +80,7 @@ public class ShenyuAdminResult implements Serializable {
public String getMessage() {
return message;
}
-
+
/**
* Sets the message.
*
@@ -166,7 +89,7 @@ public class ShenyuAdminResult implements Serializable {
public void setMessage(final String message) {
this.message = message;
}
-
+
/**
* Gets the value of data.
*
@@ -175,16 +98,16 @@ public class ShenyuAdminResult implements Serializable {
public Object getData() {
return data;
}
-
+
/**
* Sets the data.
*
* @param data data
*/
- public void setData(final Object data) {
+ public void setData(final T data) {
this.data = data;
}
-
+
@Override
public String toString() {
return "ShenyuAdminResult{"
@@ -193,19 +116,20 @@ public class ShenyuAdminResult implements Serializable {
+ '\'' + ", data=" + data
+ '}';
}
-
+
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
- if (!(o instanceof ShenyuAdminResult)) {
+ if (!(o instanceof AdminResult)) {
return false;
}
- ShenyuAdminResult that = (ShenyuAdminResult) o;
+ @SuppressWarnings("all")
+ AdminResult<T> that = (AdminResult<T>) o;
return Objects.equals(code, that.code) && Objects.equals(message,
that.message) && Objects.equals(data, that.data);
}
-
+
@Override
public int hashCode() {
return Objects.hash(code, message, data);
diff --git
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/result/ShenyuAdminResult.java
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/result/ShenyuAdminResult.java
index ee3210827..3ec2d1fdc 100644
---
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/result/ShenyuAdminResult.java
+++
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/result/ShenyuAdminResult.java
@@ -21,20 +21,11 @@ import org.apache.shenyu.common.exception.CommonErrorCode;
import org.springframework.http.HttpStatus;
import java.io.Serializable;
-import java.util.Objects;
/**
* ShenyuAdminResult.
*/
-public class ShenyuAdminResult implements Serializable {
-
- private static final long serialVersionUID = -2792556188993845048L;
-
- private Integer code;
-
- private String message;
-
- private Object data;
+public class ShenyuAdminResult extends AdminResult<Object> implements
Serializable {
/**
* Instantiates a new shenyu result.
@@ -51,9 +42,7 @@ public class ShenyuAdminResult implements Serializable {
* @param data the data
*/
public ShenyuAdminResult(final Integer code, final String message, final
Object data) {
- this.code = code;
- this.message = message;
- this.data = data;
+ super(code, message, data);
}
/**
@@ -130,84 +119,5 @@ public class ShenyuAdminResult implements Serializable {
private static ShenyuAdminResult get(final int code, final String msg,
final Object data) {
return new ShenyuAdminResult(code, msg, data);
}
-
- /**
- * Gets the value of code.
- *
- * @return the value of code
- */
- public Integer getCode() {
- return code;
- }
-
- /**
- * Sets the code.
- *
- * @param code code
- */
- public void setCode(final Integer code) {
- this.code = code;
- }
-
- /**
- * Gets the value of message.
- *
- * @return the value of message
- */
- public String getMessage() {
- return message;
- }
-
- /**
- * Sets the message.
- *
- * @param message message
- */
- public void setMessage(final String message) {
- this.message = message;
- }
-
- /**
- * Gets the value of data.
- *
- * @return the value of data
- */
- public Object getData() {
- return data;
- }
-
- /**
- * Sets the data.
- *
- * @param data data
- */
- public void setData(final Object data) {
- this.data = data;
- }
-
- @Override
- public String toString() {
- return "ShenyuAdminResult{"
- + "code=" + code
- + ", message='" + message
- + '\'' + ", data=" + data
- + '}';
- }
-
- @Override
- public boolean equals(final Object o) {
- if (this == o) {
- return true;
- }
- if (!(o instanceof ShenyuAdminResult)) {
- return false;
- }
- ShenyuAdminResult that = (ShenyuAdminResult) o;
- return Objects.equals(code, that.code) && Objects.equals(message,
that.message) && Objects.equals(data, that.data);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(code, message, data);
- }
+
}
diff --git
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/AppAuthService.java
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/AppAuthService.java
index 922e5bc76..f6c20bd56 100644
---
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/AppAuthService.java
+++
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/AppAuthService.java
@@ -32,7 +32,7 @@ import java.util.List;
/**
* this is application authority service.
*/
-public interface AppAuthService {
+public interface AppAuthService extends PageService<AppAuthQuery, AppAuthVO> {
/**
diff --git
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/PageService.java
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/PageService.java
new file mode 100644
index 000000000..286d71b54
--- /dev/null
+++
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/PageService.java
@@ -0,0 +1,69 @@
+/*
+ * 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.service;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import org.apache.shenyu.admin.model.page.CommonPager;
+import org.apache.shenyu.admin.model.page.PageCondition;
+import org.apache.shenyu.admin.model.page.PageParameter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * PageService.
+ */
+public interface PageService<Q, R> {
+
+
+ /**
+ * searh by page condition.
+ *
+ * @param pageCondition page condition
+ * @return list
+ */
+ default PageInfo<R> searchByPage(final PageCondition<Q> pageCondition) {
+ PageHelper.startPage(pageCondition.getPageNum(),
pageCondition.getPageSize());
+ return new PageInfo<>(searchByCondition(pageCondition.getCondition()));
+ }
+
+
+ /**
+ * searh by page condition.
+ *
+ * @param pageCondition page condition
+ * @return list
+ */
+ default CommonPager<R> searchByPageToPager(final PageCondition<Q>
pageCondition) {
+ final PageInfo<R> pageInfo = searchByPage(pageCondition);
+ return new CommonPager<>(new PageParameter(pageCondition.getPageNum(),
pageCondition.getPageSize(), (int) pageInfo.getTotal()), pageInfo.getList());
+ }
+
+ /**
+ * search by condition.
+ *
+ * @param condition condition
+ * @return list
+ */
+ default List<R> searchByCondition(final Q condition) {
+ // default is empty list, if paged used DB query.
+ return new ArrayList<>();
+ }
+
+}
diff --git
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/AppAuthServiceImpl.java
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/AppAuthServiceImpl.java
index d1e2cf032..1a7eec635 100644
---
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/AppAuthServiceImpl.java
+++
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/AppAuthServiceImpl.java
@@ -87,7 +87,12 @@ public class AppAuthServiceImpl implements AppAuthService {
this.authParamMapper = authParamMapper;
this.authPathMapper = authPathMapper;
}
-
+
+ @Override
+ public List<AppAuthVO> searchByCondition(final AppAuthQuery condition) {
+ return appAuthMapper.selectByCondition(condition);
+ }
+
@Override
@Transactional(rollbackFor = Exception.class)
public ShenyuAdminResult applyCreate(final AuthApplyDTO authApplyDTO) {
diff --git
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/utils/ResultUtil.java
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/utils/ResultUtil.java
new file mode 100644
index 000000000..7a96d9fa3
--- /dev/null
+++ b/shenyu-admin/src/main/java/org/apache/shenyu/admin/utils/ResultUtil.java
@@ -0,0 +1,64 @@
+/*
+ * 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.utils;
+
+import org.apache.shenyu.admin.model.result.AdminResult;
+import org.apache.shenyu.common.exception.CommonErrorCode;
+
+/**
+ * ResultUtil.
+ */
+public final class ResultUtil {
+
+ private ResultUtil() {
+ }
+
+ /**
+ * ok.
+ *
+ * @param <T> response body type
+ * @return admin result
+ */
+ public static <T> AdminResult<T> ok() {
+ return ok(null);
+ }
+
+ /**
+ * ok.
+ *
+ * @param data response body
+ * @param <T> response body type
+ * @return admin result
+ */
+ public static <T> AdminResult<T> ok(final T data) {
+ return ok(data, "ok");
+ }
+
+ /**
+ * ok.
+ *
+ * @param data response body
+ * @param message response message
+ * @param <T> response body type
+ * @return admin result
+ */
+ public static <T> AdminResult<T> ok(final T data, final String message) {
+ return new AdminResult<>(CommonErrorCode.SUCCESSFUL, message, data);
+ }
+}
diff --git a/shenyu-admin/src/main/resources/mappers/app-auth-sqlmap.xml
b/shenyu-admin/src/main/resources/mappers/app-auth-sqlmap.xml
index 92bb6d614..e97e32398 100644
--- a/shenyu-admin/src/main/resources/mappers/app-auth-sqlmap.xml
+++ b/shenyu-admin/src/main/resources/mappers/app-auth-sqlmap.xml
@@ -42,6 +42,20 @@
date_updated
</sql>
+ <select id="selectByCondition"
resultType="org.apache.shenyu.admin.model.vo.AppAuthVO">
+ SELECT
+ <include refid="Base_Column_List"/>
+ FROM app_auth
+ <where>
+ <if test="condition.appKey != null and condition.appKey != ''">
+ AND app_key = #{condition.appKey, jdbcType=VARCHAR}
+ </if>
+ <if test="condition.phone != null and condition.phone != ''">
+ AND phone = #{condition.phone, jdbcType=VARCHAR}
+ </if>
+ </where>
+ </select>
+
<select id="selectById" parameterType="java.lang.String"
resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>