package com.hw.dms.service.impl;

import java.util.List;
import com.hw.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.dms.mapper.DmsKnowledgeRepairMapper;
import com.hw.dms.domain.DmsKnowledgeRepair;
import com.hw.dms.service.IDmsKnowledgeRepairService;

/**
 * 维修知识库Service业务层处理
 *
 * @author Open Platform
 * @date 2024-02-26
 */
@Service
public class DmsKnowledgeRepairServiceImpl implements IDmsKnowledgeRepairService
{
    @Autowired
    private DmsKnowledgeRepairMapper dmsKnowledgeRepairMapper;

    /**
     * 查询维修知识库
     *
     * @param knowledgeRepairId 维修知识库主键
     * @return 维修知识库
     */
    @Override
    public DmsKnowledgeRepair selectDmsKnowledgeRepairByKnowledgeRepairId(Long knowledgeRepairId)
    {
        return dmsKnowledgeRepairMapper.selectDmsKnowledgeRepairByKnowledgeRepairId(knowledgeRepairId);
    }

    /**
     * 查询维修知识库列表
     *
     * @param dmsKnowledgeRepair 维修知识库
     * @return 维修知识库
     */
    @Override
    public List<DmsKnowledgeRepair> selectDmsKnowledgeRepairList(DmsKnowledgeRepair dmsKnowledgeRepair)
    {
        return dmsKnowledgeRepairMapper.selectDmsKnowledgeRepairList(dmsKnowledgeRepair);
    }

    /**
     * 新增维修知识库
     *
     * @param dmsKnowledgeRepair 维修知识库
     * @return 结果
     */
    @Override
    public int insertDmsKnowledgeRepair(DmsKnowledgeRepair dmsKnowledgeRepair)
    {
        dmsKnowledgeRepair.setCreateTime(DateUtils.getNowDate());
        dmsKnowledgeRepair.setIsFlag("1");
        return dmsKnowledgeRepairMapper.insertDmsKnowledgeRepair(dmsKnowledgeRepair);
    }

    /**
     * 修改维修知识库
     *
     * @param dmsKnowledgeRepair 维修知识库
     * @return 结果
     */
    @Override
    public int updateDmsKnowledgeRepair(DmsKnowledgeRepair dmsKnowledgeRepair)
    {
        dmsKnowledgeRepair.setUpdateTime(DateUtils.getNowDate());
        return dmsKnowledgeRepairMapper.updateDmsKnowledgeRepair(dmsKnowledgeRepair);
    }

    /**
     * 批量删除维修知识库
     *
     * @param knowledgeRepairIds 需要删除的维修知识库主键
     * @return 结果
     */
    @Override
    public int deleteDmsKnowledgeRepairByKnowledgeRepairIds(Long[] knowledgeRepairIds)
    {
        return dmsKnowledgeRepairMapper.deleteDmsKnowledgeRepairByKnowledgeRepairIds(knowledgeRepairIds);
    }

    /**
     * 删除维修知识库信息
     *
     * @param knowledgeRepairId 维修知识库主键
     * @return 结果
     */
    @Override
    public int deleteDmsKnowledgeRepairByKnowledgeRepairId(Long knowledgeRepairId)
    {
        return dmsKnowledgeRepairMapper.deleteDmsKnowledgeRepairByKnowledgeRepairId(knowledgeRepairId);
    }
}
