fixed bug 2281 (#2309)

This commit is contained in:
wangyong
2025-07-09 17:22:04 +08:00
committed by GitHub
parent 55ac3d1aa5
commit 9bddd4457e
4 changed files with 20 additions and 5 deletions

View File

@@ -129,7 +129,7 @@ public abstract class BaseMapper implements SchemaMapper {
Map<MatchText, List<T>> matchResult = matchStrategy.match(chatQueryContext, terms, Map<MatchText, List<T>> matchResult = matchStrategy.match(chatQueryContext, terms,
chatQueryContext.getRequest().getDataSetIds()); chatQueryContext.getRequest().getDataSetIds());
List<T> matches = new ArrayList<>(); List<T> matches = new ArrayList<>();
if (Objects.isNull(matchResult)) { if (Objects.isNull(matchResult) || matchResult.isEmpty()) {
return matches; return matches;
} }
Optional<List<T>> first = matchResult.entrySet().stream() Optional<List<T>> first = matchResult.entrySet().stream()

View File

@@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.Arrays;
import java.util.List; import java.util.List;
@RestController @RestController
@@ -50,10 +51,8 @@ public class DataSetController {
@GetMapping("/getDataSetList") @GetMapping("/getDataSetList")
public List<DataSetResp> getDataSetList(@RequestParam("domainId") Long domainId) { public List<DataSetResp> getDataSetList(@RequestParam("domainId") Long domainId) {
MetaFilter metaFilter = new MetaFilter(); List<Integer> statuCodeList = Arrays.asList(StatusEnum.ONLINE.getCode(),StatusEnum.OFFLINE.getCode());
metaFilter.setDomainId(domainId); return dataSetService.getDataSetList(domainId,statuCodeList);
metaFilter.setStatus(StatusEnum.ONLINE.getCode());
return dataSetService.getDataSetList(metaFilter);
} }
@DeleteMapping("/{id}") @DeleteMapping("/{id}")

View File

@@ -20,6 +20,8 @@ public interface DataSetService {
List<DataSetResp> getDataSetList(MetaFilter metaFilter); List<DataSetResp> getDataSetList(MetaFilter metaFilter);
List<DataSetResp> getDataSetList(Long domainId ,List<Integer> statuCodesList);
void delete(Long id, User user); void delete(Long id, User user);
Map<Long, List<Long>> getModelIdToDataSetIds(List<Long> dataSetIds, User user); Map<Long, List<Long>> getModelIdToDataSetIds(List<Long> dataSetIds, User user);

View File

@@ -102,6 +102,20 @@ public class DataSetServiceImpl extends ServiceImpl<DataSetDOMapper, DataSetDO>
return list(wrapper).stream().map(this::convert).collect(Collectors.toList()); return list(wrapper).stream().map(this::convert).collect(Collectors.toList());
} }
@Override
public List<DataSetResp> getDataSetList(Long domainId, List<Integer> statuCodesList) {
if(domainId==null || CollectionUtils.isEmpty(statuCodesList)){
return List.of();
}
QueryWrapper<DataSetDO> wrapper = new QueryWrapper<>();
wrapper.lambda().eq(DataSetDO::getDomainId, domainId);
wrapper.lambda().in(DataSetDO::getStatus, statuCodesList);
wrapper.lambda().ne(DataSetDO::getStatus, StatusEnum.DELETED.getCode());
return list(wrapper).stream().map(this::convert).collect(Collectors.toList());
}
@Override @Override
public void delete(Long id, User user) { public void delete(Long id, User user) {
DataSetDO dataSetDO = getById(id); DataSetDO dataSetDO = getById(id);