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.LeaseSceneRegistMapper;
import com.bonus.material.lease.domain.LeaseSceneRegist;
import com.bonus.material.lease.service.ILeaseSceneRegistService;

/**
 * 项目部出入记录Service业务层处理
 * 
 * @author xsheng
 * @date 2024-10-16
 */
@Service
public class LeaseSceneRegistServiceImpl implements ILeaseSceneRegistService {
    @Autowired
    private LeaseSceneRegistMapper leaseSceneRegistMapper;

    /**
     * 查询项目部出入记录
     * 
     * @param id 项目部出入记录主键
     * @return 项目部出入记录
     */
    @Override
    public LeaseSceneRegist selectLeaseSceneRegistById(Long id) {
        return leaseSceneRegistMapper.selectLeaseSceneRegistById(id);
    }

    /**
     * 查询项目部出入记录列表
     * 
     * @param leaseSceneRegist 项目部出入记录
     * @return 项目部出入记录
     */
    @Override
    public List<LeaseSceneRegist> selectLeaseSceneRegistList(LeaseSceneRegist leaseSceneRegist) {
        return leaseSceneRegistMapper.selectLeaseSceneRegistList(leaseSceneRegist);
    }

    /**
     * 新增项目部出入记录
     * 
     * @param leaseSceneRegist 项目部出入记录
     * @return 结果
     */
    @Override
    public int insertLeaseSceneRegist(LeaseSceneRegist leaseSceneRegist) {
        leaseSceneRegist.setCreateTime(DateUtils.getNowDate());
        try {
            return leaseSceneRegistMapper.insertLeaseSceneRegist(leaseSceneRegist);
        } catch (Exception e) {
            throw new ServiceException("错误信息描述");
        }
    }

    /**
     * 修改项目部出入记录
     * 
     * @param leaseSceneRegist 项目部出入记录
     * @return 结果
     */
    @Override
    public int updateLeaseSceneRegist(LeaseSceneRegist leaseSceneRegist) {
        leaseSceneRegist.setUpdateTime(DateUtils.getNowDate());
        try {
            return leaseSceneRegistMapper.updateLeaseSceneRegist(leaseSceneRegist);
        } catch (Exception e) {
            throw new ServiceException("错误信息描述");
        }
    }

    /**
     * 批量删除项目部出入记录
     * 
     * @param ids 需要删除的项目部出入记录主键
     * @return 结果
     */
    @Override
    public int deleteLeaseSceneRegistByIds(Long[] ids) {
        return leaseSceneRegistMapper.deleteLeaseSceneRegistByIds(ids);
    }

    /**
     * 删除项目部出入记录信息
     * 
     * @param id 项目部出入记录主键
     * @return 结果
     */
    @Override
    public int deleteLeaseSceneRegistById(Long id) {
        return leaseSceneRegistMapper.deleteLeaseSceneRegistById(id);
    }
}
