From 62887ff5c76d783a9492cefb809425eaf47ccc5f Mon Sep 17 00:00:00 2001 From: hongchao <3228015117@qq.com> Date: Fri, 9 Jan 2026 15:44:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8F=E6=BA=90=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ma/controller/TypeController.java | 13 ++ .../bonus/material/ma/mapper/TypeMapper.java | 2 + .../material/ma/service/ITypeService.java | 2 + .../ma/service/impl/TypeServiceImpl.java | 21 +++ .../mapper/material/ma/TypeMapper.xml | 124 +++++++++++++++++- 5 files changed, 159 insertions(+), 3 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeController.java index 03790bd0..a9930809 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeController.java @@ -185,6 +185,19 @@ public class TypeController extends BaseController { return success(listByMaType); } + /** + * 查询物资类型4级规格型号--领用申请下拉框 + * + * @param typeId 规格型号 + */ + @ApiOperation(value = "获取物资类型连动式下拉框") + @GetMapping("/equipmentTypeLY") + public AjaxResult equipmentTypeLY(@RequestParam(required = false) Long typeId, @RequestParam(required = false) String typeName) { + Long deptId = typeService.getUserDeptId(); + List listByMaType = typeService.getEquipmentTypeLY(typeId, typeName, deptId); + return success(listByMaType); + } + /** * 获取领用物资类型连动式下拉框 * @param typeId diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeMapper.java index 706c234e..78648bb8 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeMapper.java @@ -27,6 +27,8 @@ public interface TypeMapper { List selectMaTypeList(@Param("typeId") Long typeId, @Param("typeName") String typeName, @Param("companyId") Long companyId); + List selectMaTypeListLY(@Param("typeId") Long typeId, @Param("typeName") String typeName, @Param("companyId") Long companyId); + /** * 查询物资类型3级--前端联动式下拉框 * 没有4级规格型号 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeService.java index f0772d63..f5f26a8a 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeService.java @@ -29,6 +29,8 @@ public interface ITypeService { List getEquipmentType(Long typeId, String typeName, Long deptId); + List getEquipmentTypeLY(Long typeId, String typeName, Long deptId); + /** * 查询物资类型3级--前端联动式下拉框 * 没有4级规格型号 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeServiceImpl.java index b90af28e..5f7ef3cd 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeServiceImpl.java @@ -107,6 +107,27 @@ public class TypeServiceImpl implements ITypeService { return roots; } + /** + * 查询物资类型四级树--前端联动式下拉框 + * + * @param typeId 类型id + * @param typeName 类型名称 + */ + @Override + public List getEquipmentTypeLY(Long typeId, String typeName, Long deptId) { + List maTypes = typeMapper.selectMaTypeListLY(typeId, typeName, deptId); + List roots = maTypes.stream() + .filter(t -> t.getParentId() == 0) + .collect(Collectors.toList()); + + // 构建树并计算优先级 + roots.forEach(root -> buildTreeWithPriority(root, maTypes)); + + // 对根节点排序(含0值处理) + roots.sort(this::compareNodes); + return roots; + } + /** * 递归构建树结构并计算排序优先级 */ diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeMapper.xml index 0a5c3d00..9cc86ca4 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeMapper.xml @@ -379,7 +379,9 @@ 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 - + + AND mt3.company_id = #{deptId} + UNION select @@ -389,7 +391,9 @@ 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 - + + AND mt2.company_id = #{deptId} + UNION select @@ -398,7 +402,9 @@ 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 - + + AND mt1.company_id = #{deptId} + order by type_id @@ -620,6 +626,118 @@ + +