package com.ruoyi.system.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.domain.checkPoint.CheckPointManage;
import com.ruoyi.system.mapper.CheckPointManageMapper;
import com.ruoyi.system.service.ICheckPointManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 巡更点管理Service业务层处理
 * 
 * @author boman
 * @date 2025-02-14
 */
@Service
public class CheckPointManageServiceImpl implements ICheckPointManageService 
{
    @Autowired
    private CheckPointManageMapper checkPointManageMapper;

    /**
     * 查询巡更点管理
     * 
     * @param checkPointManageId 巡更点管理主键
     * @return 巡更点管理
     */
    @Override
    public CheckPointManage selectCheckPointManageByCheckPointManageId(Long checkPointManageId)
    {
        return checkPointManageMapper.selectCheckPointManageByCheckPointManageId(checkPointManageId);
    }

    /**
     * 查询巡更点管理列表
     * 
     * @param checkPointManage 巡更点管理
     * @return 巡更点管理
     */
    @Override
    public List<CheckPointManage> selectCheckPointManageList(CheckPointManage checkPointManage)
    {
        return checkPointManageMapper.selectCheckPointManageList(checkPointManage);
    }

    /**
     * 新增巡更点管理
     * 
     * @param checkPointManage 巡更点管理
     * @return 结果
     */
    @Override
    public int insertCheckPointManage(CheckPointManage checkPointManage)
    {
        checkPointManage.setCreateTime(DateUtils.getNowDate());
        checkPointManage.setUseId(SecurityUtils.getUserId());
        return checkPointManageMapper.insertCheckPointManage(checkPointManage);
    }

    /**
     * 批量新增
     * @param checkPointManage
     * @return
     */
    @Override
    public int batchCheckPointManage(List<CheckPointManage> checkPointManage) {
        for (CheckPointManage pointManage : checkPointManage) {
            pointManage.setCreateTime(DateUtils.getNowDate());
        }
        return checkPointManageMapper.batchCheckPointManage(checkPointManage);
    }

    /**
     * 修改巡更点管理
     * 
     * @param checkPointManage 巡更点管理
     * @return 结果
     */
    @Override
    public int updateCheckPointManage(CheckPointManage checkPointManage)
    {
        checkPointManage.setUpdateTime(DateUtils.getNowDate());
        return checkPointManageMapper.updateCheckPointManage(checkPointManage);
    }

    /**
     * 批量删除巡更点管理
     * 
     * @param checkPointManageIds 需要删除的巡更点管理主键
     * @return 结果
     */
    @Override
    public int deleteCheckPointManageByCheckPointManageIds(Long[] checkPointManageIds)
    {
        return checkPointManageMapper.deleteCheckPointManageByCheckPointManageIds(checkPointManageIds);
    }

    /**
     * 删除巡更点管理信息
     * 
     * @param checkPointManageId 巡更点管理主键
     * @return 结果
     */
    @Override
    public int deleteCheckPointManageByCheckPointManageId(Long checkPointManageId)
    {
        return checkPointManageMapper.deleteCheckPointManageByCheckPointManageId(checkPointManageId);
    }
}
