物资类型--公用规格型号连动式下拉框
This commit is contained in:
parent
6753565194
commit
a542efc44d
|
|
@ -74,6 +74,20 @@ public class TypeController extends BaseController {
|
||||||
return success(list);
|
return success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询物资类型4级规格型号--前端联动式下拉框
|
||||||
|
*
|
||||||
|
* @param typeId 规格型号
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "获取物资类型连动式下拉框")
|
||||||
|
@GetMapping("/equipmentType")
|
||||||
|
public AjaxResult equipmentType(@RequestParam(required = false) Long typeId,
|
||||||
|
@RequestParam(required = false) String typeName) {
|
||||||
|
List<Type> listByMaType = typeService.getEquipmentType(typeId, typeName);
|
||||||
|
return success(listByMaType);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据左列表类型id查询右表格 --- 暂未启用,代码有问题!!
|
* 根据左列表类型id查询右表格 --- 暂未启用,代码有问题!!
|
||||||
* TODO: 待完善
|
* TODO: 待完善
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,9 @@ import org.apache.ibatis.annotations.Param;
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface TypeMapper {
|
public interface TypeMapper {
|
||||||
|
|
||||||
|
List<Type> selectMaTypeList(String typeName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询物资类型
|
* 查询物资类型
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,8 @@ public interface ITypeService {
|
||||||
|
|
||||||
List<Integer> selectParentId(Long typeId, Integer level);
|
List<Integer> selectParentId(Long typeId, Integer level);
|
||||||
|
|
||||||
|
List<Type> getEquipmentType(Long typeId, String typeName);
|
||||||
|
|
||||||
List<MaTypeSelectVo> selectMaTypeListByHouseId(Long houseId);
|
List<MaTypeSelectVo> selectMaTypeListByHouseId(Long houseId);
|
||||||
|
|
||||||
List<Type> getListByParentId(Long typeId, String typeName);
|
List<Type> getListByParentId(Long typeId, String typeName);
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,31 @@ public class TypeServiceImpl implements ITypeService {
|
||||||
return typeMapper.selectParentId(typeId, level);
|
return typeMapper.selectParentId(typeId, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询物资类型四级树--前端联动式下拉框
|
||||||
|
* @param typeId 类型id
|
||||||
|
* @param typeName 类型名称
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Type> getEquipmentType(Long typeId, String typeName) {
|
||||||
|
List<Type> maTypes = typeMapper.selectMaTypeList("");
|
||||||
|
List<Type> list = new ArrayList<>();
|
||||||
|
for (Type maType : maTypes) {
|
||||||
|
if (maType.getParentId() == 0) {
|
||||||
|
list.add(maType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//根据父节点获取对应的儿子节点
|
||||||
|
for (Type maType : list) {
|
||||||
|
List<Type> child = getChild(maTypes, maType.getTypeId());
|
||||||
|
maType.setChildren(child);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<MaTypeSelectVo> selectMaTypeListByHouseId(Long houseId) {
|
public List<MaTypeSelectVo> selectMaTypeListByHouseId(Long houseId) {
|
||||||
return typeMapper.selectMaTypeListByHouseId(houseId);
|
return typeMapper.selectMaTypeListByHouseId(houseId);
|
||||||
|
|
@ -272,6 +297,25 @@ public class TypeServiceImpl implements ITypeService {
|
||||||
return new TreeSelect(type.getTypeId(), type.getTypeName(),Integer.valueOf(type.getLevel()),type.getParentId(), children);
|
return new TreeSelect(type.getTypeId(), type.getTypeName(),Integer.valueOf(type.getLevel()),type.getParentId(), children);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 递归调用获取子级
|
||||||
|
* @param list 集合
|
||||||
|
* @param parentId 父级id
|
||||||
|
*/
|
||||||
|
public List<Type> getChild(List<Type> list, Long parentId) {
|
||||||
|
List<Type> childList = new ArrayList<Type>();
|
||||||
|
for (Type maType : list) {
|
||||||
|
Long typeId = maType.getTypeId();
|
||||||
|
Long pid = maType.getParentId();
|
||||||
|
if (parentId.equals(pid)) {
|
||||||
|
List<Type> childLists = getChild(list, typeId);
|
||||||
|
maType.setChildren(childLists);
|
||||||
|
childList.add(maType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return childList;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建前端所需要树结构
|
* 构建前端所需要树结构
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -408,4 +408,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
WHERE
|
WHERE
|
||||||
a.del_flag = 0 AND a.`level` = '3'
|
a.del_flag = 0 AND a.`level` = '3'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectMaTypeList" resultMap="TypeResult">
|
||||||
|
select DISTINCT m.type_id, m.type_name, m.parent_id, m.unit_id, m.unit_name, m.manage_type,
|
||||||
|
m.lease_price,m.eff_time, m.rent_price, m.buy_price, m.pay_price, m.level, m.rated_load, m.test_load,
|
||||||
|
m.holding_time, m.warn_num,
|
||||||
|
mtk.user_id keeperUserId,
|
||||||
|
su.nick_name keeperUserName, mpi.prop_name, m.del_flag, m.create_by, m.create_time,
|
||||||
|
m.remark,m.type_id id , m.type_name label
|
||||||
|
from ma_type m
|
||||||
|
left join ma_prop_set mps on m.type_id = mps.type_id and mps.`status`='0' and mps.del_flag='0'
|
||||||
|
left join ma_prop_info mpi on mps.prop_id = mpi.prop_id and mpi.`status`='0' and mpi.del_flag='0'
|
||||||
|
left join ma_type_keeper mtk on m.type_id = mtk.type_id
|
||||||
|
left join sys_user su on mtk.user_id = su.user_id
|
||||||
|
<where>
|
||||||
|
m.del_flag = '0'
|
||||||
|
<if test="typeName != null and typeName !=''">
|
||||||
|
AND m.type_name like concat('%',#{typeName},'%')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue