package com.rj.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.rj.entity.AiPrompts;
import com.rj.mapper.AiPromptsMapper;
import com.rj.service.IAiPromptsService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 表 ai_prompts 服务实现
 */
@Service
public class AiPromptsServiceImpl extends ServiceImpl<AiPromptsMapper, AiPrompts> implements IAiPromptsService {

    @Override
    public List<AiPrompts> listByBizKeys(String scenarioCode, String categoryCode, String promptType, String fieldCode) {
        LambdaQueryWrapper<AiPrompts> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(AiPrompts::getScenarioCode, scenarioCode)
                .eq(AiPrompts::getCategoryCode, categoryCode)
                .eq(AiPrompts::getPromptType, promptType);
                if (fieldCode != null) {
                    queryWrapper.eq(AiPrompts::getFieldCode, fieldCode);
                }

        return this.list(queryWrapper);
    }
}
