fix: 优化逻辑

This commit is contained in:
tangwei 2026-07-01 18:49:55 +08:00
parent cbb93ec8ec
commit f907785f4a

View File

@ -1103,17 +1103,17 @@ public class FishImportServiceImpl implements IFishImportService {
return null; return null;
} }
SdFishDictoryB exactMatch = findFirst(fishDictoryBMapper.selectList(new LambdaQueryWrapper<SdFishDictoryB>() SdFishDictoryB exactMatch = findFirst(fishDictoryBMapper.selectList(new LambdaQueryWrapper<SdFishDictoryB>()
.select(SdFishDictoryB::getCode, SdFishDictoryB::getName) .select(SdFishDictoryB::getId, SdFishDictoryB::getName)
.eq(SdFishDictoryB::getName, normalizedName))); .eq(SdFishDictoryB::getName, normalizedName)));
if (exactMatch != null) { if (exactMatch != null) {
return exactMatch.getCode(); return exactMatch.getId();
} }
SdFishDictoryB fuzzyMatch = findFirst(fishDictoryBMapper.selectList(new LambdaQueryWrapper<SdFishDictoryB>() SdFishDictoryB fuzzyMatch = findFirst(fishDictoryBMapper.selectList(new LambdaQueryWrapper<SdFishDictoryB>()
.select(SdFishDictoryB::getCode, SdFishDictoryB::getName) .select(SdFishDictoryB::getId, SdFishDictoryB::getName)
.and(wrapper -> wrapper.like(SdFishDictoryB::getName, normalizedName) .and(wrapper -> wrapper.like(SdFishDictoryB::getName, normalizedName)
.or() .or()
.like(SdFishDictoryB::getAlias, normalizedName)))); .like(SdFishDictoryB::getAlias, normalizedName))));
return fuzzyMatch == null ? null : fuzzyMatch.getCode(); return fuzzyMatch == null ? null : fuzzyMatch.getId();
} }
@Override @Override
@ -1125,11 +1125,11 @@ public class FishImportServiceImpl implements IFishImportService {
} }
if (StringUtils.hasText(normalizedCode)) { if (StringUtils.hasText(normalizedCode)) {
SdFishDictoryB exact = findFirst(fishDictoryBMapper.selectList(new LambdaQueryWrapper<SdFishDictoryB>() SdFishDictoryB exact = findFirst(fishDictoryBMapper.selectList(new LambdaQueryWrapper<SdFishDictoryB>()
.select(SdFishDictoryB::getCode, SdFishDictoryB::getName) .select(SdFishDictoryB::getId, SdFishDictoryB::getName)
.eq(SdFishDictoryB::getCode, normalizedCode))); .eq(SdFishDictoryB::getId, normalizedCode)));
// .eq(SdFishDictoryB::getName, normalizedName))); // .eq(SdFishDictoryB::getName, normalizedName)));
if (exact != null) { if (exact != null) {
return exact.getCode(); return exact.getId();
} }
} }
// if (StringUtils.hasText(normalizedCode)) { // if (StringUtils.hasText(normalizedCode)) {