Browse Source

摄像头 分页查询接口

tags/v1.2.0^2
wanghaoran 1 year ago
parent
commit
373465c25c
4 changed files with 46 additions and 2 deletions
  1. +9
    -0
      tuoheng-admin/src/main/java/com/tuoheng/admin/controller/CameraController.java
  2. +5
    -1
      tuoheng-admin/src/main/java/com/tuoheng/admin/entity/request/camera/QueryCameraListRequest.java
  3. +24
    -1
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/camera/CameraServiceImpl.java
  4. +8
    -0
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/camera/ICameraService.java

+ 9
- 0
tuoheng-admin/src/main/java/com/tuoheng/admin/controller/CameraController.java View File

@@ -30,6 +30,15 @@ public class CameraController {
return cameraService.getList(request);
}

/**
* 查询摄像头分页列表
*/
@GetMapping("/page")
public JsonResult getPage(QueryCameraListRequest request) {
return cameraService.getPage(request);
}


/**
* 获取摄像头详细信息
*/

+ 5
- 1
tuoheng-admin/src/main/java/com/tuoheng/admin/entity/request/camera/QueryCameraListRequest.java View File

@@ -1,5 +1,6 @@
package com.tuoheng.admin.entity.request.camera;

import com.tuoheng.common.common.BaseQuery;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@@ -11,11 +12,14 @@ import java.io.Serializable;
* @author: qiujinyang
*/
@Data
public class QueryCameraListRequest implements Serializable {
public class QueryCameraListRequest extends BaseQuery implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty(value = "租户Id", hidden = true)
private Integer tenantId;

@ApiModelProperty(value = "摄像头名称", hidden = true)
private String cameraName;

}

+ 24
- 1
tuoheng-admin/src/main/java/com/tuoheng/admin/service/camera/CameraServiceImpl.java View File

@@ -1,13 +1,17 @@
package com.tuoheng.admin.service.camera;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.admin.common.ServiceExceptionEnum;
import com.tuoheng.admin.entity.domain.Camera;
import com.tuoheng.admin.entity.request.camera.QueryCameraListRequest;
import com.tuoheng.admin.enums.MarkTypeEnum;
import com.tuoheng.admin.mapper.CameraMapper;
import com.tuoheng.admin.service.camera.query.QueryCameraListService;
import com.tuoheng.admin.utils.GaodeUtil;
import com.tuoheng.common.common.BaseServiceImpl;
import com.tuoheng.common.common.OperationEnum;
import com.tuoheng.common.exception.ServiceException;
import com.tuoheng.common.utils.JsonResult;
import com.tuoheng.common.utils.StringUtils;
@@ -28,6 +32,9 @@ public class CameraServiceImpl extends BaseServiceImpl<CameraMapper, Camera> imp
@Autowired
private QueryCameraListService queryCameraListService;
@Autowired
private CameraMapper cameraMapper;
/**
* 查询摄像头列表
*
@@ -79,4 +86,20 @@ public class CameraServiceImpl extends BaseServiceImpl<CameraMapper, Camera> imp
}
@Override
public JsonResult getPage(QueryCameraListRequest request) {
if (null == request.getPage() || null == request.getLimit()) {
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
}
// 获取分页数据
IPage<Camera> page = new Page<>(request.getPage(), request.getLimit());
IPage<Camera> pageData = cameraMapper.selectPage(page, new LambdaQueryWrapper<Camera>()
.eq(Camera::getMark, MarkTypeEnum.VALID.getCode())
.like(StringUtils.isNotEmpty(request.getCameraName()), Camera::getCameraName, request.getCameraName())
.orderByDesc(Camera::getCreateTime));
return JsonResult.success(pageData);
}
}

+ 8
- 0
tuoheng-admin/src/main/java/com/tuoheng/admin/service/camera/ICameraService.java View File

@@ -36,4 +36,12 @@ public interface ICameraService extends IBaseService<Camera> {
* @return
*/
JsonResult editInfo(Camera entity);
/**
* 查询摄像头分页列表
*
* @param request
* @return
*/
JsonResult getPage(QueryCameraListRequest request);
}

Loading…
Cancel
Save