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

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.pricefloor.PriceFloorDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 楼层加价设置 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface PriceFloorMapper extends BaseMapperX<PriceFloorDO> {

    default List<PriceFloorDO> selectListByObjectId(Long objectId) {
        return selectList(new LambdaQueryWrapperX<PriceFloorDO>()
                .eq(PriceFloorDO::getObjectId, objectId));
    }

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