package com.test.test.service.impl;

import com.test.common.utils.DateUtils;
import com.test.test.domain.TestPlanDefect;
import com.test.test.mapper.TestPlanDefectMapper;
import com.test.test.service.ITestPlanDefectService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 测试计划测试缺陷关联Service业务层处理
 *
 * @author test
 * @date 2025-04-22
 */
@Service
public class TestPlanDefectServiceImpl implements ITestPlanDefectService
{
    @Resource
    private TestPlanDefectMapper testPlanDefectMapper;

    /**
     * 查询测试计划测试缺陷关联
     *
     * @param id 测试计划测试缺陷关联主键
     * @return 测试计划测试缺陷关联
     */
    @Override
    public TestPlanDefect selectTestPlanDefectById(Long id)
    {
        return testPlanDefectMapper.selectTestPlanDefectById(id);
    }

    /**
     * 查询测试计划测试缺陷关联列表
     *
     * @param testPlanDefect 测试计划测试缺陷关联
     * @return 测试计划测试缺陷关联
     */
    @Override
    public List<TestPlanDefect> selectTestPlanDefectList(TestPlanDefect testPlanDefect)
    {
        return testPlanDefectMapper.selectTestPlanDefectList(testPlanDefect);
    }

    /**
     * 新增测试计划测试缺陷关联
     *
     * @param testPlanDefect 测试计划测试缺陷关联
     * @return 结果
     */
    @Override
    public int insertTestPlanDefect(TestPlanDefect testPlanDefect)
    {
        testPlanDefect.setCreateTime(DateUtils.getNowDate());
        return testPlanDefectMapper.insertTestPlanDefect(testPlanDefect);
    }

    /**
     * 修改测试计划测试缺陷关联
     *
     * @param testPlanDefect 测试计划测试缺陷关联
     * @return 结果
     */
    @Override
    public int updateTestPlanDefect(TestPlanDefect testPlanDefect)
    {
        testPlanDefect.setUpdateTime(DateUtils.getNowDate());
        return testPlanDefectMapper.updateTestPlanDefect(testPlanDefect);
    }

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

    /**
     * 删除测试计划测试缺陷关联信息
     *
     * @param id 测试计划测试缺陷关联主键
     * @return 结果
     */
    @Override
    public int deleteTestPlanDefectById(Long id)
    {
        return testPlanDefectMapper.deleteTestPlanDefectById(id);
    }
}
