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.DmsRecordLube;
//import com.aucma.dms.mapper.DmsRecordLubeMapper;
//import com.aucma.dms.service.IDmsRecordLubeService;
//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.DmsRecordLube;
import com.aucma.dms.mapper.DmsRecordLubeMapper;
import com.aucma.dms.service.IDmsRecordLubeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 润滑记录Service业务层处理
 *
 * @author Open Platform
 * @date 2024-01-12
 */
@Service
public class DmsRecordLubeServiceImpl implements IDmsRecordLubeService
{
    @Autowired
    private DmsRecordLubeMapper dmsRecordLubeMapper;

    /**
     * 查询润滑记录
     *
     * @param recordLubeId 润滑记录主键
     * @return 润滑记录
     */
    @Override
    public DmsRecordLube selectDmsRecordLubeByRecordLubeId(Long recordLubeId)
    {
        return dmsRecordLubeMapper.selectDmsRecordLubeByRecordLubeId(recordLubeId);
    }

    /**
     * 查询润滑记录列表
     *
     * @param dmsRecordLube 润滑记录
     * @return 润滑记录
     */
    @Override
    public List<DmsRecordLube> selectDmsRecordLubeList(DmsRecordLube dmsRecordLube)
    {
        return dmsRecordLubeMapper.selectDmsRecordLubeList(dmsRecordLube);
    }

    /**
     * 新增润滑记录
     *
     * @param dmsRecordLube 润滑记录
     * @return 结果
     */
    @Override
    public int insertDmsRecordLube(DmsRecordLube dmsRecordLube)
    {
        LoginUser user = SecurityUtils.getLoginUser();
        dmsRecordLube.setCreateBy(user.getUserId());
        dmsRecordLube.setCreateTime(DateUtils.getNowDate());
        dmsRecordLube.setIsFlag("1");
        return dmsRecordLubeMapper.insertDmsRecordLube(dmsRecordLube);
    }

    /**
     * 修改润滑记录
     *
     * @param dmsRecordLube 润滑记录
     * @return 结果
     */
    @Override
    public int updateDmsRecordLube(DmsRecordLube dmsRecordLube)
    {
        LoginUser user = SecurityUtils.getLoginUser();
        dmsRecordLube.setUpdateBy(user.getUserId());
        dmsRecordLube.setUpdateTime(DateUtils.getNowDate());
        return dmsRecordLubeMapper.updateDmsRecordLube(dmsRecordLube);
    }

    /**
     * 批量删除润滑记录
     *
     * @param recordLubeIds 需要删除的润滑记录主键
     * @return 结果
     */
    @Override
    public int deleteDmsRecordLubeByRecordLubeIds(Long[] recordLubeIds)
    {
        return dmsRecordLubeMapper.deleteDmsRecordLubeByRecordLubeIds(recordLubeIds);
    }

    /**
     * 删除润滑记录信息
     *
     * @param recordLubeId 润滑记录主键
     * @return 结果
     */
    @Override
    public int deleteDmsRecordLubeByRecordLubeId(Long recordLubeId)
    {
        return dmsRecordLubeMapper.deleteDmsRecordLubeByRecordLubeId(recordLubeId);
    }
}
