增加配置属性
This commit is contained in:
parent
7849348924
commit
7bca69e746
|
|
@ -88,6 +88,8 @@ public interface MaTypeMapper {
|
|||
|
||||
Integer updateLeasePrice(@Param("typeIds")List<Integer> typeIds,@Param("leasePrice") BigDecimal leasePrice);
|
||||
|
||||
List<MaTypeProperty> selectMaTypePropertyNames();
|
||||
|
||||
int deleteMaTypePropertyNames(@Param("typeId")Long typeId);
|
||||
|
||||
int insertMaTypePropertyNames(@Param("typeId")Long typeId, @Param("list") List<String> propertyNames);
|
||||
|
|
|
|||
|
|
@ -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<TreeSelect> getMaTypeList(String typeName, String parentId) {
|
||||
List<MaType> maTypes = maTypeMapper.selectMaTypeTree(parentId);
|
||||
List<MaTypeProperty> maTypeProperties = maTypeMapper.selectMaTypePropertyNames();
|
||||
Map<Long, List<MaTypeProperty>> maTypePropertiesMap = new HashMap<>();
|
||||
if (!CollectionUtils.isEmpty(maTypeProperties)) {
|
||||
maTypePropertiesMap = maTypeProperties.stream().collect(Collectors.groupingBy(MaTypeProperty::getTypeId));
|
||||
}
|
||||
for (MaType maType : maTypes) {
|
||||
List<MaTypeProperty> tmpPropList = maTypePropertiesMap.get(maType.getTypeId());
|
||||
if (!CollectionUtils.isEmpty(tmpPropList)) {
|
||||
maType.setPropertyNames(tmpPropList.stream().map(o -> o.getPropertyName()).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
List<TreeSelect> treeSelectList = buildDeptTreeSelect(maTypes);
|
||||
//如果没有查询到那么返回空
|
||||
return treeSelectList;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
@ -27,6 +27,8 @@ public class TreeSelect implements Serializable
|
|||
|
||||
private String companyId;
|
||||
|
||||
private List<String> propertyNames;
|
||||
|
||||
/** 子节点 */
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private List<TreeSelect> 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<String> getPropertyNames() {
|
||||
return propertyNames;
|
||||
}
|
||||
|
||||
public void setPropertyNames(List<String> propertyNames) {
|
||||
this.propertyNames = propertyNames;
|
||||
}
|
||||
|
||||
public List<TreeSelect> getChildren()
|
||||
{
|
||||
return children;
|
||||
|
|
|
|||
|
|
@ -455,6 +455,12 @@
|
|||
and del_flag = 0
|
||||
</update>
|
||||
|
||||
<select id="selectMaTypePropertyNames" resultType="com.bonus.material.ma.vo.MaTypeProperty">
|
||||
select type_id as typeId,
|
||||
property_name as propertyName
|
||||
from ma_type_properties
|
||||
</select>
|
||||
|
||||
<delete id="deleteMaTypePropertyNames">
|
||||
delete from ma_type_properties where type_id = #{typeId}
|
||||
</delete>
|
||||
|
|
|
|||
Loading…
Reference in New Issue