package com.yc.ship.module.product.dal.mysql.pricesinglesetting;

import com.yc.ship.framework.mybatis.core.mapper.BaseMapperX;
import com.yc.ship.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.yc.ship.module.product.dal.dataobject.pricesinglesetting.PriceSingleSettingDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 价格单人票设置 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface PriceSingleSettingMapper extends BaseMapperX<PriceSingleSettingDO> {

    default List<PriceSingleSettingDO> selectByObjectId(Long objectId) {
        return selectList(PriceSingleSettingDO::getObjectId, objectId);
    }

    default void deleteByObjectId(Long objectId) {
        delete(new LambdaQueryWrapperX<PriceSingleSettingDO>()
                .eqIfPresent(PriceSingleSettingDO::getObjectId, objectId));
    }

    default List<PriceSingleSettingDO> selectByObjectIdAndRoomModelId(Long objectId, Long roomModelId) {
        return selectList(new LambdaQueryWrapperX<PriceSingleSettingDO>()
                .eqIfPresent(PriceSingleSettingDO::getObjectId, objectId)
                .eqIfPresent(PriceSingleSettingDO::getRoomModelId, roomModelId));
    }
}