package com.xinda.itsm.service.impl;

import java.util.List;
import com.xinda.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xinda.itsm.mapper.RepairOrderMapper;
import com.xinda.itsm.domain.RepairOrder;
import com.xinda.itsm.service.IRepairOrderService;

/**
 * 维修工单Service业务层处理
 * 
 * @author kerwincui
 * @date 2025-04-23
 */
@Service
public class RepairOrderServiceImpl implements IRepairOrderService 
{
    @Autowired
    private RepairOrderMapper repairOrderMapper;

    /**
     * 查询维修工单
     * 
     * @param id 维修工单主键
     * @return 维修工单
     */
    @Override
    public RepairOrder selectRepairOrderById(Long id)
    {
        return repairOrderMapper.selectRepairOrderById(id);
    }

    /**
     * 查询维修工单列表
     * 
     * @param repairOrder 维修工单
     * @return 维修工单
     */
    @Override
    public List<RepairOrder> selectRepairOrderList(RepairOrder repairOrder)
    {
        return repairOrderMapper.selectRepairOrderList(repairOrder);
    }

    /**
     * 新增维修工单
     * 
     * @param repairOrder 维修工单
     * @return 结果
     */
    @Override
    public int insertRepairOrder(RepairOrder repairOrder)
    {
        repairOrder.setCreateTime(DateUtils.getNowDate());
        return repairOrderMapper.insertRepairOrder(repairOrder);
    }

    /**
     * 修改维修工单
     * 
     * @param repairOrder 维修工单
     * @return 结果
     */
    @Override
    public int updateRepairOrder(RepairOrder repairOrder)
    {
        repairOrder.setUpdateTime(DateUtils.getNowDate());
        return repairOrderMapper.updateRepairOrder(repairOrder);
    }

    /**
     * 批量删除维修工单
     * 
     * @param ids 需要删除的维修工单主键
     * @return 结果
     */
    @Override
    public int deleteRepairOrderByIds(Long[] ids)
    {
        return repairOrderMapper.deleteRepairOrderByIds(ids);
    }

    /**
     * 删除维修工单信息
     * 
     * @param id 维修工单主键
     * @return 结果
     */
    @Override
    public int deleteRepairOrderById(Long id)
    {
        return repairOrderMapper.deleteRepairOrderById(id);
    }
}
