package com.ics.admin.service.impl;

import java.util.List;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ics.admin.mapper.meeting.RoomServeByRoomMapper;
import com.ics.admin.domain.meeting.RoomServeByRoom;
import com.ics.admin.service.meeting.IRoomServeByRoomService;

/**
 * 房间主体和服务关联Service业务层处理
 * 
 * @author ics
 * @date 2024-02-25
 */
@Service
public class RoomServeByRoomServiceImpl extends ServiceImpl<RoomServeByRoomMapper, RoomServeByRoom> implements IRoomServeByRoomService {
    @Autowired
    private RoomServeByRoomMapper roomServeByRoomMapper;

    /**
     * 查询房间主体和服务关联
     * 
     * @param id 房间主体和服务关联ID
     * @return 房间主体和服务关联
     */
    @Override
    public RoomServeByRoom selectRoomServeByRoomById(Long id) {
        return roomServeByRoomMapper.selectById(id);
    }

    /**
     * 查询房间主体和服务关联列表
     * 
     * @param roomServeByRoom 房间主体和服务关联
     * @return 房间主体和服务关联
     */
    @Override
    public List<RoomServeByRoom> selectRoomServeByRoomList(RoomServeByRoom roomServeByRoom) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("rome_content_Id", roomServeByRoom.getRomeContentId());
        return roomServeByRoomMapper.selectList(queryWrapper);


    }

    /**
     * 新增房间主体和服务关联
     * 
     * @param roomServeByRoom 房间主体和服务关联
     * @return 结果
     */
    @Override
    public int insertRoomServeByRoom(RoomServeByRoom roomServeByRoom) {
        return roomServeByRoomMapper.insert(roomServeByRoom);
    }

    /**
     * 修改房间主体和服务关联
     * 
     * @param roomServeByRoom 房间主体和服务关联
     * @return 结果
     */
    @Override
    public int updateRoomServeByRoom(RoomServeByRoom roomServeByRoom) {
        return roomServeByRoomMapper.updateById(roomServeByRoom);
    }

    /**
     * 删除房间主体和服务关联对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteRoomServeByRoomByIds(String ids) {
        String[] idsArray = StrUtil.split(ids,",");
        return roomServeByRoomMapper.deleteBatchIds(CollUtil.toList(idsArray));
    }

    /**
     * 删除房间主体和服务关联信息
     * 
     * @param id 房间主体和服务关联ID
     * @return 结果
     */
    @Override
    public int deleteRoomServeByRoomById(Long id) {
        return roomServeByRoomMapper.deleteRoomServeByRoomById(id);
    }
}
