package cn.iocoder.yudao.module.common.dal.mysql.mold;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldBrandProductDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 模具产品 Mapper
 *
 * @author 内蒙必硕
 */
@Mapper
public interface MoldBrandProductMapper extends BaseMapperX<MoldBrandProductDO> {

    default PageResult<MoldBrandProductDO> selectPage(PageParam reqVO, Long brandId) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MoldBrandProductDO>()
            .eq(MoldBrandProductDO::getBrandId, brandId)
            .orderByDesc(MoldBrandProductDO::getId));
    }

    default int deleteByBrandId(Long brandId) {
        return delete(MoldBrandProductDO::getBrandId, brandId);
    }
    default List<MoldBrandProductDO> selectList(MoldBrandProductDO reqVO) {
        return selectList(new LambdaQueryWrapperX<MoldBrandProductDO>()
                .eqIfPresent(MoldBrandProductDO::getProductId, reqVO.getProductId())
                .eqIfPresent(MoldBrandProductDO::getBrandId, reqVO.getBrandId())
                .orderByDesc(MoldBrandProductDO::getId));
    }
}