From c96c89bbfe70c0540cd8c17d24195608f845b1c4 Mon Sep 17 00:00:00 2001 From: jiyufei <67400194@qq.com> Date: Wed, 14 Aug 2024 16:45:36 +0800 Subject: [PATCH] =?UTF-8?q?feat():=E8=AE=BE=E5=A4=87=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/jnpf/service/impl/YysDeviceServiceImpl.java | 8 +++++++- .../main/java/jnpf/controller/YysDeviceController.java | 9 +++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysDeviceServiceImpl.java b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysDeviceServiceImpl.java index f382e1a..cb4cbfd 100644 --- a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysDeviceServiceImpl.java +++ b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysDeviceServiceImpl.java @@ -11,6 +11,7 @@ import jnpf.base.UserInfo; import jnpf.base.model.ColumnDataModel; import jnpf.database.model.superQuery.SuperJsonModel; import jnpf.entity.YysDeviceEntity; +import jnpf.entity.YysDeviceMaterialEntity; import jnpf.mapper.YysDeviceMapper; import jnpf.model.QueryModel; import jnpf.model.yysdevice.YysDeviceConstant; @@ -326,6 +327,11 @@ public class YysDeviceServiceImpl extends ServiceImpl wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YysDeviceMaterialEntity::getDeviceCode, entity.getDeviceCode()); + yysDeviceMaterialService.remove(wrapper); + yysDeviceMaterialService.saveBatch(yysDeviceForm.getData()); //向设备维保表同步数据 yysDeviceUpkeepService.syncSaveOrUpdate(entity); } @@ -347,6 +353,6 @@ public class YysDeviceServiceImpl extends ServiceImpl list = yysDeviceService.getList(yysDevicePagination); List> realList = new ArrayList<>(); + //查询设备绑定物料信息 + List list1 = yysDeviceMaterialService.list(); + Map> collect = list1.stream().collect(Collectors.groupingBy(YysDeviceMaterialEntity::getDeviceCode)); for (YysDeviceEntity entity : list) { Map yysDeviceMap = JsonUtil.entityToMap(entity); yysDeviceMap.put("id", yysDeviceMap.get("id")); + if (collect.containsKey(entity.getDeviceCode())) { + yysDeviceMap.put("data", collect.get(entity.getDeviceCode())); + } //副表数据 //子表数据 realList.add(yysDeviceMap);