package com.pjilisense.flxai.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.pjilisense.flxai.base.service.impl.CrudServiceImpl;
import com.pjilisense.flxai.dao.KnowledgeBasesDao;
import com.pjilisense.flxai.dto.FilesDTO;
import com.pjilisense.flxai.dto.KnowledgeBasesDTO;
import com.pjilisense.flxai.entity.KnowledgeBasesEntity;
import com.pjilisense.flxai.service.KnowledgeBasesService;
import cn.hutool.core.util.StrUtil;
import com.pjilisense.flxai.utils.MapUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * ${comments}
 *
 * @author liushujing liushujing@philisense.com
 * @since 1.0.0 2025-01-14
 */
@Service
public class KnowledgeBasesServiceImpl extends CrudServiceImpl<KnowledgeBasesDao, KnowledgeBasesEntity, KnowledgeBasesDTO> implements KnowledgeBasesService {

    @Override
    public QueryWrapper<KnowledgeBasesEntity> getWrapper(Map<String, Object> params){
        String id = (String)params.get("id");

        QueryWrapper<KnowledgeBasesEntity> wrapper = new QueryWrapper<>();
        wrapper.eq(StrUtil.isNotBlank(id), "id", id);

        return wrapper;
    }


    @Override
    public boolean modifyDescriptuon(KnowledgeBasesDTO dto) {
        int cnt = baseDao.modifyDescriptuon(MapUtils.objectToMap(dto));
        return cnt>0;
    }
}