Commit 1c5b85d8 authored by liufan's avatar liufan

优化:设备分类接口查询,返回空数组不为空,但内部字段都为空的问题

parent f220d165
...@@ -27,13 +27,11 @@ import org.springframework.util.CollectionUtils; ...@@ -27,13 +27,11 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayInputStream;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.InputStream;
import java.nio.file.Files; import java.nio.file.Files;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -99,16 +97,20 @@ public class CommonServiceImpl implements ICommonService { ...@@ -99,16 +97,20 @@ public class CommonServiceImpl implements ICommonService {
public List<EquipmentCategory> getEquipmentCategoryList(String code, String type) { public List<EquipmentCategory> getEquipmentCategoryList(String code, String type) {
List<EquipmentCategory> result = new ArrayList<>(); List<EquipmentCategory> result = new ArrayList<>();
LambdaQueryWrapper<EquipmentCategory> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<EquipmentCategory> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(EquipmentCategory::getCode, code); wrapper.eq(EquipmentCategory::getCode, code);
EquipmentCategory equipmentCategory = equipmentCategoryMapper.selectOne(wrapper); EquipmentCategory equipmentCategory = equipmentCategoryMapper.selectOne(wrapper);
if (ObjectUtils.isEmpty(type)) { if (ObjectUtils.isEmpty(type)) {
result.add(equipmentCategory); if(!ValidationUtil.isEmpty(equipmentCategory)){
result.add(equipmentCategory);
}
} else { } else {
LambdaQueryWrapper<EquipmentCategory> wrapper2 = new LambdaQueryWrapper<>(); LambdaQueryWrapper<EquipmentCategory> wrapper2 = new LambdaQueryWrapper<>();
wrapper2.eq(EquipmentCategory::getParentId, equipmentCategory.getId()); wrapper2.eq(EquipmentCategory::getParentId, equipmentCategory.getId());
result = equipmentCategoryMapper.selectList(wrapper2); List<EquipmentCategory> equipmentCategories = equipmentCategoryMapper.selectList(wrapper2);
if(!ValidationUtil.isEmpty(equipmentCategories)){
result = equipmentCategories;
}
} }
return result; return result;
} }
......
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