管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2022-10-10 bd85162c5b94b47b73717f454cf3f3c88c3ccc55
src/main/java/com/lf/server/controller/sys/BlacklistController.java
@@ -28,12 +28,13 @@
    @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) {
@@ -44,18 +45,19 @@
    @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) {
@@ -66,21 +68,22 @@
    @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) {