package com.test.test.service.impl;

import com.test.common.utils.DateUtils;
import com.test.test.domain.TestDefect;
import com.test.test.domain.qo.TestDefectListQO;
import com.test.test.mapper.TestDefectMapper;
import com.test.test.service.ITestDefectService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 测试缺陷Service业务层处理
 *
 * @author test
 * @date 2025-04-22
 */
@Service
public class TestDefectServiceImpl implements ITestDefectService
{
    @Resource
    private TestDefectMapper testDefectMapper;

    /**
     * 查询测试缺陷
     *
     * @param id 测试缺陷主键
     * @return 测试缺陷
     */
    @Override
    public TestDefect selectTestDefectById(Long id)
    {
        return testDefectMapper.selectTestDefectById(id);
    }

    /**
     * 查询测试缺陷列表
     *
     * @param qo 测试缺陷
     * @return 测试缺陷
     */
    @Override
    public List<TestDefect> selectTestDefectList(TestDefectListQO qo)
    {
        return testDefectMapper.selectTestDefectList(qo);
    }

    /**
     * 新增测试缺陷
     *
     * @param testDefect 测试缺陷
     * @return 结果
     */
    @Override
    public int insertTestDefect(TestDefect testDefect)
    {
        testDefect.setCreateTime(DateUtils.getNowDate());
        return testDefectMapper.insertTestDefect(testDefect);
    }

    /**
     * 修改测试缺陷
     *
     * @param testDefect 测试缺陷
     * @return 结果
     */
    @Override
    public int updateTestDefect(TestDefect testDefect)
    {
        testDefect.setUpdateTime(DateUtils.getNowDate());
        return testDefectMapper.updateTestDefect(testDefect);
    }

    /**
     * 批量删除测试缺陷
     *
     * @param ids 需要删除的测试缺陷主键
     * @return 结果
     */
    @Override
    public int deleteTestDefectByIds(Long[] ids)
    {
        return testDefectMapper.deleteTestDefectByIds(ids);
    }

    /**
     * 删除测试缺陷信息
     *
     * @param id 测试缺陷主键
     * @return 结果
     */
    @Override
    public int deleteTestDefectById(Long id)
    {
        return testDefectMapper.deleteTestDefectById(id);
    }
}
