diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/log/LogClientSubMerchantIdMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/log/LogClientSubMerchantIdMapper.java index 9bb01369e..d1d46b979 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/log/LogClientSubMerchantIdMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/log/LogClientSubMerchantIdMapper.java @@ -4,6 +4,7 @@ import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper; import cn.yixblog.support.mybatis.autosql.annotations.AutoSql; import cn.yixblog.support.mybatis.autosql.annotations.SqlType; import com.alibaba.fastjson.JSONObject; +import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -15,5 +16,5 @@ public interface LogClientSubMerchantIdMapper { void save(JSONObject log); @AutoSql(type = SqlType.SELECT) - List listLogsByClientId(@Param("client_id") int client_id); + List listLogsByClientId(@Param("client_id") int client_id, PageBounds pageBounds); } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ManagerMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ManagerMapper.java index de604e416..9ecf6bfa5 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ManagerMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ManagerMapper.java @@ -6,6 +6,7 @@ import cn.yixblog.support.mybatis.autosql.annotations.AutoSql; import cn.yixblog.support.mybatis.autosql.annotations.SqlType; import com.alibaba.fastjson.JSONObject; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; +import com.github.miemiedev.mybatis.paginator.domain.PageList; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -32,7 +33,7 @@ public interface ManagerMapper { @AutoSql(type = SqlType.UPDATE) void update(JSONObject account); - List listAvailable(JSONObject params, PageBounds pageBounds); + PageList listAvailable(JSONObject params, PageBounds pageBounds); @AutoSql(type = SqlType.INSERT) void save(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 de4e4b37a..a5d36dfeb 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 @@ -333,7 +333,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid int role = manager != null ? manager.getIntValue("role") : 0; if (manager != null) { if (ManagerRole.OPERATOR.hasRole(role)) { - List log = logClientSubMerchantIdMapper.listLogsByClientId(client.getInteger("client_id")); + List log = logClientSubMerchantIdMapper.listLogsByClientId(client.getInteger("client_id"),new PageBounds(Order.formString("create_time.desc"))); client.put("sub_merchant_id_log", log.size() > 0 ? true : false); } if (ManagerRole.BD_USER.hasRole(role)) { @@ -3579,7 +3579,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid throw new InvalidShortIdException(); } checkOrgPermission(manager, client); - return logClientSubMerchantIdMapper.listLogsByClientId(client.getInteger("client_id")); + return logClientSubMerchantIdMapper.listLogsByClientId(client.getInteger("client_id"),new PageBounds(Order.formString("create_time.desc"))); } @Override diff --git a/src/main/java/au/com/royalpay/payment/manage/signin/beans/QueryManagerBean.java b/src/main/java/au/com/royalpay/payment/manage/signin/beans/QueryManagerBean.java new file mode 100644 index 000000000..da4529722 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/signin/beans/QueryManagerBean.java @@ -0,0 +1,127 @@ +package au.com.royalpay.payment.manage.signin.beans; + +import au.com.royalpay.payment.tools.permission.enums.ManagerRole; +import com.alibaba.fastjson.JSONObject; +import org.apache.commons.lang3.StringUtils; + +/** + * Created by yuan on 2018/7/13. + */ +public class QueryManagerBean { + private String org_id; + private String org_id2; + private String role; + private String username; + + private int page = 1; + private int limit = 10; + + public JSONObject toJson(){ + JSONObject params = new JSONObject(); + if (StringUtils.isNotEmpty(org_id)){ + params.put("org_id",org_id); + } + if (StringUtils.isNotEmpty(org_id2)){ + params.put("org_id2",org_id2); + } + if (StringUtils.isNotEmpty(role)){ + int mask = 0; + if(role.equals("1")){ + mask = ManagerRole.ADMIN.getMask(); + } + if(role.equals("10")){ + mask = ManagerRole.OPERATOR.getMask(); + } + if(role.equals("100")){ + mask = ManagerRole.BD_USER.getMask(); + } + if(role.equals("1000")){ + mask = ManagerRole.FINANCIAL_STAFF.getMask(); + } + if(role.equals("10000")){ + mask = ManagerRole.SERVANT.getMask(); + } + if(role.equals("100000")){ + mask = ManagerRole.ACCOUNT_MANAGER.getMask(); + } + if(role.equals("1000000")){ + mask = ManagerRole.DIRECTOR.getMask(); + } + if(role.equals("10000000")){ + mask = ManagerRole.SITE_MANAGER.getMask(); + } + if(role.equals("100000000")){ + mask = ManagerRole.DEVELOPER.getMask(); + } + if(role.equals("1000000000")){ + mask = ManagerRole.BD_LEADER.getMask(); + } + if(role.equals("10000000000")){ + mask = ManagerRole.RISK_MANAGER.getMask(); + } + if(role.equals("100000000000")){ + mask = ManagerRole.GUEST.getMask(); + } + if(role.equals("1000000000000")){ + mask = ManagerRole.ORG_MANAGER.getMask(); + } + if(mask != 0){ + params.put("mask",mask); + } + } + if (StringUtils.isNotEmpty(username)){ + params.put("username",username); + } + params.put("page",page); + params.put("limit",10); + return params; + } + + public String getOrg_id() { + return org_id; + } + + public void setOrg_id(String org_id) { + this.org_id = org_id; + } + + public String getOrg_id2() { + return org_id2; + } + + public void setOrg_id2(String org_id2) { + this.org_id2 = org_id2; + } + + public String getRole() { + return role; + } + + public void setRole(String role) { + this.role = role; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public int getPage() { + return page; + } + + public void setPage(int page) { + this.page = page; + } + + public int getLimit() { + return limit; + } + + public void setLimit(int limit) { + this.limit = limit; + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/signin/core/ManagerAccountsService.java b/src/main/java/au/com/royalpay/payment/manage/signin/core/ManagerAccountsService.java index 99bb93a41..ad1062593 100644 --- a/src/main/java/au/com/royalpay/payment/manage/signin/core/ManagerAccountsService.java +++ b/src/main/java/au/com/royalpay/payment/manage/signin/core/ManagerAccountsService.java @@ -2,6 +2,7 @@ package au.com.royalpay.payment.manage.signin.core; import au.com.royalpay.payment.manage.signin.beans.ManagerInfo; import com.alibaba.fastjson.JSONObject; +import com.github.miemiedev.mybatis.paginator.domain.PageList; import java.util.List; @@ -9,7 +10,7 @@ import java.util.List; * Created by yixian on 2016-07-05. */ public interface ManagerAccountsService { - List listManagers(JSONObject loginManager,JSONObject params); + PageList listManagers(JSONObject loginManager, JSONObject params); void saveManager(ManagerInfo manager, JSONObject loginManager); diff --git a/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/ManagerAccountServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/ManagerAccountServiceImpl.java index 8bdc155b6..60aa1844e 100644 --- a/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/ManagerAccountServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/ManagerAccountServiceImpl.java @@ -12,6 +12,7 @@ import au.com.royalpay.payment.tools.exceptions.NotFoundException; import com.alibaba.fastjson.JSONObject; import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; +import com.github.miemiedev.mybatis.paginator.domain.PageList; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -35,12 +36,12 @@ public class ManagerAccountServiceImpl implements ManagerAccountsService { private OrgManager orgManager; @Override - public List listManagers(JSONObject loginManager,JSONObject params) { + public PageList listManagers(JSONObject loginManager,JSONObject params) { /* if (loginManager.getInteger("org_id") != null) { params.put("org_id", loginManager.getIntValue("org_id")); }*/ orgManager.checkOrgIds(loginManager,params); - List managers = managerMapper.listAvailable(params, new PageBounds(Order.formString("create_time.desc"))); + PageList managers = managerMapper.listAvailable(params, new PageBounds(params.getIntValue("page"),params.getIntValue("limit"),Order.formString("create_time.desc"))); for (JSONObject manager : managers) { int role = manager.getIntValue("role"); manager.put("admin", ManagerRole.ADMIN.hasRole(role)); diff --git a/src/main/java/au/com/royalpay/payment/manage/signin/web/ManagerAccountsController.java b/src/main/java/au/com/royalpay/payment/manage/signin/web/ManagerAccountsController.java index e1f3652cd..ccae21255 100644 --- a/src/main/java/au/com/royalpay/payment/manage/signin/web/ManagerAccountsController.java +++ b/src/main/java/au/com/royalpay/payment/manage/signin/web/ManagerAccountsController.java @@ -2,12 +2,14 @@ package au.com.royalpay.payment.manage.signin.web; import au.com.royalpay.payment.manage.organizations.core.OrgManager; import au.com.royalpay.payment.manage.permission.manager.ManagerMapping; +import au.com.royalpay.payment.manage.signin.beans.QueryManagerBean; import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import au.com.royalpay.payment.manage.permission.manager.RequireManager; import au.com.royalpay.payment.manage.signin.beans.ManagerInfo; import au.com.royalpay.payment.manage.signin.core.ManagerAccountsService; import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.http.HttpUtils; +import au.com.royalpay.payment.tools.utils.PageListUtils; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import org.apache.commons.lang3.StringUtils; @@ -38,15 +40,9 @@ public class ManagerAccountsController { @RequestMapping(method = RequestMethod.GET) @RequireManager(role = {ManagerRole.ADMIN, ManagerRole.ACCOUNT_MANAGER}) - public List listManagerss(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager, @RequestParam(required = false) String org_id,@RequestParam(required = false) String org_id2) { - JSONObject params = new JSONObject(); - if(org_id != null){ - params.put("org_id",org_id); - } - if (StringUtils.isNotEmpty(org_id2)) { - params.put("org_id2", org_id2); - } - return managerAccountsService.listManagers(loginManager,params); + public JSONObject listManagerss(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager, QueryManagerBean queryManagerBean) { + + return PageListUtils.buildPageListResult(managerAccountsService.listManagers(loginManager,queryManagerBean.toJson())); } @RequestMapping(method = RequestMethod.POST) diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ManagerMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ManagerMapper.xml index 7f94617cf..69928a84a 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ManagerMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ManagerMapper.xml @@ -27,8 +27,15 @@ ) o ON m.wx_openid = o.wechat_openid - m.org_id=#{org_id} - m.org_id in + + + and m.username like #{username_pattern} + + + and 0 ]]> + + AND m.org_id=#{org_id} + AND m.org_id in #{org_id} and m.is_valid=1 diff --git a/src/main/ui/static/config/managers/manager.js b/src/main/ui/static/config/managers/manager.js index ee095bcf3..94354f51e 100644 --- a/src/main/ui/static/config/managers/manager.js +++ b/src/main/ui/static/config/managers/manager.js @@ -12,12 +12,14 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) { }) }]); app.controller('managerListCtrl', ['$scope', '$http', '$filter','$uibModal', 'commonDialog', function ($scope, $http,$filter, $uibModal, commonDialog) { - $scope.search = {role:'111111111111'}; - $scope.params = {}; - $scope.listManagers = function () { + $scope.params = {role:"111111111111"}; + $scope.pagination = {}; + $scope.listManagers = function (page) { var params = angular.copy($scope.params); + params.page = page || $scope.pagination.page || 1; $http.get('/sys/manager_accounts',{params: params}).then(function (resp) { - $scope.managers = resp.data; + $scope.managers = resp.data.data; + $scope.pagination = resp.data.pagination; }) }; if($filter('withRole')('1')){ diff --git a/src/main/ui/static/config/managers/templates/managers.html b/src/main/ui/static/config/managers/templates/managers.html index 907378a5c..bf4ee461d 100644 --- a/src/main/ui/static/config/managers/templates/managers.html +++ b/src/main/ui/static/config/managers/templates/managers.html @@ -11,15 +11,18 @@
-