package com.hw.dms.service.impl;

import java.util.List;
import com.hw.common.core.utils.DateUtils;
import com.hw.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.dms.mapper.DmsPlanInspectMapper;
import com.hw.dms.domain.DmsPlanInspect;
import com.hw.dms.service.IDmsPlanInspectService;

/**
 * 巡检计划信息Service业务层处理
 *
 * @author Open Platform
 * @date 2024-01-17
 */
@Service
public class DmsPlanInspectServiceImpl implements IDmsPlanInspectService
{
    @Autowired
    private DmsPlanInspectMapper dmsPlanInspectMapper;

    /**
     * 查询巡检计划信息
     *
     * @param planInspectId 巡检计划信息主键
     * @return 巡检计划信息
     */
    @Override
    public DmsPlanInspect selectDmsPlanInspectByPlanInspectId(Long planInspectId)
    {
        return dmsPlanInspectMapper.selectDmsPlanInspectByPlanInspectId(planInspectId);
    }

    /**
     * 查询巡检计划信息列表
     *
     * @param dmsPlanInspect 巡检计划信息
     * @return 巡检计划信息
     */
    @Override
    public List<DmsPlanInspect> selectDmsPlanInspectList(DmsPlanInspect dmsPlanInspect)
    {
        return dmsPlanInspectMapper.selectDmsPlanInspectList(dmsPlanInspect);
    }

    /**
     * 新增巡检计划信息
     *
     * @param dmsPlanInspect 巡检计划信息
     * @return 结果
     */
    @Override
    public int insertDmsPlanInspect(DmsPlanInspect dmsPlanInspect)
    {
        LoginUser user = new LoginUser();
        dmsPlanInspect.setCreateBy(user.getUsername());
        dmsPlanInspect.setIsFlag("1");
        dmsPlanInspect.setCreateTime(DateUtils.getNowDate());
        return dmsPlanInspectMapper.insertDmsPlanInspect(dmsPlanInspect);
    }

    /**
     * 修改巡检计划信息
     *
     * @param dmsPlanInspect 巡检计划信息
     * @return 结果
     */
    @Override
    public int updateDmsPlanInspect(DmsPlanInspect dmsPlanInspect)
    {
        LoginUser user = new LoginUser();
        dmsPlanInspect.setUpdateBy(user.getUsername());
        dmsPlanInspect.setUpdateTime(DateUtils.getNowDate());
        return dmsPlanInspectMapper.updateDmsPlanInspect(dmsPlanInspect);
    }

    /**
     * 批量删除巡检计划信息
     *
     * @param planInspectIds 需要删除的巡检计划信息主键
     * @return 结果
     */
    @Override
    public int deleteDmsPlanInspectByPlanInspectIds(Long[] planInspectIds)
    {
        return dmsPlanInspectMapper.deleteDmsPlanInspectByPlanInspectIds(planInspectIds);
    }

    /**
     * 删除巡检计划信息信息
     *
     * @param planInspectId 巡检计划信息主键
     * @return 结果
     */
    @Override
    public int deleteDmsPlanInspectByPlanInspectId(Long planInspectId)
    {
        return dmsPlanInspectMapper.deleteDmsPlanInspectByPlanInspectId(planInspectId);
    }
}
