diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMapper.java index 4b164c94a..67f5d4bd9 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMapper.java @@ -78,6 +78,11 @@ public interface ClientMapper { @AdvanceSelect(addonWhereClause = "is_valid=1") List listChildClients(@Param("parent_client_id") int parentClientId); + @AutoSql(type = SqlType.SELECT) + @AdvanceSelect(addonWhereClause = "is_valid=1") + PageList listChildClientsByPage(@Param("parent_client_id") int parentClientId, PageBounds pageBounds); + + @AutoSql(type = SqlType.SELECT) @AdvanceSelect(addonWhereClause = "is_valid=1") List listChildClients(@Param("parent_client_id") int parentClientId, PageBounds pagination); diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java index e5ae1cf5c..917d1ffb4 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java @@ -173,6 +173,8 @@ public interface ClientManager { List listSubClients(JSONObject manager, String clientMoniker); + JSONObject listSubClientsByPage(JSONObject manager, String clientMoniker,int page); + List listSubClients(int clientId); // void newSubClient(String clientMoniker, SubClientRegistry registry, JSONObject manager); diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java index 013295833..6aed5f44d 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java @@ -2088,6 +2088,23 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid return listChildClients; } + + @Override + public JSONObject listSubClientsByPage(JSONObject manager, String clientMoniker,int page) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + checkOrgPermission(manager, client); + + PageBounds pageBounds; + pageBounds= new PageBounds(page, 5, Order.formString("create_time.desc")); + + PageList childClients = clientMapper.listChildClientsByPage(client.getIntValue("client_id"), pageBounds); + return PageListUtils.buildPageListResult(childClients); + + } + @Override @Cacheable(value = ":sub_clients:", key = "''+#clientId") public List listSubClients(int clientId) { diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java index dc7606d84..be10148f3 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java @@ -500,6 +500,11 @@ public class PartnerManageController { return clientManager.listSubClients(manager, clientMoniker); } + @ManagerMapping(value = "/{clientMoniker}/sub_clients/{page}", method = RequestMethod.GET) + public JSONObject listSubClients(@PathVariable String clientMoniker,@PathVariable int page, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + return clientManager.listSubClientsByPage(manager, clientMoniker,page); + } + //创建子商户 @ManagerMapping(value = "/{clientMoniker}/sub_clients", method = RequestMethod.POST, role = {ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.OPERATOR}) public void newSubClient(@PathVariable String clientMoniker, @RequestBody @Valid ClientRegisterInfo registery, Errors errors, diff --git a/src/main/ui/static/payment/partner/partner-manage.js b/src/main/ui/static/payment/partner/partner-manage.js index c2f5488d4..89654fcee 100644 --- a/src/main/ui/static/payment/partner/partner-manage.js +++ b/src/main/ui/static/payment/partner/partner-manage.js @@ -2421,16 +2421,19 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter } } }).result.then(function () { - $scope.loadSubClients(); + $scope.loadSubClients(1); }); }; - $scope.loadSubClients = function () { - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/sub_clients').then(function (resp) { - $scope.subPartners = resp.data; + $scope.loadSubClients = function (page) { + $scope.page = page || $scope.pagination.page || 1; + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/sub_clients/'+$scope.page).then(function (resp) { + $scope.subPartners = resp.data.data; + $scope.pagination = resp.data.pagination; }); }; - $scope.loadSubClients(); + + $scope.loadSubClients(1); $scope.loadPartnerPaymentInfo = function () { $http.get('/sys/partners/' + $scope.partner.client_moniker).then(function (resp) { diff --git a/src/main/ui/static/payment/partner/templates/sub_partners.html b/src/main/ui/static/payment/partner/templates/sub_partners.html index 5be44afaa..35a52563d 100644 --- a/src/main/ui/static/payment/partner/templates/sub_partners.html +++ b/src/main/ui/static/payment/partner/templates/sub_partners.html @@ -134,5 +134,23 @@ + - \ No newline at end of file +