package com.ruoyi.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.domain.TestUseCase;
import com.ruoyi.service.TestUseCaseService;
import com.ruoyi.mapper.TestUseCaseMapper;
import com.ruoyi.web.request.TestUserCaseRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
* @author wangfei
* @description 针对表【t_test_usecase(测试用例)】的数据库操作Service实现
* @createDate 2024-02-18 13:41:28
*/
@Service
@Transactional
public class TestUseCaseServiceImpl extends ServiceImpl<TestUseCaseMapper, TestUseCase> implements TestUseCaseService{

    @Autowired
    private TestUseCaseMapper testUseCaseMapper;

    /**
     * 查询测试用例列表
     *
     * @param testUserCaseRequest 测试用例库
     * @return 测试用例集合
     */
    @Override
    public List<TestUseCase> selectseCaseList(TestUserCaseRequest testUserCaseRequest){
        if(testUserCaseRequest.getSearchKeywords() != null && (testUserCaseRequest.getSearchKeywords().contains("%") ||testUserCaseRequest.getSearchKeywords().contains("_")  )){
            testUserCaseRequest.setSearchKeywords(testUserCaseRequest.getSearchKeywords().toString().replaceAll("%","/%").replaceAll("_","/_"));
        }
        return testUseCaseMapper.selectseCaseList(testUserCaseRequest);
    }

}