From fd6a020f6191357e3e90c9b5f98c56f47ba5d118 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E9=B9=8F=E9=A3=9E?= Date: Tue, 4 Mar 2025 20:04:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B0=83=E6=95=B4=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E9=83=A8=E4=BD=8D=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mobilebroken/common/pojo/vo/ComponentInfo.java | 13 +++++++++++++ .../mobilebroken/common/pojo/vo/DeviceInfoVO.java | 14 +++++--------- .../repository/mapper/DeviceMapper.java | 3 +++ .../repository/service/impl/DeviceServiceImpl.java | 8 +++++++- .../src/main/resources/mapper/DeviceMapper.xml | 11 ++++++++++- 5 files changed, 38 insertions(+), 11 deletions(-) create mode 100644 nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/ComponentInfo.java diff --git a/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/ComponentInfo.java b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/ComponentInfo.java new file mode 100644 index 00000000..0b9a787a --- /dev/null +++ b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/ComponentInfo.java @@ -0,0 +1,13 @@ +package com.nflg.mobilebroken.common.pojo.vo; + +import lombok.Data; + +@Data +public class ComponentInfo { + + //部位名称 + private String name; + + //语言对应的名称 + private String languageValue; +} diff --git a/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/DeviceInfoVO.java b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/DeviceInfoVO.java index e174fd4f..9bc42c31 100644 --- a/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/DeviceInfoVO.java +++ b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/vo/DeviceInfoVO.java @@ -1,6 +1,6 @@ package com.nflg.mobilebroken.common.pojo.vo; -import cn.hutool.core.util.StrUtil; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import lombok.experimental.Accessors; @@ -35,16 +35,12 @@ public class DeviceInfoVO { //质保期(月) private Integer warrantyMonth; - //机型部件 - private String component; - //设备部件列表 - private List components; - - public List getComponents(){ - return StrUtil.split(component,";"); - } + private List components; //客户名称 private String customerName; + + @JsonIgnore + private Integer componentId; } diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/mapper/DeviceMapper.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/mapper/DeviceMapper.java index 44a9a95f..cad31b1f 100644 --- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/mapper/DeviceMapper.java +++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/mapper/DeviceMapper.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.nflg.mobilebroken.common.pojo.query.PageBaseQuery; import com.nflg.mobilebroken.common.pojo.request.SearchDeviceRequest; +import com.nflg.mobilebroken.common.pojo.vo.ComponentInfo; import com.nflg.mobilebroken.common.pojo.vo.DeviceInfoVO; import com.nflg.mobilebroken.common.pojo.vo.DeviceVO; import com.nflg.mobilebroken.repository.entity.Device; @@ -40,4 +41,6 @@ public interface DeviceMapper extends BaseMapper { void taskWarrantyStateNotOutsideWarranty(); void taskWarrantyStateNotOutsideWithinWarranty(); + + List getComponents(Integer componentId,String language); } diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/DeviceServiceImpl.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/DeviceServiceImpl.java index 33a3c6b4..4cdeb569 100644 --- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/DeviceServiceImpl.java +++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/DeviceServiceImpl.java @@ -7,6 +7,7 @@ import com.nflg.mobilebroken.common.pojo.request.SearchDeviceRequest; import com.nflg.mobilebroken.common.pojo.vo.DeviceInfoVO; import com.nflg.mobilebroken.common.pojo.vo.DeviceVO; import com.nflg.mobilebroken.common.util.AppUserUtil; +import com.nflg.mobilebroken.common.util.MultilingualUtil; import com.nflg.mobilebroken.repository.entity.Device; import com.nflg.mobilebroken.repository.mapper.DeviceMapper; import com.nflg.mobilebroken.repository.service.IDeviceService; @@ -14,6 +15,7 @@ import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Service; import java.util.List; +import java.util.Objects; /** *

@@ -28,7 +30,11 @@ public class DeviceServiceImpl extends ServiceImpl impleme @Override public DeviceInfoVO getByDeviceNo(String deviceNo) { - return baseMapper.getByDeviceNo(deviceNo); + DeviceInfoVO vo=baseMapper.getByDeviceNo(deviceNo); + if (Objects.nonNull(vo.getComponentId())){ + vo.setComponents(baseMapper.getComponents(vo.getComponentId(), MultilingualUtil.getLanguage())); + } + return vo; } diff --git a/nflg-mobilebroken-repository/src/main/resources/mapper/DeviceMapper.xml b/nflg-mobilebroken-repository/src/main/resources/mapper/DeviceMapper.xml index ca879e12..986a7f24 100644 --- a/nflg-mobilebroken-repository/src/main/resources/mapper/DeviceMapper.xml +++ b/nflg-mobilebroken-repository/src/main/resources/mapper/DeviceMapper.xml @@ -3,9 +3,10 @@ + SELECT dcd.model_part_name AS 'name',ld.language_value AS 'languageValue' + FROM device_component_detail dcd + INNER JOIN t_base_part p ON dcd.model_part_id=p.id + LEFT JOIN t_base_language_data ld ON dcd.model_part_id=ld.source_id + WHERE dcd.device_component_id=#{componentId} AND ld.language_code=#{language} +