Merge remote-tracking branch 'origin/master'

This commit is contained in:
jjLv 2024-11-06 12:09:56 +08:00
commit 189732c3af
4 changed files with 51 additions and 7 deletions

View File

@ -30,6 +30,9 @@ public class TreeSelect implements Serializable {
/** 公司id */
private String companyId;
/** 仓库id */
private Long houseId;
/** 子节点集合 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<TreeSelect> children;
@ -38,9 +41,10 @@ public class TreeSelect implements Serializable {
}
public TreeSelect(Long id, String label, Integer level, Long parentId, List<TreeSelect> children) {
public TreeSelect(Long id, String label, Long houseId, Integer level, Long parentId, List<TreeSelect> children) {
this.id = id;
this.label = label;
this.houseId = houseId;
this.level = level;
this.parentId = parentId;
this.children = children;

View File

@ -47,9 +47,9 @@ public interface TypeMapper {
/**
* 物资类型树形结构
* @param level 排除层级
*/
List<Type> selectMaTypeTree(@Param("level") Integer level);
List<Type> selectMaTypeTree();
/**
* 查询物资类型列表

View File

@ -319,7 +319,7 @@ public class TypeServiceImpl implements ITypeService {
@Override
public List<TreeSelect> getMaTypeTree(String typeName, String parentId) {
List<Type> maTypes = typeMapper.selectMaTypeTree(TYPE_MIN_LEVEL);
List<Type> maTypes = typeMapper.selectMaTypeTree();
List<Type> builtMaTypeList = buildMaTypeTree(maTypes);
// 查询顶级节点的仓库配置信息
@ -374,7 +374,7 @@ public class TypeServiceImpl implements ITypeService {
.filter(Objects::nonNull)
.map(this::convertToTreeSelect)
.collect(Collectors.toList());
return new TreeSelect(type.getTypeId(), type.getTypeName(),Integer.valueOf(type.getLevel()),type.getParentId(), children);
return new TreeSelect(type.getTypeId(), type.getTypeName(), type.getHouseId(), Integer.valueOf(type.getLevel()),type.getParentId(), children);
}
/**

View File

@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="typeId" column="type_id" />
<result property="typeName" column="type_name" />
<result property="parentId" column="parent_id" />
<result property="houseId" column="house_id" />
<result property="storageNum" column="storage_num" />
<result property="typeCode" column="type_code" />
<result property="modelCode" column="model_code" />
@ -273,10 +274,49 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<select id="selectMaTypeTree" resultMap="TypeResult">
<include refid="selectTypeVo" />
where del_flag = 0 and level != #{level}
select
mt3.type_id, mt3.type_name, mt3.parent_id, mt3.storage_num, mt3.type_code, mt3.model_code, mt3.unit_id,
mt3.unit_name, mt3.level, whs.house_id
from ma_type mt3
left join ma_type mt2 on mt2.type_id=mt3.parent_id
left join ma_type mt1 on mt1.type_id=mt2.parent_id
left join wh_house_set whs on mt1.type_id=whs.type_id
where mt3.del_flag = 0 and mt3.level = 3
UNION
select
mt2.type_id, mt2.type_name, mt2.parent_id, mt2.storage_num, mt2.type_code, mt2.model_code, mt2.unit_id,
mt2.unit_name, mt2.level, whs.house_id
from ma_type mt2
left join ma_type mt1 on mt1.type_id=mt2.parent_id
left join wh_house_set whs on mt1.type_id=whs.type_id
where mt2.del_flag = 0 and mt2.level = 2
UNION
select
mt1.type_id, mt1.type_name, mt1.parent_id, mt1.storage_num, mt1.type_code, mt1.model_code, mt1.unit_id,
mt1.unit_name, mt1.level, whs.house_id
from ma_type mt1
left join wh_house_set whs on mt1.type_id=whs.type_id
where mt1.del_flag = 0 and mt1.level = 1
order by type_id
</select>
<!-- <select id="selectMaTypeTree2" resultMap="TypeResult">-->
<!-- select-->
<!-- mt.type_id, mt.type_name, mt.parent_id, mt.storage_num, mt.type_code, mt.model_code, mt.unit_id, mt.unit_name,-->
<!-- mt.manage_type, mt.lease_price, mt.eff_time, mt.rent_price, mt.buy_price, mt.pay_ratio, mt.pay_price,-->
<!-- mt.tax_ratio, mt.level, mt.rated_load, mt.test_load, mt.holding_time, mt.warn_num,-->
<!-- mt.create_by, mt.create_time, mt.update_by, mt.update_time, mt.is_plan,mt.is_ancuo,-->
<!-- mt.remark, mt.fac_model, mt.intelligent_code, whs.house_id-->
<!-- from ma_type mt-->
<!-- left join wh_house_set whs on mt.type_id=whs.type_id-->
<!-- where mt.del_flag = 0 and mt.level != #{level}-->
<!-- </select>-->
<select id="selectTypeListAndParent" resultMap="MaTypeVoResult">
SELECT
a.*, -- 当前层级的所有字段