package shop.alien.store.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.RequiredArgsConstructor;
import shop.alien.entity.store.StoreCustomerService;
import shop.alien.mapper.StoreCustomerServiceMapper;
import shop.alien.store.service.StoreCustomerServiceService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 门店客服 服务实现类
 * </p>
 *
 * @author ssk
 * @since 2024-12-30
 */
@Service
@RequiredArgsConstructor
public class StoreCustomerServiceServiceImpl extends ServiceImpl<StoreCustomerServiceMapper, StoreCustomerService> implements StoreCustomerServiceService {

    private final StoreCustomerServiceMapper storeCustomerServiceMapper;

    @Override
    public StoreCustomerService getByQuestion(String question) {
        LambdaQueryWrapper<StoreCustomerService> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        List<StoreCustomerService> list = storeCustomerServiceMapper.selectList(lambdaQueryWrapper);
        return list.stream().filter(item -> item.getQuestion().contains(question)).findFirst().orElse(null);
    }
}
