package com.bonus.material.lease.service.impl;

import java.util.List;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bonus.material.lease.mapper.LeaseApplyDetailsMapper;
import com.bonus.material.lease.domain.LeaseApplyDetails;
import com.bonus.material.lease.service.ILeaseApplyDetailsService;

/**
 * 领料任务详细Service业务层处理
 * 
 * @author xsheng
 * @date 2024-10-16
 */
@Service
public class LeaseApplyDetailsServiceImpl implements ILeaseApplyDetailsService {
    @Autowired
    private LeaseApplyDetailsMapper leaseApplyDetailsMapper;

    /**
     * 查询领料任务详细
     * 
     * @param id 领料任务详细主键
     * @return 领料任务详细
     */
    @Override
    public LeaseApplyDetails selectLeaseApplyDetailsById(Long id) {
        return leaseApplyDetailsMapper.selectLeaseApplyDetailsById(id);
    }

    /**
     * 查询领料任务详细列表
     * 
     * @param leaseApplyDetails 领料任务详细
     * @return 领料任务详细
     */
    @Override
    public List<LeaseApplyDetails> selectLeaseApplyDetailsList(LeaseApplyDetails leaseApplyDetails) {
        return leaseApplyDetailsMapper.selectLeaseApplyDetailsList(leaseApplyDetails);
    }

    /**
     * 新增领料任务详细
     * 
     * @param leaseApplyDetails 领料任务详细
     * @return 结果
     */
    @Override
    public int insertLeaseApplyDetails(LeaseApplyDetails leaseApplyDetails) {
        leaseApplyDetails.setCreateTime(DateUtils.getNowDate());
        try {
            return leaseApplyDetailsMapper.insertLeaseApplyDetails(leaseApplyDetails);
        } catch (Exception e) {
            throw new ServiceException("错误信息描述");
        }
    }

    /**
     * 修改领料任务详细
     * 
     * @param leaseApplyDetails 领料任务详细
     * @return 结果
     */
    @Override
    public int updateLeaseApplyDetails(LeaseApplyDetails leaseApplyDetails) {
        leaseApplyDetails.setUpdateTime(DateUtils.getNowDate());
        try {
            return leaseApplyDetailsMapper.updateLeaseApplyDetails(leaseApplyDetails);
        } catch (Exception e) {
            throw new ServiceException("错误信息描述");
        }
    }

    /**
     * 批量删除领料任务详细
     * 
     * @param ids 需要删除的领料任务详细主键
     * @return 结果
     */
    @Override
    public int deleteLeaseApplyDetailsByIds(Long[] ids) {
        return leaseApplyDetailsMapper.deleteLeaseApplyDetailsByIds(ids);
    }

    /**
     * 删除领料任务详细信息
     * 
     * @param id 领料任务详细主键
     * @return 结果
     */
    @Override
    public int deleteLeaseApplyDetailsById(Long id) {
        return leaseApplyDetailsMapper.deleteLeaseApplyDetailsById(id);
    }
}
