# RoomInfoServiceImpl.java

    package cloud.wconnect.rateshop.service.rateshop.impl;

    import cloud.wconnect.commonlib.cons.BaseErrorCodeEnum;
    import cloud.wconnect.commonlib.cons.CommonErrorI18nConstant;
    import cloud.wconnect.commonlib.exception.BadRequestException;
    import cloud.wconnect.rateshop.entity.rateshop.RoomInfo;
    import cloud.wconnect.rateshop.mapper.rateshop.RoomInfoMapper;
    import cloud.wconnect.rateshop.service.rateshop.IRoomInfoService;
    import com.baomidou.dynamic.datasource.annotation.DS;
    import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
    import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
    import org.springframework.stereotype.Service;

    import java.util.List;
    import java.util.Objects;

    /**
     * <p>
     * 房型 服务实现类
     * </p>
     *
     * @author lichen
     * @since 2023-06-06
     */
    @DS("rate_shop")
    @Service
    public class RoomInfoServiceImpl extends ServiceImpl<RoomInfoMapper, RoomInfo> implements IRoomInfoService {

        /**
         * 校验房型是否存在
         *
         * @param rid 房型id
         * @return cloud.wconnect.rateshop.entity.rateshop.RoomInfo
         * @author lichen
         * @date 2023/6/20
         */
        @Override
        public RoomInfo checkExist(Integer rid) {
            RoomInfo roomInfo = getById(rid);
            if (Objects.isNull(roomInfo)) {
                throw new BadRequestException(CommonErrorI18nConstant.DATA_NOT_FOUND,
                        BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                        "The roomInfo not found");
            }
            return roomInfo;
        }

        /**
         * 根据酒店id、平台id、pos查询房型
         *
         * @param hotelId    酒店id
         * @param platformId 平台id
         * @param pos        销售地区
         * @return java.util.List<cloud.wconnect.rateshop.entity.rateshop.RoomInfo>
         * @author lichen
         * @date 2025/12/30
         */
        @Override
        public List<RoomInfo> listByHotelIdAndPlatformIdAndPos(Integer hotelId, Integer platformId, String pos) {
            return list(new LambdaQueryWrapper<RoomInfo>()
                    .eq(RoomInfo::getHotelId, hotelId)
                    .eq(RoomInfo::getPlatformId, platformId)
                    .eq(RoomInfo::getPos, pos));
        }
    }