opt:地图编辑设备组件接口修改

This commit is contained in:
zhangzq
2026-02-24 16:55:06 +08:00
parent 3f83b1735c
commit 2e2b36ddf8
6 changed files with 62 additions and 30 deletions

View File

@@ -12,18 +12,24 @@
*/
package org.nl.module.device.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.commons.lang3.StringUtils;
import org.nl.common.page.PageQuery;
import org.nl.common.pojo.CommonResult;
import org.nl.module.device.dto.BaseDeviceQuery;
import org.nl.module.device.entity.BaseDataDevice;
import org.nl.module.device.service.BaseDataDeviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
* 设备信息表Controller
*/
@@ -41,32 +47,8 @@ public class BaseDataDeviceController {
*/
@Operation(summary = "获取设备列表")
@GetMapping("/list")
public CommonResult list(@RequestParam(required = false) String searchKey,
@RequestParam(required = false) String region,
@RequestParam(defaultValue = "1") Integer current,
@RequestParam(defaultValue = "10") Integer size) {
LambdaQueryWrapper<BaseDataDevice> queryWrapper = new LambdaQueryWrapper<>();
// 关键词搜索(设备名称或编码)
if (StringUtils.isNotBlank(searchKey)) {
queryWrapper.and(wrapper -> wrapper
.like(BaseDataDevice::getName, searchKey)
.or()
.like(BaseDataDevice::getCode, searchKey)
);
}
// 区域搜索
if (StringUtils.isNotBlank(region)) {
queryWrapper.like(BaseDataDevice::getRegion, region);
}
// 按创建时间倒序
queryWrapper.orderByDesc(BaseDataDevice::getCreateTime);
Page<BaseDataDevice> page = new Page<>(current, size);
Page<BaseDataDevice> result = baseDataDeviceService.page(page, queryWrapper);
public CommonResult list(BaseDeviceQuery query,PageQuery page) {
Page<BaseDataDevice> result = baseDataDeviceService.page(page.build(), query.build());
return CommonResult.data(result);
}
@@ -99,4 +81,9 @@ public class BaseDataDeviceController {
baseDataDeviceService.removeById(id);
return CommonResult.ok();
}
@Operation(summary = "设备组件列表")
@GetMapping("compentList")
public CommonResult<List> compentList() {
return CommonResult.data(baseDataDeviceService.list());
}
}

View File

@@ -0,0 +1,11 @@
package org.nl.module.device.dto;
import org.nl.common.page.BaseQuery;
import org.nl.module.device.entity.BaseDataDevice;
public class BaseDeviceQuery extends BaseQuery<BaseDataDevice> {
@Override
protected Class<BaseDataDevice> getEntityClass() {
return BaseDataDevice.class;
}
}

View File

@@ -33,8 +33,16 @@ public class BaseDataDevice implements Serializable {
@Schema(description = "设备名称")
private String name;
@Schema(description = "所属区域")
private String region;
@Schema(description = "类型")
private String type;
@Schema(description = "描述")
private String description;
@Schema(description = "扩展参数")
private String editParam;
@Schema(description = "吃否启用")
private Boolean isUsed;
@Schema(description = "x坐标")
private Integer x;
@@ -51,6 +59,9 @@ public class BaseDataDevice implements Serializable {
@Schema(description = "图标地址")
private String icon;
@Schema(description = "图标路径地址")
private String path;
@Schema(description = "创建时间")
private Date createTime;