package com.hw.dms.service.impl;

import java.util.List;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.dms.mapper.DmsPlanMaintDetailMapper;
import com.hw.dms.domain.DmsPlanMaintDetail;
import com.hw.dms.service.IDmsPlanMaintDetailService;

/**
 * 保养计划明细Service业务层处理
 *
 * @author xins
 * @date 2024-01-10
 */
@Service
public class DmsPlanMaintDetailServiceImpl implements IDmsPlanMaintDetailService
{
    @Autowired
    private DmsPlanMaintDetailMapper dmsPlanMaintDetailMapper;

    /**
     * 查询保养计划明细
     *
     * @param planMaintDetailId 保养计划明细主键
     * @return 保养计划明细
     */
    @Override
    public DmsPlanMaintDetail selectDmsPlanMaintDetailByPlanMaintDetailId(Long planMaintDetailId)
    {
        return dmsPlanMaintDetailMapper.selectDmsPlanMaintDetailByPlanMaintDetailId(planMaintDetailId);
    }

    /**
     * 查询保养计划明细列表
     *
     * @param dmsPlanMaintDetail 保养计划明细
     * @return 保养计划明细
     */
    @Override
    public List<DmsPlanMaintDetail> selectDmsPlanMaintDetailList(DmsPlanMaintDetail dmsPlanMaintDetail)
    {
        return dmsPlanMaintDetailMapper.selectDmsPlanMaintDetailList(dmsPlanMaintDetail);
    }

    /**
     * 新增保养计划明细
     *
     * @param dmsPlanMaintDetail 保养计划明细
     * @return 结果
     */
    @Override
    public int insertDmsPlanMaintDetail(DmsPlanMaintDetail dmsPlanMaintDetail)
    {
        dmsPlanMaintDetail.setCreateBy(SecurityUtils.getUsername());
        dmsPlanMaintDetail.setCreateTime(DateUtils.getNowDate());
        dmsPlanMaintDetail.setIsFlag(1l);
        return dmsPlanMaintDetailMapper.insertDmsPlanMaintDetail(dmsPlanMaintDetail);
    }

    /**
     * 修改保养计划明细
     *
     * @param dmsPlanMaintDetail 保养计划明细
     * @return 结果
     */
    @Override
    public int updateDmsPlanMaintDetail(DmsPlanMaintDetail dmsPlanMaintDetail)
    {
        dmsPlanMaintDetail.setUpdateBy(SecurityUtils.getUsername());
        dmsPlanMaintDetail.setUpdateTime(DateUtils.getNowDate());
        return dmsPlanMaintDetailMapper.updateDmsPlanMaintDetail(dmsPlanMaintDetail);
    }

    /**
     * 批量删除保养计划明细
     *
     * @param planMaintDetailIds 需要删除的保养计划明细主键
     * @return 结果
     */
    @Override
    public int deleteDmsPlanMaintDetailByPlanMaintDetailIds(Long[] planMaintDetailIds)
    {
        return dmsPlanMaintDetailMapper.deleteDmsPlanMaintDetailByPlanMaintDetailIds(planMaintDetailIds);
    }

    /**
     * 删除保养计划明细信息
     *
     * @param planMaintDetailId 保养计划明细主键
     * @return 结果
     */
    @Override
    public int deleteDmsPlanMaintDetailByPlanMaintDetailId(Long planMaintDetailId)
    {
        return dmsPlanMaintDetailMapper.deleteDmsPlanMaintDetailByPlanMaintDetailId(planMaintDetailId);
    }




    /**
     * 查询保养计划明细列表，Join station and standard
     *
     * @param dmsPlanMaintDetail 保养计划明细
     * @return 保养计划明细
     */
    @Override
    public List<DmsPlanMaintDetail> selectDmsPlanMaintDetailJoinList(DmsPlanMaintDetail dmsPlanMaintDetail)
    {
        return dmsPlanMaintDetailMapper.selectDmsPlanMaintDetailJoinList(dmsPlanMaintDetail);
    }

    @Override
    public List<DmsPlanMaintDetail> selectDmsPlanMaintDetailListByPlanMaintId(Long planMaintId) {
        return dmsPlanMaintDetailMapper.selectDmsPlanMaintDetailListByPlanMaintId(planMaintId);
    }
}
