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,
chatQueryContext.getRequest().getDataSetIds());
List<T> matches = new ArrayList<>();
if (Objects.isNull(matchResult)) {
if (Objects.isNull(matchResult) || matchResult.isEmpty()) {
return matches;
}
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.RestController;
import java.util.Arrays;
import java.util.List;
@RestController
@@ -50,10 +51,8 @@ public class DataSetController {
@GetMapping("/getDataSetList")
public List<DataSetResp> getDataSetList(@RequestParam("domainId") Long domainId) {
MetaFilter metaFilter = new MetaFilter();
metaFilter.setDomainId(domainId);
metaFilter.setStatus(StatusEnum.ONLINE.getCode());
return dataSetService.getDataSetList(metaFilter);
List<Integer> statuCodeList = Arrays.asList(StatusEnum.ONLINE.getCode(),StatusEnum.OFFLINE.getCode());
return dataSetService.getDataSetList(domainId,statuCodeList);
}
@DeleteMapping("/{id}")

View File

@@ -20,6 +20,8 @@ public interface DataSetService {
List<DataSetResp> getDataSetList(MetaFilter metaFilter);
List<DataSetResp> getDataSetList(Long domainId ,List<Integer> statuCodesList);
void delete(Long id, 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());
}
@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
public void delete(Long id, User user) {
DataSetDO dataSetDO = getById(id);