From 2e2b36ddf8587121b453d4cc50e9bb32fe4c1cca Mon Sep 17 00:00:00 2001 From: zhangzq Date: Tue, 24 Feb 2026 16:55:06 +0800 Subject: [PATCH] =?UTF-8?q?opt:=E5=9C=B0=E5=9B=BE=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=BB=84=E4=BB=B6=E6=8E=A5=E5=8F=A3=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/BaseDataDeviceController.java | 39 +++++++------------ .../nl/module/device/dto/BaseDeviceQuery.java | 11 ++++++ .../module/device/entity/BaseDataDevice.java | 15 ++++++- nl-vue/src/views/nl_agv/layout/index.vue | 2 +- nl-vue/src/views/nl_base_data/device/form.vue | 7 ++++ .../src/views/nl_base_data/device/index.vue | 18 ++++++++- 6 files changed, 62 insertions(+), 30 deletions(-) create mode 100644 nl-base-data/src/main/java/org/nl/module/device/dto/BaseDeviceQuery.java diff --git a/nl-base-data/src/main/java/org/nl/module/device/controller/BaseDataDeviceController.java b/nl-base-data/src/main/java/org/nl/module/device/controller/BaseDataDeviceController.java index 9ca98ec..22c9e02 100644 --- a/nl-base-data/src/main/java/org/nl/module/device/controller/BaseDataDeviceController.java +++ b/nl-base-data/src/main/java/org/nl/module/device/controller/BaseDataDeviceController.java @@ -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 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 page = new Page<>(current, size); - Page result = baseDataDeviceService.page(page, queryWrapper); - + public CommonResult list(BaseDeviceQuery query,PageQuery page) { + Page 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 compentList() { + return CommonResult.data(baseDataDeviceService.list()); + } } diff --git a/nl-base-data/src/main/java/org/nl/module/device/dto/BaseDeviceQuery.java b/nl-base-data/src/main/java/org/nl/module/device/dto/BaseDeviceQuery.java new file mode 100644 index 0000000..736cc8c --- /dev/null +++ b/nl-base-data/src/main/java/org/nl/module/device/dto/BaseDeviceQuery.java @@ -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 { + @Override + protected Class getEntityClass() { + return BaseDataDevice.class; + } +} diff --git a/nl-base-data/src/main/java/org/nl/module/device/entity/BaseDataDevice.java b/nl-base-data/src/main/java/org/nl/module/device/entity/BaseDataDevice.java index f63e025..86e70b7 100644 --- a/nl-base-data/src/main/java/org/nl/module/device/entity/BaseDataDevice.java +++ b/nl-base-data/src/main/java/org/nl/module/device/entity/BaseDataDevice.java @@ -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; diff --git a/nl-vue/src/views/nl_agv/layout/index.vue b/nl-vue/src/views/nl_agv/layout/index.vue index 876a054..735c709 100644 --- a/nl-vue/src/views/nl_agv/layout/index.vue +++ b/nl-vue/src/views/nl_agv/layout/index.vue @@ -220,7 +220,7 @@ export default { methods: { async loadDeviceList() { try { - const response = await fetch('http://localhost:8081/api/device/list', { + const response = await fetch('http://localhost:8081/api/baseData/device/compentList', { method: 'GET', headers: { 'Content-Type': 'application/json' } }) diff --git a/nl-vue/src/views/nl_base_data/device/form.vue b/nl-vue/src/views/nl_base_data/device/form.vue index 724677c..63e83cb 100644 --- a/nl-vue/src/views/nl_base_data/device/form.vue +++ b/nl-vue/src/views/nl_base_data/device/form.vue @@ -29,6 +29,12 @@ + + + + + +