package com.emoon.openplatform.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.emoon.openplatform.domain.RagDo;
import com.emoon.openplatform.domain.bo.RagBo;
import com.emoon.openplatform.domain.dto.SchemaMessageDTO;
import com.emoon.openplatform.domain.dto.request.SchemaRequest;
import com.emoon.openplatform.mapper.RagMapper;
import com.emoon.openplatform.service.IRagService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author destiny
 * @description:
 * @date 2025/10/10 22:33
 */
@Service
@RequiredArgsConstructor
public class RagServiceImpl implements IRagService {

    private final RagMapper ragMapper;

    /**
     * 获取知识库信息
     *
     * @param schemaRequest
     * @return
     */
    @Override
    public SchemaMessageDTO getSchema(SchemaRequest schemaRequest) {
        return null;
    }

    @Override
    public List<RagDo> search(RagBo bo) {
        return ragMapper.selectList(new LambdaQueryWrapper<RagDo>()
            .eq(bo.getId() != null, RagDo::getId, bo.getId())
            .eq(bo.getRagId() != null, RagDo::getRagId, bo.getRagId())
            .eq(bo.getRag() != null, RagDo::getRag, bo.getRag()));
    }
}
