| | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询记录数") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "ip", value = "IP地址", dataType = "String", paramType = "query", required = false, example = "") |
| | | @ApiImplicitParam(name = "ip", value = "IP地址", dataType = "String", paramType = "query", required = false, example = "192."), |
| | | @ApiImplicitParam(name = "type", value = "类别", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping({"/selectCount"}) |
| | | public ResponseMsg<Integer> selectCount(String ip) { |
| | | public ResponseMsg<Integer> selectCount(String ip, Integer type) { |
| | | try { |
| | | int count = blacklistService.selectCount(ip); |
| | | int count = blacklistService.selectCount(ip, type); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | |
| | | @SysLog() |
| | | @ApiOperation(value = "分页查询") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "ip", value = "IP地址", dataType = "String", paramType = "query", example = ""), |
| | | @ApiImplicitParam(name = "ip", value = "IP地址", dataType = "String", paramType = "query", example = "192."), |
| | | @ApiImplicitParam(name = "type", value = "类别", dataType = "Integer", paramType = "query", example = "1"), |
| | | @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "Integer", paramType = "query", example = "10"), |
| | | @ApiImplicitParam(name = "pageIndex", value = "分页数(从1开始)", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/selectByPage") |
| | | public ResponseMsg<List<BlacklistEntity>> selectByPage(String ip, Integer pageSize, Integer pageIndex) { |
| | | public ResponseMsg<List<BlacklistEntity>> selectByPage(String ip, Integer type, Integer pageSize, Integer pageIndex) { |
| | | try { |
| | | if (pageSize < 1 || pageIndex < 1) { |
| | | return fail("每页页数或分页数小于1", null); |
| | | } |
| | | |
| | | List<BlacklistEntity> rs = blacklistService.selectByPage(ip, pageSize, pageSize * (pageIndex - 1)); |
| | | List<BlacklistEntity> rs = blacklistService.selectByPage(ip, type, pageSize, pageSize * (pageIndex - 1)); |
| | | |
| | | return success(rs); |
| | | } catch (Exception ex) { |
| | |
| | | @SysLog() |
| | | @ApiOperation(value = "分页查询并返回记录数") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "ip", value = "IP地址", dataType = "String", paramType = "query", example = ""), |
| | | @ApiImplicitParam(name = "ip", value = "IP地址", dataType = "String", paramType = "query", required = false, example = "192."), |
| | | @ApiImplicitParam(name = "type", value = "类别", dataType = "Integer", paramType = "query", example = "1"), |
| | | @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "Integer", paramType = "query", example = "10"), |
| | | @ApiImplicitParam(name = "pageIndex", value = "分页数(从1开始)", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/selectByPageAndCount") |
| | | public ResponseMsg<List<BlacklistEntity>> selectByPageAndCount(String ip, Integer pageSize, Integer pageIndex) { |
| | | public ResponseMsg<List<BlacklistEntity>> selectByPageAndCount(String ip, Integer type, Integer pageSize, Integer pageIndex) { |
| | | try { |
| | | if (pageSize < 1 || pageIndex < 1) { |
| | | return fail("每页页数或分页数小于1", null); |
| | | } |
| | | int count = blacklistService.selectCount(ip); |
| | | int count = blacklistService.selectCount(ip, type); |
| | | if (count == 0) { |
| | | return success(0, null); |
| | | } |
| | | List<BlacklistEntity> rs = blacklistService.selectByPage(ip, pageSize, pageSize * (pageIndex - 1)); |
| | | List<BlacklistEntity> rs = blacklistService.selectByPage(ip, type, pageSize, pageSize * (pageIndex - 1)); |
| | | |
| | | return success(count, rs); |
| | | } catch (Exception ex) { |