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.LeaseAgreementRecordMapper;
import com.bonus.material.lease.domain.LeaseAgreementRecord;
import com.bonus.material.lease.service.ILeaseAgreementRecordService;

/**
 * 项目领退Service业务层处理
 * 
 * @author xsheng
 * @date 2024-10-16
 */
@Service
public class LeaseAgreementRecordServiceImpl implements ILeaseAgreementRecordService {
    @Autowired
    private LeaseAgreementRecordMapper leaseAgreementRecordMapper;

    /**
     * 查询项目领退
     * 
     * @param id 项目领退主键
     * @return 项目领退
     */
    @Override
    public LeaseAgreementRecord selectLeaseAgreementRecordById(Long id) {
        return leaseAgreementRecordMapper.selectLeaseAgreementRecordById(id);
    }

    /**
     * 查询项目领退列表
     * 
     * @param leaseAgreementRecord 项目领退
     * @return 项目领退
     */
    @Override
    public List<LeaseAgreementRecord> selectLeaseAgreementRecordList(LeaseAgreementRecord leaseAgreementRecord) {
        return leaseAgreementRecordMapper.selectLeaseAgreementRecordList(leaseAgreementRecord);
    }

    /**
     * 新增项目领退
     * 
     * @param leaseAgreementRecord 项目领退
     * @return 结果
     */
    @Override
    public int insertLeaseAgreementRecord(LeaseAgreementRecord leaseAgreementRecord) {
        leaseAgreementRecord.setCreateTime(DateUtils.getNowDate());
        try {
            return leaseAgreementRecordMapper.insertLeaseAgreementRecord(leaseAgreementRecord);
        } catch (Exception e) {
            throw new ServiceException("错误信息描述");
        }
    }

    /**
     * 修改项目领退
     * 
     * @param leaseAgreementRecord 项目领退
     * @return 结果
     */
    @Override
    public int updateLeaseAgreementRecord(LeaseAgreementRecord leaseAgreementRecord) {
        leaseAgreementRecord.setUpdateTime(DateUtils.getNowDate());
        try {
            return leaseAgreementRecordMapper.updateLeaseAgreementRecord(leaseAgreementRecord);
        } catch (Exception e) {
            throw new ServiceException("错误信息描述");
        }
    }

    /**
     * 批量删除项目领退
     * 
     * @param ids 需要删除的项目领退主键
     * @return 结果
     */
    @Override
    public int deleteLeaseAgreementRecordByIds(Long[] ids) {
        return leaseAgreementRecordMapper.deleteLeaseAgreementRecordByIds(ids);
    }

    /**
     * 删除项目领退信息
     * 
     * @param id 项目领退主键
     * @return 结果
     */
    @Override
    public int deleteLeaseAgreementRecordById(Long id) {
        return leaseAgreementRecordMapper.deleteLeaseAgreementRecordById(id);
    }
}
