package com.aucma.dms.service.impl;

//import com.hw.common.core.utils.DateUtils;
//import com.hw.common.security.utils.SecurityUtils;
//import com.aucma.dms.domain.DmsRecordInspect;
//import com.aucma.dms.mapper.DmsRecordInspectMapper;
//import com.aucma.dms.service.IDmsRecordInspectService;
//import com.hw.system.api.model.LoginUser;

import com.aucma.common.core.domain.model.LoginUser;
import com.aucma.common.utils.DateUtils;
import com.aucma.common.utils.SecurityUtils;
import com.aucma.dms.domain.DmsRecordInspect;
import com.aucma.dms.mapper.DmsRecordInspectMapper;
import com.aucma.dms.service.IDmsRecordInspectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 巡检记录Service业务层处理
 *
 * @author Open Platform
 * @date 2024-01-16
 */
@Service
public class DmsRecordInspectServiceImpl implements IDmsRecordInspectService
{
    @Autowired
    private DmsRecordInspectMapper dmsRecordInspectMapper;

    /**
     * 查询巡检记录
     *
     * @param recordInspectId 巡检记录主键
     * @return 巡检记录
     */
    @Override
    public DmsRecordInspect selectDmsRecordInspectByRecordInspectId(Long recordInspectId)
    {
        return dmsRecordInspectMapper.selectDmsRecordInspectByRecordInspectId(recordInspectId);
    }

    /**
     * 查询巡检记录列表
     *
     * @param dmsRecordInspect 巡检记录
     * @return 巡检记录
     */
    @Override
    public List<DmsRecordInspect> selectDmsRecordInspectList(DmsRecordInspect dmsRecordInspect)
    {
        return dmsRecordInspectMapper.selectDmsRecordInspectList(dmsRecordInspect);
    }

    /**
     * 新增巡检记录
     *
     * @param dmsRecordInspect 巡检记录
     * @return 结果
     */
    @Override
    public int insertDmsRecordInspect(DmsRecordInspect dmsRecordInspect)
    {
        LoginUser user = SecurityUtils.getLoginUser();
        dmsRecordInspect.setIsFlag("1");
        dmsRecordInspect.setCreateBy(user.getUserId());
        dmsRecordInspect.setCreateTime(DateUtils.getNowDate());
        return dmsRecordInspectMapper.insertDmsRecordInspect(dmsRecordInspect);
    }

    /**
     * 修改巡检记录
     *
     * @param dmsRecordInspect 巡检记录
     * @return 结果
     */
    @Override
    public int updateDmsRecordInspect(DmsRecordInspect dmsRecordInspect)
    {
        LoginUser user = SecurityUtils.getLoginUser();
        dmsRecordInspect.setUpdateBy(user.getUserId());
        dmsRecordInspect.setUpdateTime(DateUtils.getNowDate());
        return dmsRecordInspectMapper.updateDmsRecordInspect(dmsRecordInspect);
    }

    /**
     * 批量删除巡检记录
     *
     * @param recordInspectIds 需要删除的巡检记录主键
     * @return 结果
     */
    @Override
    public int deleteDmsRecordInspectByRecordInspectIds(Long[] recordInspectIds)
    {
        return dmsRecordInspectMapper.deleteDmsRecordInspectByRecordInspectIds(recordInspectIds);
    }

    /**
     * 删除巡检记录信息
     *
     * @param recordInspectId 巡检记录主键
     * @return 结果
     */
    @Override
    public int deleteDmsRecordInspectByRecordInspectId(Long recordInspectId)
    {
        return dmsRecordInspectMapper.deleteDmsRecordInspectByRecordInspectId(recordInspectId);
    }
}
