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 0f9b478..0620612 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 @@ -87,4 +87,8 @@ public interface MaTypeMapper { List selectParentId(@Param("typeId")Long typeId, @Param("level")Integer level); Integer updateLeasePrice(@Param("typeIds")List typeIds,@Param("leasePrice") BigDecimal leasePrice); + + int deleteMaTypePropertyNames(@Param("typeId")Long typeId); + + int insertMaTypePropertyNames(@Param("typeId")Long typeId, @Param("list") List propertyNames); } \ No newline at end of file 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 b084c8f..63b5a40 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 @@ -8,6 +8,8 @@ import com.bonus.material.ma.service.ITypeService; import com.bonus.material.ma.vo.*; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + import javax.annotation.Resource; import java.util.*; import java.util.stream.Collectors; @@ -128,6 +130,11 @@ public class MaTypeServiceImpl implements ITypeService { Long typeId = maType.getTypeId(); maType.setUpdateTime(DateUtils.getNowDate()); int i = maTypeMapper.updateType(maType); + //保存配置属性 + if (!CollectionUtils.isEmpty(maType.getPropertyNames())) { + maTypeMapper.deleteMaTypePropertyNames(maType.getTypeId()); + maTypeMapper.insertMaTypePropertyNames(maType.getTypeId(), maType.getPropertyNames()); + } // 图片路径保存 if (StringUtils.isNotEmpty(maType.getPhotoName()) && StringUtils.isNotEmpty(maType.getPhotoUrl())) { typeFileMapper.deleteMaTypeFileByTypeId(typeId, "1"); diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/vo/MaType.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/vo/MaType.java index b27456f..2b634bb 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/vo/MaType.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/ma/vo/MaType.java @@ -216,4 +216,6 @@ public class MaType extends BaseEntity { private String intelligentCode; private List typeIds; + + private List propertyNames; } 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 2992843..96cc55c 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 @@ -454,4 +454,21 @@ and del_flag = 0 + + + delete from ma_type_properties where type_id = #{typeId} + + + + insert into + ma_type_properties(type_id, property_name, create_time) + values + + ( + #{typeId}, + #{item}, + now() + ) + + \ No newline at end of file