From 7bca69e746da06e483bcda49040f893cb10fbf01 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Tue, 10 Dec 2024 10:46:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=85=8D=E7=BD=AE=E5=B1=9E?= =?UTF-8?q?=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bonus/material/ma/mapper/MaTypeMapper.java | 2 ++ .../ma/service/impl/MaTypeServiceImpl.java | 12 ++++++++++++ .../bonus/material/ma/vo/MaTypeProperty.java | 17 +++++++++++++++++ .../com/bonus/material/ma/vo/TreeSelect.java | 11 +++++++++++ .../mapper/material/ma/MaMachineTypeMapper.xml | 6 ++++++ 5 files changed, 48 insertions(+) create mode 100644 bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/vo/MaTypeProperty.java diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/mapper/MaTypeMapper.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/mapper/MaTypeMapper.java index 0620612..b018b70 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/mapper/MaTypeMapper.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/mapper/MaTypeMapper.java @@ -88,6 +88,8 @@ public interface MaTypeMapper { Integer updateLeasePrice(@Param("typeIds")List typeIds,@Param("leasePrice") BigDecimal leasePrice); + List selectMaTypePropertyNames(); + int deleteMaTypePropertyNames(@Param("typeId")Long typeId); int insertMaTypePropertyNames(@Param("typeId")Long typeId, @Param("list") List propertyNames); diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/service/impl/MaTypeServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/service/impl/MaTypeServiceImpl.java index 63b5a40..b3a1750 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/service/impl/MaTypeServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/service/impl/MaTypeServiceImpl.java @@ -2,6 +2,7 @@ package com.bonus.material.ma.service.impl; import com.bonus.common.core.utils.DateUtils; import com.bonus.common.core.utils.StringUtils; +import com.bonus.material.device.domain.DevInfo; import com.bonus.material.ma.mapper.MaTypeFileMapper; import com.bonus.material.ma.mapper.MaTypeMapper; import com.bonus.material.ma.service.ITypeService; @@ -209,6 +210,17 @@ public class MaTypeServiceImpl implements ITypeService { @Override public List getMaTypeList(String typeName, String parentId) { List maTypes = maTypeMapper.selectMaTypeTree(parentId); + List maTypeProperties = maTypeMapper.selectMaTypePropertyNames(); + Map> maTypePropertiesMap = new HashMap<>(); + if (!CollectionUtils.isEmpty(maTypeProperties)) { + maTypePropertiesMap = maTypeProperties.stream().collect(Collectors.groupingBy(MaTypeProperty::getTypeId)); + } + for (MaType maType : maTypes) { + List tmpPropList = maTypePropertiesMap.get(maType.getTypeId()); + if (!CollectionUtils.isEmpty(tmpPropList)) { + maType.setPropertyNames(tmpPropList.stream().map(o -> o.getPropertyName()).collect(Collectors.toList())); + } + } List treeSelectList = buildDeptTreeSelect(maTypes); //如果没有查询到那么返回空 return treeSelectList; diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/vo/MaTypeProperty.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/vo/MaTypeProperty.java new file mode 100644 index 0000000..7cf356e --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/vo/MaTypeProperty.java @@ -0,0 +1,17 @@ +package com.bonus.material.ma.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class MaTypeProperty { + + /** 类型ID */ + @ApiModelProperty(value = "类型ID") + private Long typeId; + + /** 类型ID */ + @ApiModelProperty(value = "属性名称") + private String propertyName; + +} diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/vo/TreeSelect.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/vo/TreeSelect.java index bf65755..cbdd00b 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/vo/TreeSelect.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/vo/TreeSelect.java @@ -27,6 +27,8 @@ public class TreeSelect implements Serializable private String companyId; + private List propertyNames; + /** 子节点 */ @JsonInclude(JsonInclude.Include.NON_EMPTY) private List children; @@ -51,6 +53,7 @@ public class TreeSelect implements Serializable this.id = maType.getTypeId(); this.label = maType.getTypeName(); this.companyId = maType.getCompanyId(); + this.propertyNames = maType.getPropertyNames(); this.children = maType.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); } // public TreeSelect(SysDept dept) @@ -106,6 +109,14 @@ public class TreeSelect implements Serializable this.companyId = companyId; } + public List getPropertyNames() { + return propertyNames; + } + + public void setPropertyNames(List propertyNames) { + this.propertyNames = propertyNames; + } + public List getChildren() { return children; diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/ma/MaMachineTypeMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/ma/MaMachineTypeMapper.xml index 96cc55c..ba379e4 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/ma/MaMachineTypeMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/ma/MaMachineTypeMapper.xml @@ -455,6 +455,12 @@ and del_flag = 0 + + delete from ma_type_properties where type_id = #{typeId}