api路径调整 设备列表查询

This commit is contained in:
shikong 2023-08-29 15:33:46 +08:00
parent 33ef81b99f
commit 971e9c2589
5 changed files with 94 additions and 4 deletions

View File

@ -0,0 +1,32 @@
package cn.skcks.docking.gb28181.api.info;
import cn.skcks.docking.gb28181.annotation.web.JsonMapping;
import cn.skcks.docking.gb28181.annotation.web.methods.GetJson;
import cn.skcks.docking.gb28181.common.json.JsonResponse;
import cn.skcks.docking.gb28181.config.SwaggerConfig;
import cn.skcks.docking.gb28181.orm.mybatis.dynamic.model.DockingDevice;
import cn.skcks.docking.gb28181.service.info.InfoService;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@Tag(name="详情/信息")
@RestController
@JsonMapping("/api/device/info")
@RequiredArgsConstructor
public class InfoController {
private final InfoService infoService;
@Bean
public GroupedOpenApi infoApi() {
return SwaggerConfig.api("Info", "/api/device/info");
}
@GetJson("/list")
public JsonResponse<List<DockingDevice>> list(){
return JsonResponse.success(infoService.getDeviceList());
}
}

View File

@ -18,14 +18,14 @@ import org.springframework.web.context.request.async.DeferredResult;
@Tag(name="播放")
@RestController
@JsonMapping("/device/play")
@JsonMapping("/api/device/play")
@RequiredArgsConstructor
public class PlayController {
private final PlayService playService;
@Bean
public GroupedOpenApi playApi() {
return SwaggerConfig.api("Play", "/device/play");
return SwaggerConfig.api("Play", "/api/device/play");
}
@GetJson("/realTimePlay")

View File

@ -20,14 +20,14 @@ import java.util.List;
@Tag(name="历史录像")
@RestController
@JsonMapping("/device/record")
@JsonMapping("/api/device/record")
@RequiredArgsConstructor
public class RecordController {
private final RecordService recordService;
@Bean
public GroupedOpenApi recordApi() {
return SwaggerConfig.api("Record", "/device/record");
return SwaggerConfig.api("Record", "/api/device/record");
}
@GetJson("/getInfoList")

View File

@ -0,0 +1,39 @@
package cn.skcks.docking.gb28181.common.page;
import com.github.pagehelper.PageInfo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Collection;
@AllArgsConstructor
@NoArgsConstructor
@Data
@SuppressWarnings({"unused"})
@Schema(title = "分页数据")
public class PageWrapper<T> {
@Schema(title = "数据")
private Collection<T> data;
@Schema(title = "页码")
private long page;
@Schema(title = "每页大小")
private long pageSize;
@Schema(title = "总页数")
private long pageTotal;
@Schema(title = "数据总数")
private long total;
public static <T> PageWrapper<T> of(Collection<T> data, long page, long pageSize, long pageTotal, long total) {
return new PageWrapper<>(data, page, pageSize, pageTotal, total);
}
public static <T> PageWrapper<T> of(PageInfo<T> pageInfo) {
return new PageWrapper<>(pageInfo.getList(),
pageInfo.getPageNum(),
pageInfo.getPageSize(),
pageInfo.getPages(),
pageInfo.getTotal());
}
}

View File

@ -0,0 +1,19 @@
package cn.skcks.docking.gb28181.service.info;
import cn.skcks.docking.gb28181.orm.mybatis.dynamic.mapper.DockingDeviceMapper;
import cn.skcks.docking.gb28181.orm.mybatis.dynamic.model.DockingDevice;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
@RequiredArgsConstructor
public class InfoService {
private final DockingDeviceMapper dockingDeviceMapper;
public List<DockingDevice> getDeviceList(){
// PageHelper.
return dockingDeviceMapper.select((d->d));
}
}