package com.srs.routine.service.impl;

import java.util.List;
import com.srs.common.utils.DateUtils;
import com.srs.routine.domain.RtFuReservation;
import com.srs.routine.domain.RtFuResource;
import com.srs.routine.domain.RtFuRoom;
import com.srs.routine.mapper.RtFuReservationMapper;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.srs.routine.mapper.RtFuAuditMapper;
import com.srs.routine.domain.RtFuAudit;
import com.srs.routine.service.IRtFuAuditService;

/**
 * 功能房预约审核Service业务层处理
 *
 * @author srs
 * @date 2024-07-24
 */
@Service
public class RtFuAuditServiceImpl extends ServiceImpl<RtFuAuditMapper,RtFuAudit> implements IRtFuAuditService {
    @Autowired
    private RtFuAuditMapper rtFuAuditMapper;

    @Autowired
    private RtFuReservationMapper rtFuReservationMapper;

    /**
     * 查询功能房预约审核
     *
     * @param id 功能房预约审核主键
     * @return 功能房预约审核
     */
    @Override
    public RtFuAudit selectRtFuAuditById(Long id) {
        RtFuAudit list=rtFuAuditMapper.selectRtFuAuditById(id);
        RtFuReservation res=rtFuReservationMapper.selectRtFuReservationinfos(list.getReNo());
        list.setReservation(res);
        return list;
    }

    /**
     * 查询功能房预约审核列表
     *
     * @param rtFuAudit 功能房预约审核
     * @return 功能房预约审核
     */
    @Override
    public List<RtFuAudit> selectRtFuAuditList(RtFuAudit rtFuAudit) {
        List<RtFuAudit> List=rtFuAuditMapper.selectRtFuAuditList(rtFuAudit);
        for(RtFuAudit rc:List){
            RtFuReservation res=rtFuReservationMapper.selectRtFuReservationinfos(rc.getReNo());
            rc.setReservation(res);
        }
        return List;
    }

    /**
     * 新增功能房预约审核
     *
     * @param rtFuAudit 功能房预约审核
     * @return 结果
     */
    @Override
    public int insertRtFuAudit(RtFuAudit rtFuAudit) {
        rtFuAudit.setCreateTime(DateUtils.getNowDate());
        return rtFuAuditMapper.insertRtFuAudit(rtFuAudit);
    }

    /**
     * 修改功能房预约审核
     *
     * @param rtFuAudit 功能房预约审核
     * @return 结果
     */
    @Override
    public int updateRtFuAudit(RtFuAudit rtFuAudit) {
        rtFuAudit.setUpdateTime(DateUtils.getNowDate());
        return rtFuAuditMapper.updateRtFuAudit(rtFuAudit);
    }

    /**
     * 批量删除功能房预约审核
     *
     * @param ids 需要删除的功能房预约审核主键
     * @return 结果
     */
    @Override
    public int deleteRtFuAuditByIds(Long[] ids) {
        return rtFuAuditMapper.deleteRtFuAuditByIds(ids);
    }

    /**
     * 删除功能房预约审核信息
     *
     * @param id 功能房预约审核主键
     * @return 结果
     */
    @Override
    public int deleteRtFuAuditByaure(String reNo) {
        return rtFuAuditMapper.deleteRtFuAuditByaure(reNo);
    }
}
