[Rp] 子商户分页

master
liuxinxin 5 years ago
parent 44e44af0bb
commit 7d7c3d53c4

@ -78,6 +78,11 @@ public interface ClientMapper {
@AdvanceSelect(addonWhereClause = "is_valid=1") @AdvanceSelect(addonWhereClause = "is_valid=1")
List<JSONObject> listChildClients(@Param("parent_client_id") int parentClientId); List<JSONObject> listChildClients(@Param("parent_client_id") int parentClientId);
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid=1")
PageList<JSONObject> listChildClientsByPage(@Param("parent_client_id") int parentClientId, PageBounds pageBounds);
@AutoSql(type = SqlType.SELECT) @AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid=1") @AdvanceSelect(addonWhereClause = "is_valid=1")
List<JSONObject> listChildClients(@Param("parent_client_id") int parentClientId, PageBounds pagination); List<JSONObject> listChildClients(@Param("parent_client_id") int parentClientId, PageBounds pagination);

@ -173,6 +173,8 @@ public interface ClientManager {
List<JSONObject> listSubClients(JSONObject manager, String clientMoniker); List<JSONObject> listSubClients(JSONObject manager, String clientMoniker);
JSONObject listSubClientsByPage(JSONObject manager, String clientMoniker,int page);
List<JSONObject> listSubClients(int clientId); List<JSONObject> listSubClients(int clientId);
// void newSubClient(String clientMoniker, SubClientRegistry registry, JSONObject manager); // void newSubClient(String clientMoniker, SubClientRegistry registry, JSONObject manager);

@ -2088,6 +2088,23 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
return listChildClients; 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<JSONObject> childClients = clientMapper.listChildClientsByPage(client.getIntValue("client_id"), pageBounds);
return PageListUtils.buildPageListResult(childClients);
}
@Override @Override
@Cacheable(value = ":sub_clients:", key = "''+#clientId") @Cacheable(value = ":sub_clients:", key = "''+#clientId")
public List<JSONObject> listSubClients(int clientId) { public List<JSONObject> listSubClients(int clientId) {

@ -500,6 +500,11 @@ public class PartnerManageController {
return clientManager.listSubClients(manager, clientMoniker); 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}) @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, public void newSubClient(@PathVariable String clientMoniker, @RequestBody @Valid ClientRegisterInfo registery, Errors errors,

@ -2421,16 +2421,19 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
} }
} }
}).result.then(function () { }).result.then(function () {
$scope.loadSubClients(); $scope.loadSubClients(1);
}); });
}; };
$scope.loadSubClients = function () { $scope.loadSubClients = function (page) {
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/sub_clients').then(function (resp) { $scope.page = page || $scope.pagination.page || 1;
$scope.subPartners = resp.data; $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 () { $scope.loadPartnerPaymentInfo = function () {
$http.get('/sys/partners/' + $scope.partner.client_moniker).then(function (resp) { $http.get('/sys/partners/' + $scope.partner.client_moniker).then(function (resp) {

@ -134,5 +134,23 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
<div class="box-footer" ng-if="subPartners.length">
<uib-pagination class="pagination"
total-items="pagination.totalCount"
boundary-links="true"
ng-model="pagination.page"
items-per-page="pagination.limit"
max-size="10"
ng-change="loadSubClients()"
previous-text="&lsaquo;"
next-text="&rsaquo;"
first-text="&laquo;"
last-text="&raquo;"></uib-pagination>
<div class="row">
<div class="col-xs-12">
{{'select.sign.total_records'|translate}}:{{pagination.totalCount}};{{'partners.total_pages'|translate}}:{{pagination.totalPages}}
</div>
</div>
</div>
</div> </div>
</div> </div>
Loading…
Cancel
Save