Commit 3cc1add8 authored by tianbo's avatar tianbo

refactor(设备分类): 优化设备分类查询逻辑

- 修改了 CommonServiceImpl 中设备分类筛选逻辑,使用 description 字段替代正则表达式匹配 code 字段 - 更新了 EquipmentCategoryMapper.xml 中查询条件,使用 is_delete 字段替代 NOT LIKE 条件
parent 0a580817
...@@ -2404,13 +2404,13 @@ public class CommonServiceImpl implements ICommonService { ...@@ -2404,13 +2404,13 @@ public class CommonServiceImpl implements ICommonService {
List<EquipmentCategoryDto> result = Collections.emptyList(); List<EquipmentCategoryDto> result = Collections.emptyList();
switch (type) { switch (type) {
case "1": case "1":
result = categoryList.stream().filter(category -> Pattern.compile("^[^\\D0]*000$").matcher(category.getCode()).matches()).collect(Collectors.toList()); result = categoryList.stream().filter(category -> category.getDescription().equals("EQU_LIST")).collect(Collectors.toList());
break; break;
case "2": case "2":
result = categoryList.stream().filter(category -> Pattern.compile("^[^\0]*00$").matcher(category.getCode()).matches()).collect(Collectors.toList()); result = categoryList.stream().filter(category -> category.getDescription().equals("EQU_CATEGORY")).collect(Collectors.toList());
break; break;
case "3": case "3":
result = categoryList.stream().filter(category -> Pattern.compile("^[^\\D0A-Za-z]*[A-Za-z0-9]*[^0]0$").matcher(category.getCode()).matches()).collect(Collectors.toList()); result = categoryList.stream().filter(category -> category.getDescription().equals("EQU_DEFINE")).collect(Collectors.toList());
break; break;
} }
return result; return result;
......
...@@ -721,7 +721,7 @@ ...@@ -721,7 +721,7 @@
<select id="selectClassifyNoStart7And8ByParentCode" resultType="com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto"> <select id="selectClassifyNoStart7And8ByParentCode" resultType="com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto">
select * from tz_equipment_category select * from tz_equipment_category
<where> <where>
code NOT LIKE '7%' AND code NOT LIKE '8%' is_delete = 0
<if test="parentCode != null and parentCode != ''"> <if test="parentCode != null and parentCode != ''">
and parent_id = (SELECT id FROM tz_equipment_category WHERE code = #{parentCode} ) and parent_id = (SELECT id FROM tz_equipment_category WHERE code = #{parentCode} )
</if> </if>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment