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

import java.util.List;

/**
 * 设备盘点明细Service业务层处理
 *
 * @author xins
 * @date 2024-01-02
 */
@Service
public class DmsFlowCheckplanDetailServiceImpl implements IDmsFlowCheckplanDetailService
{
    @Autowired
    private DmsFlowCheckplanDetailMapper dmsFlowCheckplanDetailMapper;

    /**
     * 查询设备盘点明细
     *
     * @param checkplanDetailId 设备盘点明细主键
     * @return 设备盘点明细
     */
    @Override
    public DmsFlowCheckplanDetail selectDmsFlowCheckplanDetailByCheckplanDetailId(Long checkplanDetailId)
    {
        return dmsFlowCheckplanDetailMapper.selectDmsFlowCheckplanDetailByCheckplanDetailId(checkplanDetailId);
    }

    /**
     * 查询设备盘点明细列表
     *
     * @param dmsFlowCheckplanDetail 设备盘点明细
     * @return 设备盘点明细
     */
    @Override
    public List<DmsFlowCheckplanDetail> selectDmsFlowCheckplanDetailList(DmsFlowCheckplanDetail dmsFlowCheckplanDetail)
    {
        return dmsFlowCheckplanDetailMapper.selectDmsFlowCheckplanDetailList(dmsFlowCheckplanDetail);
    }

    /**
     * 新增设备盘点明细
     *
     * @param dmsFlowCheckplanDetail 设备盘点明细
     * @return 结果
     */
    @Override
    public int insertDmsFlowCheckplanDetail(DmsFlowCheckplanDetail dmsFlowCheckplanDetail)
    {
        LoginUser loginUser = SecurityUtils.getLoginUser();
        dmsFlowCheckplanDetail.setCreateBy(loginUser.getUserId());
        dmsFlowCheckplanDetail.setCreateTime(DateUtils.getNowDate());
        return dmsFlowCheckplanDetailMapper.insertDmsFlowCheckplanDetail(dmsFlowCheckplanDetail);
    }

    /**
     * 修改设备盘点明细
     *
     * @param dmsFlowCheckplanDetail 设备盘点明细
     * @return 结果
     */
    @Override
    public int updateDmsFlowCheckplanDetail(DmsFlowCheckplanDetail dmsFlowCheckplanDetail)
    {
        LoginUser loginUser = SecurityUtils.getLoginUser();
        dmsFlowCheckplanDetail.setUpdateBy(loginUser.getUserId());
        dmsFlowCheckplanDetail.setUpdateTime(DateUtils.getNowDate());
        return dmsFlowCheckplanDetailMapper.updateDmsFlowCheckplanDetail(dmsFlowCheckplanDetail);
    }

    /**
     * 批量删除设备盘点明细
     *
     * @param checkplanDetailIds 需要删除的设备盘点明细主键
     * @return 结果
     */
    @Override
    public int deleteDmsFlowCheckplanDetailByCheckplanDetailIds(Long[] checkplanDetailIds)
    {
        return dmsFlowCheckplanDetailMapper.deleteDmsFlowCheckplanDetailByCheckplanDetailIds(checkplanDetailIds);
    }

    /**
     * 删除设备盘点明细信息
     *
     * @param checkplanDetailId 设备盘点明细主键
     * @return 结果
     */
    @Override
    public int deleteDmsFlowCheckplanDetailByCheckplanDetailId(Long checkplanDetailId)
    {
        return dmsFlowCheckplanDetailMapper.deleteDmsFlowCheckplanDetailByCheckplanDetailId(checkplanDetailId);
    }
}
